Make the --prev-abi flag work w/ the newest abi change

This commit is contained in:
Max Brunsfeld 2020-09-08 10:58:20 -07:00
parent 85e4636c80
commit ff488f89c9
2 changed files with 7 additions and 12 deletions

View file

@ -31,16 +31,9 @@ lazy_static! {
.unwrap();
}
const NEW_HEADER_PARTS: [&'static str; 2] = [
"
uint32_t large_state_count;
const uint16_t *small_parse_table;
const uint32_t *small_parse_table_map;
const TSSymbol *public_symbol_map;",
"
#define SMALL_STATE(id) id - LARGE_STATE_COUNT
",
];
const NEW_HEADER_PARTS: &[&'static str] = &["
const uint16_t *alias_map;
uint32_t state_count;"];
struct GeneratedParser {
c_code: String,
@ -101,7 +94,7 @@ pub fn generate_parser_in_directory(
} else {
let mut header = tree_sitter::PARSER_HEADER.to_string();
for part in &NEW_HEADER_PARTS {
for part in NEW_HEADER_PARTS.iter() {
let pos = header
.find(part)
.expect("Missing expected part of parser.h header");

View file

@ -109,7 +109,9 @@ impl Generator {
self.add_alias_sequences();
}
self.add_non_terminal_alias_map();
if self.next_abi {
self.add_non_terminal_alias_map();
}
let mut main_lex_table = LexTable::default();
swap(&mut main_lex_table, &mut self.main_lex_table);