From d57a44c2c3a0b5f81c6cd4db8ce541d3e5f01bf8 Mon Sep 17 00:00:00 2001 From: mhoffm Date: Mon, 21 Jun 2021 21:08:51 +0200 Subject: [PATCH] handle string_literal and quoted_template conflict with precedences --- grammar.js | 14 +- src/grammar.json | 105 +++++++------- src/parser.c | 312 ++++++++++++++++++++-------------------- test/corpus/strings.txt | 8 +- 4 files changed, 222 insertions(+), 217 deletions(-) diff --git a/grammar.js b/grammar.js index ab8b217..49288d4 100644 --- a/grammar.js +++ b/grammar.js @@ -7,14 +7,16 @@ const binary_comp: 3, binary_and: 2, binary_or: 1, + + // if possible prefer string_literals to quoted templates + string_lit: 2, + quoted_template: 1, } module.exports = grammar({ name: 'hcl', conflicts: $ => [ - // string literals are just quoted template without template stuff - [$.string_lit, $.quoted_template], ], externals: $ => [ @@ -103,11 +105,11 @@ module.exports = grammar({ null_lit: $ => 'null', - string_lit: $ => seq( + string_lit: $ => prec(PREC.string_lit, seq( $._quoted_template_start, $.template_literal, $._quoted_template_end, - ), + )), collection_value: $ => choice( @@ -266,7 +268,7 @@ module.exports = grammar({ // $.heredoc_template, ), - quoted_template: $ => seq( + quoted_template: $ => prec(PREC.quoted_template, seq( $._quoted_template_start, repeat(choice( $.template_literal, @@ -274,7 +276,7 @@ module.exports = grammar({ $.template_directive, )), $._quoted_template_end, - ), + )), strip_marker: $ => '~', diff --git a/src/grammar.json b/src/grammar.json index bfb21cf..f1fc04e 100644 --- a/src/grammar.json +++ b/src/grammar.json @@ -302,21 +302,25 @@ "value": "null" }, "string_lit": { - "type": "SEQ", - "members": [ - { - "type": "SYMBOL", - "name": "_quoted_template_start" - }, - { - "type": "SYMBOL", - "name": "template_literal" - }, - { - "type": "SYMBOL", - "name": "_quoted_template_end" - } - ] + "type": "PREC", + "value": 2, + "content": { + "type": "SEQ", + "members": [ + { + "type": "SYMBOL", + "name": "_quoted_template_start" + }, + { + "type": "SYMBOL", + "name": "template_literal" + }, + { + "type": "SYMBOL", + "name": "_quoted_template_end" + } + ] + } }, "collection_value": { "type": "CHOICE", @@ -1163,37 +1167,41 @@ ] }, "quoted_template": { - "type": "SEQ", - "members": [ - { - "type": "SYMBOL", - "name": "_quoted_template_start" - }, - { - "type": "REPEAT", - "content": { - "type": "CHOICE", - "members": [ - { - "type": "SYMBOL", - "name": "template_literal" - }, - { - "type": "SYMBOL", - "name": "template_interpolation" - }, - { - "type": "SYMBOL", - "name": "template_directive" - } - ] + "type": "PREC", + "value": 1, + "content": { + "type": "SEQ", + "members": [ + { + "type": "SYMBOL", + "name": "_quoted_template_start" + }, + { + "type": "REPEAT", + "content": { + "type": "CHOICE", + "members": [ + { + "type": "SYMBOL", + "name": "template_literal" + }, + { + "type": "SYMBOL", + "name": "template_interpolation" + }, + { + "type": "SYMBOL", + "name": "template_directive" + } + ] + } + }, + { + "type": "SYMBOL", + "name": "_quoted_template_end" } - }, - { - "type": "SYMBOL", - "name": "_quoted_template_end" - } - ] + ] + } }, "strip_marker": { "type": "STRING", @@ -1324,12 +1332,7 @@ "name": "_whitespace" } ], - "conflicts": [ - [ - "string_lit", - "quoted_template" - ] - ], + "conflicts": [], "precedences": [], "externals": [ { diff --git a/src/parser.c b/src/parser.c index e897da0..548a808 100644 --- a/src/parser.c +++ b/src/parser.c @@ -18584,28 +18584,28 @@ static const uint16_t ts_small_parse_table[] = { ACTIONS(3), 2, sym_comment, sym__whitespace, - ACTIONS(613), 2, + ACTIONS(612), 2, sym__template_literal_chunk, sym__template_interpolation_start, [14598] = 3, - ACTIONS(615), 1, + ACTIONS(614), 1, sym__quoted_template_end, ACTIONS(3), 2, sym_comment, sym__whitespace, - ACTIONS(613), 2, + ACTIONS(612), 2, sym__template_literal_chunk, sym__template_interpolation_start, [14610] = 2, ACTIONS(3), 2, sym_comment, sym__whitespace, - ACTIONS(618), 3, + ACTIONS(616), 3, sym__quoted_template_end, sym__template_literal_chunk, sym__template_interpolation_start, [14620] = 4, - ACTIONS(620), 1, + ACTIONS(618), 1, sym__template_literal_chunk, STATE(313), 1, aux_sym_template_literal_repeat1, @@ -18620,7 +18620,7 @@ static const uint16_t ts_small_parse_table[] = { ACTIONS(3), 2, sym_comment, sym__whitespace, - ACTIONS(622), 2, + ACTIONS(620), 2, anon_sym_RBRACE, anon_sym_RBRACK, [14646] = 3, @@ -18629,13 +18629,13 @@ static const uint16_t ts_small_parse_table[] = { ACTIONS(3), 2, sym_comment, sym__whitespace, - ACTIONS(624), 2, + ACTIONS(622), 2, anon_sym_EQ, anon_sym_COLON, [14658] = 4, ACTIONS(593), 1, sym__quoted_template_end, - ACTIONS(626), 1, + ACTIONS(624), 1, sym__template_literal_chunk, STATE(320), 1, aux_sym_template_literal_repeat1, @@ -18654,7 +18654,7 @@ static const uint16_t ts_small_parse_table[] = { ACTIONS(3), 2, sym_comment, sym__whitespace, - ACTIONS(628), 3, + ACTIONS(626), 3, sym__quoted_template_end, sym__template_literal_chunk, sym__template_interpolation_start, @@ -18662,42 +18662,42 @@ static const uint16_t ts_small_parse_table[] = { ACTIONS(3), 2, sym_comment, sym__whitespace, - ACTIONS(630), 3, + ACTIONS(628), 3, sym__quoted_template_end, sym__template_literal_chunk, sym__template_interpolation_start, [14702] = 3, - ACTIONS(632), 1, + ACTIONS(630), 1, sym__quoted_template_end, ACTIONS(3), 2, sym_comment, sym__whitespace, - ACTIONS(613), 2, + ACTIONS(612), 2, sym__template_literal_chunk, sym__template_interpolation_start, [14714] = 4, - ACTIONS(635), 1, + ACTIONS(632), 1, anon_sym_QMARK, - ACTIONS(637), 1, + ACTIONS(634), 1, sym_strip_marker, - ACTIONS(639), 1, + ACTIONS(636), 1, sym__template_interpolation_end, ACTIONS(3), 2, sym_comment, sym__whitespace, [14728] = 3, - ACTIONS(641), 1, + ACTIONS(638), 1, sym__quoted_template_end, ACTIONS(3), 2, sym_comment, sym__whitespace, - ACTIONS(613), 2, + ACTIONS(612), 2, sym__template_literal_chunk, sym__template_interpolation_start, [14740] = 4, ACTIONS(597), 1, sym__quoted_template_end, - ACTIONS(644), 1, + ACTIONS(640), 1, sym__template_literal_chunk, STATE(320), 1, aux_sym_template_literal_repeat1, @@ -18705,11 +18705,11 @@ static const uint16_t ts_small_parse_table[] = { sym_comment, sym__whitespace, [14754] = 4, - ACTIONS(635), 1, + ACTIONS(632), 1, anon_sym_QMARK, - ACTIONS(647), 1, + ACTIONS(643), 1, sym_strip_marker, - ACTIONS(649), 1, + ACTIONS(645), 1, sym__template_interpolation_end, ACTIONS(3), 2, sym_comment, @@ -18733,7 +18733,7 @@ static const uint16_t ts_small_parse_table[] = { [14788] = 3, ACTIONS(536), 1, anon_sym_QMARK, - ACTIONS(651), 1, + ACTIONS(647), 1, anon_sym_RBRACK, ACTIONS(3), 2, sym_comment, @@ -18741,7 +18741,7 @@ static const uint16_t ts_small_parse_table[] = { [14799] = 3, ACTIONS(536), 1, anon_sym_QMARK, - ACTIONS(653), 1, + ACTIONS(649), 1, anon_sym_COLON, ACTIONS(3), 2, sym_comment, @@ -18749,13 +18749,13 @@ static const uint16_t ts_small_parse_table[] = { [14810] = 3, ACTIONS(536), 1, anon_sym_QMARK, - ACTIONS(655), 1, + ACTIONS(651), 1, anon_sym_EQ_GT, ACTIONS(3), 2, sym_comment, sym__whitespace, [14821] = 3, - ACTIONS(657), 1, + ACTIONS(653), 1, anon_sym_RBRACK, STATE(170), 1, sym__tuple_end, @@ -18763,7 +18763,7 @@ static const uint16_t ts_small_parse_table[] = { sym_comment, sym__whitespace, [14832] = 3, - ACTIONS(659), 1, + ACTIONS(655), 1, anon_sym_RPAREN, STATE(219), 1, sym__function_call_end, @@ -18771,7 +18771,7 @@ static const uint16_t ts_small_parse_table[] = { sym_comment, sym__whitespace, [14843] = 3, - ACTIONS(661), 1, + ACTIONS(657), 1, anon_sym_RBRACK, STATE(222), 1, sym__tuple_end, @@ -18779,7 +18779,7 @@ static const uint16_t ts_small_parse_table[] = { sym_comment, sym__whitespace, [14854] = 3, - ACTIONS(663), 1, + ACTIONS(659), 1, anon_sym_RPAREN, STATE(130), 1, sym__function_call_end, @@ -18787,7 +18787,7 @@ static const uint16_t ts_small_parse_table[] = { sym_comment, sym__whitespace, [14865] = 3, - ACTIONS(665), 1, + ACTIONS(661), 1, anon_sym_RBRACK, STATE(131), 1, sym__tuple_end, @@ -18795,7 +18795,7 @@ static const uint16_t ts_small_parse_table[] = { sym_comment, sym__whitespace, [14876] = 3, - ACTIONS(667), 1, + ACTIONS(663), 1, anon_sym_RBRACE, STATE(132), 1, sym__object_end, @@ -18811,7 +18811,7 @@ static const uint16_t ts_small_parse_table[] = { sym_comment, sym__whitespace, [14898] = 3, - ACTIONS(669), 1, + ACTIONS(665), 1, anon_sym_RBRACE, STATE(249), 1, sym__object_end, @@ -18819,7 +18819,7 @@ static const uint16_t ts_small_parse_table[] = { sym_comment, sym__whitespace, [14909] = 3, - ACTIONS(671), 1, + ACTIONS(667), 1, anon_sym_RBRACE, STATE(225), 1, sym__object_end, @@ -18837,13 +18837,13 @@ static const uint16_t ts_small_parse_table[] = { [14931] = 3, ACTIONS(536), 1, anon_sym_QMARK, - ACTIONS(673), 1, + ACTIONS(669), 1, anon_sym_COLON, ACTIONS(3), 2, sym_comment, sym__whitespace, [14942] = 3, - ACTIONS(675), 1, + ACTIONS(671), 1, anon_sym_RBRACK, STATE(227), 1, sym__tuple_end, @@ -18851,7 +18851,7 @@ static const uint16_t ts_small_parse_table[] = { sym_comment, sym__whitespace, [14953] = 3, - ACTIONS(677), 1, + ACTIONS(673), 1, anon_sym_RBRACE, STATE(116), 1, sym__object_end, @@ -18861,12 +18861,20 @@ static const uint16_t ts_small_parse_table[] = { [14964] = 3, ACTIONS(536), 1, anon_sym_QMARK, - ACTIONS(679), 1, + ACTIONS(675), 1, anon_sym_RPAREN, ACTIONS(3), 2, sym_comment, sym__whitespace, [14975] = 3, + ACTIONS(677), 1, + sym_identifier, + ACTIONS(679), 1, + aux_sym_legacy_index_token1, + ACTIONS(3), 2, + sym_comment, + sym__whitespace, + [14986] = 3, ACTIONS(681), 1, sym_identifier, ACTIONS(683), 1, @@ -18874,24 +18882,16 @@ static const uint16_t ts_small_parse_table[] = { ACTIONS(3), 2, sym_comment, sym__whitespace, - [14986] = 3, - ACTIONS(685), 1, - sym_identifier, - ACTIONS(687), 1, - aux_sym_legacy_index_token1, - ACTIONS(3), 2, - sym_comment, - sym__whitespace, [14997] = 3, ACTIONS(536), 1, anon_sym_QMARK, - ACTIONS(689), 1, + ACTIONS(685), 1, anon_sym_COLON, ACTIONS(3), 2, sym_comment, sym__whitespace, [15008] = 3, - ACTIONS(691), 1, + ACTIONS(687), 1, anon_sym_RBRACK, STATE(218), 1, sym__tuple_end, @@ -18901,7 +18901,7 @@ static const uint16_t ts_small_parse_table[] = { [15019] = 3, ACTIONS(536), 1, anon_sym_QMARK, - ACTIONS(693), 1, + ACTIONS(689), 1, anon_sym_RPAREN, ACTIONS(3), 2, sym_comment, @@ -18915,7 +18915,7 @@ static const uint16_t ts_small_parse_table[] = { sym_comment, sym__whitespace, [15041] = 3, - ACTIONS(695), 1, + ACTIONS(691), 1, anon_sym_RPAREN, STATE(238), 1, sym__function_call_end, @@ -18925,13 +18925,13 @@ static const uint16_t ts_small_parse_table[] = { [15052] = 3, ACTIONS(536), 1, anon_sym_QMARK, - ACTIONS(697), 1, + ACTIONS(693), 1, anon_sym_COLON, ACTIONS(3), 2, sym_comment, sym__whitespace, [15063] = 3, - ACTIONS(699), 1, + ACTIONS(695), 1, anon_sym_RBRACE, STATE(212), 1, sym__object_end, @@ -18939,7 +18939,7 @@ static const uint16_t ts_small_parse_table[] = { sym_comment, sym__whitespace, [15074] = 3, - ACTIONS(701), 1, + ACTIONS(697), 1, anon_sym_RBRACE, STATE(298), 1, sym__block_end, @@ -18949,15 +18949,15 @@ static const uint16_t ts_small_parse_table[] = { [15085] = 3, ACTIONS(536), 1, anon_sym_QMARK, - ACTIONS(703), 1, + ACTIONS(699), 1, anon_sym_RPAREN, ACTIONS(3), 2, sym_comment, sym__whitespace, [15096] = 3, - ACTIONS(705), 1, + ACTIONS(701), 1, sym_identifier, - ACTIONS(707), 1, + ACTIONS(703), 1, aux_sym_legacy_index_token1, ACTIONS(3), 2, sym_comment, @@ -18965,7 +18965,7 @@ static const uint16_t ts_small_parse_table[] = { [15107] = 3, ACTIONS(536), 1, anon_sym_QMARK, - ACTIONS(709), 1, + ACTIONS(705), 1, anon_sym_EQ_GT, ACTIONS(3), 2, sym_comment, @@ -18973,7 +18973,7 @@ static const uint16_t ts_small_parse_table[] = { [15118] = 3, ACTIONS(536), 1, anon_sym_QMARK, - ACTIONS(711), 1, + ACTIONS(707), 1, anon_sym_COLON, ACTIONS(3), 2, sym_comment, @@ -18981,13 +18981,13 @@ static const uint16_t ts_small_parse_table[] = { [15129] = 3, ACTIONS(536), 1, anon_sym_QMARK, - ACTIONS(713), 1, + ACTIONS(709), 1, anon_sym_RBRACK, ACTIONS(3), 2, sym_comment, sym__whitespace, [15140] = 3, - ACTIONS(715), 1, + ACTIONS(711), 1, anon_sym_RBRACK, STATE(236), 1, sym__tuple_end, @@ -18997,21 +18997,21 @@ static const uint16_t ts_small_parse_table[] = { [15151] = 3, ACTIONS(536), 1, anon_sym_QMARK, - ACTIONS(717), 1, + ACTIONS(713), 1, anon_sym_RBRACK, ACTIONS(3), 2, sym_comment, sym__whitespace, [15162] = 3, - ACTIONS(719), 1, + ACTIONS(715), 1, anon_sym_COMMA, - ACTIONS(721), 1, + ACTIONS(717), 1, anon_sym_in, ACTIONS(3), 2, sym_comment, sym__whitespace, [15173] = 3, - ACTIONS(723), 1, + ACTIONS(719), 1, anon_sym_RBRACK, STATE(123), 1, sym__tuple_end, @@ -19019,7 +19019,7 @@ static const uint16_t ts_small_parse_table[] = { sym_comment, sym__whitespace, [15184] = 3, - ACTIONS(725), 1, + ACTIONS(721), 1, anon_sym_RPAREN, STATE(150), 1, sym__function_call_end, @@ -19037,15 +19037,15 @@ static const uint16_t ts_small_parse_table[] = { [15206] = 3, ACTIONS(536), 1, anon_sym_QMARK, - ACTIONS(727), 1, + ACTIONS(723), 1, anon_sym_RPAREN, ACTIONS(3), 2, sym_comment, sym__whitespace, [15217] = 3, - ACTIONS(729), 1, + ACTIONS(725), 1, sym_identifier, - ACTIONS(731), 1, + ACTIONS(727), 1, aux_sym_legacy_index_token1, ACTIONS(3), 2, sym_comment, @@ -19053,7 +19053,7 @@ static const uint16_t ts_small_parse_table[] = { [15228] = 3, ACTIONS(536), 1, anon_sym_QMARK, - ACTIONS(733), 1, + ACTIONS(729), 1, anon_sym_EQ_GT, ACTIONS(3), 2, sym_comment, @@ -19061,7 +19061,7 @@ static const uint16_t ts_small_parse_table[] = { [15239] = 3, ACTIONS(536), 1, anon_sym_QMARK, - ACTIONS(735), 1, + ACTIONS(731), 1, anon_sym_COLON, ACTIONS(3), 2, sym_comment, @@ -19069,13 +19069,13 @@ static const uint16_t ts_small_parse_table[] = { [15250] = 3, ACTIONS(536), 1, anon_sym_QMARK, - ACTIONS(737), 1, + ACTIONS(733), 1, anon_sym_RBRACK, ACTIONS(3), 2, sym_comment, sym__whitespace, [15261] = 3, - ACTIONS(739), 1, + ACTIONS(735), 1, anon_sym_RBRACK, STATE(144), 1, sym__tuple_end, @@ -19091,7 +19091,7 @@ static const uint16_t ts_small_parse_table[] = { sym_comment, sym__whitespace, [15283] = 3, - ACTIONS(741), 1, + ACTIONS(737), 1, anon_sym_RBRACE, STATE(241), 1, sym__object_end, @@ -19099,7 +19099,7 @@ static const uint16_t ts_small_parse_table[] = { sym_comment, sym__whitespace, [15294] = 3, - ACTIONS(743), 1, + ACTIONS(739), 1, anon_sym_RBRACE, STATE(149), 1, sym__object_end, @@ -19109,13 +19109,13 @@ static const uint16_t ts_small_parse_table[] = { [15305] = 3, ACTIONS(536), 1, anon_sym_QMARK, - ACTIONS(745), 1, + ACTIONS(741), 1, anon_sym_EQ_GT, ACTIONS(3), 2, sym_comment, sym__whitespace, [15316] = 3, - ACTIONS(747), 1, + ACTIONS(743), 1, anon_sym_RBRACE, STATE(162), 1, sym__object_end, @@ -19123,19 +19123,19 @@ static const uint16_t ts_small_parse_table[] = { sym_comment, sym__whitespace, [15327] = 2, - ACTIONS(749), 1, + ACTIONS(745), 1, sym__quoted_template_end, ACTIONS(3), 2, sym_comment, sym__whitespace, [15335] = 2, - ACTIONS(751), 1, + ACTIONS(747), 1, sym__template_interpolation_end, ACTIONS(3), 2, sym_comment, sym__whitespace, [15343] = 2, - ACTIONS(649), 1, + ACTIONS(645), 1, sym__template_interpolation_end, ACTIONS(3), 2, sym_comment, @@ -19147,13 +19147,13 @@ static const uint16_t ts_small_parse_table[] = { sym_comment, sym__whitespace, [15359] = 2, - ACTIONS(753), 1, + ACTIONS(749), 1, sym_identifier, ACTIONS(3), 2, sym_comment, sym__whitespace, [15367] = 2, - ACTIONS(755), 1, + ACTIONS(751), 1, anon_sym_in, ACTIONS(3), 2, sym_comment, @@ -19165,19 +19165,19 @@ static const uint16_t ts_small_parse_table[] = { sym_comment, sym__whitespace, [15383] = 2, - ACTIONS(757), 1, + ACTIONS(753), 1, sym_identifier, ACTIONS(3), 2, sym_comment, sym__whitespace, [15391] = 2, - ACTIONS(759), 1, + ACTIONS(755), 1, ts_builtin_sym_end, ACTIONS(3), 2, sym_comment, sym__whitespace, [15399] = 2, - ACTIONS(761), 1, + ACTIONS(757), 1, ts_builtin_sym_end, ACTIONS(3), 2, sym_comment, @@ -19861,80 +19861,80 @@ static const TSParseActionEntry ts_parse_actions[] = { [604] = {.entry = {.count = 1, .reusable = true}}, SHIFT(224), [606] = {.entry = {.count = 1, .reusable = true}}, SHIFT(118), [608] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_block, 4), - [610] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_quoted_template_repeat1, 1), SHIFT(199), - [613] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_quoted_template_repeat1, 1), - [615] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_quoted_template_repeat1, 1), SHIFT(253), - [618] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_template_interpolation, 5), - [620] = {.entry = {.count = 1, .reusable = true}}, SHIFT(313), - [622] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_for_cond, 2), - [624] = {.entry = {.count = 1, .reusable = true}}, SHIFT(51), - [626] = {.entry = {.count = 1, .reusable = true}}, SHIFT(320), - [628] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_template_interpolation, 3), - [630] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_template_interpolation, 4), - [632] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_quoted_template_repeat1, 1), SHIFT(177), - [635] = {.entry = {.count = 1, .reusable = true}}, SHIFT(62), - [637] = {.entry = {.count = 1, .reusable = true}}, SHIFT(375), - [639] = {.entry = {.count = 1, .reusable = true}}, SHIFT(315), - [641] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_quoted_template_repeat1, 1), SHIFT(124), - [644] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_template_literal_repeat1, 2), SHIFT_REPEAT(320), - [647] = {.entry = {.count = 1, .reusable = true}}, SHIFT(374), - [649] = {.entry = {.count = 1, .reusable = true}}, SHIFT(316), - [651] = {.entry = {.count = 1, .reusable = true}}, SHIFT(239), - [653] = {.entry = {.count = 1, .reusable = true}}, SHIFT(56), - [655] = {.entry = {.count = 1, .reusable = true}}, SHIFT(58), - [657] = {.entry = {.count = 1, .reusable = true}}, SHIFT(170), - [659] = {.entry = {.count = 1, .reusable = true}}, SHIFT(219), - [661] = {.entry = {.count = 1, .reusable = true}}, SHIFT(222), - [663] = {.entry = {.count = 1, .reusable = true}}, SHIFT(130), - [665] = {.entry = {.count = 1, .reusable = true}}, SHIFT(131), - [667] = {.entry = {.count = 1, .reusable = true}}, SHIFT(132), - [669] = {.entry = {.count = 1, .reusable = true}}, SHIFT(249), - [671] = {.entry = {.count = 1, .reusable = true}}, SHIFT(225), - [673] = {.entry = {.count = 1, .reusable = true}}, SHIFT(264), - [675] = {.entry = {.count = 1, .reusable = true}}, SHIFT(227), - [677] = {.entry = {.count = 1, .reusable = true}}, SHIFT(116), - [679] = {.entry = {.count = 1, .reusable = true}}, SHIFT(233), - [681] = {.entry = {.count = 1, .reusable = true}}, SHIFT(234), - [683] = {.entry = {.count = 1, .reusable = true}}, SHIFT(235), - [685] = {.entry = {.count = 1, .reusable = true}}, SHIFT(178), - [687] = {.entry = {.count = 1, .reusable = true}}, SHIFT(175), - [689] = {.entry = {.count = 1, .reusable = true}}, SHIFT(72), - [691] = {.entry = {.count = 1, .reusable = true}}, SHIFT(218), - [693] = {.entry = {.count = 1, .reusable = true}}, SHIFT(168), - [695] = {.entry = {.count = 1, .reusable = true}}, SHIFT(238), - [697] = {.entry = {.count = 1, .reusable = true}}, SHIFT(70), - [699] = {.entry = {.count = 1, .reusable = true}}, SHIFT(212), - [701] = {.entry = {.count = 1, .reusable = true}}, SHIFT(298), - [703] = {.entry = {.count = 1, .reusable = true}}, SHIFT(138), - [705] = {.entry = {.count = 1, .reusable = true}}, SHIFT(140), - [707] = {.entry = {.count = 1, .reusable = true}}, SHIFT(115), - [709] = {.entry = {.count = 1, .reusable = true}}, SHIFT(55), - [711] = {.entry = {.count = 1, .reusable = true}}, SHIFT(262), - [713] = {.entry = {.count = 1, .reusable = true}}, SHIFT(128), - [715] = {.entry = {.count = 1, .reusable = true}}, SHIFT(236), - [717] = {.entry = {.count = 1, .reusable = true}}, SHIFT(147), - [719] = {.entry = {.count = 1, .reusable = true}}, SHIFT(380), - [721] = {.entry = {.count = 1, .reusable = true}}, SHIFT(66), - [723] = {.entry = {.count = 1, .reusable = true}}, SHIFT(123), - [725] = {.entry = {.count = 1, .reusable = true}}, SHIFT(150), - [727] = {.entry = {.count = 1, .reusable = true}}, SHIFT(215), - [729] = {.entry = {.count = 1, .reusable = true}}, SHIFT(216), - [731] = {.entry = {.count = 1, .reusable = true}}, SHIFT(217), - [733] = {.entry = {.count = 1, .reusable = true}}, SHIFT(59), - [735] = {.entry = {.count = 1, .reusable = true}}, SHIFT(63), - [737] = {.entry = {.count = 1, .reusable = true}}, SHIFT(220), - [739] = {.entry = {.count = 1, .reusable = true}}, SHIFT(144), - [741] = {.entry = {.count = 1, .reusable = true}}, SHIFT(241), - [743] = {.entry = {.count = 1, .reusable = true}}, SHIFT(149), - [745] = {.entry = {.count = 1, .reusable = true}}, SHIFT(45), - [747] = {.entry = {.count = 1, .reusable = true}}, SHIFT(162), - [749] = {.entry = {.count = 1, .reusable = true}}, SHIFT(323), - [751] = {.entry = {.count = 1, .reusable = true}}, SHIFT(309), - [753] = {.entry = {.count = 1, .reusable = true}}, SHIFT(358), - [755] = {.entry = {.count = 1, .reusable = true}}, SHIFT(54), - [757] = {.entry = {.count = 1, .reusable = true}}, SHIFT(378), - [759] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_config_file, 1), - [761] = {.entry = {.count = 1, .reusable = true}}, ACCEPT_INPUT(), + [610] = {.entry = {.count = 1, .reusable = true}}, SHIFT(199), + [612] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_quoted_template_repeat1, 1), + [614] = {.entry = {.count = 1, .reusable = true}}, SHIFT(253), + [616] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_template_interpolation, 5), + [618] = {.entry = {.count = 1, .reusable = true}}, SHIFT(313), + [620] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_for_cond, 2), + [622] = {.entry = {.count = 1, .reusable = true}}, SHIFT(51), + [624] = {.entry = {.count = 1, .reusable = true}}, SHIFT(320), + [626] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_template_interpolation, 3), + [628] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_template_interpolation, 4), + [630] = {.entry = {.count = 1, .reusable = true}}, SHIFT(177), + [632] = {.entry = {.count = 1, .reusable = true}}, SHIFT(62), + [634] = {.entry = {.count = 1, .reusable = true}}, SHIFT(375), + [636] = {.entry = {.count = 1, .reusable = true}}, SHIFT(315), + [638] = {.entry = {.count = 1, .reusable = true}}, SHIFT(124), + [640] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_template_literal_repeat1, 2), SHIFT_REPEAT(320), + [643] = {.entry = {.count = 1, .reusable = true}}, SHIFT(374), + [645] = {.entry = {.count = 1, .reusable = true}}, SHIFT(316), + [647] = {.entry = {.count = 1, .reusable = true}}, SHIFT(239), + [649] = {.entry = {.count = 1, .reusable = true}}, SHIFT(56), + [651] = {.entry = {.count = 1, .reusable = true}}, SHIFT(58), + [653] = {.entry = {.count = 1, .reusable = true}}, SHIFT(170), + [655] = {.entry = {.count = 1, .reusable = true}}, SHIFT(219), + [657] = {.entry = {.count = 1, .reusable = true}}, SHIFT(222), + [659] = {.entry = {.count = 1, .reusable = true}}, SHIFT(130), + [661] = {.entry = {.count = 1, .reusable = true}}, SHIFT(131), + [663] = {.entry = {.count = 1, .reusable = true}}, SHIFT(132), + [665] = {.entry = {.count = 1, .reusable = true}}, SHIFT(249), + [667] = {.entry = {.count = 1, .reusable = true}}, SHIFT(225), + [669] = {.entry = {.count = 1, .reusable = true}}, SHIFT(264), + [671] = {.entry = {.count = 1, .reusable = true}}, SHIFT(227), + [673] = {.entry = {.count = 1, .reusable = true}}, SHIFT(116), + [675] = {.entry = {.count = 1, .reusable = true}}, SHIFT(233), + [677] = {.entry = {.count = 1, .reusable = true}}, SHIFT(234), + [679] = {.entry = {.count = 1, .reusable = true}}, SHIFT(235), + [681] = {.entry = {.count = 1, .reusable = true}}, SHIFT(178), + [683] = {.entry = {.count = 1, .reusable = true}}, SHIFT(175), + [685] = {.entry = {.count = 1, .reusable = true}}, SHIFT(72), + [687] = {.entry = {.count = 1, .reusable = true}}, SHIFT(218), + [689] = {.entry = {.count = 1, .reusable = true}}, SHIFT(168), + [691] = {.entry = {.count = 1, .reusable = true}}, SHIFT(238), + [693] = {.entry = {.count = 1, .reusable = true}}, SHIFT(70), + [695] = {.entry = {.count = 1, .reusable = true}}, SHIFT(212), + [697] = {.entry = {.count = 1, .reusable = true}}, SHIFT(298), + [699] = {.entry = {.count = 1, .reusable = true}}, SHIFT(138), + [701] = {.entry = {.count = 1, .reusable = true}}, SHIFT(140), + [703] = {.entry = {.count = 1, .reusable = true}}, SHIFT(115), + [705] = {.entry = {.count = 1, .reusable = true}}, SHIFT(55), + [707] = {.entry = {.count = 1, .reusable = true}}, SHIFT(262), + [709] = {.entry = {.count = 1, .reusable = true}}, SHIFT(128), + [711] = {.entry = {.count = 1, .reusable = true}}, SHIFT(236), + [713] = {.entry = {.count = 1, .reusable = true}}, SHIFT(147), + [715] = {.entry = {.count = 1, .reusable = true}}, SHIFT(380), + [717] = {.entry = {.count = 1, .reusable = true}}, SHIFT(66), + [719] = {.entry = {.count = 1, .reusable = true}}, SHIFT(123), + [721] = {.entry = {.count = 1, .reusable = true}}, SHIFT(150), + [723] = {.entry = {.count = 1, .reusable = true}}, SHIFT(215), + [725] = {.entry = {.count = 1, .reusable = true}}, SHIFT(216), + [727] = {.entry = {.count = 1, .reusable = true}}, SHIFT(217), + [729] = {.entry = {.count = 1, .reusable = true}}, SHIFT(59), + [731] = {.entry = {.count = 1, .reusable = true}}, SHIFT(63), + [733] = {.entry = {.count = 1, .reusable = true}}, SHIFT(220), + [735] = {.entry = {.count = 1, .reusable = true}}, SHIFT(144), + [737] = {.entry = {.count = 1, .reusable = true}}, SHIFT(241), + [739] = {.entry = {.count = 1, .reusable = true}}, SHIFT(149), + [741] = {.entry = {.count = 1, .reusable = true}}, SHIFT(45), + [743] = {.entry = {.count = 1, .reusable = true}}, SHIFT(162), + [745] = {.entry = {.count = 1, .reusable = true}}, SHIFT(323), + [747] = {.entry = {.count = 1, .reusable = true}}, SHIFT(309), + [749] = {.entry = {.count = 1, .reusable = true}}, SHIFT(358), + [751] = {.entry = {.count = 1, .reusable = true}}, SHIFT(54), + [753] = {.entry = {.count = 1, .reusable = true}}, SHIFT(378), + [755] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_config_file, 1), + [757] = {.entry = {.count = 1, .reusable = true}}, ACCEPT_INPUT(), }; #ifdef __cplusplus diff --git a/test/corpus/strings.txt b/test/corpus/strings.txt index 6347a80..40bbf3f 100644 --- a/test/corpus/strings.txt +++ b/test/corpus/strings.txt @@ -11,8 +11,8 @@ foo = "bar\uZZ" (attribute (identifier) (expression - (template_expr - (quoted_template + (literal_value + (string_lit (template_literal (ERROR (UNEXPECTED '\'))))))))) @@ -47,8 +47,8 @@ foo = "foo\bar" (attribute (identifier) (expression - (template_expr - (quoted_template + (literal_value + (string_lit (template_literal (ERROR (UNEXPECTED '\')))))))))