Closed Fxztam closed 10 months ago
Hi,
I just encountered a problem with Lark's Python 3 string definition::
string : /([ubf]?r?|r[ubf])('(?!'').*?(?<!\\)(\\\\)*?')/i
-> the parse string '\' does not work:
'\'
lark.exceptions.UnexpectedCharacters: No terminal matches ''' in the current parser context, at line 9 col 25
` x := '\';` ^
Expected one of: * /([ubf]?r?|r[ubf])('(?!'').*?(?<!\\)(\\\\)*?')/i * ...
I'm afraid I have an understanding problem with escaped strings.?
Here is an example
Thanks, Fried
Yes, '\' is not a valid string in python. This is the correct behavior.
It's nice to know. Maybe there's a suggestion for the solution when parsing a non-Python language here, please?
I tied with this
([ubf]?r?|r[ubf])('(?!'').*?(\\\\)*?'
and it seems that works.
Hi,
I just encountered a problem with Lark's Python 3 string definition::
string : /([ubf]?r?|r[ubf])('(?!'').*?(?<!\\)(\\\\)*?')/i
-> the parse string
'\'
does not work:lark.exceptions.UnexpectedCharacters: No terminal matches ''' in the current parser context, at line 9 col 25
I'm afraid I have an understanding problem with escaped strings.?
Here is an example
Thanks, Fried