@willbooster/tree-sitter-embedded-template 0.0.0-stage → 1.0.1
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/LICENSE +21 -0
- package/README.md +135 -2
- package/grammar.js +52 -0
- package/package.json +73 -4
- package/queries/highlights.scm +12 -0
- package/queries/injections-ejs.scm +7 -0
- package/queries/injections-erb.scm +7 -0
- package/queries/injections-etlua.scm +7 -0
- package/src/node-types.json +177 -0
- package/tree-sitter-embedded_template.wasm +0 -0
- package/tree-sitter.json +61 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2018 Max Brunsfeld
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,136 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @willbooster/tree-sitter-embedded-template
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://github.com/WillBooster/tree-sitter-embedded-template/actions/workflows/test.yml)
|
|
4
|
+
[](https://github.com/WillBooster/tree-sitter-embedded-template/actions/workflows/test-rust.yml)
|
|
5
|
+
[](https://github.com/semantic-release/semantic-release)
|
|
6
|
+
[](https://github.com/WillBooster/shared/tree/main/packages/wbfy)
|
|
7
|
+
[](https://crates.io/crates/willbooster-tree-sitter-embedded-template)
|
|
8
|
+
|
|
9
|
+
Embedded template grammar for [tree-sitter](https://github.com/tree-sitter/tree-sitter), forked from
|
|
10
|
+
[tree-sitter/tree-sitter-embedded-template](https://github.com/tree-sitter/tree-sitter-embedded-template). We are grateful
|
|
11
|
+
to its authors and contributors. This is not an official release of that project.
|
|
12
|
+
|
|
13
|
+
It parses templating languages such as ERB and EJS, in which scripting code is embedded in text with the delimiters
|
|
14
|
+
`<%` and `%>`. This fork extends upstream's version 0.25.0 grammar with EJS output-tag whitespace slurping.
|
|
15
|
+
It generates the parser with the
|
|
16
|
+
[WillBooster/tree-sitter](https://github.com/WillBooster/tree-sitter) generator. The parser loads only with that fork's runtime, version 2.0.0 or later
|
|
17
|
+
([willbooster-tree-sitter](https://crates.io/crates/willbooster-tree-sitter),
|
|
18
|
+
[@willbooster/web-tree-sitter](https://www.npmjs.com/package/@willbooster/web-tree-sitter)); upstream's runtime rejects it.
|
|
19
|
+
|
|
20
|
+
## Usage
|
|
21
|
+
|
|
22
|
+
The npm package ships `tree-sitter-embedded_template.wasm` for
|
|
23
|
+
[@willbooster/web-tree-sitter](https://www.npmjs.com/package/@willbooster/web-tree-sitter) version 2.0.0 or later, which runs in Node.js, Bun, browsers, and Cloudflare Workers. In Node.js and Bun, load the grammar from its path:
|
|
24
|
+
|
|
25
|
+
```js
|
|
26
|
+
import { fileURLToPath } from 'node:url';
|
|
27
|
+
import { Language, Parser } from '@willbooster/web-tree-sitter';
|
|
28
|
+
|
|
29
|
+
await Parser.init();
|
|
30
|
+
const parser = new Parser();
|
|
31
|
+
const wasmPath = fileURLToPath(
|
|
32
|
+
import.meta.resolve('@willbooster/tree-sitter-embedded-template/tree-sitter-embedded_template.wasm')
|
|
33
|
+
);
|
|
34
|
+
parser.setLanguage(await Language.load(wasmPath));
|
|
35
|
+
const tree = parser.parse('<ul><% items.each do |item| %><li><%= item %></li><% end %></ul>\n');
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
In browsers, serve both `.wasm` files and load them by URL (the example uses Vite's `?url` imports):
|
|
39
|
+
|
|
40
|
+
```js
|
|
41
|
+
import { Language, Parser } from '@willbooster/web-tree-sitter';
|
|
42
|
+
import runtimeUrl from '@willbooster/web-tree-sitter/web-tree-sitter.wasm?url';
|
|
43
|
+
import grammarUrl from '@willbooster/tree-sitter-embedded-template/tree-sitter-embedded_template.wasm?url';
|
|
44
|
+
|
|
45
|
+
await Parser.init({ locateFile: () => runtimeUrl });
|
|
46
|
+
const parser = new Parser();
|
|
47
|
+
parser.setLanguage(await Language.load(grammarUrl));
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Cloudflare Workers do not allow compiling Wasm at run time, so import both `.wasm` files as modules, with or without
|
|
51
|
+
Node.js compatibility:
|
|
52
|
+
|
|
53
|
+
```js
|
|
54
|
+
import { Language, Parser } from '@willbooster/web-tree-sitter';
|
|
55
|
+
import runtime from '@willbooster/web-tree-sitter/web-tree-sitter.wasm';
|
|
56
|
+
import grammar from '@willbooster/tree-sitter-embedded-template/tree-sitter-embedded_template.wasm';
|
|
57
|
+
|
|
58
|
+
await Parser.init({ wasmModule: runtime });
|
|
59
|
+
const parser = new Parser();
|
|
60
|
+
parser.setLanguage(await Language.load(grammar));
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
The package also ships `grammar.js`, the queries in `queries/`, and the node types in `src/node-types.json`.
|
|
64
|
+
|
|
65
|
+
In Rust, depend on the [crate](https://crates.io/crates/willbooster-tree-sitter-embedded-template) and on
|
|
66
|
+
[willbooster-tree-sitter](https://crates.io/crates/willbooster-tree-sitter), the runtime this package is tested and
|
|
67
|
+
fuzzed with:
|
|
68
|
+
|
|
69
|
+
```toml
|
|
70
|
+
[dependencies]
|
|
71
|
+
tree-sitter = { package = "willbooster-tree-sitter", version = "2.0.0" }
|
|
72
|
+
tree-sitter-embedded-template = { package = "willbooster-tree-sitter-embedded-template", version = "1" }
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
```rust
|
|
76
|
+
let mut parser = tree_sitter::Parser::new();
|
|
77
|
+
parser.set_language(&tree_sitter_embedded_template::LANGUAGE.into())?;
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## Development
|
|
81
|
+
|
|
82
|
+
```sh
|
|
83
|
+
mise install
|
|
84
|
+
bun install --frozen-lockfile
|
|
85
|
+
bun run test/ci-setup # installs Chromium for the browser test
|
|
86
|
+
bun run build/ci
|
|
87
|
+
bun run test
|
|
88
|
+
script/parse-examples
|
|
89
|
+
cargo test
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
The scripts and tests generate, build, test, and parse with `script/tree-sitter`, the tree-sitter CLI of the
|
|
93
|
+
WillBooster/tree-sitter runtime version locked in `Cargo.lock`, since the generator and the runtime of upstream's CLI are
|
|
94
|
+
not the ones this package ships with. Its first run downloads that CLI from the runtime's GitHub Release, or builds it
|
|
95
|
+
with `cargo` (whose build runs the CMake that `mise.toml` pins) when the download fails or the release has no binary that runs here. Run other CLI commands through it as
|
|
96
|
+
well (e.g. `script/tree-sitter parse --grammar-path . file.erb`).
|
|
97
|
+
|
|
98
|
+
`bun run generate` records a fresh generation profile from the applicable `test/corpus` cases, then generates
|
|
99
|
+
compact parser tables. It would also profile files tracked in `examples/`, but this repository tracks none: the
|
|
100
|
+
directory holds only the clones `script/parse-examples` makes. The parser also embeds metadata from `tree-sitter.json`.
|
|
101
|
+
After changing a grammar, `tree-sitter.json`, or a corpus case, regenerate and commit `src/`.
|
|
102
|
+
Profiles in `.tmp/generation-profiles/` are temporary and must not be committed. `bun run build-wasm`, `bun run build/ci`,
|
|
103
|
+
and the release build regenerate the parsers before compiling them.
|
|
104
|
+
|
|
105
|
+
`bun run test` runs:
|
|
106
|
+
|
|
107
|
+
- the corpus in `test/corpus`, with the native build and with the Wasm build (the first run downloads the WASI SDK);
|
|
108
|
+
- an incremental-parsing check (`test/unit/incremental.test.ts`): `script/fuzz-corpus` runs `tree-sitter fuzz`, which
|
|
109
|
+
edits each corpus case at random, reparses it, undoes the edits, and reparses again. `TREE_SITTER_SEED`,
|
|
110
|
+
`TREE_SITTER_ITERATIONS`, and `TREE_SITTER_EDITS` run other or more edits;
|
|
111
|
+
- a check that the real-world ERB and EJS templates in `examples/` fail to parse exactly as listed in
|
|
112
|
+
`script/known-failures.txt`, which is empty now. The first run clones the repositories. The example repositories are pinned to commits in
|
|
113
|
+
`script/parse-examples`. After a grammar change or a moved pin alters that list, `script/parse-examples` rewrites it;
|
|
114
|
+
review its diff before committing;
|
|
115
|
+
- a performance check (`test/unit/performance.test.ts`) that parsing a template whose last directive is still open
|
|
116
|
+
takes linear time, since consumers parse files while they are being edited. It loads the Wasm build through
|
|
117
|
+
@willbooster/web-tree-sitter, which `bun run build/ci` rebuilds after regenerating the parser;
|
|
118
|
+
- a check (`test/unit/runtimeVersion.test.ts`) that `@willbooster/web-tree-sitter` in `package.json` and
|
|
119
|
+
`willbooster-tree-sitter` in `Cargo.lock` are the same version, since the Wasm tests run on the former and the Rust
|
|
120
|
+
tests, the fuzzer, and the CLI on the latter;
|
|
121
|
+
- tests that load the Wasm build with @willbooster/web-tree-sitter in Chromium (`test/e2e/browser.test.ts`) and in
|
|
122
|
+
Cloudflare Workers with and without Node.js compatibility (`test/e2e/workers.test.ts`).
|
|
123
|
+
|
|
124
|
+
The tests and `script/parse-examples` compile the parser into `.tmp/tree-sitter-lib` rather than the CLI's cache shared
|
|
125
|
+
by every checkout; `script/fuzz-corpus` builds a parser of its own in `.tmp/fuzz` for each run and deletes it
|
|
126
|
+
afterwards.
|
|
127
|
+
|
|
128
|
+
CI also runs these tests on Linux arm64 and macOS, where the CLI compiles the parser natively, and fuzzes the parser
|
|
129
|
+
with libFuzzer and sanitizers (`.github/workflows/robustness.yml`).
|
|
130
|
+
|
|
131
|
+
### References
|
|
132
|
+
|
|
133
|
+
- [ERB Documentation](https://docs.ruby-lang.org/en/master/ERB.html)
|
|
134
|
+
- [EJS Documentation](https://ejs.co/#docs)
|
|
135
|
+
- [etlua Documentation](https://github.com/leafo/etlua)
|
|
136
|
+
- [Eta Documentation](https://eta.js.org/docs)
|
package/grammar.js
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Embedded Template grammar for tree-sitter
|
|
3
|
+
* @author Max Brunsfeld <maxbrunsfeld@gmail.com>
|
|
4
|
+
* @license MIT
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/// <reference types="tree-sitter-cli/dsl" />
|
|
8
|
+
// @ts-check
|
|
9
|
+
|
|
10
|
+
module.exports = grammar({
|
|
11
|
+
name: 'embedded_template',
|
|
12
|
+
|
|
13
|
+
extras: _ => [],
|
|
14
|
+
|
|
15
|
+
rules: {
|
|
16
|
+
template: $ => repeat(choice(
|
|
17
|
+
$.directive,
|
|
18
|
+
$.output_directive,
|
|
19
|
+
$.comment_directive,
|
|
20
|
+
$.graphql_directive,
|
|
21
|
+
$.content,
|
|
22
|
+
)),
|
|
23
|
+
|
|
24
|
+
code: _ => repeat1(choice(/[^%=_-]+|[%=_-]/, '%%>')),
|
|
25
|
+
|
|
26
|
+
content: _ => prec.right(repeat1(choice(/[^<]+|</, '<%%'))),
|
|
27
|
+
|
|
28
|
+
directive: $ => seq(
|
|
29
|
+
choice('<%', '<%_', '<%|', '<%~'),
|
|
30
|
+
optional($.code),
|
|
31
|
+
choice('%>', '-%>', '_%>'),
|
|
32
|
+
),
|
|
33
|
+
|
|
34
|
+
output_directive: $ => seq(
|
|
35
|
+
choice('<%=', '<%==', '<%|=', '<%|==', '<%-'),
|
|
36
|
+
optional($.code),
|
|
37
|
+
choice('%>', '-%>', '=%>', '_%>'),
|
|
38
|
+
),
|
|
39
|
+
|
|
40
|
+
comment_directive: $ => seq(
|
|
41
|
+
'<%#',
|
|
42
|
+
optional(alias($.code, $.comment)),
|
|
43
|
+
'%>',
|
|
44
|
+
),
|
|
45
|
+
|
|
46
|
+
graphql_directive: $ => seq(
|
|
47
|
+
'<%graphql',
|
|
48
|
+
optional($.code),
|
|
49
|
+
'%>',
|
|
50
|
+
),
|
|
51
|
+
},
|
|
52
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,75 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@willbooster/tree-sitter-embedded-template",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"description": "Embedded template (ERB, EJS) grammar for tree-sitter",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"incremental",
|
|
7
|
+
"parsing",
|
|
8
|
+
"tree-sitter",
|
|
9
|
+
"embedded-template"
|
|
10
|
+
],
|
|
11
|
+
"repository": {
|
|
12
|
+
"type": "git",
|
|
13
|
+
"url": "git+https://github.com/WillBooster/tree-sitter-embedded-template.git"
|
|
14
|
+
},
|
|
15
|
+
"license": "MIT",
|
|
16
|
+
"author": "WillBooster Inc.",
|
|
17
|
+
"files": [
|
|
18
|
+
"grammar.js",
|
|
19
|
+
"queries/*.scm",
|
|
20
|
+
"src/node-types.json",
|
|
21
|
+
"tree-sitter.json",
|
|
22
|
+
"*.wasm"
|
|
23
|
+
],
|
|
24
|
+
"scripts": {
|
|
25
|
+
"build-wasm": "script/generate --build-wasm",
|
|
26
|
+
"build/ci": "bun run build-wasm",
|
|
27
|
+
"cleanup": "bun wb lint --fix --format",
|
|
28
|
+
"format": "bun wb lint --format",
|
|
29
|
+
"generate": "script/generate",
|
|
30
|
+
"lint": "bun wb lint",
|
|
31
|
+
"lint-fix": "bun wb lint --fix",
|
|
32
|
+
"prepare": "(bun lefthook install || true) && (test ! -f .lefthook/normalize-bun-lockfile.sh || bash .lefthook/normalize-bun-lockfile.sh)",
|
|
33
|
+
"release": "wb release",
|
|
34
|
+
"prestart": "bun run build-wasm",
|
|
35
|
+
"start": "script/tree-sitter playground",
|
|
36
|
+
"test": "bun wb test",
|
|
37
|
+
"test/ci": "bun wb test-on-ci",
|
|
38
|
+
"test/ci-setup": "playwright install --with-deps chromium",
|
|
39
|
+
"typecheck": "bun wb typecheck",
|
|
40
|
+
"verify": "bun wb verify",
|
|
41
|
+
"verify-full": "bun wb verify --full"
|
|
42
|
+
},
|
|
43
|
+
"devDependencies": {
|
|
44
|
+
"@tsconfig/bun": "1.0.11",
|
|
45
|
+
"@types/bun": "1.4.2",
|
|
46
|
+
"@vitest/browser-playwright": "5.0.3",
|
|
47
|
+
"@willbooster/oxfmt-config": "1.2.2",
|
|
48
|
+
"@willbooster/oxlint-config": "1.4.8",
|
|
49
|
+
"@willbooster/wb": "22.24.0",
|
|
50
|
+
"@willbooster/web-tree-sitter": "2.0.1",
|
|
51
|
+
"conventional-changelog-conventionalcommits": "10.4.0",
|
|
52
|
+
"lefthook": "2.1.16",
|
|
53
|
+
"oxfmt": "0.71.0",
|
|
54
|
+
"oxlint": "1.86.0",
|
|
55
|
+
"oxlint-tsgolint": "7.0.2003",
|
|
56
|
+
"playwright": "1.63.0",
|
|
57
|
+
"semantic-release": "25.0.9",
|
|
58
|
+
"sort-package-json": "4.0.0",
|
|
59
|
+
"typescript": "7.0.2",
|
|
60
|
+
"vitest": "5.0.3",
|
|
61
|
+
"wrangler": "4.147.0"
|
|
62
|
+
},
|
|
63
|
+
"peerDependencies": {
|
|
64
|
+
"@willbooster/web-tree-sitter": "^2.0.0"
|
|
65
|
+
},
|
|
66
|
+
"peerDependenciesMeta": {
|
|
67
|
+
"@willbooster/web-tree-sitter": {
|
|
68
|
+
"optional": true
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
"publishConfig": {
|
|
72
|
+
"access": "public",
|
|
73
|
+
"registry": "https://registry.npmjs.org/"
|
|
74
|
+
}
|
|
75
|
+
}
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"type": "code",
|
|
4
|
+
"named": true,
|
|
5
|
+
"fields": {}
|
|
6
|
+
},
|
|
7
|
+
{
|
|
8
|
+
"type": "comment",
|
|
9
|
+
"named": true,
|
|
10
|
+
"fields": {}
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"type": "comment_directive",
|
|
14
|
+
"named": true,
|
|
15
|
+
"fields": {},
|
|
16
|
+
"children": {
|
|
17
|
+
"multiple": false,
|
|
18
|
+
"required": false,
|
|
19
|
+
"types": [
|
|
20
|
+
{
|
|
21
|
+
"type": "comment",
|
|
22
|
+
"named": true
|
|
23
|
+
}
|
|
24
|
+
]
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"type": "content",
|
|
29
|
+
"named": true,
|
|
30
|
+
"fields": {}
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"type": "directive",
|
|
34
|
+
"named": true,
|
|
35
|
+
"fields": {},
|
|
36
|
+
"children": {
|
|
37
|
+
"multiple": false,
|
|
38
|
+
"required": false,
|
|
39
|
+
"types": [
|
|
40
|
+
{
|
|
41
|
+
"type": "code",
|
|
42
|
+
"named": true
|
|
43
|
+
}
|
|
44
|
+
]
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"type": "graphql_directive",
|
|
49
|
+
"named": true,
|
|
50
|
+
"fields": {},
|
|
51
|
+
"children": {
|
|
52
|
+
"multiple": false,
|
|
53
|
+
"required": false,
|
|
54
|
+
"types": [
|
|
55
|
+
{
|
|
56
|
+
"type": "code",
|
|
57
|
+
"named": true
|
|
58
|
+
}
|
|
59
|
+
]
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
"type": "output_directive",
|
|
64
|
+
"named": true,
|
|
65
|
+
"fields": {},
|
|
66
|
+
"children": {
|
|
67
|
+
"multiple": false,
|
|
68
|
+
"required": false,
|
|
69
|
+
"types": [
|
|
70
|
+
{
|
|
71
|
+
"type": "code",
|
|
72
|
+
"named": true
|
|
73
|
+
}
|
|
74
|
+
]
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
"type": "template",
|
|
79
|
+
"named": true,
|
|
80
|
+
"root": true,
|
|
81
|
+
"fields": {},
|
|
82
|
+
"children": {
|
|
83
|
+
"multiple": true,
|
|
84
|
+
"required": false,
|
|
85
|
+
"types": [
|
|
86
|
+
{
|
|
87
|
+
"type": "comment_directive",
|
|
88
|
+
"named": true
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
"type": "content",
|
|
92
|
+
"named": true
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
"type": "directive",
|
|
96
|
+
"named": true
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
"type": "graphql_directive",
|
|
100
|
+
"named": true
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
"type": "output_directive",
|
|
104
|
+
"named": true
|
|
105
|
+
}
|
|
106
|
+
]
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
"type": "%%>",
|
|
111
|
+
"named": false
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
"type": "%>",
|
|
115
|
+
"named": false
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
"type": "-%>",
|
|
119
|
+
"named": false
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
"type": "<%",
|
|
123
|
+
"named": false
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
"type": "<%#",
|
|
127
|
+
"named": false
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
"type": "<%%",
|
|
131
|
+
"named": false
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
"type": "<%-",
|
|
135
|
+
"named": false
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
"type": "<%=",
|
|
139
|
+
"named": false
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
"type": "<%==",
|
|
143
|
+
"named": false
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
"type": "<%_",
|
|
147
|
+
"named": false
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
"type": "<%graphql",
|
|
151
|
+
"named": false
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
"type": "<%|",
|
|
155
|
+
"named": false
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
"type": "<%|=",
|
|
159
|
+
"named": false
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
"type": "<%|==",
|
|
163
|
+
"named": false
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
"type": "<%~",
|
|
167
|
+
"named": false
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
"type": "=%>",
|
|
171
|
+
"named": false
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
"type": "_%>",
|
|
175
|
+
"named": false
|
|
176
|
+
}
|
|
177
|
+
]
|
|
Binary file
|
package/tree-sitter.json
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://tree-sitter.github.io/tree-sitter/assets/schemas/config.schema.json",
|
|
3
|
+
"grammars": [
|
|
4
|
+
{
|
|
5
|
+
"name": "embedded-template",
|
|
6
|
+
"camelcase": "EmbeddedTemplate",
|
|
7
|
+
"scope": "text.html.ejs",
|
|
8
|
+
"path": ".",
|
|
9
|
+
"file-types": [
|
|
10
|
+
"ejs"
|
|
11
|
+
],
|
|
12
|
+
"injections": "queries/injections-ejs.scm",
|
|
13
|
+
"injection-regex": "ejs"
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"name": "embedded-template",
|
|
17
|
+
"camelcase": "EmbeddedTemplate",
|
|
18
|
+
"scope": "text.html.erb",
|
|
19
|
+
"path": ".",
|
|
20
|
+
"file-types": [
|
|
21
|
+
"erb"
|
|
22
|
+
],
|
|
23
|
+
"injections": "queries/injections-erb.scm",
|
|
24
|
+
"injection-regex": "erb"
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"name": "embedded-template",
|
|
28
|
+
"camelcase": "EmbeddedTemplate",
|
|
29
|
+
"scope": "text.html.etlua",
|
|
30
|
+
"path": ".",
|
|
31
|
+
"file-types": [
|
|
32
|
+
"etlua"
|
|
33
|
+
],
|
|
34
|
+
"injections": "queries/injections-etlua.scm",
|
|
35
|
+
"injection-regex": "etlua"
|
|
36
|
+
}
|
|
37
|
+
],
|
|
38
|
+
"metadata": {
|
|
39
|
+
"version": "1.0.1",
|
|
40
|
+
"license": "MIT",
|
|
41
|
+
"description": "Embedded template (ERB, EJS) grammar for tree-sitter",
|
|
42
|
+
"authors": [
|
|
43
|
+
{
|
|
44
|
+
"name": "WillBooster Inc."
|
|
45
|
+
}
|
|
46
|
+
],
|
|
47
|
+
"links": {
|
|
48
|
+
"repository": "https://github.com/WillBooster/tree-sitter-embedded-template"
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
"bindings": {
|
|
52
|
+
"c": false,
|
|
53
|
+
"go": false,
|
|
54
|
+
"java": false,
|
|
55
|
+
"node": false,
|
|
56
|
+
"python": false,
|
|
57
|
+
"rust": true,
|
|
58
|
+
"swift": false,
|
|
59
|
+
"zig": false
|
|
60
|
+
}
|
|
61
|
+
}
|