Skip to content

Commit 5824808

Browse files
committedNov 17, 2024
Q Quoted strings do not have to have content.
1 parent fbf7b8d commit 5824808

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed
 

‎src/pg.grammar

+1-1
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ semicolon { StatementEnd | automaticSemicolon }
344344

345345
@skip {} {
346346
StringDoubleQuoted { '"' interpolationContent* '"' }
347-
StringQQuoted { kw<"q"> injectedComments? QuoteLikeStartDelimiter StringContent QuoteLikeEndDelimiter }
347+
StringQQuoted { kw<"q"> injectedComments? QuoteLikeStartDelimiter StringContent* QuoteLikeEndDelimiter }
348348
StringQqQuoted { kw<"qq"> injectedComments? QuoteLikeStartDelimiter interpolationContent* QuoteLikeEndDelimiter }
349349
QWList { kw<"qw"> injectedComments? QWListContent { QuoteLikeStartDelimiter QWElement* QuoteLikeEndDelimiter } }
350350
PatternMatchM {

‎test/perl-quote-and-quote-like-operators.txt

+6-2
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ q/a b~~/c d/;
146146
q # this is a comment
147147
# this is another comment
148148
(abc);
149+
q{};
149150

150151
==>
151152

@@ -173,7 +174,8 @@ Program(
173174
ExpressionStatement(
174175
StringQQuoted(q, Comment, Comment, QuoteLikeStartDelimiter, StringContent, QuoteLikeEndDelimiter),
175176
StatementEnd(";")
176-
)
177+
),
178+
ExpressionStatement(StringQQuoted(q, QuoteLikeStartDelimiter, QuoteLikeEndDelimiter), StatementEnd(";"))
177179
)
178180

179181
# qq quoted strings
@@ -189,6 +191,7 @@ qq[ab[c]d];
189191
qq # Comment
190192
# another Comment
191193
(content $var more);
194+
qq{};
192195

193196
==>
194197

@@ -284,7 +287,8 @@ Program(
284287
QuoteLikeEndDelimiter
285288
),
286289
StatementEnd(";")
287-
)
290+
),
291+
ExpressionStatement(StringQqQuoted(qq, QuoteLikeStartDelimiter, QuoteLikeEndDelimiter), StatementEnd(";"))
288292
)
289293

290294
# qw lists

0 commit comments

Comments
 (0)