2015-10-29 13:26:12 -04:00
|
|
|
#include "tree_sitter/parser.h"
|
2015-10-29 12:42:52 -04:00
|
|
|
|
2015-11-20 12:00:49 -08:00
|
|
|
static const TSParseAction ERROR_ACTIONS[2] = {
|
|
|
|
|
{.type = TSParseActionTypeError }, {.type = 0 }
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const TSParseAction *ts_language_actions(const TSLanguage *language,
|
|
|
|
|
TSStateId state, TSSymbol sym) {
|
|
|
|
|
const TSParseAction *actions =
|
|
|
|
|
(language->parse_table + (state * language->symbol_count))[sym];
|
|
|
|
|
return actions ? actions : ERROR_ACTIONS;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TSParseAction ts_language_last_action(const TSLanguage *language,
|
|
|
|
|
TSStateId state, TSSymbol sym) {
|
|
|
|
|
const TSParseAction *action = ts_language_actions(language, state, sym);
|
|
|
|
|
while ((action + 1)->type)
|
|
|
|
|
action++;
|
|
|
|
|
return *action;
|
|
|
|
|
}
|
|
|
|
|
|
2015-10-29 12:47:04 -04:00
|
|
|
size_t ts_language_symbol_count(const TSLanguage *language) {
|
2015-10-29 12:45:28 -04:00
|
|
|
return language->symbol_count;
|
|
|
|
|
}
|
|
|
|
|
|
2015-10-29 12:42:52 -04:00
|
|
|
const char *ts_language_symbol_name(TSLanguage *language, TSSymbol symbol) {
|
|
|
|
|
return language->symbol_names[symbol];
|
|
|
|
|
}
|