lib/treetop/runtime/compiled_parser.rb in treetop-1.4.8 vs lib/treetop/runtime/compiled_parser.rb in treetop-1.4.9
- old
+ new
@@ -13,11 +13,12 @@
end
def parse(input, options = {})
prepare_to_parse(input)
@index = options[:index] if options[:index]
- result = send("_nt_#{root}")
- return nil if (consume_all_input? && index != input.size)
+ result = send("_nt_#{options[:root] || root}")
+ should_consume_all = options.include?(:consume_all_input) ? options[:consume_all_input] : consume_all_input?
+ return nil if (should_consume_all && index != input.size)
return SyntaxNode.new(input, index...(index + 1)) if result == true
return result
end
def failure_index