* src/getargs.h, src/getargs.c (trace_e, trace_args, trace_types):

Add support for --trace=skeleton.
* src/scan-skel.l: %option debug.
Scan strings of non-@ or n instead of character by character.
(scan_skel): Handle trace_skeleton.
(QPUTS): New.
(@output_parser_name@, @output_header_name@): ``Restore'' their
support (used to be M4 macros).
* data/yacc.c: Quote larger chunks, a la glr.c.
* data/lalr1.cc: Likewise.
The header guards are no longer available, so use some other
string than `YYLSP_NEEDED'.
This commit is contained in:
Akim Demaille
2002-11-16 12:31:36 +00:00
parent 4c6cc1db75
commit c5e3e51055
6 changed files with 255 additions and 228 deletions

View File

@@ -54,15 +54,16 @@ static const char * const trace_args[] =
/* In a series of synonyms, present the most meaningful first, so
that argmatch_valid be more readable. */
"none - no report",
"scan - scanner traces",
"parse - parser traces",
"scan - grammar scanner traces",
"parse - grammar parser traces",
"automaton - contruction of the automaton",
"bitsets - use of bitsets",
"grammar - reading, reducing of the grammar",
"resource - memory consumption (where available)",
"sets - grammar sets: firsts, nullable etc.",
"time - time consumption",
"tools - m4 invocation and preserve the temporary file",
"skeleton - skeleton postprocessing",
"time - time consumption",
"all - all of the above",
0
};
@@ -77,8 +78,9 @@ static const int trace_types[] =
trace_grammar,
trace_resource,
trace_sets,
trace_time,
trace_tools,
trace_skeleton,
trace_time,
trace_all
};

View File

@@ -48,6 +48,7 @@ enum trace_e
trace_automaton = 1 << 6,
trace_grammar = 1 << 7,
trace_time = 1 << 8,
trace_skeleton = 1 << 9,
trace_all = ~0
};
extern int trace_flag;

View File

@@ -18,7 +18,7 @@
Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA. */
%option nodefault noyywrap nounput never-interactive
%option nodefault noyywrap nounput never-interactive debug
%option prefix="skel_" outfile="lex.yy.c"
%{
@@ -30,6 +30,9 @@
int skel_lex (void);
#define QPUTS(String) \
fputs (quotearg_style (c_quoting_style, (String)), yyout);
%}
%%
@@ -63,11 +66,13 @@ int skel_lex (void);
"@}" fputc (']', yyout);
"@oline@" fprintf (yyout, "%d", lineno);
"@ofile@" fputs (quotearg_style (c_quoting_style, outname), yyout);
"@ofile@" QPUTS (outname);
"@output_parser_name@" QPUTS (parser_file_name);
"@output_header_name@" QPUTS (spec_defines_file);
"@" abort ();
\n lineno++; ECHO;
. ECHO;
[^@\n]+ ECHO;
<<EOF>> xfclose (yyout); free (outname); return EOF;
%%
@@ -82,8 +87,8 @@ void
scan_skel (FILE *in)
{
skel_in = in;
skel__flex_debug = trace_flag & trace_skeleton;
skel_lex ();
/* Reclaim Flex's buffers. */
yy_delete_buffer (YY_CURRENT_BUFFER);
}