@willbooster/tree-sitter-typescript 1.3.0 → 1.3.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.
@@ -3,6 +3,7 @@ const JavaScript = require('@willbooster/tree-sitter-javascript/grammar');
3
3
 
4
4
  // Words that are keywords only in some positions and identifiers elsewhere, besides the JavaScript grammar's.
5
5
  const TYPESCRIPT_CONTEXTUAL_KEYWORDS = [
6
+ 'accessor',
6
7
  'declare',
7
8
  'global',
8
9
  'namespace',
@@ -215,9 +216,6 @@ module.exports = function defineGrammar(dialect) {
215
216
  ],
216
217
 
217
218
  rules: {
218
- // A field named `get`, `set`, or `static` is told apart from a member that the word modifies by the line-break
219
- // sentinels allowed right after the name, as in the JavaScript grammar's field_definition. They are not allowed
220
- // after a type annotation, which may continue on the next line.
221
219
  public_field_definition: ($) =>
222
220
  seq(
223
221
  repeat(field('decorator', $.decorator)),
@@ -233,7 +231,8 @@ module.exports = function defineGrammar(dialect) {
233
231
  seq(optional('static'), optional($.override_modifier), optional('readonly')),
234
232
  seq(optional('abstract'), optional('readonly')),
235
233
  seq(optional('readonly'), optional('abstract')),
236
- optional('accessor')
234
+ seq(optional('static'), optional($.override_modifier), 'accessor'),
235
+ seq('abstract', optional($.override_modifier), optional('accessor'))
237
236
  ),
238
237
  choice(
239
238
  seq(
@@ -269,7 +268,8 @@ module.exports = function defineGrammar(dialect) {
269
268
  seq($.override_modifier, optional('readonly')),
270
269
  seq('readonly', optional('abstract')),
271
270
  seq('abstract', optional('readonly')),
272
- 'accessor'
271
+ seq(optional('static'), optional($.override_modifier), 'accessor'),
272
+ seq('abstract', optional($.override_modifier), optional('accessor'))
273
273
  ),
274
274
  field('name', alias('static', $.property_identifier)),
275
275
  choice(
@@ -939,16 +939,7 @@ module.exports = function defineGrammar(dialect) {
939
939
 
940
940
  asserts_annotation: ($) => seq(seq(':', $.asserts)),
941
941
 
942
- type: ($) =>
943
- choice(
944
- $.primary_type,
945
- $.function_type,
946
- $.readonly_type,
947
- $.constructor_type,
948
- $.infer_type,
949
- prec(-1, alias($._type_query_member_expression_in_type_annotation, $.member_expression)),
950
- prec(-1, alias($._type_query_call_expression_in_type_annotation, $.call_expression))
951
- ),
942
+ type: ($) => choice($.primary_type, $.function_type, $.readonly_type, $.constructor_type, $.infer_type),
952
943
 
953
944
  tuple_parameter: ($) =>
954
945
  seq(
@@ -1028,6 +1019,8 @@ module.exports = function defineGrammar(dialect) {
1028
1019
  $.flow_maybe_type,
1029
1020
  $.type_query,
1030
1021
  $.index_type_query,
1022
+ prec(-1, alias($._type_query_member_expression_in_type_annotation, $.member_expression)),
1023
+ prec(-1, alias($._type_query_call_expression_in_type_annotation, $.call_expression)),
1031
1024
  alias($.this, $.this_type),
1032
1025
  $.existential_type,
1033
1026
  $.literal_type,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@willbooster/tree-sitter-typescript",
3
- "version": "1.3.0",
3
+ "version": "1.3.2",
4
4
  "description": "TypeScript and TSX grammars for tree-sitter",
5
5
  "keywords": [
6
6
  "incremental",
@@ -18,6 +18,7 @@
18
18
  ; Keywords
19
19
 
20
20
  [ "abstract"
21
+ "accessor"
21
22
  "declare"
22
23
  "enum"
23
24
  "export"
Binary file
Binary file
package/tree-sitter.json CHANGED
@@ -83,7 +83,7 @@
83
83
  }
84
84
  ],
85
85
  "metadata": {
86
- "version": "1.3.0",
86
+ "version": "1.3.2",
87
87
  "license": "MIT",
88
88
  "description": "TypeScript and TSX grammars for tree-sitter",
89
89
  "authors": [
@@ -283,6 +283,10 @@
283
283
  "type": "array_type",
284
284
  "named": true
285
285
  },
286
+ {
287
+ "type": "call_expression",
288
+ "named": true
289
+ },
286
290
  {
287
291
  "type": "conditional_type",
288
292
  "named": true
@@ -319,6 +323,10 @@
319
323
  "type": "lookup_type",
320
324
  "named": true
321
325
  },
326
+ {
327
+ "type": "member_expression",
328
+ "named": true
329
+ },
322
330
  {
323
331
  "type": "nested_type_identifier",
324
332
  "named": true
@@ -455,10 +463,6 @@
455
463
  "type": "type",
456
464
  "named": true,
457
465
  "subtypes": [
458
- {
459
- "type": "call_expression",
460
- "named": true
461
- },
462
466
  {
463
467
  "type": "constructor_type",
464
468
  "named": true
@@ -471,10 +475,6 @@
471
475
  "type": "infer_type",
472
476
  "named": true
473
477
  },
474
- {
475
- "type": "member_expression",
476
- "named": true
477
- },
478
478
  {
479
479
  "type": "primary_type",
480
480
  "named": true
@@ -279,6 +279,10 @@
279
279
  "type": "array_type",
280
280
  "named": true
281
281
  },
282
+ {
283
+ "type": "call_expression",
284
+ "named": true
285
+ },
282
286
  {
283
287
  "type": "conditional_type",
284
288
  "named": true
@@ -315,6 +319,10 @@
315
319
  "type": "lookup_type",
316
320
  "named": true
317
321
  },
322
+ {
323
+ "type": "member_expression",
324
+ "named": true
325
+ },
318
326
  {
319
327
  "type": "nested_type_identifier",
320
328
  "named": true
@@ -451,10 +459,6 @@
451
459
  "type": "type",
452
460
  "named": true,
453
461
  "subtypes": [
454
- {
455
- "type": "call_expression",
456
- "named": true
457
- },
458
462
  {
459
463
  "type": "constructor_type",
460
464
  "named": true
@@ -467,10 +471,6 @@
467
471
  "type": "infer_type",
468
472
  "named": true
469
473
  },
470
- {
471
- "type": "member_expression",
472
- "named": true
473
- },
474
474
  {
475
475
  "type": "primary_type",
476
476
  "named": true