summaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorJohn Millaway <john43@users.sourceforge.net>2002-08-18 20:32:11 +0000
committerJohn Millaway <john43@users.sourceforge.net>2002-08-18 20:32:11 +0000
commitfb22b8c4f60905fbc828945d5a4c626cabdf74d5 (patch)
tree75bf69cd738ca14d278988e1251a740b3f400a2a /main.c
parentb206c273607a11e9bdcee528daa035705b2471a4 (diff)
Removed #undef of start conditions.
Diffstat (limited to 'main.c')
-rw-r--r--main.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/main.c b/main.c
index 35ddc28..37dd037 100644
--- a/main.c
+++ b/main.c
@@ -556,11 +556,13 @@ int exit_status;
fprintf(header_out,"#line %d \"%s\"\n", (++nlines)+1, headerfilename);
- /* Print the prefixed start conditions. */
+ /* Print the start conditions. */
fprintf(header_out,"#ifdef YY_HEADER_EXPORT_START_CONDITIONS\n");
fprintf(header_out,"/* Beware! Start conditions are not prefixed. */\n");
-
- for (i=1; i <= lastsc; i++)
+
+ /* Special case for "INITIAL" */
+ fprintf(header_out,"#undef INITIAL\n#define INITIAL 0\n");
+ for (i=2; i <= lastsc; i++)
fprintf(header_out, "#define %s %d\n",scname[i], i-1);
fprintf(header_out,"#endif /* YY_HEADER_EXPORT_START_CONDITIONS */\n\n");
@@ -576,7 +578,6 @@ int exit_status;
fprintf(header_out,"#undef EOB_ACT_LAST_MATCH\n");
fprintf(header_out,"#undef FLEX_SCANNER\n");
fprintf(header_out,"#undef FLEX_STD\n");
- fprintf(header_out,"#undef INITIAL\n");
fprintf(header_out,"#undef REJECT\n");
fprintf(header_out,"#undef YYLMAX\n");
fprintf(header_out,"#undef YYSTATE\n");
@@ -717,8 +718,13 @@ int exit_status;
fprintf(header_out,"#undef yyfree\n");
/* undef any of the auto-generated symbols. */
- for(i=0; i < defs_buf.nelts; i++)
+ for(i=0; i < defs_buf.nelts; i++){
+
+ /* don't undef start conditions */
+ if (sclookup(((char**)defs_buf.elts)[i]) > 0 )
+ continue;
fprintf(header_out, "#undef %s\n", ((char**)defs_buf.elts)[i]);
+ }
fprintf(header_out,"#endif /* !YY_HEADER_NO_UNDEFS */\n");
fprintf(header_out, "\n");