Skip to content

Commit dea6206

Browse files
committed
Merge branch 'master' into add-override-modifier
2 parents 54e14fc + fd08586 commit dea6206

File tree

11 files changed

+1378
-1035
lines changed

11 files changed

+1378
-1035
lines changed

common/corpus/declarations.txt

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ declare module Foo {
7676
(lexical_declaration
7777
(variable_declarator
7878
name: (identifier)
79-
value: (string))))
79+
value: (string (string_fragment)))))
8080
(ambient_declaration
8181
(function_signature
8282
name: (identifier)
@@ -161,7 +161,7 @@ declare module Foo {
161161
body: (switch_body
162162
(switch_case value: (number) (break_statement))
163163
(switch_default (break_statement))))
164-
(throw_statement (string))
164+
(throw_statement (string (string_fragment)))
165165
(try_statement
166166
body: (statement_block)
167167
handler: (catch_clause
@@ -430,8 +430,8 @@ declare module "example" { }
430430
(identifier)
431431
(type_annotation (generic_type (type_identifier) (type_arguments (type_identifier))))))
432432
(type_annotation (generic_type (type_identifier) (type_arguments (type_identifier))))))))
433-
(ambient_declaration (module (string)))
434-
(ambient_declaration (module (string) (statement_block))))
433+
(ambient_declaration (module (string (string_fragment))))
434+
(ambient_declaration (module (string (string_fragment)) (statement_block))))
435435

436436
=================================
437437
Accessibility modifiers as pair keywords
@@ -667,10 +667,10 @@ class Foo {
667667
(type_identifier)
668668
(class_body
669669
(public_field_definition (number) (type_annotation (predefined_type)))
670-
(public_field_definition (accessibility_modifier) (number) (type_annotation (predefined_type)) (string))
671-
(public_field_definition (accessibility_modifier) (string) (type_annotation (type_identifier)) (string))
672-
(public_field_definition (string) (type_annotation (type_identifier)) (string))
673-
(public_field_definition (string) (type_annotation (type_identifier)) (string)))))
670+
(public_field_definition (accessibility_modifier) (number) (type_annotation (predefined_type)) (string (string_fragment)))
671+
(public_field_definition (accessibility_modifier) (string (string_fragment)) (type_annotation (type_identifier)) (string (string_fragment)))
672+
(public_field_definition (string (string_fragment)) (type_annotation (type_identifier)) (string (string_fragment)))
673+
(public_field_definition (string (string_fragment)) (type_annotation (type_identifier)) (string (string_fragment))))))
674674

675675
=======================================
676676
Classes with decorators
@@ -696,10 +696,10 @@ Classes with decorators
696696
(public_field_definition (number) (type_annotation (predefined_type)))
697697

698698
(decorator (call_expression (member_expression (identifier) (property_identifier)) (arguments (identifier))))
699-
(public_field_definition (accessibility_modifier) (number) (type_annotation (predefined_type)) (string))
699+
(public_field_definition (accessibility_modifier) (number) (type_annotation (predefined_type)) (string (string_fragment)))
700700

701701
(decorator (identifier))
702-
(public_field_definition (string) (type_annotation (type_identifier)) (string))
702+
(public_field_definition (string (string_fragment)) (type_annotation (type_identifier)) (string (string_fragment)))
703703

704704
(decorator (identifier))
705705
(method_definition
@@ -812,7 +812,7 @@ abstract class Foo {
812812
function: (member_expression
813813
object: (identifier)
814814
property: (property_identifier))
815-
arguments: (arguments (string))))))))
815+
arguments: (arguments (string (string_fragment)))))))))
816816
(abstract_class_declaration
817817
decorator: (decorator (identifier))
818818
name: (type_identifier)
@@ -836,7 +836,7 @@ export type Extracted = keyof Pick<Base, "id">
836836
(type_arguments
837837
(type_identifier)
838838
(literal_type
839-
(string))))))))
839+
(string (string_fragment)))))))))
840840

841841
==================================
842842
Definite assignment assertions

common/corpus/expressions.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,11 @@ typeof module === "object" && typeof module.exports === "object"
5151
(expression_statement
5252
(binary_expression
5353
(unary_expression (class (class_body)))
54-
(string)))
54+
(string (string_fragment))))
5555
(expression_statement
5656
(binary_expression
57-
(binary_expression (unary_expression (identifier)) (string))
58-
(binary_expression (unary_expression (member_expression (identifier) (property_identifier))) (string)))))
57+
(binary_expression (unary_expression (identifier)) (string (string_fragment)))
58+
(binary_expression (unary_expression (member_expression (identifier) (property_identifier))) (string (string_fragment))))))
5959

6060
==================================
6161
Array with empty elements

common/corpus/functions.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ function foo<T, U>(this: T[]): U[] {
2626
parameters: (formal_parameters (required_parameter (identifier) (type_annotation (predefined_type))))
2727
body: (statement_block
2828
(return_statement (binary_expression
29-
left: (string)
29+
left: (string (string_fragment))
3030
right: (identifier)))))
3131
(function_declaration
3232
name: (identifier)
@@ -212,7 +212,7 @@ class A extends B {
212212
object: (super)
213213
property: (property_identifier))
214214
arguments: (arguments))
215-
right: (string))
215+
right: (string (string_fragment)))
216216
right: (member_expression
217217
object: (this)
218218
property: (property_identifier)))))))))

common/corpus/types.txt

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ var y: number;
1111
(variable_declaration (variable_declarator
1212
(identifier)
1313
(type_annotation (predefined_type))
14-
(string)))
14+
(string (string_fragment))))
1515
(variable_declaration (variable_declarator
1616
(identifier)
1717
(type_annotation (predefined_type)))))
@@ -183,15 +183,15 @@ f
183183
(formal_parameters)
184184
(type_annotation (predefined_type))
185185
(statement_block
186-
(expression_statement (string))
187-
(expression_statement (string))))
186+
(expression_statement (string (string_fragment)))
187+
(expression_statement (string (string_fragment)))))
188188
(function_declaration
189189
(identifier)
190190
(formal_parameters)
191191
(type_annotation (predefined_type))
192192
(statement_block
193-
(expression_statement (string))
194-
(expression_statement (string)))))
193+
(expression_statement (string (string_fragment)))
194+
(expression_statement (string (string_fragment))))))
195195

196196
=======================================
197197
Array types
@@ -322,16 +322,16 @@ import type UserID, {addUser, removeUser} from './User.js';
322322
(program
323323
(import_statement
324324
(import_clause
325-
(named_imports (import_specifier (identifier)) (import_specifier (identifier)))) (string))
325+
(named_imports (import_specifier (identifier)) (import_specifier (identifier)))) (string (string_fragment)))
326326
(import_statement
327327
(import_clause
328-
(named_imports (import_specifier (identifier)) (import_specifier (identifier)))) (string))
328+
(named_imports (import_specifier (identifier)) (import_specifier (identifier)))) (string (string_fragment)))
329329
(import_statement
330330
(import_clause
331-
(named_imports (import_specifier (identifier) (identifier)))) (string))
331+
(named_imports (import_specifier (identifier) (identifier)))) (string (string_fragment)))
332332
(import_statement
333333
(import_clause (identifier)
334-
(named_imports (import_specifier (identifier)) (import_specifier (identifier)))) (string)))
334+
(named_imports (import_specifier (identifier)) (import_specifier (identifier)))) (string (string_fragment))))
335335

336336
=======================================
337337
Type-only Export
@@ -418,9 +418,9 @@ enum Style {
418418
(program
419419
(enum_declaration (identifier) (enum_body
420420
(property_identifier)
421-
(string)
421+
(string (string_fragment))
422422
(enum_assignment
423-
(string)
423+
(string (string_fragment))
424424
(call_expression
425425
(member_expression (identifier) (property_identifier))
426426
(arguments (binary_expression (call_expression (member_expression (identifier) (property_identifier)) (arguments)) (number)))))
@@ -559,8 +559,8 @@ type Z = | "foo";
559559

560560
(program
561561
(type_alias_declaration (type_identifier) (union_type (predefined_type) (predefined_type)))
562-
(type_alias_declaration (type_identifier) (union_type (union_type (literal_type (string))) (literal_type (string))))
563-
(type_alias_declaration (type_identifier) (union_type (literal_type (string)))))
562+
(type_alias_declaration (type_identifier) (union_type (union_type (literal_type (string (string_fragment)))) (literal_type (string (string_fragment)))))
563+
(type_alias_declaration (type_identifier) (union_type (literal_type (string (string_fragment))))))
564564

565565
=======================================
566566
Flow Intersection types
@@ -610,7 +610,7 @@ let x: false
610610
(lexical_declaration
611611
(variable_declarator (identifier) (type_annotation (union_type (union_type (literal_type (number)) (literal_type (unary_expression (number)))) (literal_type (unary_expression (number)))))))
612612
(lexical_declaration
613-
(variable_declarator (identifier) (type_annotation (literal_type (string))))) (lexical_declaration (variable_declarator (identifier) (type_annotation (literal_type (false))))))
613+
(variable_declarator (identifier) (type_annotation (literal_type (string (string_fragment)))))) (lexical_declaration (variable_declarator (identifier) (type_annotation (literal_type (false))))))
614614

615615
=======================================
616616
Flow type parameter constraint syntax
@@ -737,7 +737,7 @@ type T = keyof U & V;
737737
(type_alias_declaration (type_identifier)
738738
(type_query (generic_type (type_identifier) (type_arguments (type_identifier)))))
739739
(type_alias_declaration (type_identifier)
740-
(type_query (call_expression (import) (arguments (string)))))
740+
(type_query (call_expression (import) (arguments (string (string_fragment))))))
741741
(type_alias_declaration (type_identifier)
742742
(index_type_query (type_query (identifier))))
743743
(type_alias_declaration (type_identifier)
@@ -761,7 +761,7 @@ type A = typeof some_array[number]
761761
(lookup_type (type_identifier) (type_identifier)))
762762
(type_alias_declaration
763763
(type_identifier)
764-
(lookup_type (type_identifier) (union_type (literal_type (string)) (literal_type (string)))))
764+
(lookup_type (type_identifier) (union_type (literal_type (string (string_fragment))) (literal_type (string (string_fragment))))))
765765
(type_alias_declaration
766766
(type_identifier)
767767
(lookup_type (type_query (identifier)) (predefined_type))))

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"main": "./bindings/node",
1616
"devDependencies": {
1717
"tree-sitter-cli": "^0.19.1",
18-
"tree-sitter-javascript": "github:tree-sitter/tree-sitter-javascript#ae9bc67"
18+
"tree-sitter-javascript": "github:tree-sitter/tree-sitter-javascript#2c5b138"
1919
},
2020
"scripts": {
2121
"build": "npm run build-typescript && npm run build-tsx",

tsx/src/grammar.json

Lines changed: 34 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5095,15 +5095,13 @@
50955095
"type": "CHOICE",
50965096
"members": [
50975097
{
5098-
"type": "IMMEDIATE_TOKEN",
5098+
"type": "ALIAS",
50995099
"content": {
5100-
"type": "PREC",
5101-
"value": 1,
5102-
"content": {
5103-
"type": "PATTERN",
5104-
"value": "[^\"\\\\]+"
5105-
}
5106-
}
5100+
"type": "SYMBOL",
5101+
"name": "unescaped_double_string_fragment"
5102+
},
5103+
"named": true,
5104+
"value": "string_fragment"
51075105
},
51085106
{
51095107
"type": "SYMBOL",
@@ -5131,15 +5129,13 @@
51315129
"type": "CHOICE",
51325130
"members": [
51335131
{
5134-
"type": "IMMEDIATE_TOKEN",
5132+
"type": "ALIAS",
51355133
"content": {
5136-
"type": "PREC",
5137-
"value": 1,
5138-
"content": {
5139-
"type": "PATTERN",
5140-
"value": "[^'\\\\]+"
5141-
}
5142-
}
5134+
"type": "SYMBOL",
5135+
"name": "unescaped_single_string_fragment"
5136+
},
5137+
"named": true,
5138+
"value": "string_fragment"
51435139
},
51445140
{
51455141
"type": "SYMBOL",
@@ -5156,6 +5152,28 @@
51565152
}
51575153
]
51585154
},
5155+
"unescaped_double_string_fragment": {
5156+
"type": "IMMEDIATE_TOKEN",
5157+
"content": {
5158+
"type": "PREC",
5159+
"value": 1,
5160+
"content": {
5161+
"type": "PATTERN",
5162+
"value": "[^\"\\\\]+"
5163+
}
5164+
}
5165+
},
5166+
"unescaped_single_string_fragment": {
5167+
"type": "IMMEDIATE_TOKEN",
5168+
"content": {
5169+
"type": "PREC",
5170+
"value": 1,
5171+
"content": {
5172+
"type": "PATTERN",
5173+
"value": "[^'\\\\]+"
5174+
}
5175+
}
5176+
},
51595177
"escape_sequence": {
51605178
"type": "IMMEDIATE_TOKEN",
51615179
"content": {

tsx/src/node-types.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4643,6 +4643,10 @@
46434643
{
46444644
"type": "escape_sequence",
46454645
"named": true
4646+
},
4647+
{
4648+
"type": "string_fragment",
4649+
"named": true
46464650
}
46474651
]
46484652
}
@@ -5949,6 +5953,10 @@
59495953
"type": "string",
59505954
"named": false
59515955
},
5956+
{
5957+
"type": "string_fragment",
5958+
"named": true
5959+
},
59525960
{
59535961
"type": "super",
59545962
"named": true

0 commit comments

Comments
 (0)