Skip to content

Commit b16f802

Browse files
committed
Improve continuation detection for string literals
1 parent f7778e2 commit b16f802

2 files changed

Lines changed: 24 additions & 1 deletion

File tree

src/scanner.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,7 @@ static bool scan_string_literal(TSLexer *lexer) {
389389
advance(lexer);
390390
}
391391
}
392+
continue;
392393
}
393394

394395
// If we hit the same kind of quote that opened this literal,

test/corpus/line_continuations.txt

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -472,11 +472,33 @@ end program test
472472

473473
================================================================================
474474
Line continuation as part of string
475-
:error
476475
================================================================================
477476
program main
478477
! This should print "I like fish&chips"
479478
print *, "I like fish&&
480479
&chips"
481480
end program main
482481
--------------------------------------------------------------------------------
482+
483+
(translation_unit
484+
(program
485+
(program_statement
486+
(whitespace)
487+
(name)
488+
(end_of_statement))
489+
(whitespace)
490+
(comment)
491+
(whitespace)
492+
(print_statement
493+
(whitespace)
494+
(format_identifier)
495+
(whitespace)
496+
(output_item_list
497+
(prefixed_string_literal
498+
(string_literal))))
499+
(end_of_statement)
500+
(end_program_statement
501+
(whitespace)
502+
(whitespace)
503+
(name)
504+
(end_of_statement))))

0 commit comments

Comments
 (0)