Class: TRuby::ErrorHandler

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

Constant Summary collapse

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

Instance Method Summary collapse

Constructor Details

#initialize(source) ⇒ ErrorHandler

Returns a new instance of ErrorHandler.



7
8
9
10
11
12
# File 'lib/t_ruby/error_handler.rb', line 7

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

Instance Method Details

#checkObject



14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/t_ruby/error_handler.rb', line 14

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

  check_type_alias_errors
  check_interface_errors
  check_syntax_errors
  check_type_validation
  check_duplicate_definitions

  @errors
end