diff --git a/src/scanner.c b/src/scanner.c index 680ba07..eac2cc0 100644 --- a/src/scanner.c +++ b/src/scanner.c @@ -51,9 +51,17 @@ static bool scan_content(TSLexer *lexer, TSSymbol content_symbol, char end_char, int32_t next; while ((next = lexer->lookahead)) { mark_end(lexer); - if (next == '\\' || (next == '$' && interp)) { + if (interp && (next == '$' || next == '\\')) { lexer->result_symbol = content_symbol; return has_content; + } else if (next == '\\') { + // Parse backslash in raw strings (check escaped delimiters and '\\') + advance(lexer); + next = lexer->lookahead; + if (next == end_char || next == '\\') { + lexer->result_symbol = content_symbol; + return has_content; + } } else { bool is_end_delimiter = true; for (unsigned i = 1; i <= n_delim; i++) { diff --git a/test/corpus/literals.txt b/test/corpus/literals.txt index 32021fd..fbe698b 100644 --- a/test/corpus/literals.txt +++ b/test/corpus/literals.txt @@ -179,7 +179,6 @@ K"\\" (operator) (prefixed_string_literal prefix: (identifier) - (escape_sequence) (content))) (assignment (identifier)