Class: TRuby::ErrorHandler

Inherits:
Object
  • Object
show all
Defined in:
lib/t_ruby/error_handler.rb

Constant Summary collapse

VALID_TYPES =
%w[String Integer Float Boolean Array Hash Symbol void nil].freeze
IDENTIFIER_PATTERN =

Unicode-aware identifier pattern for method/variable names (supports Korean, etc.)

/[\w\p{L}\p{N}]+[!?]?/

Instance Method Summary collapse

Constructor Details

#initialize(source) ⇒ ErrorHandler

Returns a new instance of ErrorHandler.



9
10
11
12
13
14
15
# File 'lib/t_ruby/error_handler.rb', line 9

def initialize(source)
  @source = source
  @lines = source.split("\n")
  @errors = []
  @functions = {}
  @type_parser = ParserCombinator::TypeParser.new
end

Instance Method Details

#checkObject



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/t_ruby/error_handler.rb', line 17

def check
  @errors = []
  @functions = {}
  @type_aliases = {}
  @interfaces = {}

  check_type_alias_errors
  check_interface_errors
  check_syntax_errors
  check_method_signature_errors
  check_type_validation
  check_duplicate_definitions

  @errors
end