tree-sitter-syscript 0.1.0 → 0.1.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/grammar.js +8 -5
- package/package.json +1 -1
- package/queries/highlights.scm +1 -1
- package/src/grammar.json +23 -51
- package/src/node-types.json +2 -2
- package/src/parser.c +1146 -1156
package/grammar.js
CHANGED
|
@@ -7,10 +7,12 @@
|
|
|
7
7
|
/// <reference types="tree-sitter-cli/dsl" />
|
|
8
8
|
// @ts-check
|
|
9
9
|
|
|
10
|
+
const MULTILINE_COMMENT_REGEX = /[^*]*\*+([^\/*][^*]*\*+)*/;
|
|
11
|
+
|
|
10
12
|
module.exports = grammar({
|
|
11
13
|
name: "syscript",
|
|
12
14
|
|
|
13
|
-
extras: $ => [/\s/, $.comment],
|
|
15
|
+
extras: $ => [/\s/, $.comment],
|
|
14
16
|
|
|
15
17
|
conflicts: $ => [
|
|
16
18
|
[$.code_block, $.struct_literal]
|
|
@@ -21,11 +23,12 @@ module.exports = grammar({
|
|
|
21
23
|
|
|
22
24
|
shebang: $ => seq("#!", /.*/),
|
|
23
25
|
|
|
24
|
-
comment: $ => choice($.single_line_comment, $.
|
|
26
|
+
comment: $ => choice($.single_line_comment, $.multi_line_comment, $.doc_comment),
|
|
25
27
|
single_line_comment: $ => token(seq("//", /.*/)),
|
|
26
|
-
|
|
27
|
-
multi_line_comment: $ =>
|
|
28
|
-
|
|
28
|
+
doc_comment: $ => token(seq("/**", MULTILINE_COMMENT_REGEX, "/")),
|
|
29
|
+
multi_line_comment: $ => token(seq("/*", MULTILINE_COMMENT_REGEX, "/")),
|
|
30
|
+
|
|
31
|
+
|
|
29
32
|
classes: $ =>
|
|
30
33
|
seq("class", field("name", $.identifier), optional(seq("extends", $.identifier)), "{", field("fields", repeat(choice($.field, $.method))), "}"),
|
|
31
34
|
structs: $ => seq("struct", field("name", $.identifier), optional(seq("extends", $.identifier)), "{", field("fields", repeat($.field)), "}"),
|
package/package.json
CHANGED
package/queries/highlights.scm
CHANGED
package/src/grammar.json
CHANGED
|
@@ -71,17 +71,13 @@
|
|
|
71
71
|
"type": "SYMBOL",
|
|
72
72
|
"name": "single_line_comment"
|
|
73
73
|
},
|
|
74
|
-
{
|
|
75
|
-
"type": "SYMBOL",
|
|
76
|
-
"name": "documentation_comment"
|
|
77
|
-
},
|
|
78
74
|
{
|
|
79
75
|
"type": "SYMBOL",
|
|
80
76
|
"name": "multi_line_comment"
|
|
81
77
|
},
|
|
82
78
|
{
|
|
83
79
|
"type": "SYMBOL",
|
|
84
|
-
"name": "
|
|
80
|
+
"name": "doc_comment"
|
|
85
81
|
}
|
|
86
82
|
]
|
|
87
83
|
},
|
|
@@ -101,55 +97,27 @@
|
|
|
101
97
|
]
|
|
102
98
|
}
|
|
103
99
|
},
|
|
104
|
-
"
|
|
105
|
-
"type": "
|
|
106
|
-
"value": 1,
|
|
100
|
+
"doc_comment": {
|
|
101
|
+
"type": "TOKEN",
|
|
107
102
|
"content": {
|
|
108
|
-
"type": "
|
|
109
|
-
"
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
}
|
|
124
|
-
]
|
|
125
|
-
}
|
|
103
|
+
"type": "SEQ",
|
|
104
|
+
"members": [
|
|
105
|
+
{
|
|
106
|
+
"type": "STRING",
|
|
107
|
+
"value": "/**"
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
"type": "PATTERN",
|
|
111
|
+
"value": "[^*]*\\*+([^\\/*][^*]*\\*+)*"
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
"type": "STRING",
|
|
115
|
+
"value": "/"
|
|
116
|
+
}
|
|
117
|
+
]
|
|
126
118
|
}
|
|
127
119
|
},
|
|
128
120
|
"multi_line_comment": {
|
|
129
|
-
"type": "PREC_LEFT",
|
|
130
|
-
"value": 1,
|
|
131
|
-
"content": {
|
|
132
|
-
"type": "TOKEN",
|
|
133
|
-
"content": {
|
|
134
|
-
"type": "SEQ",
|
|
135
|
-
"members": [
|
|
136
|
-
{
|
|
137
|
-
"type": "STRING",
|
|
138
|
-
"value": "/*"
|
|
139
|
-
},
|
|
140
|
-
{
|
|
141
|
-
"type": "PATTERN",
|
|
142
|
-
"value": "(.*)*(\\n.*)*"
|
|
143
|
-
},
|
|
144
|
-
{
|
|
145
|
-
"type": "STRING",
|
|
146
|
-
"value": "*/"
|
|
147
|
-
}
|
|
148
|
-
]
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
},
|
|
152
|
-
"unclosed_multi_line_comment": {
|
|
153
121
|
"type": "TOKEN",
|
|
154
122
|
"content": {
|
|
155
123
|
"type": "SEQ",
|
|
@@ -160,7 +128,11 @@
|
|
|
160
128
|
},
|
|
161
129
|
{
|
|
162
130
|
"type": "PATTERN",
|
|
163
|
-
"value": "(
|
|
131
|
+
"value": "[^*]*\\*+([^\\/*][^*]*\\*+)*"
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
"type": "STRING",
|
|
135
|
+
"value": "/"
|
|
164
136
|
}
|
|
165
137
|
]
|
|
166
138
|
}
|
package/src/node-types.json
CHANGED
|
@@ -129,7 +129,7 @@
|
|
|
129
129
|
"required": true,
|
|
130
130
|
"types": [
|
|
131
131
|
{
|
|
132
|
-
"type": "
|
|
132
|
+
"type": "doc_comment",
|
|
133
133
|
"named": true
|
|
134
134
|
},
|
|
135
135
|
{
|
|
@@ -1201,7 +1201,7 @@
|
|
|
1201
1201
|
"named": false
|
|
1202
1202
|
},
|
|
1203
1203
|
{
|
|
1204
|
-
"type": "
|
|
1204
|
+
"type": "doc_comment",
|
|
1205
1205
|
"named": true
|
|
1206
1206
|
},
|
|
1207
1207
|
{
|