tree-sitter-ucode 0.6.0 → 0.7.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/README.md +72 -19
- package/grammar.js +94 -56
- package/markup/grammar.js +94 -56
- package/markup/src/grammar.json +326 -398
- package/markup/src/node-types.json +32 -78
- package/markup/src/parser.c +85950 -85389
- package/package.json +1 -1
- package/prebuilds/darwin-arm64/tree-sitter-ucode.node +0 -0
- package/prebuilds/linux-arm64/tree-sitter-ucode.node +0 -0
- package/prebuilds/linux-x64/tree-sitter-ucode.node +0 -0
- package/prebuilds/win32-x64/tree-sitter-ucode.node +0 -0
- package/queries/highlights.scm +0 -1
- package/src/grammar.json +326 -398
- package/src/node-types.json +32 -78
- package/src/parser.c +71124 -70595
- package/src/scanner_impl.h +8 -0
- package/tree-sitter-ucode.wasm +0 -0
- package/tree-sitter-ucode_markup.wasm +0 -0
- package/tree-sitter.json +1 -1
- package/ucdocs/grammar.js +7 -6
- package/ucdocs/src/grammar.json +24 -6
- package/ucdocs/src/node-types.json +8 -0
- package/ucdocs/src/parser.c +2278 -2178
package/src/scanner_impl.h
CHANGED
|
@@ -255,6 +255,14 @@ static bool lookahead_is_stmt_close(TSLexer *lexer) {
|
|
|
255
255
|
/*
|
|
256
256
|
* Automatic Semicolon Insertion (ECMA-262 §12.10).
|
|
257
257
|
*
|
|
258
|
+
* NOTE: This is intentionally MORE lenient than the ucode compiler. ucode only
|
|
259
|
+
* lets a statement omit its terminating ';' immediately before '}', EOF, a tag
|
|
260
|
+
* close (%} / -%}), or an alt-syntax end keyword (endif/endfor/endwhile/
|
|
261
|
+
* endfunction/elif/else); it rejects a bare newline between two statements
|
|
262
|
+
* (`x = 1\ny = 2`). We keep full ECMAScript-style ASI here on purpose so that
|
|
263
|
+
* incomplete, mid-edit code is not aggressively flagged as an error in editors.
|
|
264
|
+
* See test/corpus and README for the (deliberate) divergence.
|
|
265
|
+
*
|
|
258
266
|
* Extended to allow ASI immediately before %} and -%} so that the last
|
|
259
267
|
* statement in a statement tag does not need an explicit trailing semicolon:
|
|
260
268
|
* {% let x = 1 %} — works without a semicolon
|
package/tree-sitter-ucode.wasm
CHANGED
|
Binary file
|
|
Binary file
|
package/tree-sitter.json
CHANGED
package/ucdocs/grammar.js
CHANGED
|
@@ -41,7 +41,7 @@ module.exports = grammar({
|
|
|
41
41
|
),
|
|
42
42
|
|
|
43
43
|
_begin: _ => token(seq('/', /\*+/)),
|
|
44
|
-
_end: _ => token(seq(
|
|
44
|
+
_end: _ => token(seq(/\*+/, '/')),
|
|
45
45
|
|
|
46
46
|
// Used after a type_expression/rest_type_expression has already claimed `{` at
|
|
47
47
|
// this position (param_tag, returns_tag, throws_tag) — excludes _brace_text so
|
|
@@ -116,7 +116,7 @@ module.exports = grammar({
|
|
|
116
116
|
typedef_tag: $ => seq(
|
|
117
117
|
'@typedef',
|
|
118
118
|
optional(field('type', $.type_expression)),
|
|
119
|
-
field('name', $.type_identifier),
|
|
119
|
+
field('name', choice($.type_identifier, $.identifier)),
|
|
120
120
|
),
|
|
121
121
|
|
|
122
122
|
type_tag: $ => seq(
|
|
@@ -246,9 +246,10 @@ module.exports = grammar({
|
|
|
246
246
|
|
|
247
247
|
module_path: _ => /[a-zA-Z_$][a-zA-Z0-9_$]*(\.[a-zA-Z_$][a-zA-Z0-9_$]*)*/,
|
|
248
248
|
|
|
249
|
-
// Covers bare
|
|
249
|
+
// Covers bare names and generic TypeName<T>, TypeName<T, U>, etc.
|
|
250
|
+
// Accepts both PascalCase (type_identifier) and lowercase (identifier) names.
|
|
250
251
|
named_type: $ => seq(
|
|
251
|
-
field('name', $.type_identifier),
|
|
252
|
+
field('name', choice($.type_identifier, $.identifier)),
|
|
252
253
|
optional(seq(
|
|
253
254
|
'<',
|
|
254
255
|
field('params', commaSep1($._type)),
|
|
@@ -294,8 +295,8 @@ module.exports = grammar({
|
|
|
294
295
|
// ?T is sugar for T | null; higher precedence than union so ?T | U == (?T) | U.
|
|
295
296
|
nullable_type: $ => prec(2, seq('?', $._type)),
|
|
296
297
|
|
|
297
|
-
//
|
|
298
|
-
type_identifier: _ => /[A-Z][a-zA-Z0-
|
|
298
|
+
// Uppercase-starting names: PascalCase typedef references and type parameters.
|
|
299
|
+
type_identifier: _ => /[A-Z][a-zA-Z0-9_$]*/,
|
|
299
300
|
|
|
300
301
|
// Lowercase-starting names: parameter names and function param names.
|
|
301
302
|
identifier: _ => /[a-z_$][a-zA-Z_$0-9]*/,
|
package/ucdocs/src/grammar.json
CHANGED
|
@@ -119,7 +119,7 @@
|
|
|
119
119
|
"members": [
|
|
120
120
|
{
|
|
121
121
|
"type": "PATTERN",
|
|
122
|
-
"value": "
|
|
122
|
+
"value": "\\*+"
|
|
123
123
|
},
|
|
124
124
|
{
|
|
125
125
|
"type": "STRING",
|
|
@@ -537,8 +537,17 @@
|
|
|
537
537
|
"type": "FIELD",
|
|
538
538
|
"name": "name",
|
|
539
539
|
"content": {
|
|
540
|
-
"type": "
|
|
541
|
-
"
|
|
540
|
+
"type": "CHOICE",
|
|
541
|
+
"members": [
|
|
542
|
+
{
|
|
543
|
+
"type": "SYMBOL",
|
|
544
|
+
"name": "type_identifier"
|
|
545
|
+
},
|
|
546
|
+
{
|
|
547
|
+
"type": "SYMBOL",
|
|
548
|
+
"name": "identifier"
|
|
549
|
+
}
|
|
550
|
+
]
|
|
542
551
|
}
|
|
543
552
|
}
|
|
544
553
|
]
|
|
@@ -1177,8 +1186,17 @@
|
|
|
1177
1186
|
"type": "FIELD",
|
|
1178
1187
|
"name": "name",
|
|
1179
1188
|
"content": {
|
|
1180
|
-
"type": "
|
|
1181
|
-
"
|
|
1189
|
+
"type": "CHOICE",
|
|
1190
|
+
"members": [
|
|
1191
|
+
{
|
|
1192
|
+
"type": "SYMBOL",
|
|
1193
|
+
"name": "type_identifier"
|
|
1194
|
+
},
|
|
1195
|
+
{
|
|
1196
|
+
"type": "SYMBOL",
|
|
1197
|
+
"name": "identifier"
|
|
1198
|
+
}
|
|
1199
|
+
]
|
|
1182
1200
|
}
|
|
1183
1201
|
},
|
|
1184
1202
|
{
|
|
@@ -1473,7 +1491,7 @@
|
|
|
1473
1491
|
},
|
|
1474
1492
|
"type_identifier": {
|
|
1475
1493
|
"type": "PATTERN",
|
|
1476
|
-
"value": "[A-Z][a-zA-Z0-
|
|
1494
|
+
"value": "[A-Z][a-zA-Z0-9_$]*"
|
|
1477
1495
|
},
|
|
1478
1496
|
"identifier": {
|
|
1479
1497
|
"type": "PATTERN",
|
|
@@ -683,6 +683,10 @@
|
|
|
683
683
|
"multiple": false,
|
|
684
684
|
"required": true,
|
|
685
685
|
"types": [
|
|
686
|
+
{
|
|
687
|
+
"type": "identifier",
|
|
688
|
+
"named": true
|
|
689
|
+
},
|
|
686
690
|
{
|
|
687
691
|
"type": "type_identifier",
|
|
688
692
|
"named": true
|
|
@@ -1333,6 +1337,10 @@
|
|
|
1333
1337
|
"multiple": false,
|
|
1334
1338
|
"required": true,
|
|
1335
1339
|
"types": [
|
|
1340
|
+
{
|
|
1341
|
+
"type": "identifier",
|
|
1342
|
+
"named": true
|
|
1343
|
+
},
|
|
1336
1344
|
{
|
|
1337
1345
|
"type": "type_identifier",
|
|
1338
1346
|
"named": true
|