Browse Source

BUGFIX: Automatic terminal names didn't respect existing terminals(Issue #224)

tags/gm/2021-09-23T00Z/github.com--lark-parser-lark/0.6.5
Erez Shinan 6 years ago
parent
commit
ce75758f76
1 changed files with 3 additions and 0 deletions
  1. +3
    -0
      lark/load_grammar.py

+ 3
- 0
lark/load_grammar.py View File

@@ -306,6 +306,9 @@ class PrepareAnonTerminals(Transformer_InPlace):
value.upper().encode('ascii') # Make sure we don't have unicode in our token names
token_name = value.upper()

if token_name in self.token_set:
token_name = None

elif isinstance(p, PatternRE):
if p in self.token_reverse: # Kind of a wierd placement.name
token_name = self.token_reverse[p].name


Loading…
Cancel
Save