Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/lint-grammar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # v6.0.9
name: Install pnpm
with:
version: 9
version: 12
run_install: false

- name: Get pnpm store directory
Expand All @@ -43,7 +43,7 @@ jobs:
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install --frozen-lockfile
run: pnpm add node-gyp && pnpm install --frozen-lockfile

- name: Run ESLint
run: pnpm run lint
30 changes: 16 additions & 14 deletions grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,11 @@ export default grammar({
],

supertypes: $ => [
$._gate_item,
$.gate_item,
$.statement,
$.typedef_item,
$.world_definition,
$.package_items,
],

conflicts: $ => [
Expand All @@ -44,16 +47,16 @@ export default grammar({
rules: {
source_file: ($) =>
seq(
repeat($._statement),
repeat($.statement),
),

_statement: $ => choice(
statement: $ => choice(
$.package_decl,
$.nested_package_definition,
$._package_items,
$.package_items,
),

_package_items: $ => choice(
package_items: $ => choice(
$.toplevel_use_item,
$.world_item,
$.interface_item,
Expand All @@ -63,7 +66,7 @@ export default grammar({
seq(
$.decl_head,
'{',
repeat($._package_items),
repeat($.package_items),
'}',
),

Expand Down Expand Up @@ -131,9 +134,9 @@ export default grammar({
seq(optional($._gate), 'world', field('name', $.id), alias($._world_body, $.body)),

_world_body: ($) =>
seq('{', repeat(seq(optional($._gate), $._world_items)), '}'),
seq('{', repeat(seq(optional($._gate), $.world_definition)), '}'),

_world_items: ($) =>
world_definition: ($) =>
choice(
$.export_item,
$.import_item,
Expand Down Expand Up @@ -187,13 +190,12 @@ export default grammar({
seq(optional($._gate), 'interface', field('name', $.id), alias($._interface_body, $.body)),

_interface_body: ($) =>
seq('{', repeat(seq(optional($._gate), $._interface_items)), '}'),
seq('{', repeat(seq(optional($._gate), $._interface_definition)), '}'),

_interface_items: ($) =>
_interface_definition: ($) =>
choice(
$.use_item,
seq(optional($.external_id), $.typedef_item),
seq(optional($.external_id), $.func_item),
seq(optional($.external_id), choice($.typedef_item, $.func_item)),
),

typedef_item: ($) =>
Expand Down Expand Up @@ -396,8 +398,8 @@ export default grammar({
//
// feature-field ::= 'feature' '=' id
// version-field ::= 'version' '=' <valid semver>
_gate: $ => repeat1($._gate_item),
_gate_item: $ => choice(
_gate: $ => repeat1($.gate_item),
gate_item: $ => choice(
$.unstable_gate,
$.since_gate,
$.deprecated_gate,
Expand Down
11 changes: 2 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,8 @@
"src/**"
],
"dependencies": {
"node-addon-api": "^8.9.0",
"node-gyp-build": "^4.8.4",
"oxfmt": "^0.71.0"
"node-addon-api": "^8.9.2",
"node-gyp-build": "^4.8.4"
},
"peerDependencies": {
"tree-sitter": "^0.22.4"
Expand All @@ -55,11 +54,5 @@
"globals": "^17.13.0",
"prebuildify": "^6.0.1",
"tree-sitter-cli": "^0.27.0"
},
"pnpm": {
"onlyBuiltDependencies": [
"tree-sitter",
"tree-sitter-cli"
]
}
}
Loading
Loading