traces: provide a means to get short m4 traces

Let --trace=m4-early dump all the logs from the start (as --trace=m4
used to do), and have --trace=m4 now start traces only when actually
working of the user's grammar.

Can make a big difference in the case of small inputs.  E.g.

    $ bison -S tests/testsuite.dir/001/input.m4 tests/testsuite.dir/001/input.y --trace=m4 |& wc
       3952   19446  251068
    $ bison -S tests/testsuite.dir/001/input.m4 tests/testsuite.dir/001/input.y --trace=m4-early |& wc
      19491  131904 1830495

* data/skeletons/traceon.m4: New.
* src/getargs.h, src/getargs.c: Introduce --trace=m4-early.
* src/output.c (output_skeleton): Adjust for --trace=m4 and --trace=m4-early.
This commit is contained in:
Akim Demaille
2020-05-21 18:02:17 +02:00
parent 94952779b6
commit 1ebc2ac55c
5 changed files with 19 additions and 12 deletions

View File

@@ -257,7 +257,8 @@ static const argmatch_trace_doc argmatch_trace_docs[] =
{ "sets", "grammar sets: firsts, nullable etc." },
{ "muscles", "m4 definitions passed to the skeleton" },
{ "tools", "m4 invocation" },
{ "m4", "m4 traces" },
{ "m4-early", "m4 traces starting from the start" },
{ "m4", "m4 traces starting from the skeleton evaluation" },
{ "skeleton", "skeleton postprocessing" },
{ "time", "time consumption" },
{ "ielr", "IELR conversion" },
@@ -279,6 +280,7 @@ static const argmatch_trace_arg argmatch_trace_args[] =
{ "sets", trace_sets },
{ "muscles", trace_muscles },
{ "tools", trace_tools },
{ "m4-early", trace_m4_early },
{ "m4", trace_m4 },
{ "skeleton", trace_skeleton },
{ "time", trace_time },