diff --git a/grammar.js b/grammar.js index 0d59fea..feee2c9 100644 --- a/grammar.js +++ b/grammar.js @@ -12,7 +12,14 @@ module.exports = grammar({ _end: ($) => choice(";", "\n"), connection: ($) => - seq($.identifier, repeat1(seq($.arrow, $.identifier)), $._end), + seq( + $.identifier, + choice( + seq(seq($.arrow, $.identifier, ":", $.label)), + seq(repeat1(seq($.arrow, $.identifier))) + ), + $._end + ), shape: ($) => seq($.identifier, optional(seq(":", $.label)), $._end), diff --git a/src/grammar.json b/src/grammar.json index 9fcbb49..0e96b58 100644 --- a/src/grammar.json +++ b/src/grammar.json @@ -42,20 +42,56 @@ "name": "identifier" }, { - "type": "REPEAT1", - "content": { - "type": "SEQ", - "members": [ - { - "type": "SYMBOL", - "name": "arrow" - }, - { - "type": "SYMBOL", - "name": "identifier" - } - ] - } + "type": "CHOICE", + "members": [ + { + "type": "SEQ", + "members": [ + { + "type": "SEQ", + "members": [ + { + "type": "SYMBOL", + "name": "arrow" + }, + { + "type": "SYMBOL", + "name": "identifier" + }, + { + "type": "STRING", + "value": ":" + }, + { + "type": "SYMBOL", + "name": "label" + } + ] + } + ] + }, + { + "type": "SEQ", + "members": [ + { + "type": "REPEAT1", + "content": { + "type": "SEQ", + "members": [ + { + "type": "SYMBOL", + "name": "arrow" + }, + { + "type": "SYMBOL", + "name": "identifier" + } + ] + } + } + ] + } + ] }, { "type": "SYMBOL", diff --git a/src/node-types.json b/src/node-types.json index a3f4bc2..70b9171 100644 --- a/src/node-types.json +++ b/src/node-types.json @@ -19,6 +19,10 @@ { "type": "identifier", "named": true + }, + { + "type": "label", + "named": true } ] } diff --git a/src/parser.c b/src/parser.c index b9e825f..446059f 100644 --- a/src/parser.c +++ b/src/parser.c @@ -6,14 +6,14 @@ #endif #define LANGUAGE_VERSION 14 -#define STATE_COUNT 38 +#define STATE_COUNT 43 #define LARGE_STATE_COUNT 2 #define SYMBOL_COUNT 28 #define ALIAS_COUNT 0 #define TOKEN_COUNT 15 #define EXTERNAL_TOKEN_COUNT 1 #define FIELD_COUNT 0 -#define MAX_ALIAS_SEQUENCE_LENGTH 4 +#define MAX_ALIAS_SEQUENCE_LENGTH 6 #define PRODUCTION_ID_COUNT 1 enum { @@ -246,20 +246,20 @@ static const TSStateId ts_primary_state_ids[STATE_COUNT] = { [11] = 11, [12] = 12, [13] = 13, - [14] = 13, + [14] = 14, [15] = 15, - [16] = 13, + [16] = 16, [17] = 17, [18] = 18, [19] = 19, [20] = 20, [21] = 21, - [22] = 22, + [22] = 21, [23] = 23, - [24] = 11, - [25] = 25, + [24] = 24, + [25] = 21, [26] = 26, - [27] = 27, + [27] = 13, [28] = 28, [29] = 29, [30] = 30, @@ -270,6 +270,11 @@ static const TSStateId ts_primary_state_ids[STATE_COUNT] = { [35] = 35, [36] = 36, [37] = 37, + [38] = 38, + [39] = 39, + [40] = 40, + [41] = 41, + [42] = 42, }; static bool ts_lex(TSLexer *lexer, TSStateId state) { @@ -324,14 +329,6 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) { END_STATE(); case 4: if (lookahead == '\n') SKIP(4) - if (lookahead == '\'') ADVANCE(22); - if (lookahead == '\t' || - lookahead == '\r' || - lookahead == ' ') ADVANCE(26); - if (lookahead != 0) ADVANCE(27); - END_STATE(); - case 5: - if (lookahead == '\n') SKIP(5) if (lookahead == '`') ADVANCE(33); if (lookahead == '\t' || lookahead == '\r' || @@ -339,6 +336,14 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) { if (lookahead != 0 && lookahead != '\'') ADVANCE(27); END_STATE(); + case 5: + if (lookahead == '\n') SKIP(5) + if (lookahead == '\'') ADVANCE(22); + if (lookahead == '\t' || + lookahead == '\r' || + lookahead == ' ') ADVANCE(26); + if (lookahead != 0) ADVANCE(27); + END_STATE(); case 6: if (lookahead == '-') ADVANCE(19); END_STATE(); @@ -504,37 +509,42 @@ static const TSLexMode ts_lex_modes[STATE_COUNT] = { [4] = {.lex_state = 1}, [5] = {.lex_state = 1}, [6] = {.lex_state = 0, .external_lex_state = 1}, - [7] = {.lex_state = 0, .external_lex_state = 1}, - [8] = {.lex_state = 2}, - [9] = {.lex_state = 1}, - [10] = {.lex_state = 7, .external_lex_state = 1}, - [11] = {.lex_state = 7, .external_lex_state = 1}, + [7] = {.lex_state = 1}, + [8] = {.lex_state = 0, .external_lex_state = 1}, + [9] = {.lex_state = 2}, + [10] = {.lex_state = 1}, + [11] = {.lex_state = 2}, [12] = {.lex_state = 7, .external_lex_state = 1}, - [13] = {.lex_state = 3}, - [14] = {.lex_state = 4}, - [15] = {.lex_state = 8}, - [16] = {.lex_state = 5}, - [17] = {.lex_state = 5}, + [13] = {.lex_state = 7, .external_lex_state = 1}, + [14] = {.lex_state = 7, .external_lex_state = 1}, + [15] = {.lex_state = 3}, + [16] = {.lex_state = 4}, + [17] = {.lex_state = 3}, [18] = {.lex_state = 4}, - [19] = {.lex_state = 3}, - [20] = {.lex_state = 5}, - [21] = {.lex_state = 1}, - [22] = {.lex_state = 7, .external_lex_state = 1}, + [19] = {.lex_state = 1}, + [20] = {.lex_state = 7, .external_lex_state = 1}, + [21] = {.lex_state = 4}, + [22] = {.lex_state = 3}, [23] = {.lex_state = 7, .external_lex_state = 1}, - [24] = {.lex_state = 8}, - [25] = {.lex_state = 3}, - [26] = {.lex_state = 4}, - [27] = {.lex_state = 1}, - [28] = {.lex_state = 0, .external_lex_state = 1}, - [29] = {.lex_state = 0, .external_lex_state = 1}, - [30] = {.lex_state = 1}, - [31] = {.lex_state = 1}, + [24] = {.lex_state = 1}, + [25] = {.lex_state = 5}, + [26] = {.lex_state = 8}, + [27] = {.lex_state = 8}, + [28] = {.lex_state = 5}, + [29] = {.lex_state = 5}, + [30] = {.lex_state = 0, .external_lex_state = 1}, + [31] = {.lex_state = 0, .external_lex_state = 1}, [32] = {.lex_state = 0, .external_lex_state = 1}, - [33] = {.lex_state = 0, .external_lex_state = 1}, - [34] = {.lex_state = 0, .external_lex_state = 1}, - [35] = {.lex_state = 0}, + [33] = {.lex_state = 1}, + [34] = {.lex_state = 1}, + [35] = {.lex_state = 0, .external_lex_state = 1}, [36] = {.lex_state = 0, .external_lex_state = 1}, [37] = {.lex_state = 0, .external_lex_state = 1}, + [38] = {.lex_state = 1}, + [39] = {.lex_state = 0, .external_lex_state = 1}, + [40] = {.lex_state = 0, .external_lex_state = 1}, + [41] = {.lex_state = 0, .external_lex_state = 1}, + [42] = {.lex_state = 0}, }; enum { @@ -567,7 +577,7 @@ static const uint16_t ts_parse_table[LARGE_STATE_COUNT][SYMBOL_COUNT] = { [sym__identifier] = ACTIONS(1), }, [1] = { - [sym_source_file] = STATE(35), + [sym_source_file] = STATE(42), [sym__definition] = STATE(6), [sym_connection] = STATE(6), [sym_shape] = STATE(6), @@ -596,12 +606,12 @@ static const uint16_t ts_small_parse_table[] = { anon_sym_DASH_GT, STATE(3), 1, aux_sym_connection_repeat1, - STATE(15), 1, + STATE(26), 1, aux_sym_arrow_repeat1, - STATE(32), 1, - sym_arrow, - STATE(33), 1, + STATE(30), 1, sym__end, + STATE(31), 1, + sym_arrow, [34] = 10, ACTIONS(13), 1, anon_sym_DASH_DASH, @@ -617,12 +627,12 @@ static const uint16_t ts_small_parse_table[] = { anon_sym_LF, STATE(4), 1, aux_sym_connection_repeat1, - STATE(15), 1, + STATE(26), 1, aux_sym_arrow_repeat1, - STATE(28), 1, - sym__end, - STATE(32), 1, + STATE(35), 1, sym_arrow, + STATE(37), 1, + sym__end, [65] = 9, ACTIONS(25), 1, anon_sym_SEMI, @@ -638,9 +648,9 @@ static const uint16_t ts_small_parse_table[] = { anon_sym_DASH_GT, STATE(4), 1, aux_sym_connection_repeat1, - STATE(15), 1, + STATE(26), 1, aux_sym_arrow_repeat1, - STATE(32), 1, + STATE(35), 1, sym_arrow, [93] = 2, ACTIONS(43), 1, @@ -659,37 +669,48 @@ static const uint16_t ts_small_parse_table[] = { ts_builtin_sym_end, STATE(2), 1, sym_identifier, - STATE(7), 4, + STATE(8), 4, sym__definition, sym_connection, sym_shape, aux_sym_source_file_repeat1, - [121] = 4, + [121] = 3, + ACTIONS(27), 1, + anon_sym_LF, ACTIONS(47), 1, - ts_builtin_sym_end, + anon_sym_COLON, + ACTIONS(25), 5, + anon_sym_SEMI, + anon_sym_DASH_DASH, + anon_sym_DASH, + anon_sym_LT_DASH, + anon_sym_DASH_GT, + [135] = 4, ACTIONS(49), 1, + ts_builtin_sym_end, + ACTIONS(51), 1, sym__identifier, STATE(2), 1, sym_identifier, - STATE(7), 4, + STATE(8), 4, sym__definition, sym_connection, sym_shape, aux_sym_source_file_repeat1, - [137] = 6, - ACTIONS(52), 1, - aux_sym_label_token1, + [151] = 6, ACTIONS(54), 1, - anon_sym_SQUOTE, + aux_sym_label_token1, ACTIONS(56), 1, - anon_sym_DQUOTE, + anon_sym_SQUOTE, ACTIONS(58), 1, + anon_sym_DQUOTE, + ACTIONS(60), 1, anon_sym_BQUOTE, - STATE(21), 1, + STATE(19), 1, sym_label, - STATE(31), 1, + STATE(38), 1, sym_string, - [156] = 2, + [170] = 2, ACTIONS(27), 1, anon_sym_LF, ACTIONS(25), 5, @@ -698,174 +719,203 @@ static const uint16_t ts_small_parse_table[] = { anon_sym_DASH, anon_sym_LT_DASH, anon_sym_DASH_GT, - [167] = 4, + [181] = 6, + ACTIONS(54), 1, + aux_sym_label_token1, + ACTIONS(56), 1, + anon_sym_SQUOTE, + ACTIONS(58), 1, + anon_sym_DQUOTE, ACTIONS(60), 1, - anon_sym_DASH, + anon_sym_BQUOTE, + STATE(24), 1, + sym_label, + STATE(38), 1, + sym_string, + [200] = 4, ACTIONS(62), 1, - anon_sym_GT, + anon_sym_DASH, ACTIONS(64), 1, + anon_sym_GT, + ACTIONS(66), 1, + sym__identifier, + STATE(13), 1, + aux_sym_arrow_repeat1, + [213] = 3, + ACTIONS(68), 1, + anon_sym_DASH, + STATE(13), 1, + aux_sym_arrow_repeat1, + ACTIONS(71), 2, + sym__identifier, + anon_sym_GT, + [224] = 4, + ACTIONS(73), 1, + anon_sym_DASH, + ACTIONS(75), 1, + anon_sym_GT, + ACTIONS(77), 1, sym__identifier, STATE(12), 1, aux_sym_arrow_repeat1, - [180] = 3, - ACTIONS(66), 1, - anon_sym_DASH, - STATE(11), 1, - aux_sym_arrow_repeat1, - ACTIONS(69), 2, - sym__identifier, - anon_sym_GT, - [191] = 4, - ACTIONS(71), 1, - anon_sym_DASH, - ACTIONS(73), 1, - anon_sym_GT, - ACTIONS(75), 1, - sym__identifier, - STATE(11), 1, - aux_sym_arrow_repeat1, - [204] = 3, - ACTIONS(77), 1, + [237] = 3, + ACTIONS(79), 1, aux_sym_string_token1, - ACTIONS(80), 1, + ACTIONS(81), 1, anon_sym_DQUOTE, - STATE(13), 1, + STATE(22), 1, aux_sym_string_repeat1, - [214] = 3, - ACTIONS(80), 1, - anon_sym_SQUOTE, - ACTIONS(82), 1, + [247] = 3, + ACTIONS(81), 1, + anon_sym_BQUOTE, + ACTIONS(83), 1, aux_sym_string_token1, - STATE(14), 1, + STATE(21), 1, aux_sym_string_repeat1, - [224] = 3, - ACTIONS(62), 1, - anon_sym_DASH_GT, + [257] = 3, ACTIONS(85), 1, - anon_sym_DASH, - STATE(24), 1, - aux_sym_arrow_repeat1, - [234] = 3, - ACTIONS(80), 1, - anon_sym_BQUOTE, + aux_sym_string_token1, ACTIONS(87), 1, - aux_sym_string_token1, - STATE(16), 1, - aux_sym_string_repeat1, - [244] = 3, - ACTIONS(90), 1, - aux_sym_string_token1, - ACTIONS(92), 1, - anon_sym_BQUOTE, - STATE(16), 1, - aux_sym_string_repeat1, - [254] = 3, - ACTIONS(94), 1, - anon_sym_SQUOTE, - ACTIONS(96), 1, - aux_sym_string_token1, - STATE(26), 1, - aux_sym_string_repeat1, - [264] = 3, - ACTIONS(94), 1, anon_sym_DQUOTE, + STATE(15), 1, + aux_sym_string_repeat1, + [267] = 3, + ACTIONS(87), 1, + anon_sym_BQUOTE, + ACTIONS(89), 1, + aux_sym_string_token1, + STATE(16), 1, + aux_sym_string_repeat1, + [277] = 3, + ACTIONS(91), 1, + anon_sym_SEMI, + ACTIONS(93), 1, + anon_sym_LF, + STATE(32), 1, + sym__end, + [287] = 3, + ACTIONS(62), 1, + anon_sym_DASH, + ACTIONS(66), 1, + sym__identifier, + STATE(13), 1, + aux_sym_arrow_repeat1, + [297] = 3, + ACTIONS(95), 1, + aux_sym_string_token1, ACTIONS(98), 1, + anon_sym_BQUOTE, + STATE(21), 1, + aux_sym_string_repeat1, + [307] = 3, + ACTIONS(98), 1, + anon_sym_DQUOTE, + ACTIONS(100), 1, + aux_sym_string_token1, + STATE(22), 1, + aux_sym_string_repeat1, + [317] = 3, + ACTIONS(77), 1, + sym__identifier, + ACTIONS(103), 1, + anon_sym_DASH, + STATE(20), 1, + aux_sym_arrow_repeat1, + [327] = 3, + ACTIONS(105), 1, + anon_sym_SEMI, + ACTIONS(107), 1, + anon_sym_LF, + STATE(36), 1, + sym__end, + [337] = 3, + ACTIONS(98), 1, + anon_sym_SQUOTE, + ACTIONS(109), 1, aux_sym_string_token1, STATE(25), 1, aux_sym_string_repeat1, - [274] = 3, - ACTIONS(94), 1, - anon_sym_BQUOTE, - ACTIONS(100), 1, - aux_sym_string_token1, - STATE(17), 1, - aux_sym_string_repeat1, - [284] = 3, - ACTIONS(102), 1, - anon_sym_SEMI, - ACTIONS(104), 1, - anon_sym_LF, - STATE(29), 1, - sym__end, - [294] = 3, - ACTIONS(71), 1, - anon_sym_DASH, + [347] = 3, ACTIONS(75), 1, - sym__identifier, - STATE(11), 1, - aux_sym_arrow_repeat1, - [304] = 3, - ACTIONS(64), 1, - sym__identifier, - ACTIONS(106), 1, - anon_sym_DASH, - STATE(22), 1, - aux_sym_arrow_repeat1, - [314] = 3, - ACTIONS(69), 1, anon_sym_DASH_GT, - ACTIONS(108), 1, + ACTIONS(112), 1, anon_sym_DASH, - STATE(24), 1, + STATE(27), 1, aux_sym_arrow_repeat1, - [324] = 3, - ACTIONS(92), 1, - anon_sym_DQUOTE, - ACTIONS(111), 1, - aux_sym_string_token1, - STATE(13), 1, - aux_sym_string_repeat1, - [334] = 3, - ACTIONS(92), 1, + [357] = 3, + ACTIONS(71), 1, + anon_sym_DASH_GT, + ACTIONS(114), 1, + anon_sym_DASH, + STATE(27), 1, + aux_sym_arrow_repeat1, + [367] = 3, + ACTIONS(87), 1, anon_sym_SQUOTE, - ACTIONS(113), 1, - aux_sym_string_token1, - STATE(14), 1, - aux_sym_string_repeat1, - [344] = 2, - ACTIONS(115), 1, - anon_sym_SEMI, ACTIONS(117), 1, - anon_sym_LF, - [351] = 1, - ACTIONS(119), 2, - sym__identifier, - ts_builtin_sym_end, - [356] = 1, + aux_sym_string_token1, + STATE(29), 1, + aux_sym_string_repeat1, + [377] = 3, + ACTIONS(81), 1, + anon_sym_SQUOTE, + ACTIONS(119), 1, + aux_sym_string_token1, + STATE(25), 1, + aux_sym_string_repeat1, + [387] = 1, ACTIONS(121), 2, sym__identifier, ts_builtin_sym_end, - [361] = 2, - ACTIONS(123), 1, - anon_sym_SEMI, - ACTIONS(125), 1, - anon_sym_LF, - [368] = 2, - ACTIONS(127), 1, - anon_sym_SEMI, - ACTIONS(129), 1, - anon_sym_LF, - [375] = 2, + [392] = 2, ACTIONS(5), 1, sym__identifier, - STATE(9), 1, + STATE(7), 1, sym_identifier, - [382] = 1, - ACTIONS(131), 2, - sym__identifier, - ts_builtin_sym_end, - [387] = 1, - ACTIONS(75), 1, - sym__identifier, - [391] = 1, - ACTIONS(133), 1, - ts_builtin_sym_end, - [395] = 1, - ACTIONS(135), 1, - sym__identifier, [399] = 1, - ACTIONS(64), 1, + ACTIONS(123), 2, sym__identifier, + ts_builtin_sym_end, + [404] = 2, + ACTIONS(125), 1, + anon_sym_SEMI, + ACTIONS(127), 1, + anon_sym_LF, + [411] = 2, + ACTIONS(129), 1, + anon_sym_SEMI, + ACTIONS(131), 1, + anon_sym_LF, + [418] = 2, + ACTIONS(5), 1, + sym__identifier, + STATE(10), 1, + sym_identifier, + [425] = 1, + ACTIONS(133), 2, + sym__identifier, + ts_builtin_sym_end, + [430] = 1, + ACTIONS(135), 2, + sym__identifier, + ts_builtin_sym_end, + [435] = 2, + ACTIONS(137), 1, + anon_sym_SEMI, + ACTIONS(139), 1, + anon_sym_LF, + [442] = 1, + ACTIONS(141), 1, + sym__identifier, + [446] = 1, + ACTIONS(66), 1, + sym__identifier, + [450] = 1, + ACTIONS(77), 1, + sym__identifier, + [454] = 1, + ACTIONS(143), 1, + ts_builtin_sym_end, }; static const uint32_t ts_small_parse_table_map[] = { @@ -875,36 +925,41 @@ static const uint32_t ts_small_parse_table_map[] = { [SMALL_STATE(5)] = 93, [SMALL_STATE(6)] = 105, [SMALL_STATE(7)] = 121, - [SMALL_STATE(8)] = 137, - [SMALL_STATE(9)] = 156, - [SMALL_STATE(10)] = 167, - [SMALL_STATE(11)] = 180, - [SMALL_STATE(12)] = 191, - [SMALL_STATE(13)] = 204, - [SMALL_STATE(14)] = 214, - [SMALL_STATE(15)] = 224, - [SMALL_STATE(16)] = 234, - [SMALL_STATE(17)] = 244, - [SMALL_STATE(18)] = 254, - [SMALL_STATE(19)] = 264, - [SMALL_STATE(20)] = 274, - [SMALL_STATE(21)] = 284, - [SMALL_STATE(22)] = 294, - [SMALL_STATE(23)] = 304, - [SMALL_STATE(24)] = 314, - [SMALL_STATE(25)] = 324, - [SMALL_STATE(26)] = 334, - [SMALL_STATE(27)] = 344, - [SMALL_STATE(28)] = 351, - [SMALL_STATE(29)] = 356, - [SMALL_STATE(30)] = 361, - [SMALL_STATE(31)] = 368, - [SMALL_STATE(32)] = 375, - [SMALL_STATE(33)] = 382, - [SMALL_STATE(34)] = 387, - [SMALL_STATE(35)] = 391, - [SMALL_STATE(36)] = 395, - [SMALL_STATE(37)] = 399, + [SMALL_STATE(8)] = 135, + [SMALL_STATE(9)] = 151, + [SMALL_STATE(10)] = 170, + [SMALL_STATE(11)] = 181, + [SMALL_STATE(12)] = 200, + [SMALL_STATE(13)] = 213, + [SMALL_STATE(14)] = 224, + [SMALL_STATE(15)] = 237, + [SMALL_STATE(16)] = 247, + [SMALL_STATE(17)] = 257, + [SMALL_STATE(18)] = 267, + [SMALL_STATE(19)] = 277, + [SMALL_STATE(20)] = 287, + [SMALL_STATE(21)] = 297, + [SMALL_STATE(22)] = 307, + [SMALL_STATE(23)] = 317, + [SMALL_STATE(24)] = 327, + [SMALL_STATE(25)] = 337, + [SMALL_STATE(26)] = 347, + [SMALL_STATE(27)] = 357, + [SMALL_STATE(28)] = 367, + [SMALL_STATE(29)] = 377, + [SMALL_STATE(30)] = 387, + [SMALL_STATE(31)] = 392, + [SMALL_STATE(32)] = 399, + [SMALL_STATE(33)] = 404, + [SMALL_STATE(34)] = 411, + [SMALL_STATE(35)] = 418, + [SMALL_STATE(36)] = 425, + [SMALL_STATE(37)] = 430, + [SMALL_STATE(38)] = 435, + [SMALL_STATE(39)] = 442, + [SMALL_STATE(40)] = 446, + [SMALL_STATE(41)] = 450, + [SMALL_STATE(42)] = 454, }; static const TSParseActionEntry ts_parse_actions[] = { @@ -912,66 +967,70 @@ static const TSParseActionEntry ts_parse_actions[] = { [1] = {.entry = {.count = 1, .reusable = false}}, RECOVER(), [3] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_source_file, 0), [5] = {.entry = {.count = 1, .reusable = true}}, SHIFT(5), - [7] = {.entry = {.count = 1, .reusable = false}}, SHIFT(33), - [9] = {.entry = {.count = 1, .reusable = true}}, SHIFT(33), - [11] = {.entry = {.count = 1, .reusable = false}}, SHIFT(8), + [7] = {.entry = {.count = 1, .reusable = false}}, SHIFT(30), + [9] = {.entry = {.count = 1, .reusable = true}}, SHIFT(30), + [11] = {.entry = {.count = 1, .reusable = false}}, SHIFT(9), [13] = {.entry = {.count = 1, .reusable = false}}, SHIFT(23), - [15] = {.entry = {.count = 1, .reusable = false}}, SHIFT(15), - [17] = {.entry = {.count = 1, .reusable = false}}, SHIFT(10), - [19] = {.entry = {.count = 1, .reusable = false}}, SHIFT(37), - [21] = {.entry = {.count = 1, .reusable = false}}, SHIFT(28), - [23] = {.entry = {.count = 1, .reusable = true}}, SHIFT(28), + [15] = {.entry = {.count = 1, .reusable = false}}, SHIFT(26), + [17] = {.entry = {.count = 1, .reusable = false}}, SHIFT(14), + [19] = {.entry = {.count = 1, .reusable = false}}, SHIFT(41), + [21] = {.entry = {.count = 1, .reusable = false}}, SHIFT(37), + [23] = {.entry = {.count = 1, .reusable = true}}, SHIFT(37), [25] = {.entry = {.count = 1, .reusable = false}}, REDUCE(aux_sym_connection_repeat1, 2), [27] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_connection_repeat1, 2), [29] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_connection_repeat1, 2), SHIFT_REPEAT(23), - [32] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_connection_repeat1, 2), SHIFT_REPEAT(15), - [35] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_connection_repeat1, 2), SHIFT_REPEAT(10), - [38] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_connection_repeat1, 2), SHIFT_REPEAT(37), + [32] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_connection_repeat1, 2), SHIFT_REPEAT(26), + [35] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_connection_repeat1, 2), SHIFT_REPEAT(14), + [38] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_connection_repeat1, 2), SHIFT_REPEAT(41), [41] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_identifier, 1), [43] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_identifier, 1), [45] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_source_file, 1), - [47] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_source_file_repeat1, 2), - [49] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_source_file_repeat1, 2), SHIFT_REPEAT(5), - [52] = {.entry = {.count = 1, .reusable = false}}, SHIFT(31), - [54] = {.entry = {.count = 1, .reusable = false}}, SHIFT(18), - [56] = {.entry = {.count = 1, .reusable = false}}, SHIFT(19), - [58] = {.entry = {.count = 1, .reusable = false}}, SHIFT(20), - [60] = {.entry = {.count = 1, .reusable = true}}, SHIFT(12), - [62] = {.entry = {.count = 1, .reusable = true}}, SHIFT(34), - [64] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_arrow, 1), - [66] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_arrow_repeat1, 2), SHIFT_REPEAT(11), - [69] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_arrow_repeat1, 2), - [71] = {.entry = {.count = 1, .reusable = true}}, SHIFT(11), - [73] = {.entry = {.count = 1, .reusable = true}}, SHIFT(36), - [75] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_arrow, 2), - [77] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_string_repeat1, 2), SHIFT_REPEAT(13), - [80] = {.entry = {.count = 1, .reusable = false}}, REDUCE(aux_sym_string_repeat1, 2), - [82] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_string_repeat1, 2), SHIFT_REPEAT(14), - [85] = {.entry = {.count = 1, .reusable = false}}, SHIFT(24), - [87] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_string_repeat1, 2), SHIFT_REPEAT(16), - [90] = {.entry = {.count = 1, .reusable = false}}, SHIFT(16), - [92] = {.entry = {.count = 1, .reusable = false}}, SHIFT(30), - [94] = {.entry = {.count = 1, .reusable = false}}, SHIFT(27), - [96] = {.entry = {.count = 1, .reusable = true}}, SHIFT(26), - [98] = {.entry = {.count = 1, .reusable = false}}, SHIFT(25), - [100] = {.entry = {.count = 1, .reusable = false}}, SHIFT(17), - [102] = {.entry = {.count = 1, .reusable = false}}, SHIFT(29), - [104] = {.entry = {.count = 1, .reusable = true}}, SHIFT(29), - [106] = {.entry = {.count = 1, .reusable = true}}, SHIFT(22), - [108] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_arrow_repeat1, 2), SHIFT_REPEAT(24), - [111] = {.entry = {.count = 1, .reusable = false}}, SHIFT(13), - [113] = {.entry = {.count = 1, .reusable = true}}, SHIFT(14), - [115] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_string, 2), - [117] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_string, 2), - [119] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_connection, 3), - [121] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_shape, 4), - [123] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_string, 3), - [125] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_string, 3), - [127] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_label, 1), - [129] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_label, 1), - [131] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_shape, 2), - [133] = {.entry = {.count = 1, .reusable = true}}, ACCEPT_INPUT(), - [135] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_arrow, 3), + [47] = {.entry = {.count = 1, .reusable = false}}, SHIFT(11), + [49] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_source_file_repeat1, 2), + [51] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_source_file_repeat1, 2), SHIFT_REPEAT(5), + [54] = {.entry = {.count = 1, .reusable = false}}, SHIFT(38), + [56] = {.entry = {.count = 1, .reusable = false}}, SHIFT(28), + [58] = {.entry = {.count = 1, .reusable = false}}, SHIFT(17), + [60] = {.entry = {.count = 1, .reusable = false}}, SHIFT(18), + [62] = {.entry = {.count = 1, .reusable = true}}, SHIFT(13), + [64] = {.entry = {.count = 1, .reusable = true}}, SHIFT(39), + [66] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_arrow, 2), + [68] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_arrow_repeat1, 2), SHIFT_REPEAT(13), + [71] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_arrow_repeat1, 2), + [73] = {.entry = {.count = 1, .reusable = true}}, SHIFT(12), + [75] = {.entry = {.count = 1, .reusable = true}}, SHIFT(40), + [77] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_arrow, 1), + [79] = {.entry = {.count = 1, .reusable = false}}, SHIFT(22), + [81] = {.entry = {.count = 1, .reusable = false}}, SHIFT(33), + [83] = {.entry = {.count = 1, .reusable = false}}, SHIFT(21), + [85] = {.entry = {.count = 1, .reusable = false}}, SHIFT(15), + [87] = {.entry = {.count = 1, .reusable = false}}, SHIFT(34), + [89] = {.entry = {.count = 1, .reusable = false}}, SHIFT(16), + [91] = {.entry = {.count = 1, .reusable = false}}, SHIFT(32), + [93] = {.entry = {.count = 1, .reusable = true}}, SHIFT(32), + [95] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_string_repeat1, 2), SHIFT_REPEAT(21), + [98] = {.entry = {.count = 1, .reusable = false}}, REDUCE(aux_sym_string_repeat1, 2), + [100] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_string_repeat1, 2), SHIFT_REPEAT(22), + [103] = {.entry = {.count = 1, .reusable = true}}, SHIFT(20), + [105] = {.entry = {.count = 1, .reusable = false}}, SHIFT(36), + [107] = {.entry = {.count = 1, .reusable = true}}, SHIFT(36), + [109] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_string_repeat1, 2), SHIFT_REPEAT(25), + [112] = {.entry = {.count = 1, .reusable = false}}, SHIFT(27), + [114] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_arrow_repeat1, 2), SHIFT_REPEAT(27), + [117] = {.entry = {.count = 1, .reusable = true}}, SHIFT(29), + [119] = {.entry = {.count = 1, .reusable = true}}, SHIFT(25), + [121] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_shape, 2), + [123] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_shape, 4), + [125] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_string, 3), + [127] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_string, 3), + [129] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_string, 2), + [131] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_string, 2), + [133] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_connection, 6), + [135] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_connection, 3), + [137] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_label, 1), + [139] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_label, 1), + [141] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_arrow, 3), + [143] = {.entry = {.count = 1, .reusable = true}}, ACCEPT_INPUT(), }; #ifdef __cplusplus diff --git a/test/corpus/connection.txt b/test/corpus/connection.txt index ca02743..b7686dc 100644 --- a/test/corpus/connection.txt +++ b/test/corpus/connection.txt @@ -73,3 +73,27 @@ foo--bar->biz->baz (identifier) ) ) + +================== +Descripted connection +================== + +foo--bar: Question? +bar->baz: Yes + +--- + +(source_file + (connection + (identifier) + (arrow) + (identifier) + (label) + ) + (connection + (identifier) + (arrow) + (identifier) + (label) + ) +)