tree-sitter-ucode 0.6.1 → 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.
@@ -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
Binary file
Binary file
package/tree-sitter.json CHANGED
@@ -78,7 +78,7 @@
78
78
  }
79
79
  ],
80
80
  "metadata": {
81
- "version": "0.6.1",
81
+ "version": "0.7.0",
82
82
  "license": "MIT",
83
83
  "description": "Ucode grammar for tree-sitter",
84
84
  "links": {
package/ucdocs/grammar.js CHANGED
@@ -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 TypeName and generic TypeName<T>, TypeName<T, U>, etc.
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
- // PascalCase names: typedef references and type parameters.
298
- type_identifier: _ => /[A-Z][a-zA-Z0-9]*/,
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]*/,
@@ -537,8 +537,17 @@
537
537
  "type": "FIELD",
538
538
  "name": "name",
539
539
  "content": {
540
- "type": "SYMBOL",
541
- "name": "type_identifier"
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": "SYMBOL",
1181
- "name": "type_identifier"
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-9]*"
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