@marko/tree-sitter 0.1.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -40,9 +40,9 @@ parser.setLanguage(Marko);
40
40
  Building from a checkout:
41
41
 
42
42
  ```sh
43
- npm install
44
- npm run build # tree-sitter generate && node-gyp rebuild
45
- npm run build:wasm # tree-sitter-marko.wasm (the CLI fetches wasi-sdk itself)
43
+ pnpm install
44
+ pnpm run build # tree-sitter generate && node-gyp rebuild
45
+ pnpm run build:wasm # tree-sitter-marko.wasm (the CLI fetches wasi-sdk itself)
46
46
  ```
47
47
 
48
48
  For editors, the grammar ships ready-to-use queries: `queries/highlights.scm`
@@ -61,9 +61,9 @@ in the host tool like any other language.
61
61
  From this directory:
62
62
 
63
63
  ```sh
64
- npx tree-sitter playground # interactive tree in the browser
65
- npx tree-sitter parse file.marko # print the syntax tree
66
- npx tree-sitter highlight file.marko # ANSI highlighting (--html for a page)
64
+ pnpm exec tree-sitter playground # interactive tree in the browser
65
+ pnpm exec tree-sitter parse file.marko # print the syntax tree
66
+ pnpm exec tree-sitter highlight file.marko # ANSI highlighting (--html for a page)
67
67
  ```
68
68
 
69
69
  `highlight` resolves the injected languages through the CLI config: run
@@ -82,7 +82,7 @@ and start treesitter for the filetype:
82
82
  ```sh
83
83
  # from this directory
84
84
  mkdir -p ~/.local/share/nvim/site/parser ~/.local/share/nvim/site/queries
85
- npx tree-sitter build -o ~/.local/share/nvim/site/parser/marko.so
85
+ pnpm exec tree-sitter build -o ~/.local/share/nvim/site/parser/marko.so
86
86
  cp -R queries ~/.local/share/nvim/site/queries/marko
87
87
  ```
88
88
 
@@ -262,7 +262,7 @@ split without lookahead the scanner doesn't have.
262
262
 
263
263
  Marko's parser is [htmljs-parser](https://github.com/marko-js/htmljs-parser);
264
264
  this grammar's external scanner reimplements its state machine, and the test
265
- suite (`npm test`, Node 22) asserts the tree reproduces the parser's event
265
+ suite (`pnpm test`, Node 22) asserts the tree reproduces the parser's event
266
266
  stream with byte-precise ranges across the parser's full fixture suite, plus
267
267
  thousands of templates from the Marko ecosystem during development.
268
268
 
package/grammar.js CHANGED
@@ -70,6 +70,7 @@ module.exports = grammar({
70
70
  $._types_close, // ">"
71
71
  $._attr_group_open, // "[" (concise mode)
72
72
  $._attr_group_close, // "]"
73
+ $.attr_method_async, // "async" before a shorthand method
73
74
  $.attr_name,
74
75
  $.attr_eq, // "="
75
76
  $.attr_bound_eq, // ":="
@@ -151,6 +152,7 @@ module.exports = grammar({
151
152
  $.type_args,
152
153
  $.type_params,
153
154
  $.attr_group,
155
+ $.attr_method_async,
154
156
  $.attr_name,
155
157
  $.attr_value,
156
158
  $.attr_bound_value,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marko/tree-sitter",
3
- "version": "0.1.0",
3
+ "version": "0.3.0",
4
4
  "description": "Tree-sitter grammar for the Marko templating language",
5
5
  "keywords": [
6
6
  "incremental",
@@ -38,11 +38,13 @@
38
38
  "node-gyp-build": "^4.8.4"
39
39
  },
40
40
  "devDependencies": {
41
+ "@changesets/changelog-github": "^0.7.0",
42
+ "@changesets/cli": "^2.31.0",
41
43
  "@types/degit": "^2.8.6",
42
44
  "@types/mocha": "^10.0.6",
43
45
  "@types/node": "^20.11.16",
44
46
  "degit": "^2.8.4",
45
- "htmljs-parser": "^5.10.2",
47
+ "htmljs-parser": "^5.14.0",
46
48
  "mocha": "^10.2.0",
47
49
  "node-gyp": "^11.0.0",
48
50
  "prebuildify": "^6.0.1",
@@ -59,15 +61,6 @@
59
61
  "optional": true
60
62
  }
61
63
  },
62
- "scripts": {
63
- "build": "tree-sitter generate && node-gyp rebuild",
64
- "generate": "tree-sitter generate",
65
- "install": "node-gyp-build",
66
- "test": "mocha \"./__tests__/*.test.mts\"",
67
- "prebuild": "prebuildify --napi --strip",
68
- "build:wasm": "tree-sitter build --wasm -o tree-sitter-marko.wasm",
69
- "test:wasm": "tsx tools/check-wasm.mts"
70
- },
71
64
  "tree-sitter": [
72
65
  {
73
66
  "scope": "source.marko",
@@ -76,5 +69,18 @@
76
69
  ],
77
70
  "injection-regex": "^marko$"
78
71
  }
79
- ]
80
- }
72
+ ],
73
+ "scripts": {
74
+ "build": "tree-sitter generate && node-gyp rebuild",
75
+ "change": "changeset add",
76
+ "generate": "tree-sitter generate",
77
+ "install": "node-gyp-build",
78
+ "release:publish": "changeset publish",
79
+ "release:tag": "changeset tag",
80
+ "test": "mocha \"./__tests__/*.test.mts\"",
81
+ "prebuild": "prebuildify --napi --strip",
82
+ "build:wasm": "tree-sitter build --wasm -o tree-sitter-marko.wasm",
83
+ "test:wasm": "tsx tools/check-wasm.mts",
84
+ "version": "changeset version && node tools/sync-tree-sitter-version.mjs && pnpm install --lockfile-only"
85
+ }
86
+ }
package/src/grammar.json CHANGED
@@ -278,6 +278,10 @@
278
278
  "type": "SYMBOL",
279
279
  "name": "attr_group"
280
280
  },
281
+ {
282
+ "type": "SYMBOL",
283
+ "name": "attr_method_async"
284
+ },
281
285
  {
282
286
  "type": "SYMBOL",
283
287
  "name": "attr_name"
@@ -994,6 +998,10 @@
994
998
  "type": "SYMBOL",
995
999
  "name": "_attr_group_close"
996
1000
  },
1001
+ {
1002
+ "type": "SYMBOL",
1003
+ "name": "attr_method_async"
1004
+ },
997
1005
  {
998
1006
  "type": "SYMBOL",
999
1007
  "name": "attr_name"
@@ -69,6 +69,10 @@
69
69
  "type": "attr_group_open",
70
70
  "named": true
71
71
  },
72
+ {
73
+ "type": "attr_method_async",
74
+ "named": true
75
+ },
72
76
  {
73
77
  "type": "attr_name",
74
78
  "named": true
@@ -241,6 +245,10 @@
241
245
  "type": "attr_group",
242
246
  "named": true
243
247
  },
248
+ {
249
+ "type": "attr_method_async",
250
+ "named": true
251
+ },
244
252
  {
245
253
  "type": "attr_name",
246
254
  "named": true
@@ -749,6 +757,10 @@
749
757
  "type": "attr_group_open",
750
758
  "named": true
751
759
  },
760
+ {
761
+ "type": "attr_method_async",
762
+ "named": true
763
+ },
752
764
  {
753
765
  "type": "attr_name",
754
766
  "named": true