@gram-data/tree-sitter-gram 0.2.0 → 0.2.2

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
@@ -24,6 +24,12 @@ As a subject:
24
24
  })
25
25
  ```
26
26
 
27
+ Gram files support comments using `//` syntax for line-based and end-of-line comments:
28
+ ```
29
+ // This is a line comment
30
+ (hello)-->(world) // End-of-line comment
31
+ ```
32
+
27
33
  Learn more about `gram` at the [gram-data github org](https://github.com/gram-data) notation.
28
34
 
29
35
  ## Editor Support
@@ -1,6 +1,6 @@
1
1
  id = "gram"
2
2
  name = "Gram Language Support"
3
- version = "0.2.0"
3
+ version = "0.2.1"
4
4
  schema_version = 1
5
5
  authors = ["Gram Data Contributors"]
6
6
  description = "Support for Gram notation - a subject-oriented notation for structured data"
@@ -8,4 +8,4 @@ description = "Support for Gram notation - a subject-oriented notation for struc
8
8
  # path = "grammars/tree-sitter-gram"
9
9
  [grammars.gram]
10
10
  repository = "https://github.com/gram-data/tree-sitter-gram"
11
- rev = "e419dbe99e299517f615f79616c836de4cb2550d"
11
+ rev = "9ea6cc1fb412128bc4197cc717a8e77e907472ec"
package/grammar.js CHANGED
@@ -1,6 +1,11 @@
1
1
  module.exports = grammar({
2
2
  name: "gram",
3
3
 
4
+ extras: ($) => [
5
+ /\s/,
6
+ $.comment,
7
+ ],
8
+
4
9
  rules: {
5
10
  gram: ($) => seq(field("root", optional($.record)), repeat($.pattern)),
6
11
 
@@ -376,6 +381,8 @@ module.exports = grammar({
376
381
  "~>",
377
382
  ),
378
383
  ),
384
+
385
+ comment: ($) => token(seq("//", /.*/)),
379
386
  },
380
387
  });
381
388
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gram-data/tree-sitter-gram",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "subject-oriented notation for structured data",
5
5
  "homepage": "https://gram-data.github.io",
6
6
  "repository": {
package/src/grammar.json CHANGED
@@ -2026,12 +2026,32 @@
2026
2026
  ]
2027
2027
  }
2028
2028
  ]
2029
+ },
2030
+ "comment": {
2031
+ "type": "TOKEN",
2032
+ "content": {
2033
+ "type": "SEQ",
2034
+ "members": [
2035
+ {
2036
+ "type": "STRING",
2037
+ "value": "//"
2038
+ },
2039
+ {
2040
+ "type": "PATTERN",
2041
+ "value": ".*"
2042
+ }
2043
+ ]
2044
+ }
2029
2045
  }
2030
2046
  },
2031
2047
  "extras": [
2032
2048
  {
2033
2049
  "type": "PATTERN",
2034
2050
  "value": "\\s"
2051
+ },
2052
+ {
2053
+ "type": "SYMBOL",
2054
+ "name": "comment"
2035
2055
  }
2036
2056
  ],
2037
2057
  "conflicts": [],
@@ -1173,6 +1173,11 @@
1173
1173
  "type": "```",
1174
1174
  "named": false
1175
1175
  },
1176
+ {
1177
+ "type": "comment",
1178
+ "named": true,
1179
+ "extra": true
1180
+ },
1176
1181
  {
1177
1182
  "type": "decimal",
1178
1183
  "named": true