/* 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 19
#define LARGE_STATE_COUNT 2
#define SYMBOL_COUNT 18
#define ALIAS_COUNT 0
#define TOKEN_COUNT 6
#define EXTERNAL_TOKEN_COUNT 0
#define FIELD_COUNT 0
#define MAX_ALIAS_SEQUENCE_LENGTH 4
#define MAX_RESERVED_WORD_SET_SIZE 0
#define PRODUCTION_ID_COUNT 1
#define SUPERTYPE_COUNT 0

enum ts_symbol_identifiers {
  sym_id_text = 1,
  sym_description_text = 2,
  sym_newline = 3,
  sym_space = 4,
  sym_sequence_text = 5,
  sym_source_file = 6,
  sym__definition = 7,
  sym_record_definition_description = 8,
  sym_record_definition_no_description = 9,
  sym_id = 10,
  sym_description = 11,
  sym_sequence = 12,
  sym_sequence_choice = 13,
  sym_sequence_newline = 14,
  sym_sequence_EOF = 15,
  aux_sym_source_file_repeat1 = 16,
  aux_sym_sequence_repeat1 = 17,
};

static const char * const ts_symbol_names[] = {
  [ts_builtin_sym_end] = "end",
  [sym_id_text] = "id_text",
  [sym_description_text] = "description_text",
  [sym_newline] = "newline",
  [sym_space] = "space",
  [sym_sequence_text] = "sequence_text",
  [sym_source_file] = "source_file",
  [sym__definition] = "_definition",
  [sym_record_definition_description] = "record_definition_description",
  [sym_record_definition_no_description] = "record_definition_no_description",
  [sym_id] = "id",
  [sym_description] = "description",
  [sym_sequence] = "sequence",
  [sym_sequence_choice] = "sequence_choice",
  [sym_sequence_newline] = "sequence_newline",
  [sym_sequence_EOF] = "sequence_EOF",
  [aux_sym_source_file_repeat1] = "source_file_repeat1",
  [aux_sym_sequence_repeat1] = "sequence_repeat1",
};

static const TSSymbol ts_symbol_map[] = {
  [ts_builtin_sym_end] = ts_builtin_sym_end,
  [sym_id_text] = sym_id_text,
  [sym_description_text] = sym_description_text,
  [sym_newline] = sym_newline,
  [sym_space] = sym_space,
  [sym_sequence_text] = sym_sequence_text,
  [sym_source_file] = sym_source_file,
  [sym__definition] = sym__definition,
  [sym_record_definition_description] = sym_record_definition_description,
  [sym_record_definition_no_description] = sym_record_definition_no_description,
  [sym_id] = sym_id,
  [sym_description] = sym_description,
  [sym_sequence] = sym_sequence,
  [sym_sequence_choice] = sym_sequence_choice,
  [sym_sequence_newline] = sym_sequence_newline,
  [sym_sequence_EOF] = sym_sequence_EOF,
  [aux_sym_source_file_repeat1] = aux_sym_source_file_repeat1,
  [aux_sym_sequence_repeat1] = aux_sym_sequence_repeat1,
};

static const TSSymbolMetadata ts_symbol_metadata[] = {
  [ts_builtin_sym_end] = {
    .visible = false,
    .named = true,
  },
  [sym_id_text] = {
    .visible = true,
    .named = true,
  },
  [sym_description_text] = {
    .visible = true,
    .named = true,
  },
  [sym_newline] = {
    .visible = true,
    .named = true,
  },
  [sym_space] = {
    .visible = true,
    .named = true,
  },
  [sym_sequence_text] = {
    .visible = true,
    .named = true,
  },
  [sym_source_file] = {
    .visible = true,
    .named = true,
  },
  [sym__definition] = {
    .visible = false,
    .named = true,
  },
  [sym_record_definition_description] = {
    .visible = true,
    .named = true,
  },
  [sym_record_definition_no_description] = {
    .visible = true,
    .named = true,
  },
  [sym_id] = {
    .visible = true,
    .named = true,
  },
  [sym_description] = {
    .visible = true,
    .named = true,
  },
  [sym_sequence] = {
    .visible = true,
    .named = true,
  },
  [sym_sequence_choice] = {
    .visible = true,
    .named = true,
  },
  [sym_sequence_newline] = {
    .visible = true,
    .named = true,
  },
  [sym_sequence_EOF] = {
    .visible = true,
    .named = true,
  },
  [aux_sym_source_file_repeat1] = {
    .visible = false,
    .named = false,
  },
  [aux_sym_sequence_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,
};

static bool ts_lex(TSLexer *lexer, TSStateId state) {
  START_LEXER();
  eof = lexer->eof(lexer);
  switch (state) {
    case 0:
      if (eof) ADVANCE(5);
      if (lookahead == '>') ADVANCE(3);
      if (lookahead == '?') ADVANCE(9);
      if (lookahead == '\n' ||
          lookahead == '\r') ADVANCE(11);
      if (('\t' <= lookahead && lookahead <= '\f') ||
          lookahead == ' ') SKIP(0);
      if (lookahead == '*' ||
          lookahead == '-' ||
          ('A' <= lookahead && lookahead <= 'Z') ||
          ('a' <= lookahead && lookahead <= 'z')) ADVANCE(13);
      END_STATE();
    case 1:
      if (lookahead == ' ') ADVANCE(12);
      if (lookahead == '?') ADVANCE(9);
      if (lookahead == '\n' ||
          lookahead == '\r') ADVANCE(10);
      if (('\t' <= lookahead && lookahead <= '\f')) SKIP(1);
      END_STATE();
    case 2:
      if (lookahead == ' ') ADVANCE(7);
      if (('\t' <= lookahead && lookahead <= '\r')) SKIP(2);
      if (('!' <= lookahead && lookahead <= '~')) ADVANCE(8);
      END_STATE();
    case 3:
      if (('!' <= lookahead && lookahead <= '=') ||
          ('?' <= lookahead && lookahead <= '~')) ADVANCE(6);
      END_STATE();
    case 4:
      if (eof) ADVANCE(5);
      if (lookahead == '>') ADVANCE(3);
      if (('\t' <= lookahead && lookahead <= '\r') ||
          lookahead == ' ') SKIP(4);
      if (lookahead == '*' ||
          lookahead == '-' ||
          ('A' <= lookahead && lookahead <= 'Z') ||
          ('a' <= lookahead && lookahead <= 'z')) ADVANCE(13);
      END_STATE();
    case 5:
      ACCEPT_TOKEN(ts_builtin_sym_end);
      END_STATE();
    case 6:
      ACCEPT_TOKEN(sym_id_text);
      if (('!' <= lookahead && lookahead <= '=') ||
          ('?' <= lookahead && lookahead <= '~')) ADVANCE(6);
      END_STATE();
    case 7:
      ACCEPT_TOKEN(sym_description_text);
      if (lookahead == ' ') ADVANCE(7);
      if (('!' <= lookahead && lookahead <= '~')) ADVANCE(8);
      END_STATE();
    case 8:
      ACCEPT_TOKEN(sym_description_text);
      if ((' ' <= lookahead && lookahead <= '~')) ADVANCE(8);
      END_STATE();
    case 9:
      ACCEPT_TOKEN(sym_newline);
      END_STATE();
    case 10:
      ACCEPT_TOKEN(sym_newline);
      if (lookahead == ' ') ADVANCE(12);
      if (lookahead == '?') ADVANCE(9);
      if (lookahead == '\n' ||
          lookahead == '\r') ADVANCE(10);
      END_STATE();
    case 11:
      ACCEPT_TOKEN(sym_newline);
      if (lookahead == '?') ADVANCE(9);
      if (lookahead == '\n' ||
          lookahead == '\r') ADVANCE(11);
      END_STATE();
    case 12:
      ACCEPT_TOKEN(sym_space);
      if (lookahead == ' ') ADVANCE(12);
      if (lookahead == '\n' ||
          lookahead == '\r') ADVANCE(10);
      END_STATE();
    case 13:
      ACCEPT_TOKEN(sym_sequence_text);
      if (lookahead == '*' ||
          lookahead == '-' ||
          ('A' <= lookahead && lookahead <= 'Z') ||
          ('a' <= lookahead && lookahead <= 'z')) ADVANCE(13);
      END_STATE();
    default:
      return false;
  }
}

static const TSLexerMode ts_lex_modes[STATE_COUNT] = {
  [0] = {.lex_state = 0},
  [1] = {.lex_state = 4},
  [2] = {.lex_state = 4},
  [3] = {.lex_state = 4},
  [4] = {.lex_state = 4},
  [5] = {.lex_state = 4},
  [6] = {.lex_state = 4},
  [7] = {.lex_state = 4},
  [8] = {.lex_state = 0},
  [9] = {.lex_state = 4},
  [10] = {.lex_state = 4},
  [11] = {.lex_state = 1},
  [12] = {.lex_state = 1},
  [13] = {.lex_state = 2},
  [14] = {.lex_state = 4},
  [15] = {.lex_state = 4},
  [16] = {.lex_state = 0},
  [17] = {.lex_state = 0},
  [18] = {.lex_state = 4},
};

static const uint16_t ts_parse_table[LARGE_STATE_COUNT][SYMBOL_COUNT] = {
  [STATE(0)] = {
    [ts_builtin_sym_end] = ACTIONS(1),
    [sym_id_text] = ACTIONS(1),
    [sym_newline] = ACTIONS(1),
    [sym_sequence_text] = ACTIONS(1),
  },
  [STATE(1)] = {
    [sym_source_file] = STATE(16),
    [sym__definition] = STATE(2),
    [sym_record_definition_description] = STATE(2),
    [sym_record_definition_no_description] = STATE(2),
    [sym_id] = STATE(12),
    [aux_sym_source_file_repeat1] = STATE(2),
    [ts_builtin_sym_end] = ACTIONS(3),
    [sym_id_text] = ACTIONS(5),
  },
};

static const uint16_t ts_small_parse_table[] = {
  [0] = 4,
    ACTIONS(5), 1,
      sym_id_text,
    ACTIONS(7), 1,
      ts_builtin_sym_end,
    STATE(12), 1,
      sym_id,
    STATE(3), 4,
      sym__definition,
      sym_record_definition_description,
      sym_record_definition_no_description,
      aux_sym_source_file_repeat1,
  [16] = 4,
    ACTIONS(9), 1,
      ts_builtin_sym_end,
    ACTIONS(11), 1,
      sym_id_text,
    STATE(12), 1,
      sym_id,
    STATE(3), 4,
      sym__definition,
      sym_record_definition_description,
      sym_record_definition_no_description,
      aux_sym_source_file_repeat1,
  [32] = 4,
    ACTIONS(16), 1,
      sym_sequence_text,
    ACTIONS(14), 2,
      ts_builtin_sym_end,
      sym_id_text,
    STATE(5), 2,
      sym_sequence_choice,
      aux_sym_sequence_repeat1,
    STATE(9), 2,
      sym_sequence_newline,
      sym_sequence_EOF,
  [48] = 4,
    ACTIONS(20), 1,
      sym_sequence_text,
    ACTIONS(18), 2,
      ts_builtin_sym_end,
      sym_id_text,
    STATE(5), 2,
      sym_sequence_choice,
      aux_sym_sequence_repeat1,
    STATE(9), 2,
      sym_sequence_newline,
      sym_sequence_EOF,
  [64] = 4,
    ACTIONS(16), 1,
      sym_sequence_text,
    STATE(14), 1,
      sym_sequence,
    STATE(4), 2,
      sym_sequence_choice,
      aux_sym_sequence_repeat1,
    STATE(9), 2,
      sym_sequence_newline,
      sym_sequence_EOF,
  [79] = 4,
    ACTIONS(16), 1,
      sym_sequence_text,
    STATE(15), 1,
      sym_sequence,
    STATE(4), 2,
      sym_sequence_choice,
      aux_sym_sequence_repeat1,
    STATE(9), 2,
      sym_sequence_newline,
      sym_sequence_EOF,
  [94] = 3,
    ACTIONS(23), 1,
      ts_builtin_sym_end,
    ACTIONS(27), 1,
      sym_newline,
    ACTIONS(25), 2,
      sym_id_text,
      sym_sequence_text,
  [105] = 1,
    ACTIONS(29), 3,
      ts_builtin_sym_end,
      sym_id_text,
      sym_sequence_text,
  [111] = 1,
    ACTIONS(31), 3,
      ts_builtin_sym_end,
      sym_id_text,
      sym_sequence_text,
  [117] = 1,
    ACTIONS(33), 2,
      sym_newline,
      sym_space,
  [122] = 2,
    ACTIONS(35), 1,
      sym_newline,
    ACTIONS(37), 1,
      sym_space,
  [129] = 2,
    ACTIONS(39), 1,
      sym_description_text,
    STATE(7), 1,
      sym_description,
  [136] = 1,
    ACTIONS(41), 2,
      ts_builtin_sym_end,
      sym_id_text,
  [141] = 1,
    ACTIONS(43), 2,
      ts_builtin_sym_end,
      sym_id_text,
  [146] = 1,
    ACTIONS(45), 1,
      ts_builtin_sym_end,
  [150] = 1,
    ACTIONS(47), 1,
      sym_newline,
  [154] = 1,
    ACTIONS(49), 1,
      sym_sequence_text,
};

static const uint32_t ts_small_parse_table_map[] = {
  [SMALL_STATE(2)] = 0,
  [SMALL_STATE(3)] = 16,
  [SMALL_STATE(4)] = 32,
  [SMALL_STATE(5)] = 48,
  [SMALL_STATE(6)] = 64,
  [SMALL_STATE(7)] = 79,
  [SMALL_STATE(8)] = 94,
  [SMALL_STATE(9)] = 105,
  [SMALL_STATE(10)] = 111,
  [SMALL_STATE(11)] = 117,
  [SMALL_STATE(12)] = 122,
  [SMALL_STATE(13)] = 129,
  [SMALL_STATE(14)] = 136,
  [SMALL_STATE(15)] = 141,
  [SMALL_STATE(16)] = 146,
  [SMALL_STATE(17)] = 150,
  [SMALL_STATE(18)] = 154,
};

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_source_file, 0, 0, 0),
  [5] = {.entry = {.count = 1, .reusable = true}}, SHIFT(11),
  [7] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_source_file, 1, 0, 0),
  [9] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_source_file_repeat1, 2, 0, 0),
  [11] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_source_file_repeat1, 2, 0, 0), SHIFT_REPEAT(11),
  [14] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_sequence, 1, 0, 0),
  [16] = {.entry = {.count = 1, .reusable = true}}, SHIFT(8),
  [18] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_sequence_repeat1, 2, 0, 0),
  [20] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_sequence_repeat1, 2, 0, 0), SHIFT_REPEAT(8),
  [23] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_sequence_EOF, 1, 0, 0),
  [25] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_sequence_EOF, 1, 0, 0),
  [27] = {.entry = {.count = 1, .reusable = true}}, SHIFT(10),
  [29] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_sequence_choice, 1, 0, 0),
  [31] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_sequence_newline, 2, 0, 0),
  [33] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_id, 1, 0, 0),
  [35] = {.entry = {.count = 1, .reusable = false}}, SHIFT(6),
  [37] = {.entry = {.count = 1, .reusable = false}}, SHIFT(13),
  [39] = {.entry = {.count = 1, .reusable = true}}, SHIFT(17),
  [41] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_record_definition_no_description, 3, 0, 0),
  [43] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_record_definition_description, 4, 0, 0),
  [45] = {.entry = {.count = 1, .reusable = true}},  ACCEPT_INPUT(),
  [47] = {.entry = {.count = 1, .reusable = true}}, SHIFT(18),
  [49] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_description, 2, 0, 0),
};

#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_fasta(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,
    .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,
    .primary_state_ids = ts_primary_state_ids,
    .name = "fasta",
    .max_reserved_word_set_size = 0,
    .metadata = {
      .major_version = 1,
      .minor_version = 0,
      .patch_version = 6,
    },
  };
  return &language;
}
#ifdef __cplusplus
}
#endif
