diff --git a/grammar.js b/grammar.js index ed4e121..234e513 100644 --- a/grammar.js +++ b/grammar.js @@ -132,14 +132,12 @@ module.exports = grammar({ ), text_block: ($) => - choice( - seq( - alias($._text_block_start, "|"), - optional($.language), - /\s/, - alias($._text_block_raw_text, $.raw_text), - alias($._text_block_end, "|") - ) + seq( + alias($._text_block_start, "|"), + optional($.language), + /\s/, + alias($._text_block_raw_text, $.raw_text), + alias($._text_block_end, "|") ), language: ($) => /\w+/, diff --git a/scripts/pre-commit b/scripts/pre-commit index d33227a..6b06a4e 100755 --- a/scripts/pre-commit +++ b/scripts/pre-commit @@ -9,5 +9,6 @@ if [ ! -z $(git diff --cached --name-only | grep -e "^grammar.js$") ] then make build make build-wasm + git add src bindings *.wasm fi diff --git a/src/grammar.json b/src/grammar.json index babb67c..7f29429 100644 --- a/src/grammar.json +++ b/src/grammar.json @@ -538,55 +538,50 @@ ] }, "text_block": { - "type": "CHOICE", + "type": "SEQ", "members": [ { - "type": "SEQ", + "type": "ALIAS", + "content": { + "type": "SYMBOL", + "name": "_text_block_start" + }, + "named": false, + "value": "|" + }, + { + "type": "CHOICE", "members": [ { - "type": "ALIAS", - "content": { - "type": "SYMBOL", - "name": "_text_block_start" - }, - "named": false, - "value": "|" + "type": "SYMBOL", + "name": "language" }, { - "type": "CHOICE", - "members": [ - { - "type": "SYMBOL", - "name": "language" - }, - { - "type": "BLANK" - } - ] - }, - { - "type": "PATTERN", - "value": "\\s" - }, - { - "type": "ALIAS", - "content": { - "type": "SYMBOL", - "name": "_text_block_raw_text" - }, - "named": true, - "value": "raw_text" - }, - { - "type": "ALIAS", - "content": { - "type": "SYMBOL", - "name": "_text_block_end" - }, - "named": false, - "value": "|" + "type": "BLANK" } ] + }, + { + "type": "PATTERN", + "value": "\\s" + }, + { + "type": "ALIAS", + "content": { + "type": "SYMBOL", + "name": "_text_block_raw_text" + }, + "named": true, + "value": "raw_text" + }, + { + "type": "ALIAS", + "content": { + "type": "SYMBOL", + "name": "_text_block_end" + }, + "named": false, + "value": "|" } ] }, diff --git a/tree-sitter-d2.wasm b/tree-sitter-d2.wasm index bca3b6a..96a1442 100755 Binary files a/tree-sitter-d2.wasm and b/tree-sitter-d2.wasm differ