runtime: make ts_language_symbol_for_name work for alias symbols

This commit is contained in:
Björn Linse 2018-11-13 11:34:12 +01:00
parent 5e456ccbb0
commit ca24942929
2 changed files with 11 additions and 1 deletions

View file

@ -50,7 +50,8 @@ const char *ts_language_symbol_name(const TSLanguage *language, TSSymbol symbol)
TSSymbol ts_language_symbol_for_name(const TSLanguage *self, const char *name) {
if (!strcmp(name, "ERROR")) return ts_builtin_sym_error;
for (TSSymbol i = 0; i < self->symbol_count; i++) {
uint32_t count = ts_language_symbol_count(self);
for (TSSymbol i = 0; i < count; i++) {
if (!strcmp(self->symbol_names[i], name)) {
return i;
}