Class: Crisp::Parser

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

Instance Method Summary collapse

Constructor Details

#initializeParser

Returns a new instance of Parser.



5
6
7
# File 'lib/crisp/parser.rb', line 5

def initialize
  @parser = CrispParser.new
end

Instance Method Details

#parse(code) ⇒ Object

Raises:



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

def parse(code)
  ast = @parser.parse(code)

  raise SyntaxError, "syntax error at : #{@parser.index}" if !ast

  ast
end