Skip to content

Commit

Permalink
[parsing] resolve parseinfo.pos with ._next_roken() before momokey
Browse files Browse the repository at this point in the history
  • Loading branch information
apalala committed Oct 16, 2023
1 parent df52528 commit 1598f08
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions tatsu/contexts.py
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,6 @@ def rule(self):

@property
def memokey(self):
self.tokenizer.next_token()
return MemoKey(self._pos, self.rule, self.substate)

def _memoize(self, key, memo):
Expand Down Expand Up @@ -638,14 +637,14 @@ def filter(key, value):
prune_dict(self._memos, filter)

def _recursive_call(self, ruleinfo):
self._next_token(ruleinfo)
key = self.memokey

if not ruleinfo.is_leftrec:
return self._invoke_rule(ruleinfo, self.memokey)
return self._invoke_rule(ruleinfo, key)
elif not self.left_recursion:
self._error('Left recursion detected', exclass=FailedLeftRecursion)

self._next_token(ruleinfo)
key = self.memokey

self._recursion_depth += 1
if key in self._results:
result = self._results[key]
Expand Down

0 comments on commit 1598f08

Please sign in to comment.