Spaces:
Runtime error
Runtime error
extern "C" { | |
typedef uint16_t TSStateId; | |
typedef uint16_t TSSymbol; | |
typedef uint16_t TSFieldId; | |
typedef struct TSLanguage TSLanguage; | |
typedef struct { | |
TSFieldId field_id; | |
uint8_t child_index; | |
bool inherited; | |
} TSFieldMapEntry; | |
typedef struct { | |
uint16_t index; | |
uint16_t length; | |
} TSFieldMapSlice; | |
typedef struct { | |
bool visible; | |
bool named; | |
bool supertype; | |
} TSSymbolMetadata; | |
typedef struct TSLexer TSLexer; | |
struct TSLexer { | |
int32_t lookahead; | |
TSSymbol result_symbol; | |
void (*advance)(TSLexer *, bool); | |
void (*mark_end)(TSLexer *); | |
uint32_t (*get_column)(TSLexer *); | |
bool (*is_at_included_range_start)(const TSLexer *); | |
bool (*eof)(const TSLexer *); | |
}; | |
typedef enum { | |
TSParseActionTypeShift, | |
TSParseActionTypeReduce, | |
TSParseActionTypeAccept, | |
TSParseActionTypeRecover, | |
} TSParseActionType; | |
typedef union { | |
struct { | |
uint8_t type; | |
TSStateId state; | |
bool extra; | |
bool repetition; | |
} shift; | |
struct { | |
uint8_t type; | |
uint8_t child_count; | |
TSSymbol symbol; | |
int16_t dynamic_precedence; | |
uint16_t production_id; | |
} reduce; | |
uint8_t type; | |
} TSParseAction; | |
typedef struct { | |
uint16_t lex_state; | |
uint16_t external_lex_state; | |
} TSLexMode; | |
typedef union { | |
TSParseAction action; | |
struct { | |
uint8_t count; | |
bool reusable; | |
} entry; | |
} TSParseActionEntry; | |
struct TSLanguage { | |
uint32_t version; | |
uint32_t symbol_count; | |
uint32_t alias_count; | |
uint32_t token_count; | |
uint32_t external_token_count; | |
uint32_t state_count; | |
uint32_t large_state_count; | |
uint32_t production_id_count; | |
uint32_t field_count; | |
uint16_t max_alias_sequence_length; | |
const uint16_t *parse_table; | |
const uint16_t *small_parse_table; | |
const uint32_t *small_parse_table_map; | |
const TSParseActionEntry *parse_actions; | |
const char * const *symbol_names; | |
const char * const *field_names; | |
const TSFieldMapSlice *field_map_slices; | |
const TSFieldMapEntry *field_map_entries; | |
const TSSymbolMetadata *symbol_metadata; | |
const TSSymbol *public_symbol_map; | |
const uint16_t *alias_map; | |
const TSSymbol *alias_sequences; | |
const TSLexMode *lex_modes; | |
bool (*lex_fn)(TSLexer *, TSStateId); | |
bool (*keyword_lex_fn)(TSLexer *, TSStateId); | |
TSSymbol keyword_capture_token; | |
struct { | |
const bool *states; | |
const TSSymbol *symbol_map; | |
void *(*create)(void); | |
void (*destroy)(void *); | |
bool (*scan)(void *, TSLexer *, const bool *symbol_whitelist); | |
unsigned (*serialize)(void *, char *); | |
void (*deserialize)(void *, const char *, unsigned); | |
} external_scanner; | |
const TSStateId *primary_state_ids; | |
}; | |
/* | |
* Lexer Macros | |
*/ | |
/* | |
* Parse Table Macros | |
*/ | |
} | |