@cavelang/tree-sitter-cave 0.27.3 → 0.29.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/Authors.md +5 -0
- package/README.md +10 -1
- package/grammar.js +6 -3
- package/package.json +13 -2
- package/queries/highlights.scm +1 -0
- package/src/grammar.json +5 -3
- package/src/parser.c +682 -472
- package/tree-sitter-cave.wasm +0 -0
- package/tree-sitter.json +1 -1
package/Authors.md
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
# Authors
|
|
2
|
+
|
|
3
|
+
By adding their name to this file, all listed authors confirm they have copyright over their contributions to this project and are waiving these rights, placing their work in the public domain in accordance with the CC0 1.0 Universal Public Domain Dedication.
|
|
4
|
+
|
|
5
|
+
- Mirek Rusin (Switzerland)
|
package/README.md
CHANGED
|
@@ -8,12 +8,17 @@ needs no external scanner: indentation is skipped and qualifier/continuation
|
|
|
8
8
|
lines are recognized by their leading verb. Parent attachment (spec §8) is
|
|
9
9
|
semantic and left to consumers such as `@cavelang/parser`.
|
|
10
10
|
|
|
11
|
+
Entity and attribute names accept Unicode letters, combining marks and
|
|
12
|
+
numbers, with `/`, `-`, `_`, and `.` as structural characters. Numeric
|
|
13
|
+
values include negative scalars and negative trajectory endpoints.
|
|
14
|
+
|
|
11
15
|
## Contents
|
|
12
16
|
|
|
13
17
|
- `grammar.js` — the grammar (spec §16, §3–§8)
|
|
14
18
|
- `queries/highlights.scm` — highlight captures (nvim/helix vocabulary);
|
|
15
19
|
the single source used by `@cavelang/highlight` (terminal ANSI) and the
|
|
16
|
-
CAVE VSCode extension (semantic tokens)
|
|
20
|
+
CAVE VSCode extension (semantic tokens), including trajectory arrows as
|
|
21
|
+
operators
|
|
17
22
|
- `src/` (generated parser) and `tree-sitter-cave.wasm` are **not
|
|
18
23
|
committed** — generated artifacts are unauditable, so `pnpm build`
|
|
19
24
|
produces both on demand (tree-sitter-cli fetches wasi-sdk itself; no
|
|
@@ -22,6 +27,10 @@ semantic and left to consumers such as `@cavelang/parser`.
|
|
|
22
27
|
|
|
23
28
|
## Consuming
|
|
24
29
|
|
|
30
|
+
The published entry points are `@cavelang/tree-sitter-cave/wasm` for the
|
|
31
|
+
generated grammar, `@cavelang/tree-sitter-cave/highlights` for the shared
|
|
32
|
+
query, and `@cavelang/tree-sitter-cave/package.json` for package metadata.
|
|
33
|
+
|
|
25
34
|
```js
|
|
26
35
|
import { Language, Parser } from 'web-tree-sitter'
|
|
27
36
|
|
package/grammar.js
CHANGED
|
@@ -137,11 +137,14 @@ module.exports = grammar({
|
|
|
137
137
|
// keywords (`NOT`, `WHEN`, …) win as strings over this regex.
|
|
138
138
|
verb: () => /[A-Z][A-Z-]*/,
|
|
139
139
|
|
|
140
|
-
|
|
140
|
+
// Entity names may use Unicode letters, combining marks and numbers.
|
|
141
|
+
// The first code point remains a letter or `_`; scope and
|
|
142
|
+
// kebab-case separators keep their existing ASCII spellings (§4.1).
|
|
143
|
+
entity: () => /[\p{L}_][\p{L}\p{M}\p{N}_./-]*/u,
|
|
141
144
|
|
|
142
|
-
attribute: () => token(/[
|
|
145
|
+
attribute: () => token(/[\p{L}_][\p{L}\p{M}\p{N}_./-]*:/u),
|
|
143
146
|
|
|
144
|
-
number: () =>
|
|
147
|
+
number: () => /~?-?[0-9][0-9A-Za-z.,%_-]*/,
|
|
145
148
|
|
|
146
149
|
string: () => token(seq('"', /[^"\r\n]*/, '"')),
|
|
147
150
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cavelang/tree-sitter-cave",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.29.0",
|
|
4
4
|
"description": "Tree-sitter grammar for CAVE — the canonical grammar artifact behind editor and terminal highlighting.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"cave",
|
|
7
|
+
"knowledge-graph",
|
|
8
|
+
"knowledge-representation",
|
|
9
|
+
"typescript"
|
|
10
|
+
],
|
|
11
|
+
"homepage": "https://github.com/mirek/cave#readme",
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/mirek/cave/issues"
|
|
14
|
+
},
|
|
5
15
|
"license": "CC0-1.0",
|
|
6
16
|
"author": "Mirek Rusin (https://github.com/mirek)",
|
|
7
17
|
"repository": {
|
|
@@ -24,7 +34,8 @@
|
|
|
24
34
|
"queries",
|
|
25
35
|
"tree-sitter-cave.wasm",
|
|
26
36
|
"README.md",
|
|
27
|
-
"License.md"
|
|
37
|
+
"License.md",
|
|
38
|
+
"Authors.md"
|
|
28
39
|
],
|
|
29
40
|
"publishConfig": {
|
|
30
41
|
"access": "public"
|
package/queries/highlights.scm
CHANGED
package/src/grammar.json
CHANGED
|
@@ -688,18 +688,20 @@
|
|
|
688
688
|
},
|
|
689
689
|
"entity": {
|
|
690
690
|
"type": "PATTERN",
|
|
691
|
-
"value": "[
|
|
691
|
+
"value": "[\\p{L}_][\\p{L}\\p{M}\\p{N}_./-]*",
|
|
692
|
+
"flags": "u"
|
|
692
693
|
},
|
|
693
694
|
"attribute": {
|
|
694
695
|
"type": "TOKEN",
|
|
695
696
|
"content": {
|
|
696
697
|
"type": "PATTERN",
|
|
697
|
-
"value": "[
|
|
698
|
+
"value": "[\\p{L}_][\\p{L}\\p{M}\\p{N}_./-]*:",
|
|
699
|
+
"flags": "u"
|
|
698
700
|
}
|
|
699
701
|
},
|
|
700
702
|
"number": {
|
|
701
703
|
"type": "PATTERN",
|
|
702
|
-
"value": "
|
|
704
|
+
"value": "~?-?[0-9][0-9A-Za-z.,%_-]*"
|
|
703
705
|
},
|
|
704
706
|
"string": {
|
|
705
707
|
"type": "TOKEN",
|