mark/expression: allow backslash characters in identifiers

Fixes #8983.
This commit is contained in:
Ran Benita
2021-08-08 11:50:15 +03:00
parent a446ee81fd
commit 25c65616f4
3 changed files with 19 additions and 3 deletions

View File

@@ -6,7 +6,7 @@ expression: expr? EOF
expr: and_expr ('or' and_expr)*
and_expr: not_expr ('and' not_expr)*
not_expr: 'not' not_expr | '(' expr ')' | ident
ident: (\w|:|\+|-|\.|\[|\])+
ident: (\w|:|\+|-|\.|\[|\]|\\)+
The semantics are:
@@ -88,7 +88,7 @@ class Scanner:
yield Token(TokenType.RPAREN, ")", pos)
pos += 1
else:
match = re.match(r"(:?\w|:|\+|-|\.|\[|\])+", input[pos:])
match = re.match(r"(:?\w|:|\+|-|\.|\[|\]|\\)+", input[pos:])
if match:
value = match.group(0)
if value == "or":