Commit 3e78d4b9 authored by Igor Dejanovic's avatar Igor Dejanovic

Optional now results in parse tree node.

parent 5515acd6
...@@ -356,7 +356,7 @@ class Optional(Repetition): ...@@ -356,7 +356,7 @@ class Optional(Repetition):
result = None result = None
c_pos = parser.position c_pos = parser.position
try: try:
result = self.nodes[0].parse(parser) result = [self.nodes[0].parse(parser)]
except NoMatch as e: except NoMatch as e:
parser.position = c_pos # Backtracking parser.position = c_pos # Backtracking
raise NoMatch(e.rule, e.position, e.parser, raise NoMatch(e.rule, e.position, e.parser,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment