Skip to content

Commit

Permalink
[parsing] eat whitespace before memoizing
Browse files Browse the repository at this point in the history
  • Loading branch information
apalala committed Oct 13, 2023
1 parent ad9095f commit 167c940
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions tatsu/contexts.py
Original file line number Diff line number Diff line change
Expand Up @@ -569,6 +569,7 @@ def rule(self):

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

def _memoize(self, key, memo):
Expand Down
3 changes: 3 additions & 0 deletions tatsu/tokenizing.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ def current(self):
def token(self):
return self.current

def eat_whitespace(self):
raise NotImplementedError

def next(self):
raise NotImplementedError

Expand Down

0 comments on commit 167c940

Please sign in to comment.