diff --git a/manifest b/manifest index 624358898f..a355a72117 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Never\suse\sstrlen().\s\sUse\sour\sown\sinternal\ssqlite3Strlen30()\swhich\sis\nguaranteed\sto\snever\soverflow\san\sinteger.\s\sAdditional\sexplicit\scasts\sto\navoid\snuisance\swarning\smessages.\s(CVS\s6007) -D 2008-12-10T19:26:22 +C Added\soption\s(-l)\sto\slemon\sparser\sto\shave\sit\sskip\sprinting\sline\snumbers\s(#line\s...\s).\s(CVS\s6008) +D 2008-12-10T20:10:05 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0 F Makefile.in f7e4c81c347b04f7b0f1c1b081a168645d7b8af7 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654 @@ -641,7 +641,7 @@ F tool/fragck.tcl 5265a95126abcf6ab357f7efa544787e5963f439 F tool/genfkey.README 080ca2269f727fcf14c8e76d52e85d157e3a8e9a F tool/genfkey.c e1b9c93da828db10c1109c7b4fa611aec8adc407 F tool/genfkey.test 182829596fb15785b94b2493c5f735b847d91076 -F tool/lemon.c 6cb39632ef3bfec2cea8f81b4d7f63c09fe12802 +F tool/lemon.c 9f21067ff5f0ba1780d39a069da65d54789ae15b F tool/lempar.c fece0da829c0e425f13e6da1671619bed43d0f70 F tool/memleak.awk 4e7690a51bf3ed757e611273d43fe3f65b510133 F tool/memleak2.awk 9cc20c8e8f3c675efac71ea0721ee6874a1566e8 @@ -664,7 +664,7 @@ F tool/speedtest16.c c8a9c793df96db7e4933f0852abb7a03d48f2e81 F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e -P 14e6d19c3157ccdce170e769d678c7f472dd3db2 -R 540b254104078d68363402828d97892e -U drh -Z 8a01ff0a84aab7060e0a3bce21036dfb +P c872d554930ecf221ac2be5f886d5d67bb35288c +R 19abd022e9b6073876fd318824d614c3 +U shane +Z 7652c32495d75461d5abb8d2cced321f diff --git a/manifest.uuid b/manifest.uuid index ce90d21cad..7336583c4f 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -c872d554930ecf221ac2be5f886d5d67bb35288c \ No newline at end of file +ccb9393a7a10f0970419b860af293b0bdad7f894 \ No newline at end of file diff --git a/tool/lemon.c b/tool/lemon.c index 175bc6e810..626cd2e2f8 100644 --- a/tool/lemon.c +++ b/tool/lemon.c @@ -271,6 +271,7 @@ struct lemon { int tablesize; /* Size of the parse tables */ int basisflag; /* Print only basis configurations */ int has_fallback; /* True if any %fallback is seen in the grammar */ + int nolinenosflag; /* True if #line statements should not be printed */ char *argv0; /* Name of the program */ }; @@ -1401,12 +1402,14 @@ char **argv; static int quiet = 0; static int statistics = 0; static int mhflag = 0; + static int nolinenosflag = 0; static struct s_options options[] = { {OPT_FLAG, "b", (char*)&basisflag, "Print only the basis in report."}, {OPT_FLAG, "c", (char*)&compress, "Don't compress the action table."}, {OPT_FSTR, "D", (char*)handle_D_option, "Define an %ifdef macro."}, {OPT_FLAG, "g", (char*)&rpflag, "Print grammar without actions."}, - {OPT_FLAG, "m", (char*)&mhflag, "Output a makeheaders compatible file"}, + {OPT_FLAG, "m", (char*)&mhflag, "Output a makeheaders compatible file."}, + {OPT_FLAG, "l", (char*)&nolinenosflag, "Do not print #line statements."}, {OPT_FLAG, "q", (char*)&quiet, "(Quiet) Don't print the report file."}, {OPT_FLAG, "s", (char*)&statistics, "Print parser stats to standard output."}, @@ -1435,6 +1438,7 @@ char **argv; lem.argv0 = argv[0]; lem.filename = OptArg(0); lem.basisflag = basisflag; + lem.nolinenosflag = nolinenosflag; Symbol_new("$"); lem.errsym = Symbol_new("error"); lem.errsym->useCnt = 0; @@ -2340,7 +2344,7 @@ to follow the previous rule."); } nOld = lemonStrlen(zOld); n = nOld + nNew + 20; - addLineMacro = psp->insertLineMacro && + addLineMacro = !psp->gp->nolinenosflag && psp->insertLineMacro && (psp->decllinenoslot==0 || psp->decllinenoslot[0]!=0); if( addLineMacro ){ for(z=psp->filename, nBack=0; *z; z++){ @@ -3119,18 +3123,18 @@ char *str; int *lineno; { if( str==0 ) return; - (*lineno)++; while( *str ){ - if( *str=='\n' ) (*lineno)++; putc(*str,out); + if( *str=='\n' ) (*lineno)++; str++; } if( str[-1]!='\n' ){ putc('\n',out); (*lineno)++; } - tplt_linedir(out,*lineno+2,lemp->outname); - (*lineno)+=2; + if (!lemp->nolinenosflag) { + (*lineno)++; tplt_linedir(out,*lineno,lemp->outname); + } return; } @@ -3146,7 +3150,6 @@ int *lineno; { char *cp = 0; - int linecnt = 0; if( sp->type==TERMINAL ){ cp = lemp->tokendest; if( cp==0 ) return; @@ -3154,7 +3157,7 @@ int *lineno; }else if( sp->destructor ){ cp = sp->destructor; fprintf(out,"{\n"); (*lineno)++; - tplt_linedir(out,sp->destLineno,lemp->filename); (*lineno)++; + if (!lemp->nolinenosflag) { (*lineno)++; tplt_linedir(out,sp->destLineno,lemp->filename); } }else if( lemp->vardest ){ cp = lemp->vardest; if( cp==0 ) return; @@ -3168,13 +3171,14 @@ int *lineno; cp++; continue; } - if( *cp=='\n' ) linecnt++; + if( *cp=='\n' ) (*lineno)++; fputc(*cp,out); } - (*lineno) += 3 + linecnt; - fprintf(out,"\n"); - tplt_linedir(out,*lineno,lemp->outname); - fprintf(out,"}\n"); + fprintf(out,"\n"); (*lineno)++; + if (!lemp->nolinenosflag) { + (*lineno)++; tplt_linedir(out,*lineno,lemp->outname); + } + fprintf(out,"}\n"); (*lineno)++; return; } @@ -3346,18 +3350,16 @@ struct lemon *lemp; int *lineno; { char *cp; - int linecnt = 0; /* Generate code to do the reduce action */ if( rp->code ){ - tplt_linedir(out,rp->line,lemp->filename); + if (!lemp->nolinenosflag) { (*lineno)++; tplt_linedir(out,rp->line,lemp->filename); } fprintf(out,"{%s",rp->code); for(cp=rp->code; *cp; cp++){ - if( *cp=='\n' ) linecnt++; + if( *cp=='\n' ) (*lineno)++; } /* End loop */ - (*lineno) += 3 + linecnt; - fprintf(out,"}\n"); - tplt_linedir(out,*lineno,lemp->outname); + fprintf(out,"}\n"); (*lineno)++; + if (!lemp->nolinenosflag) { (*lineno)++; tplt_linedir(out,*lineno,lemp->outname); } } /* End if( rp->code ) */ return;