Class: Vinter::Parser

Inherits:
Object
  • Object
show all
Defined in:
lib/vinter/parser.rb

Instance Method Summary collapse

Constructor Details

#initialize(tokens) ⇒ Parser

Returns a new instance of Parser.



3
4
5
6
7
8
# File 'lib/vinter/parser.rb', line 3

def initialize(tokens)
  @tokens = tokens
  @position = 0
  @errors = []
  @warnings = []
end

Instance Method Details

#parseObject



10
11
12
13
14
15
16
17
# File 'lib/vinter/parser.rb', line 10

def parse
  result = parse_program
  {
    ast: result,
    errors: @errors,
    warnings: @warnings
  }
end