Kaydet (Commit) 1b304f99 authored tarafından tyomitch's avatar tyomitch Kaydeden (comit) Pablo Galindo

Remove d_initial from the parser as it is unused (GH-12212)

d_initial, the first state of a particular DFA in the parser has always been initialized to 0 in the old pgen as well as the new pgen. As this value is not used and the first state of each DFA is assumed to be the first element in the array representing it, remove d_initial from the parser to reduce complexity.
üst d70a359a
......@@ -50,7 +50,6 @@ typedef struct {
typedef struct {
int d_type; /* Non-terminal this represents */
char *d_name; /* For printing */
int d_initial; /* Initial state */
int d_nstates;
state *d_state; /* Array of states */
bitset d_first;
......
......@@ -662,7 +662,7 @@ validate_node(node *tree)
REQ(tree, nt_dfa->d_type);
/* Run the DFA for this nonterminal. */
dfa_state = &nt_dfa->d_state[nt_dfa->d_initial];
dfa_state = nt_dfa->d_state;
for (pos = 0; pos < nch; ++pos) {
node *ch = CHILD(tree, pos);
int ch_type = TYPE(ch);
......
......@@ -97,7 +97,7 @@ class Grammar:
' {{{dfa_symbol}, "{symbol_name}", '.format(
dfa_symbol=symbol, symbol_name=self.number2symbol[symbol]
)
+ "0, {n_states}, states_{dfa_index},\n".format(
+ "{n_states}, states_{dfa_index},\n".format(
n_states=len(dfa), dfa_index=dfaindex
)
+ ' "'
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment