/* Automatically @generated by tree-sitter v0.25.10 */

#include "tree_sitter/parser.h"

#if defined(__GNUC__) || defined(__clang__)
#pragma GCC diagnostic ignored "-Wmissing-field-initializers"
#endif

#define LANGUAGE_VERSION 15
#define STATE_COUNT 97
#define LARGE_STATE_COUNT 2
#define SYMBOL_COUNT 65
#define ALIAS_COUNT 2
#define TOKEN_COUNT 41
#define EXTERNAL_TOKEN_COUNT 4
#define FIELD_COUNT 2
#define MAX_ALIAS_SEQUENCE_LENGTH 7
#define MAX_RESERVED_WORD_SET_SIZE 0
#define PRODUCTION_ID_COUNT 4
#define SUPERTYPE_COUNT 1

enum ts_symbol_identifiers {
  sym__identifier = 1,
  anon_sym_rule = 2,
  anon_sym_and = 3,
  anon_sym_LBRACE = 4,
  anon_sym_RBRACE = 5,
  anon_sym_let = 6,
  anon_sym_EQ = 7,
  anon_sym__ = 8,
  anon_sym_eof = 9,
  anon_sym_SQUOTE = 10,
  aux_sym_character_token1 = 11,
  anon_sym_DQUOTE = 12,
  anon_sym_SPACE = 13,
  anon_sym_LF = 14,
  anon_sym_TAB = 15,
  aux_sym_string_token1 = 16,
  aux_sym_string_token2 = 17,
  aux_sym_string_token3 = 18,
  aux_sym_escape_sequence_token1 = 19,
  aux_sym_escape_sequence_token2 = 20,
  aux_sym_escape_sequence_token3 = 21,
  aux_sym_escape_sequence_token4 = 22,
  anon_sym_LBRACK = 23,
  anon_sym_CARET = 24,
  anon_sym_RBRACK = 25,
  anon_sym_DASH = 26,
  anon_sym_POUND = 27,
  anon_sym_STAR = 28,
  anon_sym_PLUS = 29,
  anon_sym_QMARK = 30,
  anon_sym_PIPE = 31,
  anon_sym_LPAREN = 32,
  anon_sym_RPAREN = 33,
  anon_sym_as = 34,
  anon_sym_refill = 35,
  anon_sym_parse = 36,
  anon_sym_shortest = 37,
  sym_comment = 38,
  sym_ocaml = 39,
  sym__null = 40,
  sym_lexer_definition = 41,
  sym_action = 42,
  sym_named_regexp = 43,
  sym__regexp = 44,
  sym_character = 45,
  sym_string = 46,
  sym_escape_sequence = 47,
  sym_character_set = 48,
  sym_character_range = 49,
  sym_regexp_difference = 50,
  sym_regexp_repetition = 51,
  sym_regexp_alternative = 52,
  sym_regexp_concatenation = 53,
  sym_parenthesized_regexp = 54,
  sym_aliased_regexp = 55,
  sym_refill_handler = 56,
  sym_lexer_entry = 57,
  sym_lexer_case = 58,
  aux_sym_lexer_definition_repeat1 = 59,
  aux_sym_lexer_definition_repeat2 = 60,
  aux_sym_string_repeat1 = 61,
  aux_sym_character_set_repeat1 = 62,
  aux_sym_lexer_entry_repeat1 = 63,
  aux_sym_lexer_entry_repeat2 = 64,
  alias_sym_lexer_argument = 65,
  alias_sym_lexer_entry_name = 66,
};

static const char * const ts_symbol_names[] = {
  [ts_builtin_sym_end] = "end",
  [sym__identifier] = "regexp_name",
  [anon_sym_rule] = "rule",
  [anon_sym_and] = "and",
  [anon_sym_LBRACE] = "{",
  [anon_sym_RBRACE] = "}",
  [anon_sym_let] = "let",
  [anon_sym_EQ] = "=",
  [anon_sym__] = "any",
  [anon_sym_eof] = "eof",
  [anon_sym_SQUOTE] = "'",
  [aux_sym_character_token1] = "character_token1",
  [anon_sym_DQUOTE] = "\"",
  [anon_sym_SPACE] = " ",
  [anon_sym_LF] = "\n",
  [anon_sym_TAB] = "\t",
  [aux_sym_string_token1] = "string_token1",
  [aux_sym_string_token2] = "escape_sequence",
  [aux_sym_string_token3] = "escape_sequence",
  [aux_sym_escape_sequence_token1] = "escape_sequence_token1",
  [aux_sym_escape_sequence_token2] = "escape_sequence_token2",
  [aux_sym_escape_sequence_token3] = "escape_sequence_token3",
  [aux_sym_escape_sequence_token4] = "escape_sequence_token4",
  [anon_sym_LBRACK] = "[",
  [anon_sym_CARET] = "^",
  [anon_sym_RBRACK] = "]",
  [anon_sym_DASH] = "-",
  [anon_sym_POUND] = "#",
  [anon_sym_STAR] = "*",
  [anon_sym_PLUS] = "+",
  [anon_sym_QMARK] = "\?",
  [anon_sym_PIPE] = "|",
  [anon_sym_LPAREN] = "(",
  [anon_sym_RPAREN] = ")",
  [anon_sym_as] = "as",
  [anon_sym_refill] = "refill",
  [anon_sym_parse] = "parse",
  [anon_sym_shortest] = "shortest",
  [sym_comment] = "comment",
  [sym_ocaml] = "ocaml",
  [sym__null] = "_null",
  [sym_lexer_definition] = "lexer_definition",
  [sym_action] = "action",
  [sym_named_regexp] = "named_regexp",
  [sym__regexp] = "_regexp",
  [sym_character] = "character",
  [sym_string] = "string",
  [sym_escape_sequence] = "escape_sequence",
  [sym_character_set] = "character_set",
  [sym_character_range] = "character_range",
  [sym_regexp_difference] = "regexp_difference",
  [sym_regexp_repetition] = "regexp_repetition",
  [sym_regexp_alternative] = "regexp_alternative",
  [sym_regexp_concatenation] = "regexp_concatenation",
  [sym_parenthesized_regexp] = "parenthesized_regexp",
  [sym_aliased_regexp] = "aliased_regexp",
  [sym_refill_handler] = "refill_handler",
  [sym_lexer_entry] = "lexer_entry",
  [sym_lexer_case] = "lexer_case",
  [aux_sym_lexer_definition_repeat1] = "lexer_definition_repeat1",
  [aux_sym_lexer_definition_repeat2] = "lexer_definition_repeat2",
  [aux_sym_string_repeat1] = "string_repeat1",
  [aux_sym_character_set_repeat1] = "character_set_repeat1",
  [aux_sym_lexer_entry_repeat1] = "lexer_entry_repeat1",
  [aux_sym_lexer_entry_repeat2] = "lexer_entry_repeat2",
  [alias_sym_lexer_argument] = "lexer_argument",
  [alias_sym_lexer_entry_name] = "lexer_entry_name",
};

static const TSSymbol ts_symbol_map[] = {
  [ts_builtin_sym_end] = ts_builtin_sym_end,
  [sym__identifier] = sym__identifier,
  [anon_sym_rule] = anon_sym_rule,
  [anon_sym_and] = anon_sym_and,
  [anon_sym_LBRACE] = anon_sym_LBRACE,
  [anon_sym_RBRACE] = anon_sym_RBRACE,
  [anon_sym_let] = anon_sym_let,
  [anon_sym_EQ] = anon_sym_EQ,
  [anon_sym__] = anon_sym__,
  [anon_sym_eof] = anon_sym_eof,
  [anon_sym_SQUOTE] = anon_sym_SQUOTE,
  [aux_sym_character_token1] = aux_sym_character_token1,
  [anon_sym_DQUOTE] = anon_sym_DQUOTE,
  [anon_sym_SPACE] = anon_sym_SPACE,
  [anon_sym_LF] = anon_sym_LF,
  [anon_sym_TAB] = anon_sym_TAB,
  [aux_sym_string_token1] = aux_sym_string_token1,
  [aux_sym_string_token2] = sym_escape_sequence,
  [aux_sym_string_token3] = sym_escape_sequence,
  [aux_sym_escape_sequence_token1] = aux_sym_escape_sequence_token1,
  [aux_sym_escape_sequence_token2] = aux_sym_escape_sequence_token2,
  [aux_sym_escape_sequence_token3] = aux_sym_escape_sequence_token3,
  [aux_sym_escape_sequence_token4] = aux_sym_escape_sequence_token4,
  [anon_sym_LBRACK] = anon_sym_LBRACK,
  [anon_sym_CARET] = anon_sym_CARET,
  [anon_sym_RBRACK] = anon_sym_RBRACK,
  [anon_sym_DASH] = anon_sym_DASH,
  [anon_sym_POUND] = anon_sym_POUND,
  [anon_sym_STAR] = anon_sym_STAR,
  [anon_sym_PLUS] = anon_sym_PLUS,
  [anon_sym_QMARK] = anon_sym_QMARK,
  [anon_sym_PIPE] = anon_sym_PIPE,
  [anon_sym_LPAREN] = anon_sym_LPAREN,
  [anon_sym_RPAREN] = anon_sym_RPAREN,
  [anon_sym_as] = anon_sym_as,
  [anon_sym_refill] = anon_sym_refill,
  [anon_sym_parse] = anon_sym_parse,
  [anon_sym_shortest] = anon_sym_shortest,
  [sym_comment] = sym_comment,
  [sym_ocaml] = sym_ocaml,
  [sym__null] = sym__null,
  [sym_lexer_definition] = sym_lexer_definition,
  [sym_action] = sym_action,
  [sym_named_regexp] = sym_named_regexp,
  [sym__regexp] = sym__regexp,
  [sym_character] = sym_character,
  [sym_string] = sym_string,
  [sym_escape_sequence] = sym_escape_sequence,
  [sym_character_set] = sym_character_set,
  [sym_character_range] = sym_character_range,
  [sym_regexp_difference] = sym_regexp_difference,
  [sym_regexp_repetition] = sym_regexp_repetition,
  [sym_regexp_alternative] = sym_regexp_alternative,
  [sym_regexp_concatenation] = sym_regexp_concatenation,
  [sym_parenthesized_regexp] = sym_parenthesized_regexp,
  [sym_aliased_regexp] = sym_aliased_regexp,
  [sym_refill_handler] = sym_refill_handler,
  [sym_lexer_entry] = sym_lexer_entry,
  [sym_lexer_case] = sym_lexer_case,
  [aux_sym_lexer_definition_repeat1] = aux_sym_lexer_definition_repeat1,
  [aux_sym_lexer_definition_repeat2] = aux_sym_lexer_definition_repeat2,
  [aux_sym_string_repeat1] = aux_sym_string_repeat1,
  [aux_sym_character_set_repeat1] = aux_sym_character_set_repeat1,
  [aux_sym_lexer_entry_repeat1] = aux_sym_lexer_entry_repeat1,
  [aux_sym_lexer_entry_repeat2] = aux_sym_lexer_entry_repeat2,
  [alias_sym_lexer_argument] = alias_sym_lexer_argument,
  [alias_sym_lexer_entry_name] = alias_sym_lexer_entry_name,
};

static const TSSymbolMetadata ts_symbol_metadata[] = {
  [ts_builtin_sym_end] = {
    .visible = false,
    .named = true,
  },
  [sym__identifier] = {
    .visible = true,
    .named = true,
  },
  [anon_sym_rule] = {
    .visible = true,
    .named = false,
  },
  [anon_sym_and] = {
    .visible = true,
    .named = false,
  },
  [anon_sym_LBRACE] = {
    .visible = true,
    .named = false,
  },
  [anon_sym_RBRACE] = {
    .visible = true,
    .named = false,
  },
  [anon_sym_let] = {
    .visible = true,
    .named = false,
  },
  [anon_sym_EQ] = {
    .visible = true,
    .named = false,
  },
  [anon_sym__] = {
    .visible = true,
    .named = true,
  },
  [anon_sym_eof] = {
    .visible = true,
    .named = true,
  },
  [anon_sym_SQUOTE] = {
    .visible = true,
    .named = false,
  },
  [aux_sym_character_token1] = {
    .visible = false,
    .named = false,
  },
  [anon_sym_DQUOTE] = {
    .visible = true,
    .named = false,
  },
  [anon_sym_SPACE] = {
    .visible = true,
    .named = false,
  },
  [anon_sym_LF] = {
    .visible = true,
    .named = false,
  },
  [anon_sym_TAB] = {
    .visible = true,
    .named = false,
  },
  [aux_sym_string_token1] = {
    .visible = false,
    .named = false,
  },
  [aux_sym_string_token2] = {
    .visible = true,
    .named = true,
  },
  [aux_sym_string_token3] = {
    .visible = true,
    .named = true,
  },
  [aux_sym_escape_sequence_token1] = {
    .visible = false,
    .named = false,
  },
  [aux_sym_escape_sequence_token2] = {
    .visible = false,
    .named = false,
  },
  [aux_sym_escape_sequence_token3] = {
    .visible = false,
    .named = false,
  },
  [aux_sym_escape_sequence_token4] = {
    .visible = false,
    .named = false,
  },
  [anon_sym_LBRACK] = {
    .visible = true,
    .named = false,
  },
  [anon_sym_CARET] = {
    .visible = true,
    .named = false,
  },
  [anon_sym_RBRACK] = {
    .visible = true,
    .named = false,
  },
  [anon_sym_DASH] = {
    .visible = true,
    .named = false,
  },
  [anon_sym_POUND] = {
    .visible = true,
    .named = false,
  },
  [anon_sym_STAR] = {
    .visible = true,
    .named = false,
  },
  [anon_sym_PLUS] = {
    .visible = true,
    .named = false,
  },
  [anon_sym_QMARK] = {
    .visible = true,
    .named = false,
  },
  [anon_sym_PIPE] = {
    .visible = true,
    .named = false,
  },
  [anon_sym_LPAREN] = {
    .visible = true,
    .named = false,
  },
  [anon_sym_RPAREN] = {
    .visible = true,
    .named = false,
  },
  [anon_sym_as] = {
    .visible = true,
    .named = false,
  },
  [anon_sym_refill] = {
    .visible = true,
    .named = false,
  },
  [anon_sym_parse] = {
    .visible = true,
    .named = false,
  },
  [anon_sym_shortest] = {
    .visible = true,
    .named = false,
  },
  [sym_comment] = {
    .visible = true,
    .named = true,
  },
  [sym_ocaml] = {
    .visible = true,
    .named = true,
  },
  [sym__null] = {
    .visible = false,
    .named = true,
  },
  [sym_lexer_definition] = {
    .visible = true,
    .named = true,
  },
  [sym_action] = {
    .visible = true,
    .named = true,
  },
  [sym_named_regexp] = {
    .visible = true,
    .named = true,
  },
  [sym__regexp] = {
    .visible = false,
    .named = true,
    .supertype = true,
  },
  [sym_character] = {
    .visible = true,
    .named = true,
  },
  [sym_string] = {
    .visible = true,
    .named = true,
  },
  [sym_escape_sequence] = {
    .visible = true,
    .named = true,
  },
  [sym_character_set] = {
    .visible = true,
    .named = true,
  },
  [sym_character_range] = {
    .visible = true,
    .named = true,
  },
  [sym_regexp_difference] = {
    .visible = true,
    .named = true,
  },
  [sym_regexp_repetition] = {
    .visible = true,
    .named = true,
  },
  [sym_regexp_alternative] = {
    .visible = true,
    .named = true,
  },
  [sym_regexp_concatenation] = {
    .visible = true,
    .named = true,
  },
  [sym_parenthesized_regexp] = {
    .visible = true,
    .named = true,
  },
  [sym_aliased_regexp] = {
    .visible = true,
    .named = true,
  },
  [sym_refill_handler] = {
    .visible = true,
    .named = true,
  },
  [sym_lexer_entry] = {
    .visible = true,
    .named = true,
  },
  [sym_lexer_case] = {
    .visible = true,
    .named = true,
  },
  [aux_sym_lexer_definition_repeat1] = {
    .visible = false,
    .named = false,
  },
  [aux_sym_lexer_definition_repeat2] = {
    .visible = false,
    .named = false,
  },
  [aux_sym_string_repeat1] = {
    .visible = false,
    .named = false,
  },
  [aux_sym_character_set_repeat1] = {
    .visible = false,
    .named = false,
  },
  [aux_sym_lexer_entry_repeat1] = {
    .visible = false,
    .named = false,
  },
  [aux_sym_lexer_entry_repeat2] = {
    .visible = false,
    .named = false,
  },
  [alias_sym_lexer_argument] = {
    .visible = true,
    .named = true,
  },
  [alias_sym_lexer_entry_name] = {
    .visible = true,
    .named = true,
  },
};

enum ts_field_identifiers {
  field_name = 1,
  field_regexp = 2,
};

static const char * const ts_field_names[] = {
  [0] = NULL,
  [field_name] = "name",
  [field_regexp] = "regexp",
};

static const TSMapSlice ts_field_map_slices[PRODUCTION_ID_COUNT] = {
  [2] = {.index = 0, .length = 2},
  [3] = {.index = 2, .length = 1},
};

static const TSFieldMapEntry ts_field_map_entries[] = {
  [0] =
    {field_name, 1},
    {field_regexp, 3},
  [2] =
    {field_name, 0},
};

static const TSSymbol ts_alias_sequences[PRODUCTION_ID_COUNT][MAX_ALIAS_SEQUENCE_LENGTH] = {
  [0] = {0},
  [1] = {
    [0] = alias_sym_lexer_argument,
  },
  [3] = {
    [0] = alias_sym_lexer_entry_name,
  },
};

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] = 31,
  [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,
  [52] = 52,
  [53] = 53,
  [54] = 54,
  [55] = 55,
  [56] = 56,
  [57] = 57,
  [58] = 58,
  [59] = 59,
  [60] = 60,
  [61] = 61,
  [62] = 62,
  [63] = 63,
  [64] = 64,
  [65] = 17,
  [66] = 66,
  [67] = 67,
  [68] = 68,
  [69] = 69,
  [70] = 70,
  [71] = 71,
  [72] = 72,
  [73] = 73,
  [74] = 74,
  [75] = 75,
  [76] = 29,
  [77] = 77,
  [78] = 78,
  [79] = 79,
  [80] = 80,
  [81] = 81,
  [82] = 82,
  [83] = 83,
  [84] = 84,
  [85] = 85,
  [86] = 86,
  [87] = 87,
  [88] = 88,
  [89] = 89,
  [90] = 90,
  [91] = 91,
  [92] = 92,
  [93] = 93,
  [94] = 94,
  [95] = 92,
  [96] = 96,
};

static const TSSymbol ts_supertype_symbols[SUPERTYPE_COUNT] = {
  sym__regexp,
};

static const TSMapSlice ts_supertype_map_slices[] = {
  [sym__regexp] = {.index = 0, .length = 12},
};

static const TSSymbol ts_supertype_map_entries[] = {
  [0] =
    anon_sym__,
    anon_sym_eof,
    sym__identifier,
    sym_aliased_regexp,
    sym_character,
    sym_character_set,
    sym_parenthesized_regexp,
    sym_regexp_alternative,
    sym_regexp_concatenation,
    sym_regexp_difference,
    sym_regexp_repetition,
    sym_string,
};

static bool ts_lex(TSLexer *lexer, TSStateId state) {
  START_LEXER();
  eof = lexer->eof(lexer);
  switch (state) {
    case 0:
      if (eof) ADVANCE(15);
      ADVANCE_MAP(
        '"', 22,
        '#', 38,
        '\'', 19,
        '(', 43,
        ')', 44,
        '*', 39,
        '+', 40,
        '-', 37,
        '=', 18,
        '?', 41,
        '[', 34,
        '\\', 2,
        ']', 36,
        '^', 35,
        '{', 16,
        '|', 42,
        '}', 17,
      );
      if (('\t' <= lookahead && lookahead <= '\r') ||
          lookahead == ' ') SKIP(0);
      if (lookahead == '_' ||
          ('a' <= lookahead && lookahead <= 'z')) ADVANCE(45);
      END_STATE();
    case 1:
      if (lookahead == '\t') ADVANCE(25);
      if (lookahead == '\n') ADVANCE(24);
      if (lookahead == ' ') ADVANCE(23);
      if (lookahead == '"') ADVANCE(22);
      if (lookahead == '\\') ADVANCE(2);
      if ((0x0b <= lookahead && lookahead <= '\r')) ADVANCE(26);
      if (lookahead != 0) ADVANCE(27);
      END_STATE();
    case 2:
      ADVANCE_MAP(
        '\n', 29,
        'o', 7,
        'u', 5,
        'x', 14,
        ' ', 30,
        '"', 30,
        '\'', 30,
        '\\', 30,
        'b', 30,
        'n', 30,
        'r', 30,
        't', 30,
      );
      if (('0' <= lookahead && lookahead <= '9')) ADVANCE(11);
      END_STATE();
    case 3:
      if (lookahead == '\\') ADVANCE(4);
      if (('\t' <= lookahead && lookahead <= '\r') ||
          lookahead == ' ') ADVANCE(21);
      if (lookahead != 0 &&
          lookahead != '\'') ADVANCE(20);
      END_STATE();
    case 4:
      ADVANCE_MAP(
        'o', 7,
        'x', 14,
        ' ', 30,
        '"', 30,
        '\'', 30,
        '\\', 30,
        'b', 30,
        'n', 30,
        'r', 30,
        't', 30,
      );
      if (('0' <= lookahead && lookahead <= '9')) ADVANCE(11);
      END_STATE();
    case 5:
      if (lookahead == '{') ADVANCE(12);
      END_STATE();
    case 6:
      if (lookahead == '}') ADVANCE(28);
      if (('0' <= lookahead && lookahead <= '9') ||
          ('A' <= lookahead && lookahead <= 'F') ||
          ('a' <= lookahead && lookahead <= 'f')) ADVANCE(6);
      END_STATE();
    case 7:
      if (('0' <= lookahead && lookahead <= '3')) ADVANCE(9);
      END_STATE();
    case 8:
      if (('0' <= lookahead && lookahead <= '7')) ADVANCE(33);
      END_STATE();
    case 9:
      if (('0' <= lookahead && lookahead <= '7')) ADVANCE(8);
      END_STATE();
    case 10:
      if (('0' <= lookahead && lookahead <= '9')) ADVANCE(31);
      END_STATE();
    case 11:
      if (('0' <= lookahead && lookahead <= '9')) ADVANCE(10);
      END_STATE();
    case 12:
      if (('0' <= lookahead && lookahead <= '9') ||
          ('A' <= lookahead && lookahead <= 'F') ||
          ('a' <= lookahead && lookahead <= 'f')) ADVANCE(6);
      END_STATE();
    case 13:
      if (('0' <= lookahead && lookahead <= '9') ||
          ('A' <= lookahead && lookahead <= 'F') ||
          ('a' <= lookahead && lookahead <= 'f')) ADVANCE(32);
      END_STATE();
    case 14:
      if (('0' <= lookahead && lookahead <= '9') ||
          ('A' <= lookahead && lookahead <= 'F') ||
          ('a' <= lookahead && lookahead <= 'f')) ADVANCE(13);
      END_STATE();
    case 15:
      ACCEPT_TOKEN(ts_builtin_sym_end);
      END_STATE();
    case 16:
      ACCEPT_TOKEN(anon_sym_LBRACE);
      END_STATE();
    case 17:
      ACCEPT_TOKEN(anon_sym_RBRACE);
      END_STATE();
    case 18:
      ACCEPT_TOKEN(anon_sym_EQ);
      END_STATE();
    case 19:
      ACCEPT_TOKEN(anon_sym_SQUOTE);
      END_STATE();
    case 20:
      ACCEPT_TOKEN(aux_sym_character_token1);
      END_STATE();
    case 21:
      ACCEPT_TOKEN(aux_sym_character_token1);
      if (('\t' <= lookahead && lookahead <= '\r') ||
          lookahead == ' ') ADVANCE(21);
      if (lookahead != 0 &&
          lookahead != '\'' &&
          lookahead != '\\') ADVANCE(20);
      END_STATE();
    case 22:
      ACCEPT_TOKEN(anon_sym_DQUOTE);
      END_STATE();
    case 23:
      ACCEPT_TOKEN(anon_sym_SPACE);
      END_STATE();
    case 24:
      ACCEPT_TOKEN(anon_sym_LF);
      END_STATE();
    case 25:
      ACCEPT_TOKEN(anon_sym_TAB);
      END_STATE();
    case 26:
      ACCEPT_TOKEN(aux_sym_string_token1);
      if (('\t' <= lookahead && lookahead <= '\r') ||
          lookahead == ' ') ADVANCE(26);
      if (lookahead != 0 &&
          lookahead != '"' &&
          lookahead != '\\') ADVANCE(27);
      END_STATE();
    case 27:
      ACCEPT_TOKEN(aux_sym_string_token1);
      if (lookahead != 0 &&
          lookahead != '"' &&
          lookahead != '\\') ADVANCE(27);
      END_STATE();
    case 28:
      ACCEPT_TOKEN(aux_sym_string_token2);
      END_STATE();
    case 29:
      ACCEPT_TOKEN(aux_sym_string_token3);
      if (lookahead == '\t' ||
          lookahead == ' ') ADVANCE(29);
      END_STATE();
    case 30:
      ACCEPT_TOKEN(aux_sym_escape_sequence_token1);
      END_STATE();
    case 31:
      ACCEPT_TOKEN(aux_sym_escape_sequence_token2);
      END_STATE();
    case 32:
      ACCEPT_TOKEN(aux_sym_escape_sequence_token3);
      END_STATE();
    case 33:
      ACCEPT_TOKEN(aux_sym_escape_sequence_token4);
      END_STATE();
    case 34:
      ACCEPT_TOKEN(anon_sym_LBRACK);
      END_STATE();
    case 35:
      ACCEPT_TOKEN(anon_sym_CARET);
      END_STATE();
    case 36:
      ACCEPT_TOKEN(anon_sym_RBRACK);
      END_STATE();
    case 37:
      ACCEPT_TOKEN(anon_sym_DASH);
      END_STATE();
    case 38:
      ACCEPT_TOKEN(anon_sym_POUND);
      END_STATE();
    case 39:
      ACCEPT_TOKEN(anon_sym_STAR);
      END_STATE();
    case 40:
      ACCEPT_TOKEN(anon_sym_PLUS);
      END_STATE();
    case 41:
      ACCEPT_TOKEN(anon_sym_QMARK);
      END_STATE();
    case 42:
      ACCEPT_TOKEN(anon_sym_PIPE);
      END_STATE();
    case 43:
      ACCEPT_TOKEN(anon_sym_LPAREN);
      END_STATE();
    case 44:
      ACCEPT_TOKEN(anon_sym_RPAREN);
      END_STATE();
    case 45:
      ACCEPT_TOKEN(sym__identifier);
      if (lookahead == '\'' ||
          ('0' <= lookahead && lookahead <= '9') ||
          ('A' <= lookahead && lookahead <= 'Z') ||
          lookahead == '_' ||
          ('a' <= lookahead && lookahead <= 'z')) ADVANCE(45);
      END_STATE();
    default:
      return false;
  }
}

static bool ts_lex_keywords(TSLexer *lexer, TSStateId state) {
  START_LEXER();
  eof = lexer->eof(lexer);
  switch (state) {
    case 0:
      if (lookahead == '_') ADVANCE(1);
      if (lookahead == 'a') ADVANCE(2);
      if (lookahead == 'e') ADVANCE(3);
      if (lookahead == 'l') ADVANCE(4);
      if (lookahead == 'p') ADVANCE(5);
      if (lookahead == 'r') ADVANCE(6);
      if (lookahead == 's') ADVANCE(7);
      if (('\t' <= lookahead && lookahead <= '\r') ||
          lookahead == ' ') SKIP(0);
      END_STATE();
    case 1:
      ACCEPT_TOKEN(anon_sym__);
      END_STATE();
    case 2:
      if (lookahead == 'n') ADVANCE(8);
      if (lookahead == 's') ADVANCE(9);
      END_STATE();
    case 3:
      if (lookahead == 'o') ADVANCE(10);
      END_STATE();
    case 4:
      if (lookahead == 'e') ADVANCE(11);
      END_STATE();
    case 5:
      if (lookahead == 'a') ADVANCE(12);
      END_STATE();
    case 6:
      if (lookahead == 'e') ADVANCE(13);
      if (lookahead == 'u') ADVANCE(14);
      END_STATE();
    case 7:
      if (lookahead == 'h') ADVANCE(15);
      END_STATE();
    case 8:
      if (lookahead == 'd') ADVANCE(16);
      END_STATE();
    case 9:
      ACCEPT_TOKEN(anon_sym_as);
      END_STATE();
    case 10:
      if (lookahead == 'f') ADVANCE(17);
      END_STATE();
    case 11:
      if (lookahead == 't') ADVANCE(18);
      END_STATE();
    case 12:
      if (lookahead == 'r') ADVANCE(19);
      END_STATE();
    case 13:
      if (lookahead == 'f') ADVANCE(20);
      END_STATE();
    case 14:
      if (lookahead == 'l') ADVANCE(21);
      END_STATE();
    case 15:
      if (lookahead == 'o') ADVANCE(22);
      END_STATE();
    case 16:
      ACCEPT_TOKEN(anon_sym_and);
      END_STATE();
    case 17:
      ACCEPT_TOKEN(anon_sym_eof);
      END_STATE();
    case 18:
      ACCEPT_TOKEN(anon_sym_let);
      END_STATE();
    case 19:
      if (lookahead == 's') ADVANCE(23);
      END_STATE();
    case 20:
      if (lookahead == 'i') ADVANCE(24);
      END_STATE();
    case 21:
      if (lookahead == 'e') ADVANCE(25);
      END_STATE();
    case 22:
      if (lookahead == 'r') ADVANCE(26);
      END_STATE();
    case 23:
      if (lookahead == 'e') ADVANCE(27);
      END_STATE();
    case 24:
      if (lookahead == 'l') ADVANCE(28);
      END_STATE();
    case 25:
      ACCEPT_TOKEN(anon_sym_rule);
      END_STATE();
    case 26:
      if (lookahead == 't') ADVANCE(29);
      END_STATE();
    case 27:
      ACCEPT_TOKEN(anon_sym_parse);
      END_STATE();
    case 28:
      if (lookahead == 'l') ADVANCE(30);
      END_STATE();
    case 29:
      if (lookahead == 'e') ADVANCE(31);
      END_STATE();
    case 30:
      ACCEPT_TOKEN(anon_sym_refill);
      END_STATE();
    case 31:
      if (lookahead == 's') ADVANCE(32);
      END_STATE();
    case 32:
      if (lookahead == 't') ADVANCE(33);
      END_STATE();
    case 33:
      ACCEPT_TOKEN(anon_sym_shortest);
      END_STATE();
    default:
      return false;
  }
}

static const TSLexerMode ts_lex_modes[STATE_COUNT] = {
  [0] = {.lex_state = 0, .external_lex_state = 1},
  [1] = {.lex_state = 0, .external_lex_state = 2},
  [2] = {.lex_state = 0, .external_lex_state = 3},
  [3] = {.lex_state = 0, .external_lex_state = 3},
  [4] = {.lex_state = 0, .external_lex_state = 3},
  [5] = {.lex_state = 0, .external_lex_state = 3},
  [6] = {.lex_state = 0, .external_lex_state = 3},
  [7] = {.lex_state = 0, .external_lex_state = 3},
  [8] = {.lex_state = 0, .external_lex_state = 3},
  [9] = {.lex_state = 0, .external_lex_state = 3},
  [10] = {.lex_state = 0, .external_lex_state = 3},
  [11] = {.lex_state = 0, .external_lex_state = 3},
  [12] = {.lex_state = 0, .external_lex_state = 3},
  [13] = {.lex_state = 0, .external_lex_state = 3},
  [14] = {.lex_state = 0, .external_lex_state = 3},
  [15] = {.lex_state = 0, .external_lex_state = 3},
  [16] = {.lex_state = 0, .external_lex_state = 3},
  [17] = {.lex_state = 0, .external_lex_state = 3},
  [18] = {.lex_state = 0, .external_lex_state = 3},
  [19] = {.lex_state = 0, .external_lex_state = 3},
  [20] = {.lex_state = 0, .external_lex_state = 3},
  [21] = {.lex_state = 0, .external_lex_state = 3},
  [22] = {.lex_state = 0, .external_lex_state = 3},
  [23] = {.lex_state = 0, .external_lex_state = 3},
  [24] = {.lex_state = 0, .external_lex_state = 3},
  [25] = {.lex_state = 0, .external_lex_state = 3},
  [26] = {.lex_state = 1, .external_lex_state = 4},
  [27] = {.lex_state = 1, .external_lex_state = 4},
  [28] = {.lex_state = 1, .external_lex_state = 4},
  [29] = {.lex_state = 1, .external_lex_state = 4},
  [30] = {.lex_state = 0, .external_lex_state = 2},
  [31] = {.lex_state = 3, .external_lex_state = 5},
  [32] = {.lex_state = 3, .external_lex_state = 5},
  [33] = {.lex_state = 0, .external_lex_state = 2},
  [34] = {.lex_state = 0, .external_lex_state = 2},
  [35] = {.lex_state = 0, .external_lex_state = 2},
  [36] = {.lex_state = 0, .external_lex_state = 2},
  [37] = {.lex_state = 0, .external_lex_state = 2},
  [38] = {.lex_state = 0, .external_lex_state = 2},
  [39] = {.lex_state = 0, .external_lex_state = 2},
  [40] = {.lex_state = 0, .external_lex_state = 2},
  [41] = {.lex_state = 0, .external_lex_state = 2},
  [42] = {.lex_state = 0, .external_lex_state = 2},
  [43] = {.lex_state = 0, .external_lex_state = 2},
  [44] = {.lex_state = 0, .external_lex_state = 2},
  [45] = {.lex_state = 0, .external_lex_state = 2},
  [46] = {.lex_state = 0, .external_lex_state = 2},
  [47] = {.lex_state = 0, .external_lex_state = 2},
  [48] = {.lex_state = 0, .external_lex_state = 2},
  [49] = {.lex_state = 0, .external_lex_state = 2},
  [50] = {.lex_state = 0, .external_lex_state = 2},
  [51] = {.lex_state = 0, .external_lex_state = 2},
  [52] = {.lex_state = 0, .external_lex_state = 2},
  [53] = {.lex_state = 0, .external_lex_state = 2},
  [54] = {.lex_state = 0, .external_lex_state = 2},
  [55] = {.lex_state = 0, .external_lex_state = 2},
  [56] = {.lex_state = 0, .external_lex_state = 2},
  [57] = {.lex_state = 0, .external_lex_state = 2},
  [58] = {.lex_state = 0, .external_lex_state = 2},
  [59] = {.lex_state = 0, .external_lex_state = 2},
  [60] = {.lex_state = 0, .external_lex_state = 2},
  [61] = {.lex_state = 0, .external_lex_state = 2},
  [62] = {.lex_state = 0, .external_lex_state = 2},
  [63] = {.lex_state = 0, .external_lex_state = 2},
  [64] = {.lex_state = 0, .external_lex_state = 2},
  [65] = {.lex_state = 0, .external_lex_state = 2},
  [66] = {.lex_state = 0, .external_lex_state = 2},
  [67] = {.lex_state = 0, .external_lex_state = 2},
  [68] = {.lex_state = 0, .external_lex_state = 2},
  [69] = {.lex_state = 0, .external_lex_state = 2},
  [70] = {.lex_state = 0, .external_lex_state = 2},
  [71] = {.lex_state = 0, .external_lex_state = 2},
  [72] = {.lex_state = 0, .external_lex_state = 2},
  [73] = {.lex_state = 0, .external_lex_state = 2},
  [74] = {.lex_state = 0, .external_lex_state = 2},
  [75] = {.lex_state = 0, .external_lex_state = 2},
  [76] = {.lex_state = 0, .external_lex_state = 2},
  [77] = {.lex_state = 0, .external_lex_state = 2},
  [78] = {.lex_state = 0, .external_lex_state = 2},
  [79] = {.lex_state = 0, .external_lex_state = 6},
  [80] = {.lex_state = 0, .external_lex_state = 2},
  [81] = {.lex_state = 0, .external_lex_state = 2},
  [82] = {.lex_state = 0, .external_lex_state = 2},
  [83] = {.lex_state = 0, .external_lex_state = 2},
  [84] = {.lex_state = 0, .external_lex_state = 2},
  [85] = {.lex_state = 0, .external_lex_state = 2},
  [86] = {.lex_state = 0, .external_lex_state = 2},
  [87] = {.lex_state = 0, .external_lex_state = 2},
  [88] = {.lex_state = 0, .external_lex_state = 2},
  [89] = {.lex_state = 0, .external_lex_state = 2},
  [90] = {.lex_state = 0, .external_lex_state = 2},
  [91] = {.lex_state = 0, .external_lex_state = 2},
  [92] = {.lex_state = 0, .external_lex_state = 2},
  [93] = {.lex_state = 0, .external_lex_state = 2},
  [94] = {.lex_state = 0, .external_lex_state = 2},
  [95] = {.lex_state = 0, .external_lex_state = 2},
  [96] = {.lex_state = 0, .external_lex_state = 6},
};

static const uint16_t ts_parse_table[LARGE_STATE_COUNT][SYMBOL_COUNT] = {
  [STATE(0)] = {
    [ts_builtin_sym_end] = ACTIONS(1),
    [sym__identifier] = ACTIONS(1),
    [anon_sym_rule] = ACTIONS(1),
    [anon_sym_and] = ACTIONS(1),
    [anon_sym_LBRACE] = ACTIONS(1),
    [anon_sym_RBRACE] = ACTIONS(1),
    [anon_sym_let] = ACTIONS(1),
    [anon_sym_EQ] = ACTIONS(1),
    [anon_sym__] = ACTIONS(1),
    [anon_sym_eof] = ACTIONS(1),
    [anon_sym_SQUOTE] = ACTIONS(1),
    [anon_sym_DQUOTE] = ACTIONS(1),
    [aux_sym_string_token2] = ACTIONS(1),
    [aux_sym_string_token3] = ACTIONS(1),
    [aux_sym_escape_sequence_token1] = ACTIONS(1),
    [aux_sym_escape_sequence_token2] = ACTIONS(1),
    [aux_sym_escape_sequence_token3] = ACTIONS(1),
    [aux_sym_escape_sequence_token4] = ACTIONS(1),
    [anon_sym_LBRACK] = ACTIONS(1),
    [anon_sym_CARET] = ACTIONS(1),
    [anon_sym_RBRACK] = ACTIONS(1),
    [anon_sym_DASH] = ACTIONS(1),
    [anon_sym_POUND] = ACTIONS(1),
    [anon_sym_STAR] = ACTIONS(1),
    [anon_sym_PLUS] = ACTIONS(1),
    [anon_sym_QMARK] = ACTIONS(1),
    [anon_sym_PIPE] = ACTIONS(1),
    [anon_sym_LPAREN] = ACTIONS(1),
    [anon_sym_RPAREN] = ACTIONS(1),
    [anon_sym_as] = ACTIONS(1),
    [anon_sym_refill] = ACTIONS(1),
    [anon_sym_parse] = ACTIONS(1),
    [anon_sym_shortest] = ACTIONS(1),
    [sym_comment] = ACTIONS(3),
    [sym_ocaml] = ACTIONS(1),
    [sym__null] = ACTIONS(1),
  },
  [STATE(1)] = {
    [sym_lexer_definition] = STATE(89),
    [sym_action] = STATE(34),
    [sym_named_regexp] = STATE(33),
    [sym_refill_handler] = STATE(86),
    [aux_sym_lexer_definition_repeat1] = STATE(33),
    [anon_sym_rule] = ACTIONS(5),
    [anon_sym_LBRACE] = ACTIONS(7),
    [anon_sym_let] = ACTIONS(9),
    [anon_sym_refill] = ACTIONS(11),
    [sym_comment] = ACTIONS(3),
  },
};

static const uint16_t ts_small_parse_table[] = {
  [0] = 5,
    ACTIONS(3), 1,
      sym_comment,
    STATE(3), 1,
      sym__regexp,
    ACTIONS(13), 7,
      anon_sym_rule,
      anon_sym_let,
      anon_sym__,
      anon_sym_eof,
      anon_sym_as,
      anon_sym_refill,
      sym__identifier,
    STATE(14), 9,
      sym_character,
      sym_string,
      sym_character_set,
      sym_regexp_difference,
      sym_regexp_repetition,
      sym_regexp_alternative,
      sym_regexp_concatenation,
      sym_parenthesized_regexp,
      sym_aliased_regexp,
    ACTIONS(15), 11,
      anon_sym_LBRACE,
      anon_sym_SQUOTE,
      anon_sym_DQUOTE,
      anon_sym_LBRACK,
      anon_sym_POUND,
      anon_sym_STAR,
      anon_sym_PLUS,
      anon_sym_QMARK,
      anon_sym_PIPE,
      anon_sym_LPAREN,
      anon_sym_RPAREN,
  [40] = 7,
    ACTIONS(3), 1,
      sym_comment,
    ACTIONS(21), 1,
      anon_sym_POUND,
    STATE(3), 1,
      sym__regexp,
    ACTIONS(23), 3,
      anon_sym_STAR,
      anon_sym_PLUS,
      anon_sym_QMARK,
    ACTIONS(17), 7,
      anon_sym_rule,
      anon_sym_let,
      anon_sym__,
      anon_sym_eof,
      anon_sym_as,
      anon_sym_refill,
      sym__identifier,
    ACTIONS(19), 7,
      anon_sym_LBRACE,
      anon_sym_SQUOTE,
      anon_sym_DQUOTE,
      anon_sym_LBRACK,
      anon_sym_PIPE,
      anon_sym_LPAREN,
      anon_sym_RPAREN,
    STATE(14), 9,
      sym_character,
      sym_string,
      sym_character_set,
      sym_regexp_difference,
      sym_regexp_repetition,
      sym_regexp_alternative,
      sym_regexp_concatenation,
      sym_parenthesized_regexp,
      sym_aliased_regexp,
  [84] = 12,
    ACTIONS(3), 1,
      sym_comment,
    ACTIONS(21), 1,
      anon_sym_POUND,
    ACTIONS(31), 1,
      anon_sym_SQUOTE,
    ACTIONS(33), 1,
      anon_sym_DQUOTE,
    ACTIONS(35), 1,
      anon_sym_LBRACK,
    ACTIONS(37), 1,
      anon_sym_LPAREN,
    STATE(3), 1,
      sym__regexp,
    ACTIONS(23), 3,
      anon_sym_STAR,
      anon_sym_PLUS,
      anon_sym_QMARK,
    ACTIONS(25), 3,
      anon_sym__,
      anon_sym_eof,
      sym__identifier,
    ACTIONS(29), 3,
      anon_sym_LBRACE,
      anon_sym_PIPE,
      anon_sym_RPAREN,
    ACTIONS(27), 4,
      anon_sym_rule,
      anon_sym_let,
      anon_sym_as,
      anon_sym_refill,
    STATE(14), 9,
      sym_character,
      sym_string,
      sym_character_set,
      sym_regexp_difference,
      sym_regexp_repetition,
      sym_regexp_alternative,
      sym_regexp_concatenation,
      sym_parenthesized_regexp,
      sym_aliased_regexp,
  [138] = 13,
    ACTIONS(3), 1,
      sym_comment,
    ACTIONS(21), 1,
      anon_sym_POUND,
    ACTIONS(31), 1,
      anon_sym_SQUOTE,
    ACTIONS(33), 1,
      anon_sym_DQUOTE,
    ACTIONS(35), 1,
      anon_sym_LBRACK,
    ACTIONS(37), 1,
      anon_sym_LPAREN,
    ACTIONS(41), 1,
      anon_sym_PIPE,
    ACTIONS(43), 1,
      anon_sym_as,
    STATE(3), 1,
      sym__regexp,
    ACTIONS(23), 3,
      anon_sym_STAR,
      anon_sym_PLUS,
      anon_sym_QMARK,
    ACTIONS(25), 3,
      anon_sym__,
      anon_sym_eof,
      sym__identifier,
    ACTIONS(39), 3,
      anon_sym_rule,
      anon_sym_let,
      anon_sym_refill,
    STATE(14), 9,
      sym_character,
      sym_string,
      sym_character_set,
      sym_regexp_difference,
      sym_regexp_repetition,
      sym_regexp_alternative,
      sym_regexp_concatenation,
      sym_parenthesized_regexp,
      sym_aliased_regexp,
  [192] = 14,
    ACTIONS(3), 1,
      sym_comment,
    ACTIONS(7), 1,
      anon_sym_LBRACE,
    ACTIONS(21), 1,
      anon_sym_POUND,
    ACTIONS(31), 1,
      anon_sym_SQUOTE,
    ACTIONS(33), 1,
      anon_sym_DQUOTE,
    ACTIONS(35), 1,
      anon_sym_LBRACK,
    ACTIONS(37), 1,
      anon_sym_LPAREN,
    ACTIONS(41), 1,
      anon_sym_PIPE,
    ACTIONS(43), 1,
      anon_sym_as,
    STATE(3), 1,
      sym__regexp,
    STATE(58), 1,
      sym_action,
    ACTIONS(23), 3,
      anon_sym_STAR,
      anon_sym_PLUS,
      anon_sym_QMARK,
    ACTIONS(25), 3,
      anon_sym__,
      anon_sym_eof,
      sym__identifier,
    STATE(14), 9,
      sym_character,
      sym_string,
      sym_character_set,
      sym_regexp_difference,
      sym_regexp_repetition,
      sym_regexp_alternative,
      sym_regexp_concatenation,
      sym_parenthesized_regexp,
      sym_aliased_regexp,
  [247] = 13,
    ACTIONS(3), 1,
      sym_comment,
    ACTIONS(21), 1,
      anon_sym_POUND,
    ACTIONS(31), 1,
      anon_sym_SQUOTE,
    ACTIONS(33), 1,
      anon_sym_DQUOTE,
    ACTIONS(35), 1,
      anon_sym_LBRACK,
    ACTIONS(37), 1,
      anon_sym_LPAREN,
    ACTIONS(41), 1,
      anon_sym_PIPE,
    ACTIONS(43), 1,
      anon_sym_as,
    ACTIONS(45), 1,
      anon_sym_RPAREN,
    STATE(3), 1,
      sym__regexp,
    ACTIONS(23), 3,
      anon_sym_STAR,
      anon_sym_PLUS,
      anon_sym_QMARK,
    ACTIONS(25), 3,
      anon_sym__,
      anon_sym_eof,
      sym__identifier,
    STATE(14), 9,
      sym_character,
      sym_string,
      sym_character_set,
      sym_regexp_difference,
      sym_regexp_repetition,
      sym_regexp_alternative,
      sym_regexp_concatenation,
      sym_parenthesized_regexp,
      sym_aliased_regexp,
  [299] = 10,
    ACTIONS(3), 1,
      sym_comment,
    ACTIONS(31), 1,
      anon_sym_SQUOTE,
    ACTIONS(33), 1,
      anon_sym_DQUOTE,
    ACTIONS(35), 1,
      anon_sym_LBRACK,
    ACTIONS(37), 1,
      anon_sym_LPAREN,
    ACTIONS(47), 1,
      anon_sym_PIPE,
    STATE(6), 1,
      sym__regexp,
    STATE(42), 1,
      sym_lexer_case,
    ACTIONS(25), 3,
      anon_sym__,
      anon_sym_eof,
      sym__identifier,
    STATE(14), 9,
      sym_character,
      sym_string,
      sym_character_set,
      sym_regexp_difference,
      sym_regexp_repetition,
      sym_regexp_alternative,
      sym_regexp_concatenation,
      sym_parenthesized_regexp,
      sym_aliased_regexp,
  [340] = 10,
    ACTIONS(3), 1,
      sym_comment,
    ACTIONS(31), 1,
      anon_sym_SQUOTE,
    ACTIONS(33), 1,
      anon_sym_DQUOTE,
    ACTIONS(35), 1,
      anon_sym_LBRACK,
    ACTIONS(37), 1,
      anon_sym_LPAREN,
    ACTIONS(49), 1,
      anon_sym_PIPE,
    STATE(6), 1,
      sym__regexp,
    STATE(47), 1,
      sym_lexer_case,
    ACTIONS(25), 3,
      anon_sym__,
      anon_sym_eof,
      sym__identifier,
    STATE(14), 9,
      sym_character,
      sym_string,
      sym_character_set,
      sym_regexp_difference,
      sym_regexp_repetition,
      sym_regexp_alternative,
      sym_regexp_concatenation,
      sym_parenthesized_regexp,
      sym_aliased_regexp,
  [381] = 3,
    ACTIONS(3), 1,
      sym_comment,
    ACTIONS(51), 7,
      anon_sym_rule,
      anon_sym_let,
      anon_sym__,
      anon_sym_eof,
      anon_sym_as,
      anon_sym_refill,
      sym__identifier,
    ACTIONS(53), 11,
      anon_sym_LBRACE,
      anon_sym_SQUOTE,
      anon_sym_DQUOTE,
      anon_sym_LBRACK,
      anon_sym_POUND,
      anon_sym_STAR,
      anon_sym_PLUS,
      anon_sym_QMARK,
      anon_sym_PIPE,
      anon_sym_LPAREN,
      anon_sym_RPAREN,
  [407] = 3,
    ACTIONS(3), 1,
      sym_comment,
    ACTIONS(55), 7,
      anon_sym_rule,
      anon_sym_let,
      anon_sym__,
      anon_sym_eof,
      anon_sym_as,
      anon_sym_refill,
      sym__identifier,
    ACTIONS(57), 11,
      anon_sym_LBRACE,
      anon_sym_SQUOTE,
      anon_sym_DQUOTE,
      anon_sym_LBRACK,
      anon_sym_POUND,
      anon_sym_STAR,
      anon_sym_PLUS,
      anon_sym_QMARK,
      anon_sym_PIPE,
      anon_sym_LPAREN,
      anon_sym_RPAREN,
  [433] = 9,
    ACTIONS(3), 1,
      sym_comment,
    ACTIONS(31), 1,
      anon_sym_SQUOTE,
    ACTIONS(33), 1,
      anon_sym_DQUOTE,
    ACTIONS(35), 1,
      anon_sym_LBRACK,
    ACTIONS(37), 1,
      anon_sym_LPAREN,
    STATE(6), 1,
      sym__regexp,
    STATE(47), 1,
      sym_lexer_case,
    ACTIONS(25), 3,
      anon_sym__,
      anon_sym_eof,
      sym__identifier,
    STATE(14), 9,
      sym_character,
      sym_string,
      sym_character_set,
      sym_regexp_difference,
      sym_regexp_repetition,
      sym_regexp_alternative,
      sym_regexp_concatenation,
      sym_parenthesized_regexp,
      sym_aliased_regexp,
  [471] = 3,
    ACTIONS(3), 1,
      sym_comment,
    ACTIONS(59), 7,
      anon_sym_rule,
      anon_sym_let,
      anon_sym__,
      anon_sym_eof,
      anon_sym_as,
      anon_sym_refill,
      sym__identifier,
    ACTIONS(61), 11,
      anon_sym_LBRACE,
      anon_sym_SQUOTE,
      anon_sym_DQUOTE,
      anon_sym_LBRACK,
      anon_sym_POUND,
      anon_sym_STAR,
      anon_sym_PLUS,
      anon_sym_QMARK,
      anon_sym_PIPE,
      anon_sym_LPAREN,
      anon_sym_RPAREN,
  [497] = 3,
    ACTIONS(3), 1,
      sym_comment,
    ACTIONS(63), 7,
      anon_sym_rule,
      anon_sym_let,
      anon_sym__,
      anon_sym_eof,
      anon_sym_as,
      anon_sym_refill,
      sym__identifier,
    ACTIONS(65), 11,
      anon_sym_LBRACE,
      anon_sym_SQUOTE,
      anon_sym_DQUOTE,
      anon_sym_LBRACK,
      anon_sym_POUND,
      anon_sym_STAR,
      anon_sym_PLUS,
      anon_sym_QMARK,
      anon_sym_PIPE,
      anon_sym_LPAREN,
      anon_sym_RPAREN,
  [523] = 9,
    ACTIONS(3), 1,
      sym_comment,
    ACTIONS(31), 1,
      anon_sym_SQUOTE,
    ACTIONS(33), 1,
      anon_sym_DQUOTE,
    ACTIONS(35), 1,
      anon_sym_LBRACK,
    ACTIONS(37), 1,
      anon_sym_LPAREN,
    STATE(6), 1,
      sym__regexp,
    STATE(56), 1,
      sym_lexer_case,
    ACTIONS(25), 3,
      anon_sym__,
      anon_sym_eof,
      sym__identifier,
    STATE(14), 9,
      sym_character,
      sym_string,
      sym_character_set,
      sym_regexp_difference,
      sym_regexp_repetition,
      sym_regexp_alternative,
      sym_regexp_concatenation,
      sym_parenthesized_regexp,
      sym_aliased_regexp,
  [561] = 9,
    ACTIONS(3), 1,
      sym_comment,
    ACTIONS(31), 1,
      anon_sym_SQUOTE,
    ACTIONS(33), 1,
      anon_sym_DQUOTE,
    ACTIONS(35), 1,
      anon_sym_LBRACK,
    ACTIONS(37), 1,
      anon_sym_LPAREN,
    STATE(6), 1,
      sym__regexp,
    STATE(55), 1,
      sym_lexer_case,
    ACTIONS(25), 3,
      anon_sym__,
      anon_sym_eof,
      sym__identifier,
    STATE(14), 9,
      sym_character,
      sym_string,
      sym_character_set,
      sym_regexp_difference,
      sym_regexp_repetition,
      sym_regexp_alternative,
      sym_regexp_concatenation,
      sym_parenthesized_regexp,
      sym_aliased_regexp,
  [599] = 3,
    ACTIONS(3), 1,
      sym_comment,
    ACTIONS(67), 7,
      anon_sym_rule,
      anon_sym_let,
      anon_sym__,
      anon_sym_eof,
      anon_sym_as,
      anon_sym_refill,
      sym__identifier,
    ACTIONS(69), 11,
      anon_sym_LBRACE,
      anon_sym_SQUOTE,
      anon_sym_DQUOTE,
      anon_sym_LBRACK,
      anon_sym_POUND,
      anon_sym_STAR,
      anon_sym_PLUS,
      anon_sym_QMARK,
      anon_sym_PIPE,
      anon_sym_LPAREN,
      anon_sym_RPAREN,
  [625] = 3,
    ACTIONS(3), 1,
      sym_comment,
    ACTIONS(71), 7,
      anon_sym_rule,
      anon_sym_let,
      anon_sym__,
      anon_sym_eof,
      anon_sym_as,
      anon_sym_refill,
      sym__identifier,
    ACTIONS(73), 11,
      anon_sym_LBRACE,
      anon_sym_SQUOTE,
      anon_sym_DQUOTE,
      anon_sym_LBRACK,
      anon_sym_POUND,
      anon_sym_STAR,
      anon_sym_PLUS,
      anon_sym_QMARK,
      anon_sym_PIPE,
      anon_sym_LPAREN,
      anon_sym_RPAREN,
  [651] = 3,
    ACTIONS(3), 1,
      sym_comment,
    ACTIONS(75), 7,
      anon_sym_rule,
      anon_sym_let,
      anon_sym__,
      anon_sym_eof,
      anon_sym_as,
      anon_sym_refill,
      sym__identifier,
    ACTIONS(77), 11,
      anon_sym_LBRACE,
      anon_sym_SQUOTE,
      anon_sym_DQUOTE,
      anon_sym_LBRACK,
      anon_sym_POUND,
      anon_sym_STAR,
      anon_sym_PLUS,
      anon_sym_QMARK,
      anon_sym_PIPE,
      anon_sym_LPAREN,
      anon_sym_RPAREN,
  [677] = 3,
    ACTIONS(3), 1,
      sym_comment,
    ACTIONS(79), 7,
      anon_sym_rule,
      anon_sym_let,
      anon_sym__,
      anon_sym_eof,
      anon_sym_as,
      anon_sym_refill,
      sym__identifier,
    ACTIONS(81), 11,
      anon_sym_LBRACE,
      anon_sym_SQUOTE,
      anon_sym_DQUOTE,
      anon_sym_LBRACK,
      anon_sym_POUND,
      anon_sym_STAR,
      anon_sym_PLUS,
      anon_sym_QMARK,
      anon_sym_PIPE,
      anon_sym_LPAREN,
      anon_sym_RPAREN,
  [703] = 3,
    ACTIONS(3), 1,
      sym_comment,
    ACTIONS(83), 7,
      anon_sym_rule,
      anon_sym_let,
      anon_sym__,
      anon_sym_eof,
      anon_sym_as,
      anon_sym_refill,
      sym__identifier,
    ACTIONS(85), 11,
      anon_sym_LBRACE,
      anon_sym_SQUOTE,
      anon_sym_DQUOTE,
      anon_sym_LBRACK,
      anon_sym_POUND,
      anon_sym_STAR,
      anon_sym_PLUS,
      anon_sym_QMARK,
      anon_sym_PIPE,
      anon_sym_LPAREN,
      anon_sym_RPAREN,
  [729] = 8,
    ACTIONS(3), 1,
      sym_comment,
    ACTIONS(31), 1,
      anon_sym_SQUOTE,
    ACTIONS(33), 1,
      anon_sym_DQUOTE,
    ACTIONS(35), 1,
      anon_sym_LBRACK,
    ACTIONS(37), 1,
      anon_sym_LPAREN,
    STATE(5), 1,
      sym__regexp,
    ACTIONS(25), 3,
      anon_sym__,
      anon_sym_eof,
      sym__identifier,
    STATE(14), 9,
      sym_character,
      sym_string,
      sym_character_set,
      sym_regexp_difference,
      sym_regexp_repetition,
      sym_regexp_alternative,
      sym_regexp_concatenation,
      sym_parenthesized_regexp,
      sym_aliased_regexp,
  [764] = 8,
    ACTIONS(3), 1,
      sym_comment,
    ACTIONS(31), 1,
      anon_sym_SQUOTE,
    ACTIONS(33), 1,
      anon_sym_DQUOTE,
    ACTIONS(35), 1,
      anon_sym_LBRACK,
    ACTIONS(37), 1,
      anon_sym_LPAREN,
    STATE(2), 1,
      sym__regexp,
    ACTIONS(25), 3,
      anon_sym__,
      anon_sym_eof,
      sym__identifier,
    STATE(14), 9,
      sym_character,
      sym_string,
      sym_character_set,
      sym_regexp_difference,
      sym_regexp_repetition,
      sym_regexp_alternative,
      sym_regexp_concatenation,
      sym_parenthesized_regexp,
      sym_aliased_regexp,
  [799] = 8,
    ACTIONS(3), 1,
      sym_comment,
    ACTIONS(31), 1,
      anon_sym_SQUOTE,
    ACTIONS(33), 1,
      anon_sym_DQUOTE,
    ACTIONS(35), 1,
      anon_sym_LBRACK,
    ACTIONS(37), 1,
      anon_sym_LPAREN,
    STATE(4), 1,
      sym__regexp,
    ACTIONS(25), 3,
      anon_sym__,
      anon_sym_eof,
      sym__identifier,
    STATE(14), 9,
      sym_character,
      sym_string,
      sym_character_set,
      sym_regexp_difference,
      sym_regexp_repetition,
      sym_regexp_alternative,
      sym_regexp_concatenation,
      sym_parenthesized_regexp,
      sym_aliased_regexp,
  [834] = 8,
    ACTIONS(3), 1,
      sym_comment,
    ACTIONS(31), 1,
      anon_sym_SQUOTE,
    ACTIONS(33), 1,
      anon_sym_DQUOTE,
    ACTIONS(35), 1,
      anon_sym_LBRACK,
    ACTIONS(37), 1,
      anon_sym_LPAREN,
    STATE(7), 1,
      sym__regexp,
    ACTIONS(25), 3,
      anon_sym__,
      anon_sym_eof,
      sym__identifier,
    STATE(14), 9,
      sym_character,
      sym_string,
      sym_character_set,
      sym_regexp_difference,
      sym_regexp_repetition,
      sym_regexp_alternative,
      sym_regexp_concatenation,
      sym_parenthesized_regexp,
      sym_aliased_regexp,
  [869] = 6,
    ACTIONS(3), 1,
      sym_comment,
    ACTIONS(87), 1,
      anon_sym_DQUOTE,
    ACTIONS(93), 1,
      sym__null,
    STATE(28), 2,
      sym_escape_sequence,
      aux_sym_string_repeat1,
    ACTIONS(91), 4,
      aux_sym_escape_sequence_token1,
      aux_sym_escape_sequence_token2,
      aux_sym_escape_sequence_token3,
      aux_sym_escape_sequence_token4,
    ACTIONS(89), 6,
      anon_sym_SPACE,
      anon_sym_LF,
      anon_sym_TAB,
      aux_sym_string_token1,
      aux_sym_string_token2,
      aux_sym_string_token3,
  [897] = 6,
    ACTIONS(3), 1,
      sym_comment,
    ACTIONS(95), 1,
      anon_sym_DQUOTE,
    ACTIONS(99), 1,
      sym__null,
    STATE(26), 2,
      sym_escape_sequence,
      aux_sym_string_repeat1,
    ACTIONS(91), 4,
      aux_sym_escape_sequence_token1,
      aux_sym_escape_sequence_token2,
      aux_sym_escape_sequence_token3,
      aux_sym_escape_sequence_token4,
    ACTIONS(97), 6,
      anon_sym_SPACE,
      anon_sym_LF,
      anon_sym_TAB,
      aux_sym_string_token1,
      aux_sym_string_token2,
      aux_sym_string_token3,
  [925] = 6,
    ACTIONS(3), 1,
      sym_comment,
    ACTIONS(101), 1,
      anon_sym_DQUOTE,
    ACTIONS(109), 1,
      sym__null,
    STATE(28), 2,
      sym_escape_sequence,
      aux_sym_string_repeat1,
    ACTIONS(106), 4,
      aux_sym_escape_sequence_token1,
      aux_sym_escape_sequence_token2,
      aux_sym_escape_sequence_token3,
      aux_sym_escape_sequence_token4,
    ACTIONS(103), 6,
      anon_sym_SPACE,
      anon_sym_LF,
      anon_sym_TAB,
      aux_sym_string_token1,
      aux_sym_string_token2,
      aux_sym_string_token3,
  [953] = 3,
    ACTIONS(3), 1,
      sym_comment,
    ACTIONS(114), 1,
      sym__null,
    ACTIONS(112), 11,
      anon_sym_DQUOTE,
      anon_sym_SPACE,
      anon_sym_LF,
      anon_sym_TAB,
      aux_sym_string_token1,
      aux_sym_string_token2,
      aux_sym_string_token3,
      aux_sym_escape_sequence_token1,
      aux_sym_escape_sequence_token2,
      aux_sym_escape_sequence_token3,
      aux_sym_escape_sequence_token4,
  [973] = 2,
    ACTIONS(3), 1,
      sym_comment,
    ACTIONS(116), 7,
      ts_builtin_sym_end,
      anon_sym_rule,
      anon_sym_and,
      anon_sym_LBRACE,
      anon_sym_let,
      anon_sym_PIPE,
      anon_sym_refill,
  [986] = 4,
    ACTIONS(3), 1,
      sym_comment,
    STATE(95), 1,
      sym_escape_sequence,
    ACTIONS(118), 2,
      sym__null,
      aux_sym_character_token1,
    ACTIONS(120), 4,
      aux_sym_escape_sequence_token1,
      aux_sym_escape_sequence_token2,
      aux_sym_escape_sequence_token3,
      aux_sym_escape_sequence_token4,
  [1003] = 4,
    ACTIONS(3), 1,
      sym_comment,
    STATE(92), 1,
      sym_escape_sequence,
    ACTIONS(122), 2,
      sym__null,
      aux_sym_character_token1,
    ACTIONS(120), 4,
      aux_sym_escape_sequence_token1,
      aux_sym_escape_sequence_token2,
      aux_sym_escape_sequence_token3,
      aux_sym_escape_sequence_token4,
  [1020] = 6,
    ACTIONS(3), 1,
      sym_comment,
    ACTIONS(9), 1,
      anon_sym_let,
    ACTIONS(11), 1,
      anon_sym_refill,
    ACTIONS(124), 1,
      anon_sym_rule,
    STATE(78), 1,
      sym_refill_handler,
    STATE(44), 2,
      sym_named_regexp,
      aux_sym_lexer_definition_repeat1,
  [1040] = 6,
    ACTIONS(3), 1,
      sym_comment,
    ACTIONS(9), 1,
      anon_sym_let,
    ACTIONS(11), 1,
      anon_sym_refill,
    ACTIONS(124), 1,
      anon_sym_rule,
    STATE(78), 1,
      sym_refill_handler,
    STATE(35), 2,
      sym_named_regexp,
      aux_sym_lexer_definition_repeat1,
  [1060] = 6,
    ACTIONS(3), 1,
      sym_comment,
    ACTIONS(9), 1,
      anon_sym_let,
    ACTIONS(11), 1,
      anon_sym_refill,
    ACTIONS(126), 1,
      anon_sym_rule,
    STATE(80), 1,
      sym_refill_handler,
    STATE(44), 2,
      sym_named_regexp,
      aux_sym_lexer_definition_repeat1,
  [1080] = 6,
    ACTIONS(3), 1,
      sym_comment,
    ACTIONS(7), 1,
      anon_sym_LBRACE,
    ACTIONS(128), 1,
      ts_builtin_sym_end,
    ACTIONS(130), 1,
      anon_sym_and,
    STATE(57), 1,
      aux_sym_lexer_definition_repeat2,
    STATE(91), 1,
      sym_action,
  [1099] = 4,
    ACTIONS(3), 1,
      sym_comment,
    ACTIONS(134), 1,
      anon_sym_PIPE,
    STATE(54), 1,
      aux_sym_lexer_entry_repeat2,
    ACTIONS(132), 3,
      ts_builtin_sym_end,
      anon_sym_and,
      anon_sym_LBRACE,
  [1114] = 5,
    ACTIONS(3), 1,
      sym_comment,
    ACTIONS(136), 1,
      anon_sym_SQUOTE,
    ACTIONS(138), 1,
      anon_sym_CARET,
    STATE(64), 1,
      sym_character,
    STATE(43), 2,
      sym_character_range,
      aux_sym_character_set_repeat1,
  [1131] = 6,
    ACTIONS(3), 1,
      sym_comment,
    ACTIONS(7), 1,
      anon_sym_LBRACE,
    ACTIONS(130), 1,
      anon_sym_and,
    ACTIONS(140), 1,
      ts_builtin_sym_end,
    STATE(49), 1,
      aux_sym_lexer_definition_repeat2,
    STATE(82), 1,
      sym_action,
  [1150] = 6,
    ACTIONS(3), 1,
      sym_comment,
    ACTIONS(7), 1,
      anon_sym_LBRACE,
    ACTIONS(130), 1,
      anon_sym_and,
    ACTIONS(142), 1,
      ts_builtin_sym_end,
    STATE(57), 1,
      aux_sym_lexer_definition_repeat2,
    STATE(81), 1,
      sym_action,
  [1169] = 6,
    ACTIONS(3), 1,
      sym_comment,
    ACTIONS(7), 1,
      anon_sym_LBRACE,
    ACTIONS(130), 1,
      anon_sym_and,
    ACTIONS(142), 1,
      ts_builtin_sym_end,
    STATE(45), 1,
      aux_sym_lexer_definition_repeat2,
    STATE(81), 1,
      sym_action,
  [1188] = 4,
    ACTIONS(3), 1,
      sym_comment,
    ACTIONS(134), 1,
      anon_sym_PIPE,
    STATE(48), 1,
      aux_sym_lexer_entry_repeat2,
    ACTIONS(144), 3,
      ts_builtin_sym_end,
      anon_sym_and,
      anon_sym_LBRACE,
  [1203] = 5,
    ACTIONS(3), 1,
      sym_comment,
    ACTIONS(136), 1,
      anon_sym_SQUOTE,
    ACTIONS(146), 1,
      anon_sym_RBRACK,
    STATE(64), 1,
      sym_character,
    STATE(52), 2,
      sym_character_range,
      aux_sym_character_set_repeat1,
  [1220] = 4,
    ACTIONS(3), 1,
      sym_comment,
    ACTIONS(150), 1,
      anon_sym_let,
    ACTIONS(148), 2,
      anon_sym_rule,
      anon_sym_refill,
    STATE(44), 2,
      sym_named_regexp,
      aux_sym_lexer_definition_repeat1,
  [1235] = 6,
    ACTIONS(3), 1,
      sym_comment,
    ACTIONS(7), 1,
      anon_sym_LBRACE,
    ACTIONS(130), 1,
      anon_sym_and,
    ACTIONS(153), 1,
      ts_builtin_sym_end,
    STATE(57), 1,
      aux_sym_lexer_definition_repeat2,
    STATE(83), 1,
      sym_action,
  [1254] = 6,
    ACTIONS(3), 1,
      sym_comment,
    ACTIONS(7), 1,
      anon_sym_LBRACE,
    ACTIONS(130), 1,
      anon_sym_and,
    ACTIONS(153), 1,
      ts_builtin_sym_end,
    STATE(36), 1,
      aux_sym_lexer_definition_repeat2,
    STATE(83), 1,
      sym_action,
  [1273] = 4,
    ACTIONS(3), 1,
      sym_comment,
    ACTIONS(134), 1,
      anon_sym_PIPE,
    STATE(53), 1,
      aux_sym_lexer_entry_repeat2,
    ACTIONS(155), 3,
      ts_builtin_sym_end,
      anon_sym_and,
      anon_sym_LBRACE,
  [1288] = 4,
    ACTIONS(3), 1,
      sym_comment,
    ACTIONS(134), 1,
      anon_sym_PIPE,
    STATE(54), 1,
      aux_sym_lexer_entry_repeat2,
    ACTIONS(155), 3,
      ts_builtin_sym_end,
      anon_sym_and,
      anon_sym_LBRACE,
  [1303] = 6,
    ACTIONS(3), 1,
      sym_comment,
    ACTIONS(7), 1,
      anon_sym_LBRACE,
    ACTIONS(130), 1,
      anon_sym_and,
    ACTIONS(157), 1,
      ts_builtin_sym_end,
    STATE(57), 1,
      aux_sym_lexer_definition_repeat2,
    STATE(93), 1,
      sym_action,
  [1322] = 5,
    ACTIONS(3), 1,
      sym_comment,
    ACTIONS(136), 1,
      anon_sym_SQUOTE,
    ACTIONS(159), 1,
      anon_sym_RBRACK,
    STATE(64), 1,
      sym_character,
    STATE(52), 2,
      sym_character_range,
      aux_sym_character_set_repeat1,
  [1339] = 6,
    ACTIONS(3), 1,
      sym_comment,
    ACTIONS(7), 1,
      anon_sym_LBRACE,
    ACTIONS(130), 1,
      anon_sym_and,
    ACTIONS(157), 1,
      ts_builtin_sym_end,
    STATE(40), 1,
      aux_sym_lexer_definition_repeat2,
    STATE(93), 1,
      sym_action,
  [1358] = 5,
    ACTIONS(3), 1,
      sym_comment,
    ACTIONS(161), 1,
      anon_sym_SQUOTE,
    ACTIONS(164), 1,
      anon_sym_RBRACK,
    STATE(64), 1,
      sym_character,
    STATE(52), 2,
      sym_character_range,
      aux_sym_character_set_repeat1,
  [1375] = 4,
    ACTIONS(3), 1,
      sym_comment,
    ACTIONS(134), 1,
      anon_sym_PIPE,
    STATE(54), 1,
      aux_sym_lexer_entry_repeat2,
    ACTIONS(166), 3,
      ts_builtin_sym_end,
      anon_sym_and,
      anon_sym_LBRACE,
  [1390] = 4,
    ACTIONS(3), 1,
      sym_comment,
    ACTIONS(170), 1,
      anon_sym_PIPE,
    STATE(54), 1,
      aux_sym_lexer_entry_repeat2,
    ACTIONS(168), 3,
      ts_builtin_sym_end,
      anon_sym_and,
      anon_sym_LBRACE,
  [1405] = 4,
    ACTIONS(3), 1,
      sym_comment,
    ACTIONS(134), 1,
      anon_sym_PIPE,
    STATE(37), 1,
      aux_sym_lexer_entry_repeat2,
    ACTIONS(166), 3,
      ts_builtin_sym_end,
      anon_sym_and,
      anon_sym_LBRACE,
  [1420] = 2,
    ACTIONS(3), 1,
      sym_comment,
    ACTIONS(168), 4,
      ts_builtin_sym_end,
      anon_sym_and,
      anon_sym_LBRACE,
      anon_sym_PIPE,
  [1430] = 4,
    ACTIONS(3), 1,
      sym_comment,
    ACTIONS(175), 1,
      anon_sym_and,
    STATE(57), 1,
      aux_sym_lexer_definition_repeat2,
    ACTIONS(173), 2,
      ts_builtin_sym_end,
      anon_sym_LBRACE,
  [1444] = 2,
    ACTIONS(3), 1,
      sym_comment,
    ACTIONS(178), 4,
      ts_builtin_sym_end,
      anon_sym_and,
      anon_sym_LBRACE,
      anon_sym_PIPE,
  [1454] = 4,
    ACTIONS(3), 1,
      sym_comment,
    ACTIONS(136), 1,
      anon_sym_SQUOTE,
    STATE(64), 1,
      sym_character,
    STATE(50), 2,
      sym_character_range,
      aux_sym_character_set_repeat1,
  [1468] = 4,
    ACTIONS(3), 1,
      sym_comment,
    ACTIONS(180), 1,
      sym__identifier,
    ACTIONS(182), 1,
      anon_sym_EQ,
    STATE(62), 1,
      aux_sym_lexer_entry_repeat1,
  [1481] = 4,
    ACTIONS(3), 1,
      sym_comment,
    ACTIONS(180), 1,
      sym__identifier,
    ACTIONS(184), 1,
      anon_sym_EQ,
    STATE(60), 1,
      aux_sym_lexer_entry_repeat1,
  [1494] = 4,
    ACTIONS(3), 1,
      sym_comment,
    ACTIONS(186), 1,
      sym__identifier,
    ACTIONS(189), 1,
      anon_sym_EQ,
    STATE(62), 1,
      aux_sym_lexer_entry_repeat1,
  [1507] = 2,
    ACTIONS(3), 1,
      sym_comment,
    ACTIONS(173), 3,
      ts_builtin_sym_end,
      anon_sym_and,
      anon_sym_LBRACE,
  [1516] = 3,
    ACTIONS(3), 1,
      sym_comment,
    ACTIONS(193), 1,
      anon_sym_DASH,
    ACTIONS(191), 2,
      anon_sym_SQUOTE,
      anon_sym_RBRACK,
  [1527] = 2,
    ACTIONS(3), 1,
      sym_comment,
    ACTIONS(69), 3,
      anon_sym_SQUOTE,
      anon_sym_RBRACK,
      anon_sym_DASH,
  [1536] = 2,
    ACTIONS(3), 1,
      sym_comment,
    ACTIONS(195), 2,
      anon_sym_parse,
      anon_sym_shortest,
  [1544] = 2,
    ACTIONS(3), 1,
      sym_comment,
    ACTIONS(197), 2,
      anon_sym_EQ,
      sym__identifier,
  [1552] = 3,
    ACTIONS(3), 1,
      sym_comment,
    ACTIONS(199), 1,
      sym__identifier,
    STATE(63), 1,
      sym_lexer_entry,
  [1562] = 3,
    ACTIONS(3), 1,
      sym_comment,
    ACTIONS(199), 1,
      sym__identifier,
    STATE(46), 1,
      sym_lexer_entry,
  [1572] = 3,
    ACTIONS(3), 1,
      sym_comment,
    ACTIONS(199), 1,
      sym__identifier,
    STATE(51), 1,
      sym_lexer_entry,
  [1582] = 3,
    ACTIONS(3), 1,
      sym_comment,
    ACTIONS(136), 1,
      anon_sym_SQUOTE,
    STATE(74), 1,
      sym_character,
  [1592] = 3,
    ACTIONS(3), 1,
      sym_comment,
    ACTIONS(199), 1,
      sym__identifier,
    STATE(39), 1,
      sym_lexer_entry,
  [1602] = 2,
    ACTIONS(3), 1,
      sym_comment,
    ACTIONS(201), 2,
      anon_sym_parse,
      anon_sym_shortest,
  [1610] = 2,
    ACTIONS(3), 1,
      sym_comment,
    ACTIONS(203), 2,
      anon_sym_SQUOTE,
      anon_sym_RBRACK,
  [1618] = 3,
    ACTIONS(3), 1,
      sym_comment,
    ACTIONS(199), 1,
      sym__identifier,
    STATE(41), 1,
      sym_lexer_entry,
  [1628] = 2,
    ACTIONS(3), 1,
      sym_comment,
    ACTIONS(114), 1,
      anon_sym_SQUOTE,
  [1635] = 2,
    ACTIONS(3), 1,
      sym_comment,
    ACTIONS(205), 1,
      anon_sym_RBRACE,
  [1642] = 2,
    ACTIONS(3), 1,
      sym_comment,
    ACTIONS(126), 1,
      anon_sym_rule,
  [1649] = 2,
    ACTIONS(3), 1,
      sym_comment,
    ACTIONS(207), 1,
      sym_ocaml,
  [1656] = 2,
    ACTIONS(3), 1,
      sym_comment,
    ACTIONS(209), 1,
      anon_sym_rule,
  [1663] = 2,
    ACTIONS(3), 1,
      sym_comment,
    ACTIONS(153), 1,
      ts_builtin_sym_end,
  [1670] = 2,
    ACTIONS(3), 1,
      sym_comment,
    ACTIONS(157), 1,
      ts_builtin_sym_end,
  [1677] = 2,
    ACTIONS(3), 1,
      sym_comment,
    ACTIONS(128), 1,
      ts_builtin_sym_end,
  [1684] = 2,
    ACTIONS(3), 1,
      sym_comment,
    ACTIONS(211), 1,
      anon_sym_rule,
  [1691] = 2,
    ACTIONS(3), 1,
      sym_comment,
    ACTIONS(213), 1,
      sym__identifier,
  [1698] = 2,
    ACTIONS(3), 1,
      sym_comment,
    ACTIONS(124), 1,
      anon_sym_rule,
  [1705] = 2,
    ACTIONS(3), 1,
      sym_comment,
    ACTIONS(215), 1,
      sym__identifier,
  [1712] = 2,
    ACTIONS(3), 1,
      sym_comment,
    ACTIONS(217), 1,
      anon_sym_LBRACE,
  [1719] = 2,
    ACTIONS(3), 1,
      sym_comment,
    ACTIONS(219), 1,
      ts_builtin_sym_end,
  [1726] = 2,
    ACTIONS(3), 1,
      sym_comment,
    ACTIONS(221), 1,
      anon_sym_RBRACE,
  [1733] = 2,
    ACTIONS(3), 1,
      sym_comment,
    ACTIONS(223), 1,
      ts_builtin_sym_end,
  [1740] = 2,
    ACTIONS(3), 1,
      sym_comment,
    ACTIONS(225), 1,
      anon_sym_SQUOTE,
  [1747] = 2,
    ACTIONS(3), 1,
      sym_comment,
    ACTIONS(142), 1,
      ts_builtin_sym_end,
  [1754] = 2,
    ACTIONS(3), 1,
      sym_comment,
    ACTIONS(227), 1,
      anon_sym_EQ,
  [1761] = 2,
    ACTIONS(3), 1,
      sym_comment,
    ACTIONS(229), 1,
      anon_sym_SQUOTE,
  [1768] = 2,
    ACTIONS(3), 1,
      sym_comment,
    ACTIONS(231), 1,
      sym_ocaml,
};

static const uint32_t ts_small_parse_table_map[] = {
  [SMALL_STATE(2)] = 0,
  [SMALL_STATE(3)] = 40,
  [SMALL_STATE(4)] = 84,
  [SMALL_STATE(5)] = 138,
  [SMALL_STATE(6)] = 192,
  [SMALL_STATE(7)] = 247,
  [SMALL_STATE(8)] = 299,
  [SMALL_STATE(9)] = 340,
  [SMALL_STATE(10)] = 381,
  [SMALL_STATE(11)] = 407,
  [SMALL_STATE(12)] = 433,
  [SMALL_STATE(13)] = 471,
  [SMALL_STATE(14)] = 497,
  [SMALL_STATE(15)] = 523,
  [SMALL_STATE(16)] = 561,
  [SMALL_STATE(17)] = 599,
  [SMALL_STATE(18)] = 625,
  [SMALL_STATE(19)] = 651,
  [SMALL_STATE(20)] = 677,
  [SMALL_STATE(21)] = 703,
  [SMALL_STATE(22)] = 729,
  [SMALL_STATE(23)] = 764,
  [SMALL_STATE(24)] = 799,
  [SMALL_STATE(25)] = 834,
  [SMALL_STATE(26)] = 869,
  [SMALL_STATE(27)] = 897,
  [SMALL_STATE(28)] = 925,
  [SMALL_STATE(29)] = 953,
  [SMALL_STATE(30)] = 973,
  [SMALL_STATE(31)] = 986,
  [SMALL_STATE(32)] = 1003,
  [SMALL_STATE(33)] = 1020,
  [SMALL_STATE(34)] = 1040,
  [SMALL_STATE(35)] = 1060,
  [SMALL_STATE(36)] = 1080,
  [SMALL_STATE(37)] = 1099,
  [SMALL_STATE(38)] = 1114,
  [SMALL_STATE(39)] = 1131,
  [SMALL_STATE(40)] = 1150,
  [SMALL_STATE(41)] = 1169,
  [SMALL_STATE(42)] = 1188,
  [SMALL_STATE(43)] = 1203,
  [SMALL_STATE(44)] = 1220,
  [SMALL_STATE(45)] = 1235,
  [SMALL_STATE(46)] = 1254,
  [SMALL_STATE(47)] = 1273,
  [SMALL_STATE(48)] = 1288,
  [SMALL_STATE(49)] = 1303,
  [SMALL_STATE(50)] = 1322,
  [SMALL_STATE(51)] = 1339,
  [SMALL_STATE(52)] = 1358,
  [SMALL_STATE(53)] = 1375,
  [SMALL_STATE(54)] = 1390,
  [SMALL_STATE(55)] = 1405,
  [SMALL_STATE(56)] = 1420,
  [SMALL_STATE(57)] = 1430,
  [SMALL_STATE(58)] = 1444,
  [SMALL_STATE(59)] = 1454,
  [SMALL_STATE(60)] = 1468,
  [SMALL_STATE(61)] = 1481,
  [SMALL_STATE(62)] = 1494,
  [SMALL_STATE(63)] = 1507,
  [SMALL_STATE(64)] = 1516,
  [SMALL_STATE(65)] = 1527,
  [SMALL_STATE(66)] = 1536,
  [SMALL_STATE(67)] = 1544,
  [SMALL_STATE(68)] = 1552,
  [SMALL_STATE(69)] = 1562,
  [SMALL_STATE(70)] = 1572,
  [SMALL_STATE(71)] = 1582,
  [SMALL_STATE(72)] = 1592,
  [SMALL_STATE(73)] = 1602,
  [SMALL_STATE(74)] = 1610,
  [SMALL_STATE(75)] = 1618,
  [SMALL_STATE(76)] = 1628,
  [SMALL_STATE(77)] = 1635,
  [SMALL_STATE(78)] = 1642,
  [SMALL_STATE(79)] = 1649,
  [SMALL_STATE(80)] = 1656,
  [SMALL_STATE(81)] = 1663,
  [SMALL_STATE(82)] = 1670,
  [SMALL_STATE(83)] = 1677,
  [SMALL_STATE(84)] = 1684,
  [SMALL_STATE(85)] = 1691,
  [SMALL_STATE(86)] = 1698,
  [SMALL_STATE(87)] = 1705,
  [SMALL_STATE(88)] = 1712,
  [SMALL_STATE(89)] = 1719,
  [SMALL_STATE(90)] = 1726,
  [SMALL_STATE(91)] = 1733,
  [SMALL_STATE(92)] = 1740,
  [SMALL_STATE(93)] = 1747,
  [SMALL_STATE(94)] = 1754,
  [SMALL_STATE(95)] = 1761,
  [SMALL_STATE(96)] = 1768,
};

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}}, SHIFT_EXTRA(),
  [5] = {.entry = {.count = 1, .reusable = true}}, SHIFT(72),
  [7] = {.entry = {.count = 1, .reusable = true}}, SHIFT(96),
  [9] = {.entry = {.count = 1, .reusable = true}}, SHIFT(85),
  [11] = {.entry = {.count = 1, .reusable = true}}, SHIFT(88),
  [13] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_regexp_difference, 3, 0, 0),
  [15] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_regexp_difference, 3, 0, 0),
  [17] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_regexp_concatenation, 2, 0, 0),
  [19] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_regexp_concatenation, 2, 0, 0),
  [21] = {.entry = {.count = 1, .reusable = true}}, SHIFT(23),
  [23] = {.entry = {.count = 1, .reusable = true}}, SHIFT(13),
  [25] = {.entry = {.count = 1, .reusable = false}}, SHIFT(14),
  [27] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_regexp_alternative, 3, 0, 0),
  [29] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_regexp_alternative, 3, 0, 0),
  [31] = {.entry = {.count = 1, .reusable = true}}, SHIFT(32),
  [33] = {.entry = {.count = 1, .reusable = true}}, SHIFT(27),
  [35] = {.entry = {.count = 1, .reusable = true}}, SHIFT(38),
  [37] = {.entry = {.count = 1, .reusable = true}}, SHIFT(25),
  [39] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_named_regexp, 4, 0, 2),
  [41] = {.entry = {.count = 1, .reusable = true}}, SHIFT(24),
  [43] = {.entry = {.count = 1, .reusable = false}}, SHIFT(87),
  [45] = {.entry = {.count = 1, .reusable = true}}, SHIFT(10),
  [47] = {.entry = {.count = 1, .reusable = true}}, SHIFT(12),
  [49] = {.entry = {.count = 1, .reusable = true}}, SHIFT(16),
  [51] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_parenthesized_regexp, 3, 0, 0),
  [53] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_parenthesized_regexp, 3, 0, 0),
  [55] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_string, 2, 0, 0),
  [57] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_string, 2, 0, 0),
  [59] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_regexp_repetition, 2, 0, 0),
  [61] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_regexp_repetition, 2, 0, 0),
  [63] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym__regexp, 1, 0, 0),
  [65] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__regexp, 1, 0, 0),
  [67] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_character, 3, 0, 0),
  [69] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_character, 3, 0, 0),
  [71] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_string, 3, 0, 0),
  [73] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_string, 3, 0, 0),
  [75] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_aliased_regexp, 3, 0, 0),
  [77] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_aliased_regexp, 3, 0, 0),
  [79] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_character_set, 3, 0, 0),
  [81] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_character_set, 3, 0, 0),
  [83] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_character_set, 4, 0, 0),
  [85] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_character_set, 4, 0, 0),
  [87] = {.entry = {.count = 1, .reusable = false}}, SHIFT(18),
  [89] = {.entry = {.count = 1, .reusable = false}}, SHIFT(28),
  [91] = {.entry = {.count = 1, .reusable = false}}, SHIFT(29),
  [93] = {.entry = {.count = 1, .reusable = true}}, SHIFT(28),
  [95] = {.entry = {.count = 1, .reusable = false}}, SHIFT(11),
  [97] = {.entry = {.count = 1, .reusable = false}}, SHIFT(26),
  [99] = {.entry = {.count = 1, .reusable = true}}, SHIFT(26),
  [101] = {.entry = {.count = 1, .reusable = false}}, REDUCE(aux_sym_string_repeat1, 2, 0, 0),
  [103] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_string_repeat1, 2, 0, 0), SHIFT_REPEAT(28),
  [106] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_string_repeat1, 2, 0, 0), SHIFT_REPEAT(29),
  [109] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_string_repeat1, 2, 0, 0), SHIFT_REPEAT(28),
  [112] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_escape_sequence, 1, 0, 0),
  [114] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_escape_sequence, 1, 0, 0),
  [116] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_action, 3, 0, 0),
  [118] = {.entry = {.count = 1, .reusable = true}}, SHIFT(95),
  [120] = {.entry = {.count = 1, .reusable = false}}, SHIFT(76),
  [122] = {.entry = {.count = 1, .reusable = true}}, SHIFT(92),
  [124] = {.entry = {.count = 1, .reusable = true}}, SHIFT(70),
  [126] = {.entry = {.count = 1, .reusable = true}}, SHIFT(75),
  [128] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_lexer_definition, 6, 0, 0),
  [130] = {.entry = {.count = 1, .reusable = true}}, SHIFT(68),
  [132] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_lexer_entry, 7, 0, 3),
  [134] = {.entry = {.count = 1, .reusable = true}}, SHIFT(15),
  [136] = {.entry = {.count = 1, .reusable = true}}, SHIFT(31),
  [138] = {.entry = {.count = 1, .reusable = true}}, SHIFT(59),
  [140] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_lexer_definition, 2, 0, 0),
  [142] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_lexer_definition, 4, 0, 0),
  [144] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_lexer_entry, 4, 0, 3),
  [146] = {.entry = {.count = 1, .reusable = true}}, SHIFT(20),
  [148] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_lexer_definition_repeat1, 2, 0, 0),
  [150] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_lexer_definition_repeat1, 2, 0, 0), SHIFT_REPEAT(85),
  [153] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_lexer_definition, 5, 0, 0),
  [155] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_lexer_entry, 5, 0, 3),
  [157] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_lexer_definition, 3, 0, 0),
  [159] = {.entry = {.count = 1, .reusable = true}}, SHIFT(21),
  [161] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_character_set_repeat1, 2, 0, 0), SHIFT_REPEAT(31),
  [164] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_character_set_repeat1, 2, 0, 0),
  [166] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_lexer_entry, 6, 0, 3),
  [168] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_lexer_entry_repeat2, 2, 0, 0),
  [170] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_lexer_entry_repeat2, 2, 0, 0), SHIFT_REPEAT(15),
  [173] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_lexer_definition_repeat2, 2, 0, 0),
  [175] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_lexer_definition_repeat2, 2, 0, 0), SHIFT_REPEAT(68),
  [178] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_lexer_case, 2, 0, 0),
  [180] = {.entry = {.count = 1, .reusable = true}}, SHIFT(67),
  [182] = {.entry = {.count = 1, .reusable = true}}, SHIFT(73),
  [184] = {.entry = {.count = 1, .reusable = true}}, SHIFT(66),
  [186] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_lexer_entry_repeat1, 2, 0, 0), SHIFT_REPEAT(67),
  [189] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_lexer_entry_repeat1, 2, 0, 0),
  [191] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_character_set_repeat1, 1, 0, 0),
  [193] = {.entry = {.count = 1, .reusable = true}}, SHIFT(71),
  [195] = {.entry = {.count = 1, .reusable = true}}, SHIFT(8),
  [197] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_lexer_entry_repeat1, 1, 0, 1),
  [199] = {.entry = {.count = 1, .reusable = true}}, SHIFT(61),
  [201] = {.entry = {.count = 1, .reusable = true}}, SHIFT(9),
  [203] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_character_range, 3, 0, 0),
  [205] = {.entry = {.count = 1, .reusable = true}}, SHIFT(30),
  [207] = {.entry = {.count = 1, .reusable = true}}, SHIFT(90),
  [209] = {.entry = {.count = 1, .reusable = true}}, SHIFT(69),
  [211] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_refill_handler, 4, 0, 0),
  [213] = {.entry = {.count = 1, .reusable = true}}, SHIFT(94),
  [215] = {.entry = {.count = 1, .reusable = true}}, SHIFT(19),
  [217] = {.entry = {.count = 1, .reusable = true}}, SHIFT(79),
  [219] = {.entry = {.count = 1, .reusable = true}},  ACCEPT_INPUT(),
  [221] = {.entry = {.count = 1, .reusable = true}}, SHIFT(84),
  [223] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_lexer_definition, 7, 0, 0),
  [225] = {.entry = {.count = 1, .reusable = true}}, SHIFT(17),
  [227] = {.entry = {.count = 1, .reusable = true}}, SHIFT(22),
  [229] = {.entry = {.count = 1, .reusable = true}}, SHIFT(65),
  [231] = {.entry = {.count = 1, .reusable = true}}, SHIFT(77),
};

enum ts_external_scanner_symbol_identifiers {
  ts_external_token_comment = 0,
  ts_external_token_ocaml = 1,
  ts_external_token_DQUOTE = 2,
  ts_external_token__null = 3,
};

static const TSSymbol ts_external_scanner_symbol_map[EXTERNAL_TOKEN_COUNT] = {
  [ts_external_token_comment] = sym_comment,
  [ts_external_token_ocaml] = sym_ocaml,
  [ts_external_token_DQUOTE] = anon_sym_DQUOTE,
  [ts_external_token__null] = sym__null,
};

static const bool ts_external_scanner_states[7][EXTERNAL_TOKEN_COUNT] = {
  [1] = {
    [ts_external_token_comment] = true,
    [ts_external_token_ocaml] = true,
    [ts_external_token_DQUOTE] = true,
    [ts_external_token__null] = true,
  },
  [2] = {
    [ts_external_token_comment] = true,
  },
  [3] = {
    [ts_external_token_comment] = true,
    [ts_external_token_DQUOTE] = true,
  },
  [4] = {
    [ts_external_token_comment] = true,
    [ts_external_token_DQUOTE] = true,
    [ts_external_token__null] = true,
  },
  [5] = {
    [ts_external_token_comment] = true,
    [ts_external_token__null] = true,
  },
  [6] = {
    [ts_external_token_comment] = true,
    [ts_external_token_ocaml] = true,
  },
};

#ifdef __cplusplus
extern "C" {
#endif
void *tree_sitter_ocamllex_external_scanner_create(void);
void tree_sitter_ocamllex_external_scanner_destroy(void *);
bool tree_sitter_ocamllex_external_scanner_scan(void *, TSLexer *, const bool *);
unsigned tree_sitter_ocamllex_external_scanner_serialize(void *, char *);
void tree_sitter_ocamllex_external_scanner_deserialize(void *, const char *, unsigned);

#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_ocamllex(void) {
  static const TSLanguage language = {
    .abi_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,
    .supertype_count = SUPERTYPE_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,
    .field_names = ts_field_names,
    .field_map_slices = ts_field_map_slices,
    .field_map_entries = ts_field_map_entries,
    .supertype_map_slices = ts_supertype_map_slices,
    .supertype_map_entries = ts_supertype_map_entries,
    .supertype_symbols = ts_supertype_symbols,
    .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 = (const void*)ts_lex_modes,
    .lex_fn = ts_lex,
    .keyword_lex_fn = ts_lex_keywords,
    .keyword_capture_token = sym__identifier,
    .external_scanner = {
      &ts_external_scanner_states[0][0],
      ts_external_scanner_symbol_map,
      tree_sitter_ocamllex_external_scanner_create,
      tree_sitter_ocamllex_external_scanner_destroy,
      tree_sitter_ocamllex_external_scanner_scan,
      tree_sitter_ocamllex_external_scanner_serialize,
      tree_sitter_ocamllex_external_scanner_deserialize,
    },
    .primary_state_ids = ts_primary_state_ids,
    .name = "ocamllex",
    .max_reserved_word_set_size = 0,
    .metadata = {
      .major_version = 0,
      .minor_version = 25,
      .patch_version = 0,
    },
  };
  return &language;
}
#ifdef __cplusplus
}
#endif
