summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAkim Demaille <akim.demaille@gmail.com>2019-04-09 21:02:08 +0200
committerAkim Demaille <akim.demaille@gmail.com>2019-04-12 08:33:34 +0200
commit99664706e2c0fdac1d54207aef4a15054aa7378a (patch)
tree09081486bc7ef6e6bf18b9ccc17b4891ff943a8b /src
parenta745041b7d57266b6b370b42467b4263a3cc372d (diff)
downloadbison-99664706e2c0fdac1d54207aef4a15054aa7378a.tar.gz
traces: improve logs
* src/lalr.c: Move logs to a better place to understand the chronology of events. * src/symlist.c (symbol_list_syms_print): Don't dump core on type elements.
Diffstat (limited to 'src')
-rw-r--r--src/lalr.c8
-rw-r--r--src/symlist.c7
2 files changed, 9 insertions, 6 deletions
diff --git a/src/lalr.c b/src/lalr.c
index 70cf33a9..09e5ae3a 100644
--- a/src/lalr.c
+++ b/src/lalr.c
@@ -398,10 +398,7 @@ build_relations (void)
relation_transpose (&includes, ngotos);
if (trace_flag & trace_automaton)
- {
- lookback_print (stderr);
- relation_print ("includes", includes, ngotos, goto_print, stderr);
- }
+ relation_print ("includes", includes, ngotos, goto_print, stderr);
}
/* Compute FOLLOWS from INCLUDES, and free INCLUDES. */
@@ -420,6 +417,9 @@ compute_follows (void)
static void
compute_lookahead_tokens (void)
{
+ if (trace_flag & trace_automaton)
+ lookback_print (stderr);
+
for (size_t i = 0; i < nLA; ++i)
for (goto_list *sp = lookback[i]; sp; sp = sp->next)
bitset_or (LA[i], LA[i], goto_follows[sp->value]);
diff --git a/src/symlist.c b/src/symlist.c
index d90946e7..79277e27 100644
--- a/src/symlist.c
+++ b/src/symlist.c
@@ -97,6 +97,7 @@ symbol_list_type_set (symbol_list *syms, uniqstr type_name, location loc)
void
symbol_list_syms_print (const symbol_list *l, FILE *f)
{
+ fputc ('[', f);
char const *sep = "";
for (/* Nothing. */; l && l->content.sym; l = l->next)
{
@@ -105,10 +106,12 @@ symbol_list_syms_print (const symbol_list *l, FILE *f)
: l->content_type == SYMLIST_TYPE ? "type: "
: "invalid content_type: ",
f);
- symbol_print (l->content.sym, f);
- fputs (l->action_props.is_value_used ? " used" : " unused", f);
+ if (l->content_type == SYMLIST_SYMBOL)
+ symbol_print (l->content.sym, f);
+ fputs (l->action_props.is_value_used ? " (used)" : " (unused)", f);
sep = ", ";
}
+ fputc (']', f);
}