#include "tree_sitter/parser.h" #if defined(__GNUC__) || defined(__clang__) #pragma GCC diagnostic ignored "-Wmissing-field-initializers" #endif #define LANGUAGE_VERSION 14 #define STATE_COUNT 52 #define LARGE_STATE_COUNT 12 #define SYMBOL_COUNT 39 #define ALIAS_COUNT 0 #define TOKEN_COUNT 21 #define EXTERNAL_TOKEN_COUNT 0 #define FIELD_COUNT 0 #define MAX_ALIAS_SEQUENCE_LENGTH 6 #define PRODUCTION_ID_COUNT 1 enum ts_symbol_identifiers { sym_identifier = 1, sym_comment = 2, anon_sym_LPAREN = 3, anon_sym_COLON = 4, anon_sym_RPAREN = 5, sym_star = 6, anon_sym_u25a1 = 7, anon_sym_LBRACK_RBRACK = 8, anon_sym_u03bb = 9, anon_sym_fun = 10, anon_sym_u220f = 11, anon_sym_forall = 12, anon_sym_EQ_GT = 13, anon_sym_u21d2 = 14, anon_sym_COMMA = 15, sym_axiom = 16, anon_sym_DASH_GT = 17, anon_sym_u2192 = 18, anon_sym_COLON_EQ = 19, anon_sym_SEMI = 20, sym_program = 21, sym_param_block = 22, sym_square = 23, sym_lambda = 24, sym_pi = 25, sym_labs = 26, sym_pabs = 27, sym_term = 28, sym_app = 29, sym_arrow = 30, sym_app_term = 31, sym_expr = 32, sym_ascription = 33, sym_definition = 34, aux_sym_program_repeat1 = 35, aux_sym_param_block_repeat1 = 36, aux_sym_labs_repeat1 = 37, aux_sym_app_repeat1 = 38, }; static const char * const ts_symbol_names[] = { [ts_builtin_sym_end] = "end", [sym_identifier] = "identifier", [sym_comment] = "comment", [anon_sym_LPAREN] = "(", [anon_sym_COLON] = ":", [anon_sym_RPAREN] = ")", [sym_star] = "star", [anon_sym_u25a1] = "\u25a1", [anon_sym_LBRACK_RBRACK] = "[]", [anon_sym_u03bb] = "\u03bb", [anon_sym_fun] = "fun", [anon_sym_u220f] = "\u220f", [anon_sym_forall] = "forall", [anon_sym_EQ_GT] = "=>", [anon_sym_u21d2] = "\u21d2", [anon_sym_COMMA] = ",", [sym_axiom] = "axiom", [anon_sym_DASH_GT] = "->", [anon_sym_u2192] = "\u2192", [anon_sym_COLON_EQ] = ":=", [anon_sym_SEMI] = ";", [sym_program] = "program", [sym_param_block] = "param_block", [sym_square] = "square", [sym_lambda] = "lambda", [sym_pi] = "pi", [sym_labs] = "labs", [sym_pabs] = "pabs", [sym_term] = "term", [sym_app] = "app", [sym_arrow] = "arrow", [sym_app_term] = "app_term", [sym_expr] = "expr", [sym_ascription] = "ascription", [sym_definition] = "definition", [aux_sym_program_repeat1] = "program_repeat1", [aux_sym_param_block_repeat1] = "param_block_repeat1", [aux_sym_labs_repeat1] = "labs_repeat1", [aux_sym_app_repeat1] = "app_repeat1", }; static const TSSymbol ts_symbol_map[] = { [ts_builtin_sym_end] = ts_builtin_sym_end, [sym_identifier] = sym_identifier, [sym_comment] = sym_comment, [anon_sym_LPAREN] = anon_sym_LPAREN, [anon_sym_COLON] = anon_sym_COLON, [anon_sym_RPAREN] = anon_sym_RPAREN, [sym_star] = sym_star, [anon_sym_u25a1] = anon_sym_u25a1, [anon_sym_LBRACK_RBRACK] = anon_sym_LBRACK_RBRACK, [anon_sym_u03bb] = anon_sym_u03bb, [anon_sym_fun] = anon_sym_fun, [anon_sym_u220f] = anon_sym_u220f, [anon_sym_forall] = anon_sym_forall, [anon_sym_EQ_GT] = anon_sym_EQ_GT, [anon_sym_u21d2] = anon_sym_u21d2, [anon_sym_COMMA] = anon_sym_COMMA, [sym_axiom] = sym_axiom, [anon_sym_DASH_GT] = anon_sym_DASH_GT, [anon_sym_u2192] = anon_sym_u2192, [anon_sym_COLON_EQ] = anon_sym_COLON_EQ, [anon_sym_SEMI] = anon_sym_SEMI, [sym_program] = sym_program, [sym_param_block] = sym_param_block, [sym_square] = sym_square, [sym_lambda] = sym_lambda, [sym_pi] = sym_pi, [sym_labs] = sym_labs, [sym_pabs] = sym_pabs, [sym_term] = sym_term, [sym_app] = sym_app, [sym_arrow] = sym_arrow, [sym_app_term] = sym_app_term, [sym_expr] = sym_expr, [sym_ascription] = sym_ascription, [sym_definition] = sym_definition, [aux_sym_program_repeat1] = aux_sym_program_repeat1, [aux_sym_param_block_repeat1] = aux_sym_param_block_repeat1, [aux_sym_labs_repeat1] = aux_sym_labs_repeat1, [aux_sym_app_repeat1] = aux_sym_app_repeat1, }; static const TSSymbolMetadata ts_symbol_metadata[] = { [ts_builtin_sym_end] = { .visible = false, .named = true, }, [sym_identifier] = { .visible = true, .named = true, }, [sym_comment] = { .visible = true, .named = true, }, [anon_sym_LPAREN] = { .visible = true, .named = false, }, [anon_sym_COLON] = { .visible = true, .named = false, }, [anon_sym_RPAREN] = { .visible = true, .named = false, }, [sym_star] = { .visible = true, .named = true, }, [anon_sym_u25a1] = { .visible = true, .named = false, }, [anon_sym_LBRACK_RBRACK] = { .visible = true, .named = false, }, [anon_sym_u03bb] = { .visible = true, .named = false, }, [anon_sym_fun] = { .visible = true, .named = false, }, [anon_sym_u220f] = { .visible = true, .named = false, }, [anon_sym_forall] = { .visible = true, .named = false, }, [anon_sym_EQ_GT] = { .visible = true, .named = false, }, [anon_sym_u21d2] = { .visible = true, .named = false, }, [anon_sym_COMMA] = { .visible = true, .named = false, }, [sym_axiom] = { .visible = true, .named = true, }, [anon_sym_DASH_GT] = { .visible = true, .named = false, }, [anon_sym_u2192] = { .visible = true, .named = false, }, [anon_sym_COLON_EQ] = { .visible = true, .named = false, }, [anon_sym_SEMI] = { .visible = true, .named = false, }, [sym_program] = { .visible = true, .named = true, }, [sym_param_block] = { .visible = true, .named = true, }, [sym_square] = { .visible = true, .named = true, }, [sym_lambda] = { .visible = true, .named = true, }, [sym_pi] = { .visible = true, .named = true, }, [sym_labs] = { .visible = true, .named = true, }, [sym_pabs] = { .visible = true, .named = true, }, [sym_term] = { .visible = true, .named = true, }, [sym_app] = { .visible = true, .named = true, }, [sym_arrow] = { .visible = true, .named = true, }, [sym_app_term] = { .visible = true, .named = true, }, [sym_expr] = { .visible = true, .named = true, }, [sym_ascription] = { .visible = true, .named = true, }, [sym_definition] = { .visible = true, .named = true, }, [aux_sym_program_repeat1] = { .visible = false, .named = false, }, [aux_sym_param_block_repeat1] = { .visible = false, .named = false, }, [aux_sym_labs_repeat1] = { .visible = false, .named = false, }, [aux_sym_app_repeat1] = { .visible = false, .named = false, }, }; static const TSSymbol ts_alias_sequences[PRODUCTION_ID_COUNT][MAX_ALIAS_SEQUENCE_LENGTH] = { [0] = {0}, }; static const uint16_t ts_non_terminal_alias_map[] = { 0, }; static const TSStateId ts_primary_state_ids[STATE_COUNT] = { [0] = 0, [1] = 1, [2] = 2, [3] = 3, [4] = 4, [5] = 5, [6] = 6, [7] = 7, [8] = 8, [9] = 9, [10] = 10, [11] = 11, [12] = 12, [13] = 13, [14] = 14, [15] = 15, [16] = 16, [17] = 17, [18] = 18, [19] = 19, [20] = 20, [21] = 21, [22] = 22, [23] = 23, [24] = 24, [25] = 25, [26] = 26, [27] = 27, [28] = 28, [29] = 29, [30] = 30, [31] = 31, [32] = 32, [33] = 33, [34] = 34, [35] = 35, [36] = 36, [37] = 37, [38] = 38, [39] = 39, [40] = 40, [41] = 41, [42] = 42, [43] = 43, [44] = 44, [45] = 45, [46] = 46, [47] = 47, [48] = 48, [49] = 49, [50] = 50, [51] = 51, }; static bool ts_lex(TSLexer *lexer, TSStateId state) { START_LEXER(); eof = lexer->eof(lexer); switch (state) { case 0: if (eof) ADVANCE(6); ADVANCE_MAP( '(', 19, ')', 21, '*', 22, ',', 31, '-', 2, ':', 20, ';', 36, '=', 3, '[', 4, 'a', 16, 'f', 13, 0x3bb, 25, 0x2192, 34, 0x21d2, 30, 0x220f, 27, 0x25a1, 23, ); if (('\t' <= lookahead && lookahead <= '\r') || lookahead == ' ') SKIP(0); if (('A' <= lookahead && lookahead <= 'Z') || lookahead == '_' || ('b' <= lookahead && lookahead <= 'z')) ADVANCE(17); END_STATE(); case 1: if (lookahead == '(') ADVANCE(19); if (lookahead == '*') ADVANCE(22); if (lookahead == '[') ADVANCE(4); if (lookahead == 'f') ADVANCE(13); if (lookahead == 0x3bb) ADVANCE(25); if (lookahead == 0x220f) ADVANCE(27); if (lookahead == 0x25a1) ADVANCE(23); if (('\t' <= lookahead && lookahead <= '\r') || lookahead == ' ') SKIP(1); if (('A' <= lookahead && lookahead <= 'Z') || lookahead == '_' || ('a' <= lookahead && lookahead <= 'z')) ADVANCE(17); END_STATE(); case 2: if (lookahead == '-') ADVANCE(18); if (lookahead == '>') ADVANCE(33); END_STATE(); case 3: if (lookahead == '>') ADVANCE(29); END_STATE(); case 4: if (lookahead == ']') ADVANCE(24); END_STATE(); case 5: if (eof) ADVANCE(6); ADVANCE_MAP( '(', 19, ')', 21, '*', 22, '-', 2, ':', 20, ';', 36, '[', 4, 0x2192, 34, 0x25a1, 23, ); if (('\t' <= lookahead && lookahead <= '\r') || lookahead == ' ') SKIP(5); if (('A' <= lookahead && lookahead <= 'Z') || lookahead == '_' || ('a' <= lookahead && lookahead <= 'z')) ADVANCE(17); END_STATE(); case 6: ACCEPT_TOKEN(ts_builtin_sym_end); END_STATE(); case 7: ACCEPT_TOKEN(sym_identifier); if (lookahead == 'a') ADVANCE(10); if (('0' <= lookahead && lookahead <= '9') || ('A' <= lookahead && lookahead <= 'Z') || lookahead == '_' || ('b' <= lookahead && lookahead <= 'z')) ADVANCE(17); END_STATE(); case 8: ACCEPT_TOKEN(sym_identifier); if (lookahead == 'i') ADVANCE(14); if (('0' <= lookahead && lookahead <= '9') || ('A' <= lookahead && lookahead <= 'Z') || lookahead == '_' || ('a' <= lookahead && lookahead <= 'z')) ADVANCE(17); END_STATE(); case 9: ACCEPT_TOKEN(sym_identifier); if (lookahead == 'l') ADVANCE(28); if (('0' <= lookahead && lookahead <= '9') || ('A' <= lookahead && lookahead <= 'Z') || lookahead == '_' || ('a' <= lookahead && lookahead <= 'z')) ADVANCE(17); END_STATE(); case 10: ACCEPT_TOKEN(sym_identifier); if (lookahead == 'l') ADVANCE(9); if (('0' <= lookahead && lookahead <= '9') || ('A' <= lookahead && lookahead <= 'Z') || lookahead == '_' || ('a' <= lookahead && lookahead <= 'z')) ADVANCE(17); END_STATE(); case 11: ACCEPT_TOKEN(sym_identifier); if (lookahead == 'm') ADVANCE(32); if (('0' <= lookahead && lookahead <= '9') || ('A' <= lookahead && lookahead <= 'Z') || lookahead == '_' || ('a' <= lookahead && lookahead <= 'z')) ADVANCE(17); END_STATE(); case 12: ACCEPT_TOKEN(sym_identifier); if (lookahead == 'n') ADVANCE(26); if (('0' <= lookahead && lookahead <= '9') || ('A' <= lookahead && lookahead <= 'Z') || lookahead == '_' || ('a' <= lookahead && lookahead <= 'z')) ADVANCE(17); END_STATE(); case 13: ACCEPT_TOKEN(sym_identifier); if (lookahead == 'o') ADVANCE(15); if (lookahead == 'u') ADVANCE(12); if (('0' <= lookahead && lookahead <= '9') || ('A' <= lookahead && lookahead <= 'Z') || lookahead == '_' || ('a' <= lookahead && lookahead <= 'z')) ADVANCE(17); END_STATE(); case 14: ACCEPT_TOKEN(sym_identifier); if (lookahead == 'o') ADVANCE(11); if (('0' <= lookahead && lookahead <= '9') || ('A' <= lookahead && lookahead <= 'Z') || lookahead == '_' || ('a' <= lookahead && lookahead <= 'z')) ADVANCE(17); END_STATE(); case 15: ACCEPT_TOKEN(sym_identifier); if (lookahead == 'r') ADVANCE(7); if (('0' <= lookahead && lookahead <= '9') || ('A' <= lookahead && lookahead <= 'Z') || lookahead == '_' || ('a' <= lookahead && lookahead <= 'z')) ADVANCE(17); END_STATE(); case 16: ACCEPT_TOKEN(sym_identifier); if (lookahead == 'x') ADVANCE(8); if (('0' <= lookahead && lookahead <= '9') || ('A' <= lookahead && lookahead <= 'Z') || lookahead == '_' || ('a' <= lookahead && lookahead <= 'z')) ADVANCE(17); END_STATE(); case 17: ACCEPT_TOKEN(sym_identifier); if (('0' <= lookahead && lookahead <= '9') || ('A' <= lookahead && lookahead <= 'Z') || lookahead == '_' || ('a' <= lookahead && lookahead <= 'z')) ADVANCE(17); END_STATE(); case 18: ACCEPT_TOKEN(sym_comment); if (lookahead != 0 && lookahead != '\n') ADVANCE(18); END_STATE(); case 19: ACCEPT_TOKEN(anon_sym_LPAREN); END_STATE(); case 20: ACCEPT_TOKEN(anon_sym_COLON); if (lookahead == '=') ADVANCE(35); END_STATE(); case 21: ACCEPT_TOKEN(anon_sym_RPAREN); END_STATE(); case 22: ACCEPT_TOKEN(sym_star); END_STATE(); case 23: ACCEPT_TOKEN(anon_sym_u25a1); END_STATE(); case 24: ACCEPT_TOKEN(anon_sym_LBRACK_RBRACK); END_STATE(); case 25: ACCEPT_TOKEN(anon_sym_u03bb); END_STATE(); case 26: ACCEPT_TOKEN(anon_sym_fun); if (('0' <= lookahead && lookahead <= '9') || ('A' <= lookahead && lookahead <= 'Z') || lookahead == '_' || ('a' <= lookahead && lookahead <= 'z')) ADVANCE(17); END_STATE(); case 27: ACCEPT_TOKEN(anon_sym_u220f); END_STATE(); case 28: ACCEPT_TOKEN(anon_sym_forall); if (('0' <= lookahead && lookahead <= '9') || ('A' <= lookahead && lookahead <= 'Z') || lookahead == '_' || ('a' <= lookahead && lookahead <= 'z')) ADVANCE(17); END_STATE(); case 29: ACCEPT_TOKEN(anon_sym_EQ_GT); END_STATE(); case 30: ACCEPT_TOKEN(anon_sym_u21d2); END_STATE(); case 31: ACCEPT_TOKEN(anon_sym_COMMA); END_STATE(); case 32: ACCEPT_TOKEN(sym_axiom); if (('0' <= lookahead && lookahead <= '9') || ('A' <= lookahead && lookahead <= 'Z') || lookahead == '_' || ('a' <= lookahead && lookahead <= 'z')) ADVANCE(17); END_STATE(); case 33: ACCEPT_TOKEN(anon_sym_DASH_GT); END_STATE(); case 34: ACCEPT_TOKEN(anon_sym_u2192); END_STATE(); case 35: ACCEPT_TOKEN(anon_sym_COLON_EQ); END_STATE(); case 36: ACCEPT_TOKEN(anon_sym_SEMI); END_STATE(); default: return false; } } static const TSLexMode ts_lex_modes[STATE_COUNT] = { [0] = {.lex_state = 0}, [1] = {.lex_state = 5}, [2] = {.lex_state = 0}, [3] = {.lex_state = 0}, [4] = {.lex_state = 0}, [5] = {.lex_state = 1}, [6] = {.lex_state = 1}, [7] = {.lex_state = 1}, [8] = {.lex_state = 1}, [9] = {.lex_state = 1}, [10] = {.lex_state = 1}, [11] = {.lex_state = 1}, [12] = {.lex_state = 5}, [13] = {.lex_state = 5}, [14] = {.lex_state = 5}, [15] = {.lex_state = 5}, [16] = {.lex_state = 5}, [17] = {.lex_state = 0}, [18] = {.lex_state = 0}, [19] = {.lex_state = 0}, [20] = {.lex_state = 0}, [21] = {.lex_state = 0}, [22] = {.lex_state = 0}, [23] = {.lex_state = 0}, [24] = {.lex_state = 0}, [25] = {.lex_state = 0}, [26] = {.lex_state = 5}, [27] = {.lex_state = 5}, [28] = {.lex_state = 0}, [29] = {.lex_state = 0}, [30] = {.lex_state = 0}, [31] = {.lex_state = 0}, [32] = {.lex_state = 0}, [33] = {.lex_state = 5}, [34] = {.lex_state = 0}, [35] = {.lex_state = 5}, [36] = {.lex_state = 5}, [37] = {.lex_state = 5}, [38] = {.lex_state = 5}, [39] = {.lex_state = 5}, [40] = {.lex_state = 0}, [41] = {.lex_state = 0}, [42] = {.lex_state = 0}, [43] = {.lex_state = 0}, [44] = {.lex_state = 0}, [45] = {.lex_state = 0}, [46] = {.lex_state = 0}, [47] = {.lex_state = 0}, [48] = {.lex_state = 0}, [49] = {.lex_state = 0}, [50] = {.lex_state = 0}, [51] = {.lex_state = 0}, }; static const uint16_t ts_parse_table[LARGE_STATE_COUNT][SYMBOL_COUNT] = { [0] = { [ts_builtin_sym_end] = ACTIONS(1), [sym_identifier] = ACTIONS(1), [sym_comment] = ACTIONS(1), [anon_sym_LPAREN] = ACTIONS(1), [anon_sym_COLON] = ACTIONS(1), [anon_sym_RPAREN] = ACTIONS(1), [sym_star] = ACTIONS(1), [anon_sym_u25a1] = ACTIONS(1), [anon_sym_LBRACK_RBRACK] = ACTIONS(1), [anon_sym_u03bb] = ACTIONS(1), [anon_sym_fun] = ACTIONS(1), [anon_sym_u220f] = ACTIONS(1), [anon_sym_forall] = ACTIONS(1), [anon_sym_EQ_GT] = ACTIONS(1), [anon_sym_u21d2] = ACTIONS(1), [anon_sym_COMMA] = ACTIONS(1), [sym_axiom] = ACTIONS(1), [anon_sym_DASH_GT] = ACTIONS(1), [anon_sym_u2192] = ACTIONS(1), [anon_sym_COLON_EQ] = ACTIONS(1), [anon_sym_SEMI] = ACTIONS(1), }, [1] = { [sym_program] = STATE(45), [sym_definition] = STATE(27), [aux_sym_program_repeat1] = STATE(27), [ts_builtin_sym_end] = ACTIONS(3), [sym_identifier] = ACTIONS(5), [sym_comment] = ACTIONS(7), }, [2] = { [sym_square] = STATE(16), [sym_lambda] = STATE(32), [sym_pi] = STATE(34), [sym_labs] = STATE(22), [sym_pabs] = STATE(22), [sym_term] = STATE(12), [sym_app] = STATE(22), [sym_arrow] = STATE(23), [sym_app_term] = STATE(25), [sym_expr] = STATE(44), [aux_sym_app_repeat1] = STATE(12), [sym_identifier] = ACTIONS(9), [anon_sym_LPAREN] = ACTIONS(11), [sym_star] = ACTIONS(13), [anon_sym_u25a1] = ACTIONS(15), [anon_sym_LBRACK_RBRACK] = ACTIONS(15), [anon_sym_u03bb] = ACTIONS(17), [anon_sym_fun] = ACTIONS(19), [anon_sym_u220f] = ACTIONS(21), [anon_sym_forall] = ACTIONS(23), [sym_axiom] = ACTIONS(25), }, [3] = { [sym_square] = STATE(16), [sym_lambda] = STATE(32), [sym_pi] = STATE(34), [sym_labs] = STATE(22), [sym_pabs] = STATE(22), [sym_term] = STATE(12), [sym_app] = STATE(22), [sym_arrow] = STATE(23), [sym_app_term] = STATE(25), [sym_expr] = STATE(49), [aux_sym_app_repeat1] = STATE(12), [sym_identifier] = ACTIONS(9), [anon_sym_LPAREN] = ACTIONS(11), [sym_star] = ACTIONS(13), [anon_sym_u25a1] = ACTIONS(15), [anon_sym_LBRACK_RBRACK] = ACTIONS(15), [anon_sym_u03bb] = ACTIONS(17), [anon_sym_fun] = ACTIONS(19), [anon_sym_u220f] = ACTIONS(21), [anon_sym_forall] = ACTIONS(23), [sym_axiom] = ACTIONS(27), }, [4] = { [sym_square] = STATE(16), [sym_lambda] = STATE(32), [sym_pi] = STATE(34), [sym_labs] = STATE(22), [sym_pabs] = STATE(22), [sym_term] = STATE(12), [sym_app] = STATE(22), [sym_arrow] = STATE(23), [sym_app_term] = STATE(25), [sym_expr] = STATE(47), [aux_sym_app_repeat1] = STATE(12), [sym_identifier] = ACTIONS(9), [anon_sym_LPAREN] = ACTIONS(11), [sym_star] = ACTIONS(13), [anon_sym_u25a1] = ACTIONS(15), [anon_sym_LBRACK_RBRACK] = ACTIONS(15), [anon_sym_u03bb] = ACTIONS(17), [anon_sym_fun] = ACTIONS(19), [anon_sym_u220f] = ACTIONS(21), [anon_sym_forall] = ACTIONS(23), [sym_axiom] = ACTIONS(29), }, [5] = { [sym_square] = STATE(16), [sym_lambda] = STATE(32), [sym_pi] = STATE(34), [sym_labs] = STATE(22), [sym_pabs] = STATE(22), [sym_term] = STATE(12), [sym_app] = STATE(22), [sym_arrow] = STATE(23), [sym_app_term] = STATE(25), [sym_expr] = STATE(41), [aux_sym_app_repeat1] = STATE(12), [sym_identifier] = ACTIONS(9), [anon_sym_LPAREN] = ACTIONS(11), [sym_star] = ACTIONS(13), [anon_sym_u25a1] = ACTIONS(15), [anon_sym_LBRACK_RBRACK] = ACTIONS(15), [anon_sym_u03bb] = ACTIONS(17), [anon_sym_fun] = ACTIONS(19), [anon_sym_u220f] = ACTIONS(21), [anon_sym_forall] = ACTIONS(23), }, [6] = { [sym_square] = STATE(16), [sym_lambda] = STATE(32), [sym_pi] = STATE(34), [sym_labs] = STATE(22), [sym_pabs] = STATE(22), [sym_term] = STATE(12), [sym_app] = STATE(22), [sym_arrow] = STATE(23), [sym_app_term] = STATE(25), [sym_expr] = STATE(42), [aux_sym_app_repeat1] = STATE(12), [sym_identifier] = ACTIONS(9), [anon_sym_LPAREN] = ACTIONS(11), [sym_star] = ACTIONS(13), [anon_sym_u25a1] = ACTIONS(15), [anon_sym_LBRACK_RBRACK] = ACTIONS(15), [anon_sym_u03bb] = ACTIONS(17), [anon_sym_fun] = ACTIONS(19), [anon_sym_u220f] = ACTIONS(21), [anon_sym_forall] = ACTIONS(23), }, [7] = { [sym_square] = STATE(16), [sym_lambda] = STATE(32), [sym_pi] = STATE(34), [sym_labs] = STATE(22), [sym_pabs] = STATE(22), [sym_term] = STATE(12), [sym_app] = STATE(22), [sym_arrow] = STATE(23), [sym_app_term] = STATE(25), [sym_expr] = STATE(50), [aux_sym_app_repeat1] = STATE(12), [sym_identifier] = ACTIONS(9), [anon_sym_LPAREN] = ACTIONS(11), [sym_star] = ACTIONS(13), [anon_sym_u25a1] = ACTIONS(15), [anon_sym_LBRACK_RBRACK] = ACTIONS(15), [anon_sym_u03bb] = ACTIONS(17), [anon_sym_fun] = ACTIONS(19), [anon_sym_u220f] = ACTIONS(21), [anon_sym_forall] = ACTIONS(23), }, [8] = { [sym_square] = STATE(16), [sym_lambda] = STATE(32), [sym_pi] = STATE(34), [sym_labs] = STATE(22), [sym_pabs] = STATE(22), [sym_term] = STATE(12), [sym_app] = STATE(22), [sym_arrow] = STATE(23), [sym_app_term] = STATE(25), [sym_expr] = STATE(40), [aux_sym_app_repeat1] = STATE(12), [sym_identifier] = ACTIONS(9), [anon_sym_LPAREN] = ACTIONS(11), [sym_star] = ACTIONS(13), [anon_sym_u25a1] = ACTIONS(15), [anon_sym_LBRACK_RBRACK] = ACTIONS(15), [anon_sym_u03bb] = ACTIONS(17), [anon_sym_fun] = ACTIONS(19), [anon_sym_u220f] = ACTIONS(21), [anon_sym_forall] = ACTIONS(23), }, [9] = { [sym_square] = STATE(16), [sym_lambda] = STATE(32), [sym_pi] = STATE(34), [sym_labs] = STATE(22), [sym_pabs] = STATE(22), [sym_term] = STATE(12), [sym_app] = STATE(22), [sym_arrow] = STATE(23), [sym_app_term] = STATE(25), [sym_expr] = STATE(28), [aux_sym_app_repeat1] = STATE(12), [sym_identifier] = ACTIONS(9), [anon_sym_LPAREN] = ACTIONS(11), [sym_star] = ACTIONS(13), [anon_sym_u25a1] = ACTIONS(15), [anon_sym_LBRACK_RBRACK] = ACTIONS(15), [anon_sym_u03bb] = ACTIONS(17), [anon_sym_fun] = ACTIONS(19), [anon_sym_u220f] = ACTIONS(21), [anon_sym_forall] = ACTIONS(23), }, [10] = { [sym_square] = STATE(16), [sym_lambda] = STATE(32), [sym_pi] = STATE(34), [sym_labs] = STATE(22), [sym_pabs] = STATE(22), [sym_term] = STATE(12), [sym_app] = STATE(22), [sym_arrow] = STATE(23), [sym_app_term] = STATE(25), [sym_expr] = STATE(29), [aux_sym_app_repeat1] = STATE(12), [sym_identifier] = ACTIONS(9), [anon_sym_LPAREN] = ACTIONS(11), [sym_star] = ACTIONS(13), [anon_sym_u25a1] = ACTIONS(15), [anon_sym_LBRACK_RBRACK] = ACTIONS(15), [anon_sym_u03bb] = ACTIONS(17), [anon_sym_fun] = ACTIONS(19), [anon_sym_u220f] = ACTIONS(21), [anon_sym_forall] = ACTIONS(23), }, [11] = { [sym_square] = STATE(16), [sym_lambda] = STATE(32), [sym_pi] = STATE(34), [sym_labs] = STATE(22), [sym_pabs] = STATE(22), [sym_term] = STATE(12), [sym_app] = STATE(22), [sym_arrow] = STATE(23), [sym_app_term] = STATE(25), [sym_expr] = STATE(30), [aux_sym_app_repeat1] = STATE(12), [sym_identifier] = ACTIONS(9), [anon_sym_LPAREN] = ACTIONS(11), [sym_star] = ACTIONS(13), [anon_sym_u25a1] = ACTIONS(15), [anon_sym_LBRACK_RBRACK] = ACTIONS(15), [anon_sym_u03bb] = ACTIONS(17), [anon_sym_fun] = ACTIONS(19), [anon_sym_u220f] = ACTIONS(21), [anon_sym_forall] = ACTIONS(23), }, }; static const uint16_t ts_small_parse_table[] = { [0] = 6, ACTIONS(11), 1, anon_sym_LPAREN, STATE(16), 1, sym_square, ACTIONS(13), 2, sym_identifier, sym_star, ACTIONS(15), 2, anon_sym_u25a1, anon_sym_LBRACK_RBRACK, STATE(13), 2, sym_term, aux_sym_app_repeat1, ACTIONS(31), 5, anon_sym_RPAREN, anon_sym_DASH_GT, anon_sym_u2192, anon_sym_COLON_EQ, anon_sym_SEMI, [26] = 6, ACTIONS(36), 1, anon_sym_LPAREN, STATE(16), 1, sym_square, ACTIONS(33), 2, sym_identifier, sym_star, ACTIONS(41), 2, anon_sym_u25a1, anon_sym_LBRACK_RBRACK, STATE(13), 2, sym_term, aux_sym_app_repeat1, ACTIONS(39), 5, anon_sym_RPAREN, anon_sym_DASH_GT, anon_sym_u2192, anon_sym_COLON_EQ, anon_sym_SEMI, [52] = 1, ACTIONS(44), 10, sym_identifier, anon_sym_LPAREN, anon_sym_RPAREN, sym_star, anon_sym_u25a1, anon_sym_LBRACK_RBRACK, anon_sym_DASH_GT, anon_sym_u2192, anon_sym_COLON_EQ, anon_sym_SEMI, [65] = 1, ACTIONS(46), 10, sym_identifier, anon_sym_LPAREN, anon_sym_RPAREN, sym_star, anon_sym_u25a1, anon_sym_LBRACK_RBRACK, anon_sym_DASH_GT, anon_sym_u2192, anon_sym_COLON_EQ, anon_sym_SEMI, [78] = 1, ACTIONS(48), 10, sym_identifier, anon_sym_LPAREN, anon_sym_RPAREN, sym_star, anon_sym_u25a1, anon_sym_LBRACK_RBRACK, anon_sym_DASH_GT, anon_sym_u2192, anon_sym_COLON_EQ, anon_sym_SEMI, [91] = 4, ACTIONS(50), 1, anon_sym_LPAREN, ACTIONS(53), 1, anon_sym_COLON, STATE(17), 2, sym_param_block, aux_sym_labs_repeat1, ACTIONS(55), 4, anon_sym_EQ_GT, anon_sym_u21d2, anon_sym_COMMA, anon_sym_COLON_EQ, [108] = 5, ACTIONS(57), 1, anon_sym_LPAREN, ACTIONS(59), 1, anon_sym_COLON, ACTIONS(61), 1, anon_sym_COLON_EQ, STATE(51), 1, sym_ascription, STATE(19), 2, sym_param_block, aux_sym_labs_repeat1, [125] = 5, ACTIONS(57), 1, anon_sym_LPAREN, ACTIONS(59), 1, anon_sym_COLON, ACTIONS(63), 1, anon_sym_COLON_EQ, STATE(46), 1, sym_ascription, STATE(17), 2, sym_param_block, aux_sym_labs_repeat1, [142] = 2, ACTIONS(67), 1, anon_sym_COLON, ACTIONS(65), 5, anon_sym_LPAREN, anon_sym_EQ_GT, anon_sym_u21d2, anon_sym_COMMA, anon_sym_COLON_EQ, [153] = 2, ACTIONS(71), 1, anon_sym_COLON, ACTIONS(69), 5, anon_sym_LPAREN, anon_sym_EQ_GT, anon_sym_u21d2, anon_sym_COMMA, anon_sym_COLON_EQ, [164] = 1, ACTIONS(73), 5, anon_sym_RPAREN, anon_sym_DASH_GT, anon_sym_u2192, anon_sym_COLON_EQ, anon_sym_SEMI, [172] = 1, ACTIONS(75), 5, anon_sym_RPAREN, anon_sym_DASH_GT, anon_sym_u2192, anon_sym_COLON_EQ, anon_sym_SEMI, [180] = 3, ACTIONS(57), 1, anon_sym_LPAREN, ACTIONS(77), 2, anon_sym_EQ_GT, anon_sym_u21d2, STATE(17), 2, sym_param_block, aux_sym_labs_repeat1, [192] = 2, ACTIONS(79), 2, anon_sym_DASH_GT, anon_sym_u2192, ACTIONS(75), 3, anon_sym_RPAREN, anon_sym_COLON_EQ, anon_sym_SEMI, [202] = 4, ACTIONS(81), 1, ts_builtin_sym_end, ACTIONS(83), 1, sym_identifier, ACTIONS(86), 1, sym_comment, STATE(26), 2, sym_definition, aux_sym_program_repeat1, [216] = 4, ACTIONS(5), 1, sym_identifier, ACTIONS(89), 1, ts_builtin_sym_end, ACTIONS(91), 1, sym_comment, STATE(26), 2, sym_definition, aux_sym_program_repeat1, [230] = 1, ACTIONS(93), 5, anon_sym_RPAREN, anon_sym_DASH_GT, anon_sym_u2192, anon_sym_COLON_EQ, anon_sym_SEMI, [238] = 1, ACTIONS(95), 5, anon_sym_RPAREN, anon_sym_DASH_GT, anon_sym_u2192, anon_sym_COLON_EQ, anon_sym_SEMI, [246] = 1, ACTIONS(97), 5, anon_sym_RPAREN, anon_sym_DASH_GT, anon_sym_u2192, anon_sym_COLON_EQ, anon_sym_SEMI, [254] = 3, ACTIONS(57), 1, anon_sym_LPAREN, ACTIONS(99), 1, anon_sym_COMMA, STATE(17), 2, sym_param_block, aux_sym_labs_repeat1, [265] = 2, ACTIONS(57), 1, anon_sym_LPAREN, STATE(24), 2, sym_param_block, aux_sym_labs_repeat1, [273] = 3, ACTIONS(101), 1, sym_identifier, ACTIONS(104), 1, anon_sym_COLON, STATE(33), 1, aux_sym_param_block_repeat1, [283] = 2, ACTIONS(57), 1, anon_sym_LPAREN, STATE(31), 2, sym_param_block, aux_sym_labs_repeat1, [291] = 3, ACTIONS(106), 1, sym_identifier, ACTIONS(108), 1, anon_sym_COLON, STATE(37), 1, aux_sym_param_block_repeat1, [301] = 1, ACTIONS(110), 3, ts_builtin_sym_end, sym_identifier, sym_comment, [307] = 3, ACTIONS(112), 1, sym_identifier, ACTIONS(114), 1, anon_sym_COLON, STATE(33), 1, aux_sym_param_block_repeat1, [317] = 1, ACTIONS(116), 3, ts_builtin_sym_end, sym_identifier, sym_comment, [323] = 1, ACTIONS(118), 3, ts_builtin_sym_end, sym_identifier, sym_comment, [329] = 1, ACTIONS(120), 1, anon_sym_RPAREN, [333] = 1, ACTIONS(122), 1, anon_sym_COLON_EQ, [337] = 1, ACTIONS(124), 1, anon_sym_RPAREN, [341] = 1, ACTIONS(126), 1, anon_sym_LPAREN, [345] = 1, ACTIONS(128), 1, anon_sym_SEMI, [349] = 1, ACTIONS(130), 1, ts_builtin_sym_end, [353] = 1, ACTIONS(132), 1, anon_sym_COLON_EQ, [357] = 1, ACTIONS(134), 1, anon_sym_SEMI, [361] = 1, ACTIONS(136), 1, anon_sym_LPAREN, [365] = 1, ACTIONS(138), 1, anon_sym_SEMI, [369] = 1, ACTIONS(140), 1, anon_sym_RPAREN, [373] = 1, ACTIONS(63), 1, anon_sym_COLON_EQ, }; static const uint32_t ts_small_parse_table_map[] = { [SMALL_STATE(12)] = 0, [SMALL_STATE(13)] = 26, [SMALL_STATE(14)] = 52, [SMALL_STATE(15)] = 65, [SMALL_STATE(16)] = 78, [SMALL_STATE(17)] = 91, [SMALL_STATE(18)] = 108, [SMALL_STATE(19)] = 125, [SMALL_STATE(20)] = 142, [SMALL_STATE(21)] = 153, [SMALL_STATE(22)] = 164, [SMALL_STATE(23)] = 172, [SMALL_STATE(24)] = 180, [SMALL_STATE(25)] = 192, [SMALL_STATE(26)] = 202, [SMALL_STATE(27)] = 216, [SMALL_STATE(28)] = 230, [SMALL_STATE(29)] = 238, [SMALL_STATE(30)] = 246, [SMALL_STATE(31)] = 254, [SMALL_STATE(32)] = 265, [SMALL_STATE(33)] = 273, [SMALL_STATE(34)] = 283, [SMALL_STATE(35)] = 291, [SMALL_STATE(36)] = 301, [SMALL_STATE(37)] = 307, [SMALL_STATE(38)] = 317, [SMALL_STATE(39)] = 323, [SMALL_STATE(40)] = 329, [SMALL_STATE(41)] = 333, [SMALL_STATE(42)] = 337, [SMALL_STATE(43)] = 341, [SMALL_STATE(44)] = 345, [SMALL_STATE(45)] = 349, [SMALL_STATE(46)] = 353, [SMALL_STATE(47)] = 357, [SMALL_STATE(48)] = 361, [SMALL_STATE(49)] = 365, [SMALL_STATE(50)] = 369, [SMALL_STATE(51)] = 373, }; static const TSParseActionEntry ts_parse_actions[] = { [0] = {.entry = {.count = 0, .reusable = false}}, [1] = {.entry = {.count = 1, .reusable = false}}, RECOVER(), [3] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_program, 0, 0, 0), [5] = {.entry = {.count = 1, .reusable = true}}, SHIFT(18), [7] = {.entry = {.count = 1, .reusable = true}}, SHIFT(27), [9] = {.entry = {.count = 1, .reusable = false}}, SHIFT(16), [11] = {.entry = {.count = 1, .reusable = true}}, SHIFT(6), [13] = {.entry = {.count = 1, .reusable = true}}, SHIFT(16), [15] = {.entry = {.count = 1, .reusable = true}}, SHIFT(14), [17] = {.entry = {.count = 1, .reusable = true}}, SHIFT(48), [19] = {.entry = {.count = 1, .reusable = false}}, SHIFT(48), [21] = {.entry = {.count = 1, .reusable = true}}, SHIFT(43), [23] = {.entry = {.count = 1, .reusable = false}}, SHIFT(43), [25] = {.entry = {.count = 1, .reusable = false}}, SHIFT(44), [27] = {.entry = {.count = 1, .reusable = false}}, SHIFT(49), [29] = {.entry = {.count = 1, .reusable = false}}, SHIFT(47), [31] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_app, 1, 0, 0), [33] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_app_repeat1, 2, 0, 0), SHIFT_REPEAT(16), [36] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_app_repeat1, 2, 0, 0), SHIFT_REPEAT(6), [39] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_app_repeat1, 2, 0, 0), [41] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_app_repeat1, 2, 0, 0), SHIFT_REPEAT(14), [44] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_square, 1, 0, 0), [46] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_term, 3, 0, 0), [48] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_term, 1, 0, 0), [50] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_labs_repeat1, 2, 0, 0), SHIFT_REPEAT(35), [53] = {.entry = {.count = 1, .reusable = false}}, REDUCE(aux_sym_labs_repeat1, 2, 0, 0), [55] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_labs_repeat1, 2, 0, 0), [57] = {.entry = {.count = 1, .reusable = true}}, SHIFT(35), [59] = {.entry = {.count = 1, .reusable = false}}, SHIFT(5), [61] = {.entry = {.count = 1, .reusable = true}}, SHIFT(2), [63] = {.entry = {.count = 1, .reusable = true}}, SHIFT(3), [65] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_param_block, 5, 0, 0), [67] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_param_block, 5, 0, 0), [69] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_param_block, 4, 0, 0), [71] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_param_block, 4, 0, 0), [73] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_app_term, 1, 0, 0), [75] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_expr, 1, 0, 0), [77] = {.entry = {.count = 1, .reusable = true}}, SHIFT(10), [79] = {.entry = {.count = 1, .reusable = true}}, SHIFT(9), [81] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_program_repeat1, 2, 0, 0), [83] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_program_repeat1, 2, 0, 0), SHIFT_REPEAT(18), [86] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_program_repeat1, 2, 0, 0), SHIFT_REPEAT(26), [89] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_program, 1, 0, 0), [91] = {.entry = {.count = 1, .reusable = true}}, SHIFT(26), [93] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_arrow, 3, 0, 0), [95] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_labs, 4, 0, 0), [97] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_pabs, 4, 0, 0), [99] = {.entry = {.count = 1, .reusable = true}}, SHIFT(11), [101] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_param_block_repeat1, 2, 0, 0), SHIFT_REPEAT(33), [104] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_param_block_repeat1, 2, 0, 0), [106] = {.entry = {.count = 1, .reusable = true}}, SHIFT(37), [108] = {.entry = {.count = 1, .reusable = true}}, SHIFT(7), [110] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_definition, 5, 0, 0), [112] = {.entry = {.count = 1, .reusable = true}}, SHIFT(33), [114] = {.entry = {.count = 1, .reusable = true}}, SHIFT(8), [116] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_definition, 4, 0, 0), [118] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_definition, 6, 0, 0), [120] = {.entry = {.count = 1, .reusable = true}}, SHIFT(20), [122] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_ascription, 2, 0, 0), [124] = {.entry = {.count = 1, .reusable = true}}, SHIFT(15), [126] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_pi, 1, 0, 0), [128] = {.entry = {.count = 1, .reusable = true}}, SHIFT(38), [130] = {.entry = {.count = 1, .reusable = true}}, ACCEPT_INPUT(), [132] = {.entry = {.count = 1, .reusable = true}}, SHIFT(4), [134] = {.entry = {.count = 1, .reusable = true}}, SHIFT(39), [136] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_lambda, 1, 0, 0), [138] = {.entry = {.count = 1, .reusable = true}}, SHIFT(36), [140] = {.entry = {.count = 1, .reusable = true}}, SHIFT(21), }; #ifdef __cplusplus extern "C" { #endif #ifdef TREE_SITTER_HIDE_SYMBOLS #define TS_PUBLIC #elif defined(_WIN32) #define TS_PUBLIC __declspec(dllexport) #else #define TS_PUBLIC __attribute__((visibility("default"))) #endif TS_PUBLIC const TSLanguage *tree_sitter_perga(void) { static const TSLanguage language = { .version = LANGUAGE_VERSION, .symbol_count = SYMBOL_COUNT, .alias_count = ALIAS_COUNT, .token_count = TOKEN_COUNT, .external_token_count = EXTERNAL_TOKEN_COUNT, .state_count = STATE_COUNT, .large_state_count = LARGE_STATE_COUNT, .production_id_count = PRODUCTION_ID_COUNT, .field_count = FIELD_COUNT, .max_alias_sequence_length = MAX_ALIAS_SEQUENCE_LENGTH, .parse_table = &ts_parse_table[0][0], .small_parse_table = ts_small_parse_table, .small_parse_table_map = ts_small_parse_table_map, .parse_actions = ts_parse_actions, .symbol_names = ts_symbol_names, .symbol_metadata = ts_symbol_metadata, .public_symbol_map = ts_symbol_map, .alias_map = ts_non_terminal_alias_map, .alias_sequences = &ts_alias_sequences[0][0], .lex_modes = ts_lex_modes, .lex_fn = ts_lex, .primary_state_ids = ts_primary_state_ids, }; return &language; } #ifdef __cplusplus } #endif