Re-enable --prev-abi flag to generate command

This commit is contained in:
Max Brunsfeld 2021-02-26 14:51:01 -08:00
parent dc20540136
commit d56f9ebe4e
2 changed files with 9 additions and 17 deletions

View file

@ -32,10 +32,6 @@ lazy_static! {
.unwrap();
}
const NEW_HEADER_PARTS: &[&'static str] = &["
const uint16_t *alias_map;
uint32_t state_count;"];
struct GeneratedParser {
c_code: String,
node_types_json: String,
@ -92,17 +88,6 @@ pub fn generate_parser_in_directory(
if next_abi {
write_file(&header_path.join("parser.h"), tree_sitter::PARSER_HEADER)?;
} else {
let mut header = tree_sitter::PARSER_HEADER.to_string();
for part in NEW_HEADER_PARTS.iter() {
let pos = header
.find(part)
.expect("Missing expected part of parser.h header");
header.replace_range(pos..(pos + part.len()), "");
}
write_file(&header_path.join("parser.h"), header)?;
}
binding_files::generate_binding_files(&repo_path, &language_name)?;

View file

@ -294,7 +294,11 @@ impl Generator {
add_line!(
self,
"#define LANGUAGE_VERSION {}",
tree_sitter::LANGUAGE_VERSION
if self.next_abi {
tree_sitter::LANGUAGE_VERSION
} else {
tree_sitter::LANGUAGE_VERSION - 1
}
);
add_line!(
@ -1390,7 +1394,10 @@ impl Generator {
add_line!(self, ".public_symbol_map = ts_symbol_map,");
add_line!(self, ".alias_map = ts_non_terminal_alias_map,");
add_line!(self, ".state_count = STATE_COUNT,");
add_line!(self, ".production_id_count = PRODUCTION_ID_COUNT,");
if self.next_abi {
add_line!(self, ".production_id_count = PRODUCTION_ID_COUNT,");
}
dedent!(self);
add_line!(self, "}};");