mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-18 00:33:03 +00:00
style: cex: remove variables that don't make it simpler to read
* src/counterexample.c: With arrays, prefer the array notation rather than the pointer one.
This commit is contained in:
@@ -1284,8 +1284,7 @@ counterexample_report_state (const state *s, FILE *out, const char *prefix)
|
|||||||
for (int j = state_item_map[sn]; j < state_item_map[sn + 1]; ++j)
|
for (int j = state_item_map[sn]; j < state_item_map[sn + 1]; ++j)
|
||||||
if (!SI_DISABLED (j))
|
if (!SI_DISABLED (j))
|
||||||
{
|
{
|
||||||
state_item *si = state_items + j;
|
item_number conf = *state_items[j].item;
|
||||||
item_number conf = *si->item;
|
|
||||||
if (item_number_is_symbol_number (conf)
|
if (item_number_is_symbol_number (conf)
|
||||||
&& bitset_test (reds->lookahead_tokens[i], conf))
|
&& bitset_test (reds->lookahead_tokens[i], conf))
|
||||||
counterexample_report_shift_reduce (c1, j, conf, out, prefix);
|
counterexample_report_shift_reduce (c1, j, conf, out, prefix);
|
||||||
@@ -1293,24 +1292,18 @@ counterexample_report_state (const state *s, FILE *out, const char *prefix)
|
|||||||
for (int j = i+1; j < reds->num; ++j)
|
for (int j = i+1; j < reds->num; ++j)
|
||||||
{
|
{
|
||||||
bitset conf = bitset_create (ntokens, BITSET_FIXED);
|
bitset conf = bitset_create (ntokens, BITSET_FIXED);
|
||||||
|
const rule *r2 = reds->rules[j];
|
||||||
bitset_intersection (conf,
|
bitset_intersection (conf,
|
||||||
reds->lookahead_tokens[i],
|
reds->lookahead_tokens[i],
|
||||||
reds->lookahead_tokens[j]);
|
reds->lookahead_tokens[j]);
|
||||||
if (!bitset_empty_p (conf))
|
if (!bitset_empty_p (conf))
|
||||||
{
|
for (int k = state_item_map[sn]; k < state_item_map[sn + 1]; ++k)
|
||||||
const rule *r2 = reds->rules[j];
|
if (!SI_DISABLED (k)
|
||||||
for (int k = state_item_map[sn]; k < state_item_map[sn + 1]; ++k)
|
&& item_rule (state_items[k].item) == r2)
|
||||||
if (!SI_DISABLED (k))
|
{
|
||||||
{
|
counterexample_report_reduce_reduce (c1, k, conf, out, prefix);
|
||||||
state_item *si = state_items + k;
|
break;
|
||||||
const rule *r = item_rule (si->item);
|
}
|
||||||
if (r == r2)
|
|
||||||
{
|
|
||||||
counterexample_report_reduce_reduce (c1, k, conf, out, prefix);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
bitset_free (conf);
|
bitset_free (conf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,16 +28,16 @@
|
|||||||
# include "state.h"
|
# include "state.h"
|
||||||
|
|
||||||
/* Initializes a graph connecting (state, production item) pairs to
|
/* Initializes a graph connecting (state, production item) pairs to
|
||||||
pairs they can make a transition or production step to. This graph
|
pairs they can make a transition or production step to. This graph
|
||||||
is used to search for paths that represent counterexamples of some
|
is used to search for paths that represent counterexamples of some
|
||||||
conflict.
|
conflict.
|
||||||
|
|
||||||
state_items is an array of state state-item pairs ordered by state.
|
state_items is an array of state state-item pairs ordered by state.
|
||||||
state_item_map maps state numbers to the first item which
|
state_item_map maps state numbers to the first item which
|
||||||
corresponds to it in the array. A state's portion in state_items
|
corresponds to it in the array. A state's portion in state_items
|
||||||
begins with its items in the same order as it was in the
|
begins with its items in the same order as it was in the state.
|
||||||
state. This is then followed by productions from the closure of the
|
This is then followed by productions from the closure of the state
|
||||||
state in order by rule.
|
in order by rule.
|
||||||
|
|
||||||
There are two type of edges in this graph transitions and
|
There are two type of edges in this graph transitions and
|
||||||
productions. Transitions are the same as transitions from the
|
productions. Transitions are the same as transitions from the
|
||||||
@@ -53,9 +53,9 @@
|
|||||||
production edges, and all others will have reverse transition
|
production edges, and all others will have reverse transition
|
||||||
edges. */
|
edges. */
|
||||||
|
|
||||||
# define SI_DISABLED(sin) (state_items[sin].trans == -2)
|
# define SI_DISABLED(Sin) (state_items[Sin].trans == -2)
|
||||||
# define SI_PRODUCTION(si) ((si) == state_items || *((si)->item - 1) < 0)
|
# define SI_PRODUCTION(Si) ((Si) == state_items || *((Si)->item - 1) < 0)
|
||||||
# define SI_TRANSITION(si) ((si) != state_items && *((si)->item - 1) >= 0)
|
# define SI_TRANSITION(Si) ((Si) != state_items && *((Si)->item - 1) >= 0)
|
||||||
|
|
||||||
typedef int state_item_number;
|
typedef int state_item_number;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user