Skip to content

Commit 4e4c0af

Browse files
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
1 parent 568d103 commit 4e4c0af

5 files changed

Lines changed: 9 additions & 1 deletion

File tree

draft-marchan-kdl2.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -991,7 +991,7 @@ quoted-string :=
991991
(multi-line-string-body newline)?
992992
(unicode-space | ws-escape)* '"""'
993993
single-line-string-body := (string-character - newline)*
994-
multi-line-string-body := (('"' | '""')? string-character)*
994+
multi-line-string-body := ('"' ^'"' | '""' ^'"' | string-character)*?
995995
string-character :=
996996
'\\' (["\\bfnrts] |
997997
'u{' hex-unicode '}') |
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node "\""
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node "\"\""
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node """
2+
"
3+
"""
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node """
2+
""
3+
"""

0 commit comments

Comments
 (0)