|
@@ -288,7 +288,12 @@ class Lark(Serialize): |
|
|
if self.options.parser == 'lalr': |
|
|
if self.options.parser == 'lalr': |
|
|
self.options.lexer = 'contextual' |
|
|
self.options.lexer = 'contextual' |
|
|
elif self.options.parser == 'earley': |
|
|
elif self.options.parser == 'earley': |
|
|
self.options.lexer = 'dynamic' |
|
|
|
|
|
|
|
|
if self.options.postlex is not None: |
|
|
|
|
|
logger.info("postlex can't be used with the dynamic lexer, so we use standard instead. " |
|
|
|
|
|
"Consider using lalr with contextual instead of earley") |
|
|
|
|
|
self.options.lexer = 'standard' |
|
|
|
|
|
else: |
|
|
|
|
|
self.options.lexer = 'dynamic' |
|
|
elif self.options.parser == 'cyk': |
|
|
elif self.options.parser == 'cyk': |
|
|
self.options.lexer = 'standard' |
|
|
self.options.lexer = 'standard' |
|
|
else: |
|
|
else: |
|
@@ -298,6 +303,8 @@ class Lark(Serialize): |
|
|
assert issubclass(lexer, Lexer) # XXX Is this really important? Maybe just ensure interface compliance |
|
|
assert issubclass(lexer, Lexer) # XXX Is this really important? Maybe just ensure interface compliance |
|
|
else: |
|
|
else: |
|
|
assert_config(lexer, ('standard', 'contextual', 'dynamic', 'dynamic_complete')) |
|
|
assert_config(lexer, ('standard', 'contextual', 'dynamic', 'dynamic_complete')) |
|
|
|
|
|
if self.options.postlex is not None and 'dynamic' in lexer: |
|
|
|
|
|
raise ConfigurationError("Can't use postlex with a dynamic lexer. Use standard or contextual instead") |
|
|
|
|
|
|
|
|
if self.options.ambiguity == 'auto': |
|
|
if self.options.ambiguity == 'auto': |
|
|
if self.options.parser == 'earley': |
|
|
if self.options.parser == 'earley': |
|
|