mirror of https://github.com/lark-parser/lark.git
Added 'edit_terminals' option (Issue #406)
This commit is contained in:
parent
535aebab3c
commit
bb57629418
|
@ -69,6 +69,7 @@ class LarkOptions(Serialize):
|
|||
'propagate_positions': False,
|
||||
'lexer_callbacks': {},
|
||||
'maybe_placeholders': False,
|
||||
'edit_terminals': None,
|
||||
}
|
||||
|
||||
def __init__(self, options_dict):
|
||||
|
@ -205,6 +206,10 @@ class Lark(Serialize):
|
|||
# Compile the EBNF grammar into BNF
|
||||
self.terminals, self.rules, self.ignore_tokens = self.grammar.compile(self.options.start)
|
||||
|
||||
if self.options.edit_terminals:
|
||||
for t in self.terminals:
|
||||
self.options.edit_terminals(t)
|
||||
|
||||
self._terminals_dict = {t.name:t for t in self.terminals}
|
||||
|
||||
# If the user asked to invert the priorities, negate them all here.
|
||||
|
|
Loading…
Reference in New Issue