Skip to content

Commit 3ec2482

Browse files
committed
Fix bug with line continuations immediately after string literal
1 parent 1005c30 commit 3ec2482

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/scanner.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,8 @@ static bool scan_string_literal(TSLexer *lexer) {
365365
// the end of the literal. We also need to check that an
366366
// escaped quote isn't split in half by a line
367367
// continuation -- people do this!
368-
if (skip_literal_continuation_sequence(lexer) && lexer->lookahead != opening_quote) {
368+
skip_literal_continuation_sequence(lexer);
369+
if (lexer->lookahead != opening_quote) {
369370
return true;
370371
}
371372
}

test/corpus/line_continuations.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,8 @@ program test
204204
&"one string"
205205
print*, "this is "&
206206
& // "two strings"
207+
print*, "this is "&
208+
, "two strings"
207209
end program
208210

209211
--------------------------------------------------------------------------------
@@ -230,6 +232,11 @@ end program
230232
(concatenation_expression
231233
(string_literal)
232234
(string_literal))))
235+
(print_statement
236+
(format_identifier)
237+
(output_item_list
238+
(string_literal)
239+
(string_literal)))
233240
(end_program_statement)))
234241

235242
================================================================================

0 commit comments

Comments
 (0)