@@ -98,7 +98,6 @@ module.exports = grammar({
9898 [ $ . _record_field_name , $ . record_pattern ] ,
9999 [ $ . decorator ] ,
100100 [ $ . _statement , $ . _one_or_more_statements ] ,
101- [ $ . _simple_extension ] ,
102101 [ $ . _inline_type , $ . function_type_parameters ] ,
103102 [ $ . primary_expression , $ . parameter , $ . _pattern ] ,
104103 [ $ . parameter , $ . _pattern ] ,
@@ -1153,65 +1152,13 @@ module.exports = grammar({
11531152 ) )
11541153 ) ) ,
11551154
1156- extension_expression : $ => prec ( 'call' , seq (
1155+ extension_expression : $ => prec . right ( seq (
11571156 repeat1 ( '%' ) ,
1158- choice (
1159- $ . _raw_js_extension ,
1160- $ . _raw_gql_extension ,
1161- $ . _simple_extension ,
1162- ) ,
1163- ) ) ,
1164-
1165- _simple_extension : $ => seq (
11661157 $ . extension_identifier ,
1167- optional ( $ . _extension_expression_payload ) ,
1168- ) ,
1169-
1170- _raw_js_extension : $ => seq (
1171- alias ( token ( 'raw' ) , $ . extension_identifier ) ,
1172- '(' ,
1173- alias ( $ . _raw_js , $ . expression_statement ) ,
1174- ')' ,
1175- ) ,
1176-
1177- _raw_js : $ => choice (
1178- alias ( $ . _raw_js_template_string , $ . template_string ) ,
1179- alias ( $ . _raw_js_string , $ . string ) ,
1180- ) ,
1181-
1182- _raw_js_string : $ => alias ( $ . string , $ . raw_js ) ,
1183-
1184- _raw_js_template_string : $ => seq (
1185- token ( seq (
1186- optional ( choice (
1187- 'j' ,
1188- 'js' ,
1189- ) ) ,
1190- '`' ,
1191- ) ) ,
1192- alias ( repeat ( $ . _template_string_content ) , $ . raw_js ) ,
1193- '`' ,
1194- ) ,
1195-
1196- _raw_gql_extension : $ => seq (
1197- alias ( token ( 'graphql' ) , $ . extension_identifier ) ,
1198- '(' ,
1199- alias ( $ . _raw_gql , $ . expression_statement ) ,
1200- ')' ,
1201- ) ,
1202-
1203- _raw_gql : $ => choice (
1204- alias ( $ . _raw_gql_template_string , $ . template_string ) ,
1205- alias ( $ . _raw_gql_string , $ . string ) ,
1206- ) ,
1207-
1208- _raw_gql_string : $ => alias ( $ . string , $ . raw_gql ) ,
1209-
1210- _raw_gql_template_string : $ => seq (
1211- '`' ,
1212- alias ( repeat ( $ . _template_string_content ) , $ . raw_gql ) ,
1213- '`' ,
1214- ) ,
1158+ optional (
1159+ $ . _extension_expression_payload ,
1160+ )
1161+ ) ) ,
12151162
12161163 _extension_expression_payload : $ => seq (
12171164 '(' ,
@@ -1460,18 +1407,21 @@ module.exports = grammar({
14601407 ) ) ,
14611408 '`' ,
14621409 ) ) ,
1463- repeat ( $ . _template_string_content ) ,
1410+ $ . template_string_content ,
14641411 '`'
14651412 ) ,
14661413
1467- _template_string_content : $ => choice (
1468- $ . _template_chars ,
1469- $ . template_substitution ,
1470- choice (
1471- alias ( '\\`' , $ . escape_sequence ) ,
1472- $ . escape_sequence ,
1414+ template_string_content : $ =>
1415+ repeat1 (
1416+ choice (
1417+ $ . _template_chars ,
1418+ $ . template_substitution ,
1419+ choice (
1420+ alias ( '\\`' , $ . escape_sequence ) ,
1421+ $ . escape_sequence ,
1422+ )
1423+ ) ,
14731424 ) ,
1474- ) ,
14751425
14761426 template_substitution : $ => choice (
14771427 seq ( '$' , $ . value_identifier ) ,
0 commit comments