Fix back compat by moving primary_field_ids to the end

Due to an oversight in #1589, I added `primary_field_ids` into the
`TSLanguage` struct in a place that wasn't the end. This is not actually
backwards compatible and causes downstream failures :(
This commit is contained in:
Alex Pinkus 2022-01-17 17:21:35 -08:00
parent 691469c783
commit 858ea5782b
2 changed files with 5 additions and 5 deletions

View file

@ -1390,10 +1390,6 @@ impl Generator {
add_line!(self, ".alias_sequences = &ts_alias_sequences[0][0],");
}
if self.abi_version >= ABI_VERSION_WITH_PRIMARY_STATES {
add_line!(self, ".primary_state_ids = ts_primary_state_ids,");
}
// Lexing
add_line!(self, ".lex_modes = ts_lex_modes,");
add_line!(self, ".lex_fn = ts_lex,");
@ -1420,6 +1416,10 @@ impl Generator {
add_line!(self, "}},");
}
if self.abi_version >= ABI_VERSION_WITH_PRIMARY_STATES {
add_line!(self, ".primary_state_ids = ts_primary_state_ids,");
}
dedent!(self);
add_line!(self, "}};");
add_line!(self, "return &language;");

View file

@ -110,7 +110,6 @@ struct TSLanguage {
const TSSymbol *public_symbol_map;
const uint16_t *alias_map;
const TSSymbol *alias_sequences;
const TSStateId *primary_state_ids;
const TSLexMode *lex_modes;
bool (*lex_fn)(TSLexer *, TSStateId);
bool (*keyword_lex_fn)(TSLexer *, TSStateId);
@ -124,6 +123,7 @@ struct TSLanguage {
unsigned (*serialize)(void *, char *);
void (*deserialize)(void *, const char *, unsigned);
} external_scanner;
const TSStateId *primary_state_ids;
};
/*