Skip to content

Commit

Permalink
fix: error in braced commands
Browse files Browse the repository at this point in the history
  • Loading branch information
lewis6991 committed Nov 5, 2024
1 parent cdba4ab commit 98015eb
Show file tree
Hide file tree
Showing 7 changed files with 11,562 additions and 17,734 deletions.
17 changes: 8 additions & 9 deletions grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ module.exports = grammar({
],

inline: $ => [
$._commands,
$._builtin,
$._terminator,
$._word,
Expand All @@ -42,13 +41,10 @@ module.exports = grammar({
],

rules: {
source_file: $ => $._commands,

_commands: $ => seq(
repeat($._terminator),
interleaved1($._command, repeat1($._terminator)),
repeat($._terminator)
),
source_file: $ => repeat(seq(
optional($._command),
$._terminator
)),

_terminator: _ => choice('\n', ';'),

Expand Down Expand Up @@ -171,7 +167,10 @@ module.exports = grammar({
optional($.array_index)
),

braced_word: $ => seq('{', optional($._commands), '}'),
braced_word: $ => seq('{', optional(seq(
interleaved1($._command, repeat1($._terminator)),
repeat($._terminator)
)), '}'),

braced_word_simple: $ => seq('{', repeat($._word_simple), '}'),

Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
"install": "node-gyp-build",
"prestart": "tree-sitter build --wasm",
"start": "tree-sitter playground",
"test": "node --test bindings/node/*_test.js"
"test": "node --test bindings/node/*_test.js",
"prebuildify": "prebuildify --napi --strip"
},
"author": "Lewis Russell <[email protected]>",
"license": "MIT",
Expand All @@ -47,6 +48,5 @@
"eslint-config-google": "^0.14.0",
"tree-sitter-cli": "^0.21.0",
"prebuildify": "^6.0.0"
},
"tree-sitter": []
}
}
}
105 changes: 57 additions & 48 deletions src/grammar.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/node-types.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 98015eb

Please sign in to comment.