Fix a bug in the #line generator of lemon. Ticket #3214. (CVS 5404)

FossilOrigin-Name: dc697c26668929c4eed5ab8cde6975125a7e66c7
This commit is contained in:
drh 2008-07-14 12:21:08 +00:00
parent 71f486254b
commit b5bd49e9cb
3 changed files with 12 additions and 11 deletions

View File

@ -1,5 +1,5 @@
C Fix\sa\stypo\sin\sthe\sdocumentation.\s(CVS\s5403)
D 2008-07-13T03:55:04
C Fix\sa\sbug\sin\sthe\s#line\sgenerator\sof\slemon.\sTicket\s#3214.\s(CVS\s5404)
D 2008-07-14T12:21:08
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
F Makefile.in a03f7cb4f7ad50bc53a788c6c544430e81f95de4
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@ -583,7 +583,7 @@ F test/where6.test 42c4373595f4409d9c6a9987b4a60000ad664faf
F test/zeroblob.test 792124852ec61458a2eb527b5091791215e0be95
F tool/diffdb.c 7524b1b5df217c20cd0431f6789851a4e0cb191b
F tool/fragck.tcl 5265a95126abcf6ab357f7efa544787e5963f439
F tool/lemon.c f1f54e93808b09d2000ec1c3ff53888a27067b52
F tool/lemon.c e307368d18e0edab70d6a6f377def2df0fb17da1
F tool/lempar.c aab54f1758c554e550ff5c4b191053a819279a2b
F tool/memleak.awk 4e7690a51bf3ed757e611273d43fe3f65b510133
F tool/memleak2.awk 9cc20c8e8f3c675efac71ea0721ee6874a1566e8
@ -605,7 +605,7 @@ F tool/speedtest16.c c8a9c793df96db7e4933f0852abb7a03d48f2e81
F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
F tool/speedtest8.c 1dbced29de5f59ba2ebf877edcadf171540374d1
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
P 8be28aa0f259f0b86103e4f1e7da1adfecc4305c
R 0469352c7a367ad90bb92709945de132
P d618a883304d5a84540daf5e3397de677786aff8
R d246c1c43f9887c2d7543ad7eeb3272b
U drh
Z 2cd44177dc95d42b786dcb644774490e
Z e65f4d0ffa1fb542437cde4899bed914

View File

@ -1 +1 @@
d618a883304d5a84540daf5e3397de677786aff8
dc697c26668929c4eed5ab8cde6975125a7e66c7

View File

@ -2321,6 +2321,7 @@ to follow the previous rule.");
if( x[0]=='{' || x[0]=='\"' || isalnum(x[0]) ){
char *zOld, *zNew, *zBuf, *z;
int nOld, n, nLine, nNew, nBack;
int addLineMacro;
char zLine[50];
zNew = x;
if( zNew[0]=='"' || zNew[0]=='{' ) zNew++;
@ -2332,8 +2333,9 @@ to follow the previous rule.");
}
nOld = strlen(zOld);
n = nOld + nNew + 20;
if( psp->insertLineMacro && psp->decllinenoslot
&& psp->decllinenoslot[0] ){
addLineMacro = psp->insertLineMacro &&
(psp->decllinenoslot==0 || psp->decllinenoslot[0]!=0);
if( addLineMacro ){
for(z=psp->filename, nBack=0; *z; z++){
if( *z=='\\' ) nBack++;
}
@ -2343,8 +2345,7 @@ to follow the previous rule.");
}
*psp->declargslot = zBuf = realloc(*psp->declargslot, n);
zBuf += nOld;
if( psp->insertLineMacro && psp->decllinenoslot
&& psp->decllinenoslot[0] ){
if( addLineMacro ){
if( nOld && zBuf[-1]!='\n' ){
*(zBuf++) = '\n';
}