Browse Source

No longer confusing aliases and rules when importing (Issue #433)

tags/gm/2021-09-23T00Z/github.com--lark-parser-lark/0.7.4
Erez Sh 5 years ago
parent
commit
56978206a3
1 changed files with 1 additions and 0 deletions
  1. +1
    -0
      lark/load_grammar.py

+ 1
- 0
lark/load_grammar.py View File

@@ -605,6 +605,7 @@ def import_from_grammar_into_namespace(grammar, namespace, aliases):
_, tree, _ = imported_rules[symbol]
except KeyError:
raise GrammarError("Missing symbol '%s' in grammar %s" % (symbol, namespace))
tree = next(tree.find_data("expansion")) # Skip "alias" or other annotations
return tree.scan_values(lambda x: x.type in ('RULE', 'TERMINAL'))

def get_namespace_name(name):


Loading…
Cancel
Save