r = item_number_as_rule_number (*sp);
sp = rules[r].rhs;
/* Display the lookahead tokens? */
if (item_number_is_rule_number (*sp1))
r = item_number_as_rule_number (*sp);
sp = rules[r].rhs;
/* Display the lookahead tokens? */
if (item_number_is_rule_number (*sp1))
- {
- reductions *reds = s->reductions;
- int red = state_reduction_find (s, &rules[r]);
- /* Print item with lookaheads if there are. */
- if (reds->lookahead_tokens && red != -1)
- {
- xml_printf (out, level + 1,
- "<item rule-number=\"%d\" point=\"%d\">",
- rules[r].number, sp1 - sp);
- state_rule_lookahead_tokens_print_xml (s, &rules[r],
- out, level + 2);
- xml_puts (out, level + 1, "</item>");
- printed = true;
- }
- }
+ {
+ reductions *reds = s->reductions;
+ int red = state_reduction_find (s, &rules[r]);
+ /* Print item with lookaheads if there are. */
+ if (reds->lookahead_tokens && red != -1)
+ {
+ xml_printf (out, level + 1,
+ "<item rule-number=\"%d\" point=\"%d\">",
+ rules[r].number, sp1 - sp);
+ state_rule_lookahead_tokens_print_xml (s, &rules[r],
+ out, level + 2);
+ xml_puts (out, level + 1, "</item>");
+ printed = true;
+ }
+ }
- {
- xml_printf (out, level + 1,
- "<item rule-number=\"%d\" point=\"%d\"/>",
- rules[r].number,
- sp1 - sp);
- }
+ {
+ xml_printf (out, level + 1,
+ "<item rule-number=\"%d\" point=\"%d\"/>",
+ rules[r].number,
+ sp1 - sp);
+ }
for (i = 0; i < trans->num; i++)
if (!TRANSITION_IS_DISABLED (trans, i))
{
for (i = 0; i < trans->num; i++)
if (!TRANSITION_IS_DISABLED (trans, i))
{
for (i = 0; i < trans->num; i++)
if (!TRANSITION_IS_DISABLED (trans, i)
for (i = 0; i < trans->num; i++)
if (!TRANSITION_IS_DISABLED (trans, i)
- symbol *sym = symbols[TRANSITION_SYMBOL (trans, i)];
- char const *tag = sym->tag;
- state *s1 = trans->states[i];
+ symbol *sym = symbols[TRANSITION_SYMBOL (trans, i)];
+ char const *tag = sym->tag;
+ state *s1 = trans->states[i];
- xml_printf (out, level + 1,
- "<transition type=\"shift\" symbol=\"%s\" state=\"%d\"/>",
- xml_escape (tag), s1->number);
+ xml_printf (out, level + 1,
+ "<transition type=\"shift\" symbol=\"%s\" state=\"%d\"/>",
+ xml_escape (tag), s1->number);
}
for (i = 0; i < trans->num; i++)
if (!TRANSITION_IS_DISABLED (trans, i)
}
for (i = 0; i < trans->num; i++)
if (!TRANSITION_IS_DISABLED (trans, i)
- symbol *sym = symbols[TRANSITION_SYMBOL (trans, i)];
- char const *tag = sym->tag;
- state *s1 = trans->states[i];
+ symbol *sym = symbols[TRANSITION_SYMBOL (trans, i)];
+ char const *tag = sym->tag;
+ state *s1 = trans->states[i];
- xml_printf (out, level + 1,
- "<transition type=\"goto\" symbol=\"%s\" state=\"%d\"/>",
- xml_escape (tag), s1->number);
+ xml_printf (out, level + 1,
+ "<transition type=\"goto\" symbol=\"%s\" state=\"%d\"/>",
+ xml_escape (tag), s1->number);
- char const *tag = errp->symbols[i]->tag;
- xml_printf (out, level + 1,
- "<error symbol=\"%s\">nonassociative</error>",
- xml_escape (tag));
+ char const *tag = errp->symbols[i]->tag;
+ xml_printf (out, level + 1,
+ "<error symbol=\"%s\">nonassociative</error>",
+ xml_escape (tag));
}
xml_puts (out, level, "</errors>");
}
/*-------------------------------------------------------------------------.
}
xml_puts (out, level, "</errors>");
}
/*-------------------------------------------------------------------------.
| If not ENABLED, the rule is masked by a shift or a reduce (S/R and |
| R/R conflicts). |
`-------------------------------------------------------------------------*/
static void
print_reduction (FILE *out, int level, char const *lookahead_token,
| If not ENABLED, the rule is masked by a shift or a reduce (S/R and |
| R/R conflicts). |
`-------------------------------------------------------------------------*/
static void
print_reduction (FILE *out, int level, char const *lookahead_token,
- "<reduction symbol=\"%s\" rule=\"%d\" enabled=\"%s\"/>",
- xml_escape (lookahead_token),
- r->number,
- enabled ? "true" : "false");
+ "<reduction symbol=\"%s\" rule=\"%d\" enabled=\"%s\"/>",
+ xml_escape (lookahead_token),
+ r->number,
+ enabled ? "true" : "false");
- "<reduction symbol=\"%s\" rule=\"accept\" enabled=\"%s\"/>",
- xml_escape (lookahead_token),
- enabled ? "true" : "false");
+ "<reduction symbol=\"%s\" rule=\"accept\" enabled=\"%s\"/>",
+ xml_escape (lookahead_token),
+ enabled ? "true" : "false");
- bool count = bitset_test (no_reduce_set, i);
-
- for (j = 0; j < reds->num; ++j)
- if (bitset_test (reds->lookahead_tokens[j], i))
- {
- if (! count)
- {
- if (reds->rules[j] != default_reduction)
- report = true;
- count = true;
- }
- else
- {
- report = true;
- }
- }
+ bool count = bitset_test (no_reduce_set, i);
+
+ for (j = 0; j < reds->num; ++j)
+ if (bitset_test (reds->lookahead_tokens[j], i))
+ {
+ if (! count)
+ {
+ if (reds->rules[j] != default_reduction)
+ report = true;
+ count = true;
+ }
+ else
+ {
+ report = true;
+ }
+ }
- bool defaulted = false;
- bool count = bitset_test (no_reduce_set, i);
-
- for (j = 0; j < reds->num; ++j)
- if (bitset_test (reds->lookahead_tokens[j], i))
- {
- if (! count)
- {
- if (reds->rules[j] != default_reduction)
- print_reduction (out, level + 1, symbols[i]->tag,
- reds->rules[j], true);
- else
- defaulted = true;
- count = true;
- }
- else
- {
- if (defaulted)
- print_reduction (out, level + 1, symbols[i]->tag,
- default_reduction, true);
- defaulted = false;
- print_reduction (out, level + 1, symbols[i]->tag,
- reds->rules[j], false);
- }
- }
+ bool defaulted = false;
+ bool count = bitset_test (no_reduce_set, i);
+
+ for (j = 0; j < reds->num; ++j)
+ if (bitset_test (reds->lookahead_tokens[j], i))
+ {
+ if (! count)
+ {
+ if (reds->rules[j] != default_reduction)
+ print_reduction (out, level + 1, symbols[i]->tag,
+ reds->rules[j], true);
+ else
+ defaulted = true;
+ count = true;
+ }
+ else
+ {
+ if (defaulted)
+ print_reduction (out, level + 1, symbols[i]->tag,
+ default_reduction, true);
+ defaulted = false;
+ print_reduction (out, level + 1, symbols[i]->tag,
+ reds->rules[j], false);
+ }
+ }
int precedence = symbols[token_translations[i]]->prec;
assoc associativity = symbols[token_translations[i]]->assoc;
xml_indent (out, level + 2);
int precedence = symbols[token_translations[i]]->prec;
assoc associativity = symbols[token_translations[i]]->assoc;
xml_indent (out, level + 2);
{
char const *tag = symbols[i]->tag;
xml_printf (out, level + 2,
{
char const *tag = symbols[i]->tag;
xml_printf (out, level + 2,
fputc ('\n', out);
xml_printf (out, level + 1, "<filename>%s</filename>",
fputc ('\n', out);
xml_printf (out, level + 1, "<filename>%s</filename>",
- for (i = 0; i < nstates; i++)
- print_state (out, level + 2, states[i]);
+ {
+ state_number i;
+ for (i = 0; i < nstates; i++)
+ print_state (out, level + 2, states[i]);
+ }
xml_puts (out, level + 1, "</automaton>");
bitset_free (no_reduce_set);
xml_puts (out, level + 1, "</automaton>");
bitset_free (no_reduce_set);