From 96f7878104d1185afcb73466c8e46b30673a0767 Mon Sep 17 00:00:00 2001 From: Erez Sh Date: Mon, 5 Jul 2021 15:07:20 +0300 Subject: [PATCH] Disable 'unless' mechanism if priority is different, not just lower (Issue #920) --- lark/lexer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lark/lexer.py b/lark/lexer.py index 7c2f979..0653dc9 100644 --- a/lark/lexer.py +++ b/lark/lexer.py @@ -248,7 +248,7 @@ def _create_unless(terminals, g_regex_flags, re_, use_bytes): for retok in tokens_by_type.get(PatternRE, []): unless = [] for strtok in tokens_by_type.get(PatternStr, []): - if strtok.priority > retok.priority: + if strtok.priority != retok.priority: continue s = strtok.pattern.value if s == _get_match(re_, retok.pattern.to_regexp(), s, g_regex_flags):