From d018f2e6620bbaee229cb31fc8b67fabd713d770 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=C3=A1=C5=A1=20Dujava?= <19737748+jdujava@users.noreply.github.com> Date: Sat, 20 Jul 2024 21:37:17 +0200 Subject: [PATCH] Add delimiter node (#147) Signed-off-by: Jonas Dujava --- grammar.js | 5 ++++- src/grammar.json | 10 +++++++++- src/node-types.json | 8 ++++++++ test/corpus/issues.txt | 4 ++-- 4 files changed, 23 insertions(+), 4 deletions(-) diff --git a/grammar.js b/grammar.js index 83187543c..e0b0e7aa1 100644 --- a/grammar.js +++ b/grammar.js @@ -375,6 +375,7 @@ module.exports = grammar({ $.operator, $.word, $.placeholder, + $.delimiter, $.block_comment, $._command, $.superscript, @@ -384,10 +385,12 @@ module.exports = grammar({ ), ), - word: $ => /[^\s\\%\{\},\$\[\]\(\)=\#_\^\-\+\/\*]+/, + word: $ => /[^\s\\%\{\},\$\[\]\(\)=\#&_\^\-\+\/\*]+/, placeholder: $ => /#\d/, + delimiter: $ => /&/, + path: $ => /[^\*\"\[\]:;,\|\{\}<>]+/, uri: $ => /[^\[\]\{\}]+/, diff --git a/src/grammar.json b/src/grammar.json index 89a46bb75..4d8853427 100644 --- a/src/grammar.json +++ b/src/grammar.json @@ -1641,6 +1641,10 @@ "type": "SYMBOL", "name": "placeholder" }, + { + "type": "SYMBOL", + "name": "delimiter" + }, { "type": "SYMBOL", "name": "block_comment" @@ -1664,12 +1668,16 @@ }, "word": { "type": "PATTERN", - "value": "[^\\s\\\\%\\{\\},\\$\\[\\]\\(\\)=\\#_\\^\\-\\+\\/\\*]+" + "value": "[^\\s\\\\%\\{\\},\\$\\[\\]\\(\\)=\\#&_\\^\\-\\+\\/\\*]+" }, "placeholder": { "type": "PATTERN", "value": "#\\d" }, + "delimiter": { + "type": "PATTERN", + "value": "&" + }, "path": { "type": "PATTERN", "value": "[^\\*\\\"\\[\\]:;,\\|\\{\\}<>]+" diff --git a/src/node-types.json b/src/node-types.json index 6b66bbd00..af4bd6640 100644 --- a/src/node-types.json +++ b/src/node-types.json @@ -7513,6 +7513,10 @@ "type": "color_set_definition", "named": true }, + { + "type": "delimiter", + "named": true + }, { "type": "environment_definition", "named": true @@ -9262,6 +9266,10 @@ "type": "comment", "named": true }, + { + "type": "delimiter", + "named": true + }, { "type": "letter", "named": true diff --git a/test/corpus/issues.txt b/test/corpus/issues.txt index 28c846f34..65988c3e0 100644 --- a/test/corpus/issues.txt +++ b/test/corpus/issues.txt @@ -477,7 +477,7 @@ Let (word)))) (text (word) - (word)) + (delimiter)) (text (word) (superscript @@ -493,7 +493,7 @@ Let (word)))) (text (word) - (word)) + (delimiter)) (text (word) (superscript