lib/treetop/compiler/node_classes/predicate.rb in treetop-1.5.3 vs lib/treetop/compiler/node_classes/predicate.rb in treetop-1.6.2
- old
+ new
@@ -11,10 +11,11 @@
builder.else_ { when_failure }
end_comment(parent_expression)
end
def assign_failure
+ reset_index
super(start_index_var)
end
def assign_success
reset_index
@@ -33,13 +34,19 @@
end
class NotPredicate < Predicate
def when_success
assign_failure
+ if (e = parent.atomic.expected)
+ builder << "terminal_parse_failure(#{e}, true)"
+ end
end
def when_failure
+ if (e = parent.atomic.expected)
+ builder << "terminal_failures.pop"
+ end
assign_success
end
end
end
-end
\ No newline at end of file
+end