diff --git a/grammar.js b/grammar.js index 45cb6cd..624af69 100644 --- a/grammar.js +++ b/grammar.js @@ -419,7 +419,7 @@ module.exports = grammar({ _unescaped_double_string_fragment: ($) => token.immediate(/[^"\\\n]+/), escape_sequence: ($) => - token.immediate( + token( seq( "\\", choice( diff --git a/src/grammar.json b/src/grammar.json index 12d898c..0ca6060 100644 --- a/src/grammar.json +++ b/src/grammar.json @@ -2155,7 +2155,7 @@ } }, "escape_sequence": { - "type": "IMMEDIATE_TOKEN", + "type": "TOKEN", "content": { "type": "SEQ", "members": [ diff --git a/src/parser.c b/src/parser.c index 7978f41..e8c3622 100644 Binary files a/src/parser.c and b/src/parser.c differ diff --git a/test/corpus/connection.txt b/test/corpus/connection.txt index d7bb654..205c0c0 100644 --- a/test/corpus/connection.txt +++ b/test/corpus/connection.txt @@ -245,3 +245,26 @@ Connection with espaced key fragments ) ) ) + + +================================================================================ +Connection with espaced key fragments +================================================================================ +\#hello\[\] -- \[world\] + +-------------------------------------------------------------------------------- + +(source_file + (connection + (shape_key + (escape_sequence) + (escape_sequence) + (escape_sequence) + ) + (arrow) + (shape_key + (escape_sequence) + (escape_sequence) + ) + ) +) diff --git a/test/corpus/shape.txt b/test/corpus/shape.txt index ef18f64..6ef4ba0 100644 --- a/test/corpus/shape.txt +++ b/test/corpus/shape.txt @@ -3,6 +3,7 @@ Declare unquoted shape identifier with escape sequence (issue #21) ================================================================================ hello\[world\] \#ello\[world\] +\# helloello\[world\] -------------------------------------------------------------------------------- (source_file @@ -19,6 +20,13 @@ hello\[world\] (escape_sequence) ) ) + (shape + (shape_key + (escape_sequence) + (escape_sequence) + (escape_sequence) + ) + ) ) ================================================================================ diff --git a/tree-sitter-d2.wasm b/tree-sitter-d2.wasm index 526df67..e8a10a6 100755 Binary files a/tree-sitter-d2.wasm and b/tree-sitter-d2.wasm differ