lark icon indicating copy to clipboard operation
lark copied to clipboard

multiline strings in python3 grammar

Open kediaharshit9 opened this issue 2 years ago • 1 comments

A common way to write strings in python is to put a backslash at the end and continue in the next line, this makes code more readable as well.

To Reproduce

x = "abc \
def"

This is valid python code, but lark parser fails with error

lark.exceptions.UnexpectedCharacters: No terminal matches '"' in the current parser context, at line ...

kediaharshit9 avatar Nov 28 '23 14:11 kediaharshit9

Use the STRING definition from this draft PR: https://github.com/lark-parser/lark/pull/1351/files#diff-0c6c68851bb98bda0665017b99a92f90d67ff56e55dca71a83ae390129a3a538

MegaIng avatar Nov 28 '23 14:11 MegaIng