Skip to content

Commit 2f9492f

Browse files
committed
fix(scanner): verbatim string parsing with immediate quotes
1 parent 31a64b2 commit 2f9492f

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

src/scanner.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ bool tree_sitter_c_sharp_external_scanner_scan(void *payload, TSLexer *lexer, co
225225
lexer->mark_end(lexer);
226226
advance(lexer);
227227

228-
if (lexer->lookahead == '"') {
228+
if (lexer->lookahead == '"' && !is_verbatim) {
229229
advance(lexer);
230230
if (lexer->lookahead == '"') {
231231
lexer->result_symbol = INTERPOLATION_RAW_START;

test/corpus/literals.txt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ var x = $""""
129129
"""";
130130

131131
var x = $@" ""hi"" ";
132+
var x = @$"""Hello"" {world}!";
132133

133134
--------------------------------------------------------------------------------
134135

@@ -845,4 +846,18 @@ var x = $@" ""hi"" ";
845846
name: (identifier)
846847
(interpolated_string_expression
847848
(interpolation_start)
849+
(string_content))))))
850+
(global_statement
851+
(local_declaration_statement
852+
(variable_declaration
853+
type: (implicit_type)
854+
(variable_declarator
855+
name: (identifier)
856+
(interpolated_string_expression
857+
(interpolation_start)
858+
(string_content)
859+
(interpolation
860+
(interpolation_brace)
861+
(identifier)
862+
(interpolation_brace))
848863
(string_content)))))))

0 commit comments

Comments
 (0)