diff options
author | John Millaway <john43@users.sourceforge.net> | 2002-08-18 20:32:11 +0000 |
---|---|---|
committer | John Millaway <john43@users.sourceforge.net> | 2002-08-18 20:32:11 +0000 |
commit | fb22b8c4f60905fbc828945d5a4c626cabdf74d5 (patch) | |
tree | 75bf69cd738ca14d278988e1251a740b3f400a2a /main.c | |
parent | b206c273607a11e9bdcee528daa035705b2471a4 (diff) |
Removed #undef of start conditions.
Diffstat (limited to 'main.c')
-rw-r--r-- | main.c | 16 |
1 files changed, 11 insertions, 5 deletions
@@ -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"); |