@gram-data/tree-sitter-gram 0.2.7 → 0.3.4

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.
@@ -7,3 +7,31 @@ test("can load grammar", () => {
7
7
  const parser = new (require("tree-sitter"))();
8
8
  assert.doesNotThrow(() => parser.setLanguage(require(".")));
9
9
  });
10
+
11
+ test("annotation node kinds: identified_annotation and property_annotation", () => {
12
+ const Parser = require("tree-sitter");
13
+ const GramLang = require(".");
14
+ const parser = new Parser();
15
+ parser.setLanguage(GramLang);
16
+
17
+ const annotated = (root) => root.child(0) ?? null;
18
+
19
+ const withIdentified = parser.parse("@@p (a)");
20
+ const ap1 = annotated(withIdentified.rootNode);
21
+ assert(ap1?.type === "annotated_pattern", "root should have annotated_pattern child");
22
+ const annotations1 = ap1.childForFieldName("annotations");
23
+ assert(annotations1, "annotations node should exist");
24
+ const first1 = annotations1.child(0);
25
+ assert.strictEqual(first1?.type, "identified_annotation", "@@ form should be identified_annotation");
26
+ assert(first1?.childForFieldName("identifier"), "identified_annotation should have identifier field");
27
+
28
+ const withProperty = parser.parse("@x(1) ()");
29
+ const ap2 = annotated(withProperty.rootNode);
30
+ assert(ap2?.type === "annotated_pattern", "root should have annotated_pattern child");
31
+ const annotations2 = ap2.childForFieldName("annotations");
32
+ assert(annotations2, "annotations node should exist");
33
+ const first2 = annotations2.child(0);
34
+ assert.strictEqual(first2?.type, "property_annotation", "@ form should be property_annotation");
35
+ assert(first2?.childForFieldName("key"), "property_annotation should have key field");
36
+ assert(first2?.childForFieldName("value"), "property_annotation should have value field");
37
+ });
@@ -115,27 +115,44 @@ To work on this extension:
115
115
 
116
116
  ```
117
117
  editors/zed/
118
- ├── extension.toml # Extension metadata
119
- ├── grammars/
120
- │ └── tree-sitter-gram/ # Grammar files
121
- │ ├── grammar.js # Tree-sitter grammar definition
122
- │ └── src/ # Generated parser source
118
+ ├── extension.toml # Extension metadata; points at grammar repo (repository + rev)
123
119
  ├── languages/
124
120
  │ └── gram/
125
- │ ├── config.toml # Language configuration
126
- └── queries/ # Syntax highlighting queries
127
- └── highlights.scm
128
- └── example.gram # Example file for testing
121
+ │ ├── config.toml # Zed language config (brackets, suffixes, etc.)
122
+ ├── highlights.scm # → ../../../../queries/ (symlink; edit queries/ in repo root)
123
+ ├── indents.scm
124
+ │ ├── locals.scm
125
+ │ └── injections.scm
126
+ ├── test.gram # Example file for testing
127
+ └── .gitignore # Ignores grammars/ (populated by Zed from extension.toml)
129
128
  ```
130
129
 
130
+ Query files (`.scm`) in `languages/gram/` are symlinks to the canonical `queries/` directory at the repo root. Edit `queries/*.scm` there; do not edit the copies under `editors/zed` directly. Running `scripts/prepare-zed-extension.sh` copies `queries/*.scm` into this directory (e.g. for distribution) and updates extension version/rev.
131
+
132
+ The `grammars/` directory is created by Zed when it loads the extension (it clones the grammar from the URL in `extension.toml`). It is gitignored. If you see a nested `editors/zed/grammars/gram/...` path, that is the cloned repo inside Zed’s cache; you can ignore or delete `editors/zed/grammars/` locally.
133
+
134
+ ### Keeping the grammar revision in sync
135
+
136
+ The extension pins the tree-sitter-gram grammar with `repository` and `rev` in `extension.toml`. Zed uses that to fetch and build the parser. To keep it aligned with the latest version:
137
+
138
+ | Goal | Command | What it does |
139
+ |------|---------|---------------|
140
+ | **Local testing** | `npm run zed:dev` | Sets `repository = "file://<repo-root>"` and `rev = HEAD`. Zed uses your local clone at the current commit, so you can test grammar/query changes without pushing. |
141
+ | **Prepare for publish** | `npm run zed:publish` | Sets `repository` to the public GitHub URL (from `package.json`) and `rev = HEAD`. Run this before committing a release so the published extension points at the correct commit on GitHub. |
142
+
143
+ After either command, `extension.toml` is updated in place. For local dev you typically don’t commit that change (so the repo keeps a rev that matches the last release). For a release, run `zed:publish`, then commit and push so the extension and the tagged release stay aligned.
144
+
145
+ **If Zed shows an old version (e.g. 0.1.11) after installing the dev extension:** Zed may be using a cached clone of the grammar (at an old rev) or an older copy of the extension. Try: (1) Uninstall the Gram extension from Zed’s Extensions panel. (2) Delete the grammar cache: remove `editors/zed/grammars/` if it exists (Zed recreates it when needed). (3) Run `npm run zed:dev` again so `extension.toml` has the current version and rev. (4) In Zed, run “Install Dev Extension” and select `editors/zed` again. Restart Zed and recheck the extension version.
146
+
131
147
  ## Contributing
132
148
 
133
149
  Contributions are welcome! Please see the main [repository](https://github.com/gram-data/tree-sitter-gram) for contribution guidelines.
134
150
 
135
- To improve syntax highlighting:
136
- 1. Edit `languages/gram/queries/highlights.scm`
137
- 2. Test with various Gram files
138
- 3. Submit a pull request
151
+ To improve syntax highlighting and editor behavior:
152
+
153
+ 1. Edit the canonical query files under `queries/` at the repo root (e.g. `queries/highlights.scm`).
154
+ 2. The extension uses those via symlinks in `languages/gram/`; run `scripts/prepare-zed-extension.sh` if you need to copy them for distribution.
155
+ 3. Test with various Gram files, then submit a pull request.
139
156
 
140
157
  ## License
141
158
 
@@ -1,11 +1,11 @@
1
1
  id = "gram"
2
2
  name = "Gram Language Support"
3
- version = "0.2.7"
3
+ version = "0.3.4"
4
4
  schema_version = 1
5
5
  authors = ["Gram Data Contributors"]
6
- description = "Support for Gram notation - a subject-oriented notation for structured data"
6
+ description = "Support for Gram notation - composable data patterns"
7
7
 
8
8
  # path = "grammars/tree-sitter-gram"
9
9
  [grammars.gram]
10
10
  repository = "https://github.com/gram-data/tree-sitter-gram"
11
- rev = "a702c249d589daca07380db66c54bcf497d71a38"
11
+ rev = "7aee4c203a5c6ea48660ae6d8af849ed90317bed"
@@ -12,7 +12,38 @@
12
12
  ; Boolean literals
13
13
  (boolean_literal) @boolean
14
14
 
15
- ; Symbols and identifiers
15
+ ; Comment (FR-003)
16
+ (comment) @comment
17
+
18
+ ; Tagged-string tag distinct from content (FR-002)
19
+ (tagged_string tag: (symbol) @attribute)
20
+
21
+ ; Reference identifier: pattern_reference (FR-001)
22
+ (pattern_reference identifier: (_) @variable)
23
+
24
+ ; Definition-like identifiers (FR-001): @type
25
+ ; subject/node subject is _subject (use wildcard _ as it may be hidden in some runtimes)
26
+ (subject_pattern subject: (_ identifier: (_) @type))
27
+ (subject_pattern subject: (_ labels: (labels (symbol) @type)))
28
+ (node_pattern subject: (_ identifier: (_) @type))
29
+ (node_pattern subject: (_ labels: (labels (symbol) @type)))
30
+ (relationship_pattern left: (node_pattern subject: (_ identifier: (_) @type)))
31
+ (relationship_pattern left: (node_pattern subject: (_ labels: (labels (symbol) @type))))
32
+ (relationship_pattern right: (node_pattern subject: (_ identifier: (_) @type)))
33
+ (relationship_pattern right: (node_pattern subject: (_ labels: (labels (symbol) @type))))
34
+ ; Arrow kind: subject is inside optional brackets on the arrow
35
+ (relationship_pattern kind: (right_arrow subject: (_ identifier: (_) @type)))
36
+ (relationship_pattern kind: (right_arrow subject: (_ labels: (labels (symbol) @type))))
37
+ (relationship_pattern kind: (left_arrow subject: (_ identifier: (_) @type)))
38
+ (relationship_pattern kind: (left_arrow subject: (_ labels: (labels (symbol) @type))))
39
+ (relationship_pattern kind: (undirected_arrow subject: (_ identifier: (_) @type)))
40
+ (relationship_pattern kind: (undirected_arrow subject: (_ labels: (labels (symbol) @type))))
41
+ (relationship_pattern kind: (bidirectional_arrow subject: (_ identifier: (_) @type)))
42
+ (relationship_pattern kind: (bidirectional_arrow subject: (_ labels: (labels (symbol) @type))))
43
+ (identified_annotation identifier: (_) @type)
44
+ (identified_annotation labels: (labels (symbol) @type))
45
+
46
+ ; Symbols and identifiers (generic; definition/reference/tag captured above)
16
47
  (symbol) @variable
17
48
 
18
49
  ; Keywords and operators
@@ -46,14 +77,8 @@
46
77
  (map_entry key: (string_literal) @property)
47
78
  (map_entry key: (integer) @property)
48
79
 
49
- ; Annotation keys
50
- (annotation key: (symbol) @attribute)
51
-
52
- ; Subject Pattern notation (special highlighting)
53
- (subject_pattern) @type
54
-
55
- ; Node with labels
56
- (node_pattern (labels (symbol) @type))
80
+ ; Annotation keys (property-style) and headers (identified/label-style)
81
+ (property_annotation key: (symbol) @attribute)
57
82
 
58
83
  ; Relationship arrows (special highlighting for graph syntax)
59
84
  (relationship_pattern) @keyword
@@ -0,0 +1,14 @@
1
+ ; Indentation: 2 spaces per level for brackets and multi-line structures
2
+ ; FR-007 — specs/004-editor-improvements/contracts/indents.md
3
+
4
+ ; Record {}
5
+ "{" @indent
6
+ "}" @indent.end
7
+
8
+ ; Subject pattern []
9
+ "[" @indent
10
+ "]" @indent.end
11
+
12
+ ; Node pattern ()
13
+ "(" @indent
14
+ ")" @indent.end
@@ -0,0 +1,29 @@
1
+ ; Language injection for tagged strings: tag`content` and ```tag\ncontent\n```
2
+ ;
3
+ ; The tag symbol is used as the injection language so that downstream and editors
4
+ ; can support arbitrary tags without changing the grammar. Well-known tags (md, ts,
5
+ ; date, datetime, time, sql, json, html, etc.) are documented in docs/tagged-strings-and-injections.md.
6
+ ;
7
+ ; Overrides below map tags that do not match common parser names. The final
8
+ ; rule uses the tag's text as the language name for all other tags (e.g. "sql",
9
+ ; "json", "html" often match parser names).
10
+
11
+ ; md -> markdown
12
+ (tagged_string
13
+ tag: (symbol) @_tag
14
+ content: (string_content) @injection.content)
15
+ (#eq? @_tag "md")
16
+ (#set! injection.language "markdown")
17
+
18
+ ; ts -> typescript
19
+ (tagged_string
20
+ tag: (symbol) @_tag
21
+ content: (string_content) @injection.content)
22
+ (#eq? @_tag "ts")
23
+ (#set! injection.language "typescript")
24
+
25
+ ; Dynamic: use tag text as language name for all other tags (sql, json, html, etc.)
26
+ ; Editors may map additional tags (e.g. date, datetime, time) to parsers or leave as plain.
27
+ (tagged_string
28
+ tag: (symbol) @injection.language
29
+ content: (string_content) @injection.content)
@@ -0,0 +1,28 @@
1
+ ; Locals: go to definition and highlight references (file scope)
2
+ ; FR-005, FR-006 — specs/004-editor-improvements/contracts/locals.md
3
+
4
+ ; File scope: all definitions and references in one scope
5
+ (gram_pattern) @local.scope
6
+
7
+ ; Definitions: identifiers that define a pattern or annotation
8
+ (subject_pattern subject: (_ identifier: (_) @local.definition))
9
+ (subject_pattern subject: (_ labels: (labels (symbol) @local.definition)))
10
+ (node_pattern subject: (_ identifier: (_) @local.definition))
11
+ (node_pattern subject: (_ labels: (labels (symbol) @local.definition)))
12
+ (relationship_pattern left: (node_pattern subject: (_ identifier: (_) @local.definition)))
13
+ (relationship_pattern left: (node_pattern subject: (_ labels: (labels (symbol) @local.definition))))
14
+ (relationship_pattern right: (node_pattern subject: (_ identifier: (_) @local.definition)))
15
+ (relationship_pattern right: (node_pattern subject: (_ labels: (labels (symbol) @local.definition))))
16
+ (relationship_pattern kind: (right_arrow subject: (_ identifier: (_) @local.definition)))
17
+ (relationship_pattern kind: (right_arrow subject: (_ labels: (labels (symbol) @local.definition))))
18
+ (relationship_pattern kind: (left_arrow subject: (_ identifier: (_) @local.definition)))
19
+ (relationship_pattern kind: (left_arrow subject: (_ labels: (labels (symbol) @local.definition))))
20
+ (relationship_pattern kind: (undirected_arrow subject: (_ identifier: (_) @local.definition)))
21
+ (relationship_pattern kind: (undirected_arrow subject: (_ labels: (labels (symbol) @local.definition))))
22
+ (relationship_pattern kind: (bidirectional_arrow subject: (_ identifier: (_) @local.definition)))
23
+ (relationship_pattern kind: (bidirectional_arrow subject: (_ labels: (labels (symbol) @local.definition))))
24
+ (identified_annotation identifier: (_) @local.definition)
25
+ (identified_annotation labels: (labels (symbol) @local.definition))
26
+
27
+ ; References: pattern_reference identifier
28
+ (pattern_reference identifier: (_) @local.reference)
package/grammar.js CHANGED
@@ -13,11 +13,9 @@ module.exports = grammar({
13
13
 
14
14
  annotated_pattern: ($) =>
15
15
  seq(
16
- // field("annotations", optional($.annotations)),
17
16
  field("annotations", $.annotations),
18
17
  field("elements", choice($.subject_pattern, $._path_pattern)),
19
18
  ),
20
- // _annotated_pattern_element: ($) => choice($.subject_pattern, $._path_pattern),
21
19
 
22
20
  subject_pattern: ($) =>
23
21
  seq(
@@ -31,11 +29,28 @@ module.exports = grammar({
31
29
 
32
30
  _subject_pattern_element: ($) => choice($.subject_pattern, $._path_pattern, $.pattern_reference),
33
31
 
34
- annotations: ($) => repeat1($.annotation),
32
+ annotations: ($) =>
33
+ choice(
34
+ seq($.identified_annotation, repeat($.property_annotation)),
35
+ repeat1($.property_annotation),
36
+ ),
35
37
 
36
- annotation: ($) =>
38
+ property_annotation: ($) =>
37
39
  seq("@", field("key", $.symbol), "(", field("value", $._value), ")"),
38
40
 
41
+ identified_annotation: ($) =>
42
+ seq(
43
+ "@@",
44
+ choice(
45
+ field("identifier", $._identifier),
46
+ field("labels", $.labels),
47
+ seq(
48
+ field("identifier", $._identifier),
49
+ field("labels", $.labels),
50
+ ),
51
+ ),
52
+ ),
53
+
39
54
  _path_pattern: ($) => choice($.relationship_pattern, $.node_pattern),
40
55
 
41
56
  node_pattern: ($) =>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gram-data/tree-sitter-gram",
3
- "version": "0.2.7",
3
+ "version": "0.3.4",
4
4
  "description": "subject-oriented notation for structured data",
5
5
  "homepage": "https://gram-data.github.io",
6
6
  "repository": {
@@ -12,6 +12,7 @@
12
12
  "scripts": {
13
13
  "install": "node-gyp-build",
14
14
  "prestart": "tree-sitter build --wasm",
15
+ "build": "tree-sitter build --wasm",
15
16
  "start": "tree-sitter playground",
16
17
  "test": "node --test bindings/node/*_test.js",
17
18
  "zed:dev": "ZED_REPO_MODE=dev bash scripts/prepare-zed-extension.sh",
@@ -28,12 +29,14 @@
28
29
  ],
29
30
  "files": [
30
31
  "grammar.js",
32
+ "tree-sitter.json",
31
33
  "binding.gyp",
32
34
  "prebuilds/**",
33
35
  "bindings/node/*",
34
36
  "queries/*",
35
37
  "src/**",
36
- "editors/**"
38
+ "editors/**",
39
+ "*.wasm"
37
40
  ],
38
41
  "author": "",
39
42
  "license": "ISC",
@@ -51,8 +54,8 @@
51
54
  },
52
55
  "devDependencies": {
53
56
  "eslint": "^9.37.0",
54
- "node-gyp": "^11.4.2",
55
57
  "prebuildify": "^6.0.1",
56
- "tree-sitter-cli": "^0.25.10"
58
+ "tree-sitter": "^0.25.0",
59
+ "tree-sitter-cli": "^0.26.5"
57
60
  }
58
61
  }
@@ -12,7 +12,38 @@
12
12
  ; Boolean literals
13
13
  (boolean_literal) @boolean
14
14
 
15
- ; Symbols and identifiers
15
+ ; Comment (FR-003)
16
+ (comment) @comment
17
+
18
+ ; Tagged-string tag distinct from content (FR-002)
19
+ (tagged_string tag: (symbol) @attribute)
20
+
21
+ ; Reference identifier: pattern_reference (FR-001)
22
+ (pattern_reference identifier: (_) @variable)
23
+
24
+ ; Definition-like identifiers (FR-001): @type
25
+ ; subject/node subject is _subject (use wildcard _ as it may be hidden in some runtimes)
26
+ (subject_pattern subject: (_ identifier: (_) @type))
27
+ (subject_pattern subject: (_ labels: (labels (symbol) @type)))
28
+ (node_pattern subject: (_ identifier: (_) @type))
29
+ (node_pattern subject: (_ labels: (labels (symbol) @type)))
30
+ (relationship_pattern left: (node_pattern subject: (_ identifier: (_) @type)))
31
+ (relationship_pattern left: (node_pattern subject: (_ labels: (labels (symbol) @type))))
32
+ (relationship_pattern right: (node_pattern subject: (_ identifier: (_) @type)))
33
+ (relationship_pattern right: (node_pattern subject: (_ labels: (labels (symbol) @type))))
34
+ ; Arrow kind: subject is inside optional brackets on the arrow
35
+ (relationship_pattern kind: (right_arrow subject: (_ identifier: (_) @type)))
36
+ (relationship_pattern kind: (right_arrow subject: (_ labels: (labels (symbol) @type))))
37
+ (relationship_pattern kind: (left_arrow subject: (_ identifier: (_) @type)))
38
+ (relationship_pattern kind: (left_arrow subject: (_ labels: (labels (symbol) @type))))
39
+ (relationship_pattern kind: (undirected_arrow subject: (_ identifier: (_) @type)))
40
+ (relationship_pattern kind: (undirected_arrow subject: (_ labels: (labels (symbol) @type))))
41
+ (relationship_pattern kind: (bidirectional_arrow subject: (_ identifier: (_) @type)))
42
+ (relationship_pattern kind: (bidirectional_arrow subject: (_ labels: (labels (symbol) @type))))
43
+ (identified_annotation identifier: (_) @type)
44
+ (identified_annotation labels: (labels (symbol) @type))
45
+
46
+ ; Symbols and identifiers (generic; definition/reference/tag captured above)
16
47
  (symbol) @variable
17
48
 
18
49
  ; Keywords and operators
@@ -46,14 +77,8 @@
46
77
  (map_entry key: (string_literal) @property)
47
78
  (map_entry key: (integer) @property)
48
79
 
49
- ; Annotation keys
50
- (annotation key: (symbol) @attribute)
51
-
52
- ; Subject Pattern notation (special highlighting)
53
- (subject_pattern) @type
54
-
55
- ; Node with labels
56
- (node_pattern (labels (symbol) @type))
80
+ ; Annotation keys (property-style) and headers (identified/label-style)
81
+ (property_annotation key: (symbol) @attribute)
57
82
 
58
83
  ; Relationship arrows (special highlighting for graph syntax)
59
84
  (relationship_pattern) @keyword
@@ -0,0 +1,14 @@
1
+ ; Indentation: 2 spaces per level for brackets and multi-line structures
2
+ ; FR-007 — specs/004-editor-improvements/contracts/indents.md
3
+
4
+ ; Record {}
5
+ "{" @indent
6
+ "}" @indent.end
7
+
8
+ ; Subject pattern []
9
+ "[" @indent
10
+ "]" @indent.end
11
+
12
+ ; Node pattern ()
13
+ "(" @indent
14
+ ")" @indent.end
@@ -0,0 +1,29 @@
1
+ ; Language injection for tagged strings: tag`content` and ```tag\ncontent\n```
2
+ ;
3
+ ; The tag symbol is used as the injection language so that downstream and editors
4
+ ; can support arbitrary tags without changing the grammar. Well-known tags (md, ts,
5
+ ; date, datetime, time, sql, json, html, etc.) are documented in docs/tagged-strings-and-injections.md.
6
+ ;
7
+ ; Overrides below map tags that do not match common parser names. The final
8
+ ; rule uses the tag's text as the language name for all other tags (e.g. "sql",
9
+ ; "json", "html" often match parser names).
10
+
11
+ ; md -> markdown
12
+ (tagged_string
13
+ tag: (symbol) @_tag
14
+ content: (string_content) @injection.content)
15
+ (#eq? @_tag "md")
16
+ (#set! injection.language "markdown")
17
+
18
+ ; ts -> typescript
19
+ (tagged_string
20
+ tag: (symbol) @_tag
21
+ content: (string_content) @injection.content)
22
+ (#eq? @_tag "ts")
23
+ (#set! injection.language "typescript")
24
+
25
+ ; Dynamic: use tag text as language name for all other tags (sql, json, html, etc.)
26
+ ; Editors may map additional tags (e.g. date, datetime, time) to parsers or leave as plain.
27
+ (tagged_string
28
+ tag: (symbol) @injection.language
29
+ content: (string_content) @injection.content)
@@ -0,0 +1,28 @@
1
+ ; Locals: go to definition and highlight references (file scope)
2
+ ; FR-005, FR-006 — specs/004-editor-improvements/contracts/locals.md
3
+
4
+ ; File scope: all definitions and references in one scope
5
+ (gram_pattern) @local.scope
6
+
7
+ ; Definitions: identifiers that define a pattern or annotation
8
+ (subject_pattern subject: (_ identifier: (_) @local.definition))
9
+ (subject_pattern subject: (_ labels: (labels (symbol) @local.definition)))
10
+ (node_pattern subject: (_ identifier: (_) @local.definition))
11
+ (node_pattern subject: (_ labels: (labels (symbol) @local.definition)))
12
+ (relationship_pattern left: (node_pattern subject: (_ identifier: (_) @local.definition)))
13
+ (relationship_pattern left: (node_pattern subject: (_ labels: (labels (symbol) @local.definition))))
14
+ (relationship_pattern right: (node_pattern subject: (_ identifier: (_) @local.definition)))
15
+ (relationship_pattern right: (node_pattern subject: (_ labels: (labels (symbol) @local.definition))))
16
+ (relationship_pattern kind: (right_arrow subject: (_ identifier: (_) @local.definition)))
17
+ (relationship_pattern kind: (right_arrow subject: (_ labels: (labels (symbol) @local.definition))))
18
+ (relationship_pattern kind: (left_arrow subject: (_ identifier: (_) @local.definition)))
19
+ (relationship_pattern kind: (left_arrow subject: (_ labels: (labels (symbol) @local.definition))))
20
+ (relationship_pattern kind: (undirected_arrow subject: (_ identifier: (_) @local.definition)))
21
+ (relationship_pattern kind: (undirected_arrow subject: (_ labels: (labels (symbol) @local.definition))))
22
+ (relationship_pattern kind: (bidirectional_arrow subject: (_ identifier: (_) @local.definition)))
23
+ (relationship_pattern kind: (bidirectional_arrow subject: (_ labels: (labels (symbol) @local.definition))))
24
+ (identified_annotation identifier: (_) @local.definition)
25
+ (identified_annotation labels: (labels (symbol) @local.definition))
26
+
27
+ ; References: pattern_reference identifier
28
+ (pattern_reference identifier: (_) @local.reference)
package/src/grammar.json CHANGED
@@ -178,13 +178,34 @@
178
178
  ]
179
179
  },
180
180
  "annotations": {
181
- "type": "REPEAT1",
182
- "content": {
183
- "type": "SYMBOL",
184
- "name": "annotation"
185
- }
181
+ "type": "CHOICE",
182
+ "members": [
183
+ {
184
+ "type": "SEQ",
185
+ "members": [
186
+ {
187
+ "type": "SYMBOL",
188
+ "name": "identified_annotation"
189
+ },
190
+ {
191
+ "type": "REPEAT",
192
+ "content": {
193
+ "type": "SYMBOL",
194
+ "name": "property_annotation"
195
+ }
196
+ }
197
+ ]
198
+ },
199
+ {
200
+ "type": "REPEAT1",
201
+ "content": {
202
+ "type": "SYMBOL",
203
+ "name": "property_annotation"
204
+ }
205
+ }
206
+ ]
186
207
  },
187
- "annotation": {
208
+ "property_annotation": {
188
209
  "type": "SEQ",
189
210
  "members": [
190
211
  {
@@ -217,6 +238,57 @@
217
238
  }
218
239
  ]
219
240
  },
241
+ "identified_annotation": {
242
+ "type": "SEQ",
243
+ "members": [
244
+ {
245
+ "type": "STRING",
246
+ "value": "@@"
247
+ },
248
+ {
249
+ "type": "CHOICE",
250
+ "members": [
251
+ {
252
+ "type": "FIELD",
253
+ "name": "identifier",
254
+ "content": {
255
+ "type": "SYMBOL",
256
+ "name": "_identifier"
257
+ }
258
+ },
259
+ {
260
+ "type": "FIELD",
261
+ "name": "labels",
262
+ "content": {
263
+ "type": "SYMBOL",
264
+ "name": "labels"
265
+ }
266
+ },
267
+ {
268
+ "type": "SEQ",
269
+ "members": [
270
+ {
271
+ "type": "FIELD",
272
+ "name": "identifier",
273
+ "content": {
274
+ "type": "SYMBOL",
275
+ "name": "_identifier"
276
+ }
277
+ },
278
+ {
279
+ "type": "FIELD",
280
+ "name": "labels",
281
+ "content": {
282
+ "type": "SYMBOL",
283
+ "name": "labels"
284
+ }
285
+ }
286
+ ]
287
+ }
288
+ ]
289
+ }
290
+ ]
291
+ },
220
292
  "_path_pattern": {
221
293
  "type": "CHOICE",
222
294
  "members": [