Fix bug with wrongly provided context object
@@ -82,18 +82,18 @@ class GLRParser(Parser):
self.errors = []
self.current_error = None
+ self.context = context = context if context else Context()
# Initialize dynamic disambiguation
if self.dynamic_filter:
if self.debug:
prints("\tInitializing dynamic disambiguation.")
- self.dynamic_filter(None, None, None, None, None, context)
+ self.dynamic_filter(None, None, None, None, None, self.context)
self.last_position = 0
self.expected = set()
self.empty_reductions_results = {}
- self.context = context = context if context else Context()
context.parser = self
context.input_str = input_str
context.file_name = file_name
