Restore naming of alias sequence lengths

Fields aren't stored in sequences now, so the max length
is back to being just for aliases.
This commit is contained in:
Max Brunsfeld 2019-02-08 16:14:18 -08:00
parent d8a2c0dda2
commit 79d90f0d3e
6 changed files with 11 additions and 11 deletions

View file

@ -684,8 +684,8 @@ impl<'a> ParseTableBuilder<'a> {
child_info.alias_sequence.pop();
}
if item.production.steps.len() > self.parse_table.max_production_length_with_child_info {
self.parse_table.max_production_length_with_child_info = item.production.steps.len()
if item.production.steps.len() > self.parse_table.max_aliased_production_length {
self.parse_table.max_aliased_production_length = item.production.steps.len()
}
if let Some(index) = self
@ -791,7 +791,7 @@ pub(crate) fn build_parse_table(
states: Vec::new(),
symbols: Vec::new(),
child_infos: Vec::new(),
max_production_length_with_child_info: 0,
max_aliased_production_length: 0,
},
field_names_by_hidden_symbol: field_names_by_hidden_symbol(syntax_grammar),
}

View file

@ -222,8 +222,8 @@ impl Generator {
add_line!(self, "#define FIELD_COUNT {}", self.field_names.len());
add_line!(
self,
"#define MAX_CHILD_INFO_PRODUCTION_LENGTH {}",
self.parse_table.max_production_length_with_child_info
"#define MAX_ALIAS_SEQUENCE_LENGTH {}",
self.parse_table.max_aliased_production_length
);
add_line!(self, "");
}
@ -357,7 +357,7 @@ impl Generator {
fn add_alias_sequences(&mut self) {
add_line!(
self,
"static TSSymbol ts_alias_sequences[{}][MAX_CHILD_INFO_PRODUCTION_LENGTH] = {{",
"static TSSymbol ts_alias_sequences[{}][MAX_ALIAS_SEQUENCE_LENGTH] = {{",
self.parse_table.child_infos.len()
);
indent!(self);
@ -912,7 +912,7 @@ impl Generator {
add_line!(
self,
".max_child_info_production_length = MAX_CHILD_INFO_PRODUCTION_LENGTH,"
".max_alias_sequence_length = MAX_ALIAS_SEQUENCE_LENGTH,"
);
add_line!(self, ".lex_fn = ts_lex,");

View file

@ -57,7 +57,7 @@ pub(crate) struct ParseTable {
pub states: Vec<ParseState>,
pub symbols: Vec<Symbol>,
pub child_infos: Vec<ChildInfo>,
pub max_production_length_with_child_info: usize,
pub max_aliased_production_length: usize,
}
#[derive(Clone, Debug, PartialEq, Eq)]