[][src]Constant tree_sitter::PARSER_HEADER

pub const PARSER_HEADER: &'static str = "#ifndef TREE_SITTER_PARSER_H_\n#define TREE_SITTER_PARSER_H_\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n#include <stdbool.h>\n#include <stdint.h>\n#include <stdlib.h>\n\n#define ts_builtin_sym_error ((TSSymbol)-1)\n#define ts_builtin_sym_end 0\n#define TREE_SITTER_SERIALIZATION_BUFFER_SIZE 1024\n\n#ifndef TREE_SITTER_API_H_\ntypedef uint16_t TSSymbol;\ntypedef uint16_t TSFieldId;\ntypedef struct TSLanguage TSLanguage;\n#endif\n\ntypedef struct {\n  TSFieldId field_id;\n  uint8_t child_index;\n  bool inherited;\n} TSFieldMapEntry;\n\ntypedef struct {\n  uint16_t index;\n  uint16_t length;\n} TSFieldMapSlice;\n\ntypedef uint16_t TSStateId;\n\ntypedef struct {\n  bool visible : 1;\n  bool named : 1;\n  bool supertype: 1;\n} TSSymbolMetadata;\n\ntypedef struct TSLexer TSLexer;\n\nstruct TSLexer {\n  int32_t lookahead;\n  TSSymbol result_symbol;\n  void (*advance)(TSLexer *, bool);\n  void (*mark_end)(TSLexer *);\n  uint32_t (*get_column)(TSLexer *);\n  bool (*is_at_included_range_start)(const TSLexer *);\n  bool (*eof)(const TSLexer *);\n};\n\ntypedef enum {\n  TSParseActionTypeShift,\n  TSParseActionTypeReduce,\n  TSParseActionTypeAccept,\n  TSParseActionTypeRecover,\n} TSParseActionType;\n\ntypedef struct {\n  union {\n    struct {\n      TSStateId state;\n      bool extra : 1;\n      bool repetition : 1;\n    } shift;\n    struct {\n      TSSymbol symbol;\n      int16_t dynamic_precedence;\n      uint8_t child_count;\n      uint8_t production_id;\n    } reduce;\n  } params;\n  TSParseActionType type : 4;\n} TSParseAction;\n\ntypedef struct {\n  uint16_t lex_state;\n  uint16_t external_lex_state;\n} TSLexMode;\n\ntypedef union {\n  TSParseAction action;\n  struct {\n    uint8_t count;\n    bool reusable : 1;\n  } entry;\n} TSParseActionEntry;\n\nstruct TSLanguage {\n  uint32_t version;\n  uint32_t symbol_count;\n  uint32_t alias_count;\n  uint32_t token_count;\n  uint32_t external_token_count;\n  const char **symbol_names;\n  const TSSymbolMetadata *symbol_metadata;\n  const uint16_t *parse_table;\n  const TSParseActionEntry *parse_actions;\n  const TSLexMode *lex_modes;\n  const TSSymbol *alias_sequences;\n  uint16_t max_alias_sequence_length;\n  bool (*lex_fn)(TSLexer *, TSStateId);\n  bool (*keyword_lex_fn)(TSLexer *, TSStateId);\n  TSSymbol keyword_capture_token;\n  struct {\n    const bool *states;\n    const TSSymbol *symbol_map;\n    void *(*create)(void);\n    void (*destroy)(void *);\n    bool (*scan)(void *, TSLexer *, const bool *symbol_whitelist);\n    unsigned (*serialize)(void *, char *);\n    void (*deserialize)(void *, const char *, unsigned);\n  } external_scanner;\n  uint32_t field_count;\n  const TSFieldMapSlice *field_map_slices;\n  const TSFieldMapEntry *field_map_entries;\n  const char **field_names;\n  uint32_t large_state_count;\n  const uint16_t *small_parse_table;\n  const uint32_t *small_parse_table_map;\n  const TSSymbol *public_symbol_map;\n  const uint16_t *alias_map;\n  uint32_t state_count;\n};\n\n/*\n *  Lexer Macros\n */\n\n#define START_LEXER()           \\\n  bool result = false;          \\\n  bool skip = false;            \\\n  bool eof = false;             \\\n  int32_t lookahead;            \\\n  goto start;                   \\\n  next_state:                   \\\n  lexer->advance(lexer, skip);  \\\n  start:                        \\\n  skip = false;                 \\\n  lookahead = lexer->lookahead;\n\n#define ADVANCE(state_value) \\\n  {                          \\\n    state = state_value;     \\\n    goto next_state;         \\\n  }\n\n#define SKIP(state_value) \\\n  {                       \\\n    skip = true;          \\\n    state = state_value;  \\\n    goto next_state;      \\\n  }\n\n#define ACCEPT_TOKEN(symbol_value)     \\\n  result = true;                       \\\n  lexer->result_symbol = symbol_value; \\\n  lexer->mark_end(lexer);\n\n#define END_STATE() return result;\n\n/*\n *  Parse Table Macros\n */\n\n#define SMALL_STATE(id) id - LARGE_STATE_COUNT\n\n#define STATE(id) id\n\n#define ACTIONS(id) id\n\n#define SHIFT(state_value)                \\\n  {                                       \\\n    {                                     \\\n      .params = {                         \\\n        .shift = {                        \\\n          .state = state_value            \\\n        }                                 \\\n      },                                  \\\n      .type = TSParseActionTypeShift      \\\n    }                                     \\\n  }\n\n#define SHIFT_REPEAT(state_value)     \\\n  {                                   \\\n    {                                 \\\n      .params = {                     \\\n        .shift = {                    \\\n          .state = state_value,       \\\n          .repetition = true          \\\n        }                             \\\n      },                              \\\n      .type = TSParseActionTypeShift  \\\n    }                                 \\\n  }\n\n#define RECOVER()                        \\\n  {                                      \\\n    { .type = TSParseActionTypeRecover } \\\n  }\n\n#define SHIFT_EXTRA()                 \\\n  {                                   \\\n    {                                 \\\n      .params = {                     \\\n        .shift = {                    \\\n          .extra = true               \\\n        }                             \\\n      },                              \\\n      .type = TSParseActionTypeShift  \\\n    }                                 \\\n  }\n\n#define REDUCE(symbol_val, child_count_val, ...) \\\n  {                                              \\\n    {                                            \\\n      .params = {                                \\\n        .reduce = {                              \\\n          .symbol = symbol_val,                  \\\n          .child_count = child_count_val,        \\\n          __VA_ARGS__                            \\\n        },                                       \\\n      },                                         \\\n      .type = TSParseActionTypeReduce            \\\n    }                                            \\\n  }\n\n#define ACCEPT_INPUT()                  \\\n  {                                     \\\n    { .type = TSParseActionTypeAccept } \\\n  }\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif  // TREE_SITTER_PARSER_H_\n";