diff options
author | millaway <millaway> | 2003-03-14 20:03:31 +0000 |
---|---|---|
committer | millaway <millaway> | 2003-03-14 20:03:31 +0000 |
commit | 0ffe6e9da64089b2535431778e94407e0bb7d8f6 (patch) | |
tree | 8586e855d89cfab101b3a61460db00efb56e5787 | |
parent | 3393d15698b935f2e3442754ab22cfa50bf8c971 (diff) | |
download | flex-0ffe6e9da64089b2535431778e94407e0bb7d8f6.tar.gz |
Bison bridge was simplified to rely less on bison output.
New option bison-locations.
-rw-r--r-- | flexdef.h | 3 | ||||
-rw-r--r-- | main.c | 22 | ||||
-rw-r--r-- | options.c | 2 | ||||
-rw-r--r-- | options.h | 1 | ||||
-rw-r--r-- | scan.l | 5 | ||||
-rw-r--r-- | tests/test-bison-nr/scanner.l | 2 | ||||
-rw-r--r-- | tests/test-bison-yylloc/scanner.l | 2 |
7 files changed, 25 insertions, 12 deletions
@@ -350,6 +350,7 @@ * otherwise, a standard C scanner * reentrant - if true (-R), generate a reentrant C scanner. * bison_bridge - if true (--bison-bridge), bison pure calling convention. + * bison_bridge_locations - if true (--bison-locations), bison yylloc. * long_align - if true (-Ca flag), favor long-word alignment. * use_read - if true (-f, -F, or -Cr) then use read() for scanner input; * otherwise, use fread(). @@ -376,7 +377,7 @@ extern int printstats, syntaxerror, eofseen, ddebug, trace, nowarn, extern int interactive, caseins, lex_compat, posix_compat, do_yylineno; extern int useecs, fulltbl, usemecs, fullspd; extern int gen_line_dirs, performance_report, backing_up_report; -extern int reentrant, bison_bridge; +extern int reentrant, bison_bridge, bison_bridge_locations; extern int C_plus_plus, long_align, use_read, yytext_is_array, do_yywrap; extern int csize; extern int yymore_used, reject, real_reject, continued_action, in_rule; @@ -54,7 +54,7 @@ int interactive, caseins, lex_compat, posix_compat, do_yylineno, 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 reentrant, bison_bridge; +int reentrant, bison_bridge, bison_bridge_locations; int yymore_used, reject, real_reject, continued_action, in_rule; int yymore_really_used, reject_really_used; int datapos, dataline, linenum, out_linenum; @@ -405,13 +405,11 @@ void check_options () buf_m4_define (&m4defs_buf, "M4_YY_TEXT_IS_ARRAY", NULL); } - if ( bison_bridge){ + if ( bison_bridge) buf_m4_define (&m4defs_buf, "M4_YY_BISON_BRIDGE", NULL); - /* for now, assume bison is using %locations until I think - * of the best way to detect them. - */ - buf_m4_define (&m4defs_buf, "M4_YY_BISON_BRIDGE_LOCATIONS", NULL); - } + + if ( bison_bridge_locations) + buf_m4_define (&m4defs_buf, "M4_YY_BISON_BRIDGE_LOCATIONS", NULL); if (strcmp (prefix, "yy")) { #define GEN_PREFIX(name) out_str3( "#define yy%s %s%s\n", name, prefix, name ) @@ -458,6 +456,8 @@ void check_options () if (bison_bridge){ GEN_PREFIX ("get_lval"); GEN_PREFIX ("set_lval"); + } + if (bison_bridge_locations){ GEN_PREFIX ("get_lloc"); GEN_PREFIX ("set_lloc"); } @@ -894,6 +894,8 @@ void flexend (exit_status) fputs ("--reentrant", stderr); if (bison_bridge) fputs ("--bison-bridge", stderr); + if (bison_bridge_locations) + fputs ("--bison-locations", stderr); if (use_stdout) putc ('t', stderr); if (printstats) @@ -1075,7 +1077,7 @@ void flexinit (argc, argv) yymore_really_used = reject_really_used = unspecified; interactive = csize = unspecified; do_yywrap = gen_line_dirs = usemecs = useecs = true; - reentrant = bison_bridge = false; + reentrant = bison_bridge = bison_bridge_locations = false; performance_report = 0; did_outfilename = 0; prefix = "yy"; @@ -1263,6 +1265,10 @@ void flexinit (argc, argv) bison_bridge = true; break; + case OPT_BISON_BRIDGE_LOCATIONS: + bison_bridge = bison_bridge_locations = true; + break; + case OPT_REENTRANT: reentrant = true; break; @@ -68,6 +68,8 @@ optspec_t flexopts[] = { , /* Generate batch scanner (opposite of -I). */ {"--bison-bridge", OPT_BISON_BRIDGE, 0} , /* Scanner to be called by a bison pure parser. */ + {"--bison-locations", OPT_BISON_BRIDGE_LOCATIONS, 0} + , /* Scanner to be called by a bison pure parser. */ {"-i", OPT_CASE_INSENSITIVE, 0} , {"--case-insensitive", OPT_CASE_INSENSITIVE, 0} @@ -48,6 +48,7 @@ enum flexopt_flag_t { OPT_BACKUP, OPT_BATCH, OPT_BISON_BRIDGE, + OPT_BISON_BRIDGE_LOCATIONS, OPT_CASE_INSENSITIVE, OPT_COMPRESSION, OPT_CPLUSPLUS, @@ -268,7 +268,10 @@ LEXOPT [aceknopr] array yytext_is_array = option_sense; backup backing_up_report = option_sense; batch interactive = ! option_sense; - bison-bridge bison_bridge = option_sense; + bison-bridge bison_bridge = option_sense; + bison-locations { if((bison_bridge_locations = option_sense)) + bison_bridge = true; + } "c++" C_plus_plus = option_sense; caseful|case-sensitive caseins = ! option_sense; caseless|case-insensitive caseins = option_sense; diff --git a/tests/test-bison-nr/scanner.l b/tests/test-bison-nr/scanner.l index db3b683..2510de6 100644 --- a/tests/test-bison-nr/scanner.l +++ b/tests/test-bison-nr/scanner.l @@ -32,7 +32,7 @@ static char* STRDUP(char* s1); %} %option 8bit outfile="scanner.c" prefix="test" -%option bison-bridge yylineno +%option bison-locations yylineno %option nomain nounput noyy_top_state noyywrap nodefault warn %option prefix="test" header="scanner.h" yylineno diff --git a/tests/test-bison-yylloc/scanner.l b/tests/test-bison-yylloc/scanner.l index 0ae65ed..aaf6fd7 100644 --- a/tests/test-bison-yylloc/scanner.l +++ b/tests/test-bison-yylloc/scanner.l @@ -32,7 +32,7 @@ static char* STRDUP(char* s1); %} %option 8bit outfile="scanner.c" prefix="test" -%option reentrant bison-bridge yylineno +%option reentrant bison-bridge bison-locations yylineno %option nomain nounput noyy_top_state noyywrap nodefault warn %option prefix="test" header="scanner.h" |