Fix multi-line-string-body grammar (#552)

* Make multi-line-string-body non-greedy

* Don't require string-character after quotes in multiline strings

* Prevent accidentally consuming triple quotes in multi-line-string-body

* Add test cases
This commit is contained in:
Brandon Chinn 2026-03-25 09:59:25 -07:00 committed by GitHub
parent 568d103308
commit 4e4c0af933
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 9 additions and 1 deletions

View File

@ -991,7 +991,7 @@ quoted-string :=
(multi-line-string-body newline)?
(unicode-space | ws-escape)* '"""'
single-line-string-body := (string-character - newline)*
multi-line-string-body := (('"' | '""')? string-character)*
multi-line-string-body := ('"' ^'"' | '""' ^'"' | string-character)*?
string-character :=
'\\' (["\\bfnrts] |
'u{' hex-unicode '}') |

View File

@ -0,0 +1 @@
node "\""

View File

@ -0,0 +1 @@
node "\"\""

View File

@ -0,0 +1,3 @@
node """
"
"""

View File

@ -0,0 +1,3 @@
node """
""
"""