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:
parent
d8a2c0dda2
commit
79d90f0d3e
6 changed files with 11 additions and 11 deletions
|
|
@ -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),
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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,");
|
||||
|
||||
|
|
|
|||
|
|
@ -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)]
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@ struct TSLanguage {
|
|||
const TSParseActionEntry *parse_actions;
|
||||
const TSLexMode *lex_modes;
|
||||
const TSSymbol *alias_sequences;
|
||||
uint16_t max_child_info_production_length;
|
||||
uint16_t max_alias_sequence_length;
|
||||
bool (*lex_fn)(TSLexer *, TSStateId);
|
||||
bool (*keyword_lex_fn)(TSLexer *, TSStateId);
|
||||
TSSymbol keyword_capture_token;
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ ts_language_enabled_external_tokens(const TSLanguage *self,
|
|||
static inline const TSSymbol *
|
||||
ts_language_alias_sequence(const TSLanguage *self, uint32_t child_info_id) {
|
||||
return child_info_id > 0 ?
|
||||
self->alias_sequences + child_info_id * self->max_child_info_production_length :
|
||||
self->alias_sequences + child_info_id * self->max_alias_sequence_length :
|
||||
NULL;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -914,7 +914,7 @@ void ts_subtree__print_dot_graph(const Subtree *self, uint32_t start_offset,
|
|||
|
||||
uint32_t child_start_offset = start_offset;
|
||||
uint32_t child_info_offset =
|
||||
language->max_child_info_production_length *
|
||||
language->max_alias_sequence_length *
|
||||
ts_subtree_child_info_id(*self);
|
||||
for (uint32_t i = 0, n = ts_subtree_child_count(*self); i < n; i++) {
|
||||
const Subtree *child = &self->ptr->children[i];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue