style: decouple different uses of item_number

item_number is used for elements of ritem as well as indices into
ritem which is fairly confusing.  Introduce item_index to represent
indices into ritem.

* src/gram.h (item_index): Introduce it for ritem indices.
* src/closure.h, src/closure.c, src/ielr.c, src/lr0.c,
* src/print-graph.c, src/state.h, src/state.h:
Replace uses of item_number with item_index where appropriate.
This commit is contained in:
Vincent Imbimbo
2020-05-24 11:09:49 -04:00
committed by Akim Demaille
parent dd878d1851
commit 6a1a681fd2
8 changed files with 26 additions and 23 deletions

View File

@@ -225,7 +225,7 @@ struct state
/* Its items. Must be last, since ITEMS can be arbitrarily large. Sorted
ascendingly on item index in RITEM, which is sorted on rule number. */
size_t nitems;
item_number items[1];
item_index items[1];
};
extern state_number nstates;
@@ -233,7 +233,7 @@ extern state *final_state;
/* Create a new state with ACCESSING_SYMBOL for those items. */
state *state_new (symbol_number accessing_symbol,
size_t core_size, item_number *core);
size_t core_size, item_index *core);
state *state_new_isocore (state const *s);
/* Record that from S we can reach all the DST states (NUM of them). */
@@ -264,7 +264,7 @@ void state_hash_free (void);
/* Find the state associated to the CORE, and return it. If it does
not exist yet, return NULL. */
state *state_hash_lookup (size_t core_size, item_number *core);
state *state_hash_lookup (size_t core_size, item_index *core);
/* Insert STATE in the state hash table. */
void state_hash_insert (state *s);