diff -a -B -d -E -r -u flex-2.5.4/flex.skl flex-2.5.4-pure-parser/flex.skl --- flex-2.5.4/flex.skl 1996-09-10 17:58:54.000000000 -0600 +++ flex-2.5.4-pure-parser/flex.skl 2002-07-28 11:32:14.000000000 -0600 @@ -426,7 +426,7 @@ */ #ifndef YY_DECL %- Standard (non-C++) definition -#define YY_DECL int yylex YY_PROTO(( void )) +#define YY_DECL int yylex YY_PROTO( YYLEX_INTERFACE ) %+ C++ definition #define YY_DECL int yyFlexLexer::yylex() %* @@ -454,6 +454,12 @@ %% user's declarations go here +#ifdef YY_PURE_PARSER +/* provide a common interface (so the user is able to use 'yylval' instead of '*yylval', e.g.) */ +#define yylval (*yylvalp) +#define yylloc (*yyllocp) +#endif + if ( yy_init ) { yy_init = 0; Only in flex-2.5.4-pure-parser: gen.o Only in flex-2.5.4-pure-parser: libfl.a Only in flex-2.5.4-pure-parser: libmain.o Only in flex-2.5.4-pure-parser: libyywrap.o diff -a -B -d -E -r -u flex-2.5.4/main.c flex-2.5.4-pure-parser/main.c --- flex-2.5.4/main.c 1997-07-26 20:32:19.000000000 -0600 +++ flex-2.5.4-pure-parser/main.c 2002-07-28 11:44:03.000000000 -0600 @@ -57,6 +57,7 @@ int interactive, caseins, lex_compat, do_yylineno, useecs, fulltbl, usemecs; int fullspd, gen_line_dirs, performance_report, backing_up_report; int C_plus_plus, long_align, use_read, yytext_is_array, do_yywrap, csize; +int pure_parser, pure_yyltype, pure_param; int yymore_used, reject, real_reject, continued_action, in_rule; int yymore_really_used, reject_really_used; int datapos, dataline, linenum, out_linenum; @@ -411,6 +412,13 @@ if ( C_plus_plus ) putc( '+', stderr ); + if ( pure_parser ) { + putc( 'u', stderr ); + if ( pure_yyltype ) + putc( 'l', stderr ); + if ( pure_param ) + putc( 'r', stderr ); + } if ( backing_up_report ) putc( 'b', stderr ); if ( ddebug ) @@ -589,6 +597,7 @@ printstats = syntaxerror = trace = spprdflt = caseins = false; lex_compat = C_plus_plus = backing_up_report = ddebug = fulltbl = false; + pure_parser = pure_yyltype = pure_param = false; fullspd = long_align = nowarn = yymore_used = continued_action = false; do_yylineno = yytext_is_array = in_rule = reject = do_stdinit = false; yymore_really_used = reject_really_used = unspecified; @@ -787,6 +796,14 @@ case 'T': trace = true; break; + + case 'u': + pure_parser = true; + if (strchr(arg + i + 1, 'l')) + pure_yyltype = true; + if (strchr(arg + i + 1, 'p')) + pure_param = true; + goto get_next_arg; case 'v': printstats = true; @@ -1022,8 +1039,26 @@ } } + else if ( pure_parser ) + { + outn( "\n#define YY_PURE_PARSER 1" ); + fputs( "#define YYLEX_INTERFACE ( YYSTYPE *yylvalp", stdout ); + + if ( pure_yyltype ) + fputs( ", YYLTYPE *yyllocp", stdout ); + + if ( pure_param ) + fputs( ", void *parm", stdout ); + + outn( " )" ); + } + else + outn( "\n#define YYLEX_INTERFACE ( void )" ); + + if ( ! C_plus_plus ) { + if ( yytext_is_array ) outn( "extern char yytext[];\n" ); @@ -1114,7 +1149,7 @@ FILE *f = stdout; fprintf( f, -_( "%s [-bcdfhilnpstvwBFILTV78+? -C[aefFmr] -ooutput -Pprefix -Sskeleton]\n" ), +_( "%s [-bcdfhilnpstvwBFILTV78+? -u[lp] -C[aefFmr] -ooutput -Pprefix -Sskeleton]\n" ), program_name ); fprintf( f, _( "\t[--help --version] [file ...]\n" ) ); @@ -1156,6 +1191,12 @@ fprintf( f, _( "\t-7 generate 7-bit scanner\n" ) ); fprintf( f, _( "\t-8 generate 8-bit scanner\n" ) ); fprintf( f, _( "\t-+ generate C++ scanner class\n" ) ); + fprintf( f, _( "\t-u generate a type of pure interface:\n" ) ); + fprintf( f, _( "\t\t-ul include YYLTYPE paramater\n" ) ); + fprintf( f, _( "\t\t-up include YYLEX_PARAM parameter\n" ) ); + fprintf( f, _( "\t\t-ulp include both\n" ) ); + fprintf( f, _( "\t\t-u include neither; just yylex(yylval)" ) ); + fprintf( f, _( "\t\tsee bison's info page for more information" ) ); fprintf( f, _( "\t-? produce this help message\n" ) ); fprintf( f, _( "\t-C specify degree of table compression (default is -Cem):\n" ) ); Only in flex-2.5.4-pure-parser: main.o Only in flex-2.5.4-pure-parser: misc.o Only in flex-2.5.4-pure-parser: nfa.o Only in flex-2.5.4-pure-parser: parse.c Only in flex-2.5.4-pure-parser: parse.h Only in flex-2.5.4-pure-parser: parse.o Only in flex-2.5.4-pure-parser: scan.c Only in flex-2.5.4-pure-parser: scan.o diff -a -B -d -E -r -u flex-2.5.4/skel.c flex-2.5.4-pure-parser/skel.c --- flex-2.5.4/skel.c 1996-09-10 18:00:38.000000000 -0600 +++ flex-2.5.4-pure-parser/skel.c 2002-07-28 11:32:19.000000000 -0600 @@ -431,7 +431,7 @@ " */", "#ifndef YY_DECL", "%- Standard (non-C++) definition", - "#define YY_DECL int yylex YY_PROTO(( void ))", + "#define YY_DECL int yylex YY_PROTO( YYLEX_INTERFACE )", "%+ C++ definition", "#define YY_DECL int yyFlexLexer::yylex()", "%*", @@ -459,6 +459,12 @@ "", "%% user's declarations go here", "", + "#ifdef YY_PURE_PARSER", + "/* provide a common interface (so the user is able to use 'yylval' instead of '*yylval', e.g.) */", + "#define yylval (*yylvalp)", + "#define yylloc (*yyllocp)", + "#endif", + "", " if ( yy_init )", " {", " yy_init = 0;",