diff options
author | John Millaway <john43@users.sourceforge.net> | 2002-08-13 19:16:44 +0000 |
---|---|---|
committer | John Millaway <john43@users.sourceforge.net> | 2002-08-13 19:16:44 +0000 |
commit | b19fc6297a8238f7e722641ad30db95840eaf054 (patch) | |
tree | 0dbc0c6e244fb2d02ac85ea6d85730dae55e34fe /main.c | |
parent | 5c3d0566c866a0f3a581d4b4a39edde6f7c684b5 (diff) |
Omit user code and tables from generated header file.
Diffstat (limited to 'main.c')
-rw-r--r-- | main.c | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -532,6 +532,7 @@ int exit_status; FILE *header_out; char linebuf[LINE_SZ]; int nlines=0; + int discard = 0; /* rewind the outfile file. */ fflush(stdout); @@ -548,6 +549,16 @@ int exit_status; nlines=4; while(fgets(linebuf, LINE_SZ, stdout)) { + if (strstr(linebuf, "YY-DISCARD-FROM-HEADER")) + discard++; + else if (strstr(linebuf, "YY-END-DISCARD-FROM-HEADER")){ + discard--; + continue; + } + + if (discard) + continue; + fix_line_dirs(linebuf, outfilename, headerfilename, nlines); fputs(linebuf, header_out); nlines++; @@ -555,6 +566,7 @@ int exit_status; /* Kill ALL flex-related macros. This is so the user * can #include more than one generated header file. */ + fprintf(header_out,"#line %d \"%s\"", (++nlines)+1, headerfilename); fprintf(header_out,"\n"); fprintf(header_out,"#undef BEGIN\n"); fprintf(header_out,"#undef ECHO\n"); |