Class: Predicator::Parser
Constant Summary
GeneratedParser::Racc_arg, GeneratedParser::Racc_debug_parser, GeneratedParser::Racc_token_to_s_table
Instance Method Summary
collapse
#_reduce_none
Instance Method Details
#next_token ⇒ Object
6
7
8
|
# File 'lib/predicator/parser.rb', line 6
def next_token
@lexer.next_token
end
|
#on_error(type, val, values) ⇒ Object
15
16
17
18
19
20
|
# File 'lib/predicator/parser.rb', line 15
def on_error type, val, values
super
rescue Racc::ParseError
trace = values.each_with_index.map{|l, i| "#{' ' * i}#{l}"}
raise ParseError, "\nparse error on value #{val.inspect}\n#{trace.join("\n")}"
end
|
#parse(string) ⇒ Object
10
11
12
13
|
# File 'lib/predicator/parser.rb', line 10
def parse string
@lexer = Lexer.new string
do_parse
end
|