Object
Initialize the parser. machine_name refers to a state machine table.
# File lib/gherkin/parser/parser.rb, line 15 def initialize(listener, raise_on_error=true, machine_name='root') @listener = listener @raise_on_error = raise_on_error @machines = [] @machine_name = machine_name push_machine(@machine_name) end
# File lib/gherkin/parser/parser.rb, line 39 def event(ev, line) machine.event(ev, line) do |state, expected| if @raise_on_error raise ParseError.new(state, ev, expected, line) else @listener.syntax_error(state, ev, expected, line) return false end end true end
# File lib/gherkin/parser/parser.rb, line 63 def expected machine.expected end
# File lib/gherkin/parser/parser.rb, line 67 def force_state(state) machine.instance_variable_set('@state', state) end
# File lib/gherkin/parser/parser.rb, line 23 def location(uri, offset) @listener.location(uri, offset) end
# File lib/gherkin/parser/parser.rb, line 59 def machine @machines[-1] end
Doesn’t yet fall back to super
# File lib/gherkin/parser/parser.rb, line 28 def method_missing(method, *args) # TODO: Catch exception and call super if(event(method.to_s, args[-1])) @listener.__send__(method, *args) end if method == :eof pop_machine push_machine(@machine_name) end end
Generated with the Darkfish Rdoc Generator 2.