1 #ifndef TREE_SITTER_LANGUAGE_H_
2 #define TREE_SITTER_LANGUAGE_H_
9 #include "tree_sitter/parser.h"
11 #define ts_builtin_sym_error_repeat (ts_builtin_sym_error - 1)
42 return 0 < symbol && symbol <
self->external_token_count + 1;
79 if (
state >= self->large_state_count) {
80 uint32_t index =
self->small_parse_table_map[
state -
self->large_state_count];
81 const uint16_t *data = &
self->small_parse_table[index];
83 for (
unsigned i = 0;
i < group_count;
i++) {
86 for (
unsigned i = 0;
i < symbol_count;
i++) {
87 if (*(data++) == symbol)
return section_value;
92 return self->parse_table[
state *
self->symbol_count + symbol];
114 bool is_small_state =
state >=
self->large_state_count;
118 if (is_small_state) {
119 uint32_t index =
self->small_parse_table_map[
state -
self->large_state_count];
120 data = &
self->small_parse_table[index];
121 group_end = data + 1;
124 data = &
self->parse_table[
state *
self->symbol_count] - 1;
129 .group_end = group_end,
130 .group_count = group_count,
131 .is_small_state = is_small_state,
141 if (self->is_small_state) {
143 if (self->data == self->group_end) {
144 if (self->group_count == 0)
return false;
146 self->table_value = *(
self->data++);
147 unsigned symbol_count = *(
self->data++);
148 self->group_end =
self->data + symbol_count;
149 self->symbol = *
self->data;
151 self->symbol = *
self->data;
162 if (self->symbol >= self->language->symbol_count)
return false;
163 self->table_value = *
self->data;
164 }
while (!self->table_value);
169 if (self->symbol < self->language->token_count) {
171 self->action_count =
entry->entry.count;
173 self->next_state = 0;
175 self->action_count = 0;
176 self->next_state =
self->table_value;
188 }
else if (symbol < self->token_count) {
209 if (self->version >= 14) {
210 return state ==
self->primary_state_ids[
state];
218 unsigned external_scanner_state
220 if (external_scanner_state == 0) {
223 return self->external_scanner.states +
self->external_token_count * external_scanner_state;
231 return production_id ?
232 &
self->alias_sequences[production_id *
self->max_alias_sequence_length] :
241 return production_id ?
242 self->alias_sequences[production_id *
self->max_alias_sequence_length + child_index] :
252 if (self->field_count == 0) {
259 *
start = &
self->field_map_entries[slice.
index];
269 *
start = &
self->public_symbol_map[original_symbol];
275 if (symbol == 0 || symbol > original_symbol)
break;
277 if (symbol == original_symbol) {
278 *
start = &
self->alias_map[
i];
static static sync static getppid static getegid const char static filename char static len const char char static bufsiz static mask static vfork const void static prot static getpgrp const char static swapflags static arg static fd static protocol static who struct sockaddr static addrlen static backlog struct timeval struct timezone static tz const struct iovec static count static mode const void const struct sockaddr static tolen const char static pathname void count
static static sync static getppid static getegid const char static filename char static len const char char static bufsiz static mask static vfork const void static prot static getpgrp const char static swapflags static arg static fd static protocol static who struct sockaddr static addrlen static backlog struct timeval struct timezone static tz const struct iovec static count static mode const void const struct sockaddr static tolen const char static pathname void static offset struct stat static buf void long static basep static whence static length const void static len static semflg const void static shmflg const struct timespec struct timespec static rem const char static group const void start
static const TSParseAction * ts_language_actions(const TSLanguage *self, TSStateId state, TSSymbol symbol, uint32_t *count)
static bool ts_language_has_reduce_action(const TSLanguage *self, TSStateId state, TSSymbol symbol)
static bool ts_language_is_symbol_external(const TSLanguage *self, TSSymbol symbol)
TSSymbolMetadata ts_language_symbol_metadata(const TSLanguage *, TSSymbol)
static uint16_t ts_language_lookup(const TSLanguage *self, TSStateId state, TSSymbol symbol)
static void ts_language_field_map(const TSLanguage *self, uint32_t production_id, const TSFieldMapEntry **start, const TSFieldMapEntry **end)
static bool ts_language_state_is_primary(const TSLanguage *self, TSStateId state)
static TSStateId ts_language_next_state(const TSLanguage *self, TSStateId state, TSSymbol symbol)
static bool ts_lookahead_iterator_next(LookaheadIterator *self)
void ts_language_table_entry(const TSLanguage *, TSStateId, TSSymbol, TableEntry *)
static bool ts_language_has_actions(const TSLanguage *self, TSStateId state, TSSymbol symbol)
#define ts_builtin_sym_error_repeat
static void ts_language_aliases_for_symbol(const TSLanguage *self, TSSymbol original_symbol, const TSSymbol **start, const TSSymbol **end)
TSSymbol ts_language_public_symbol(const TSLanguage *, TSSymbol)
static const TSSymbol * ts_language_alias_sequence(const TSLanguage *self, uint32_t production_id)
static const bool * ts_language_enabled_external_tokens(const TSLanguage *self, unsigned external_scanner_state)
static TSSymbol ts_language_alias_at(const TSLanguage *self, uint32_t production_id, uint32_t child_index)
static LookaheadIterator ts_language_lookaheads(const TSLanguage *self, TSStateId state)
@ TSParseActionTypeReduce
#define ts_builtin_sym_error
const uint16_t * group_end
const TSLanguage * language
const TSParseAction * actions
const TSParseAction * actions