-C Fix\smore\sname\scollisions.\s\sAllow\ssqlite.h\sand\ssqlite3.h\sto\sboth\sbe\sincluded\nin\sthe\ssame\sC/C++\ssource\sfile.\s(CVS\s1942)
-D 2004-09-06T17:34:13
+C Lemon\sescapes\sbackslashes\sin\sfilenames\sin\s#line\sdirectives\sit\sgenerates.\nTicket\s#892.\s(CVS\s1943)
+D 2004-09-07T11:28:25
F Makefile.in 65a7c43fcaf9a710d62f120b11b6e435eeb4a450
F Makefile.linux-gcc a9e5a0d309fa7c38e7c14d3ecf7690879d3a5457
F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd
F test/view.test ca5c296989d3045f121be9a67588ff88c64874a8
F test/where.test 40dcffcb77ad0a00960cef2b5b1212c77fd02199
F tool/diffdb.c 7524b1b5df217c20cd0431f6789851a4e0cb191b
-F tool/lemon.c ece41a3cd100e68fef5f136267cf02c44366c263
+F tool/lemon.c b64210ca04268681a74b32a830c64be523ccc859
F tool/lempar.c 0b5e7a58634e0d448929b8e85f7981c2aa708d57
F tool/memleak.awk b744b6109566206c746d826f6ecdba34662216bc
F tool/memleak2.awk 9cc20c8e8f3c675efac71ea0721ee6874a1566e8
F www/vdbe.tcl 59288db1ac5c0616296b26dce071c36cb611dfe9
F www/version3.tcl 092a01f5ef430d2c4acc0ae558d74c4bb89638a0
F www/whentouse.tcl a8335bce47cc2fddb07f19052cb0cb4d9129a8e4
-P 3ddf5a9d1c480a2e3aa32685879063b11afddbe1
-R 4e21ecb2dca1b0e6b2292d8785d52007
+P 23e5bed1c5062f0f639751f89873bf1a277547bd
+R e40cf5a15ff3721d6f9f87371f66f8fc
U drh
-Z 6b0395c7e689562e57eb91318a8ed3d1
+Z 9268fa6b52f2c5d13e0dc61c8a84d6ef
return in;
}
+/* Print a #line directive line to the output file. */
+PRIVATE void tplt_linedir(out,lineno,filename)
+FILE *out;
+int lineno;
+char *filename;
+{
+ fprintf(out,"#line %d \"",lineno);
+ while( *filename ){
+ if( *filename == '\\' ) putc('\\',out);
+ putc(*filename,out);
+ filename++;
+ }
+ fprintf(out,"\"\n");
+}
+
/* Print a string to the file and keep the linenumber up to date */
PRIVATE void tplt_print(out,lemp,str,strln,lineno)
FILE *out;
int *lineno;
{
if( str==0 ) return;
- fprintf(out,"#line %d \"%s\"\n",strln,lemp->filename); (*lineno)++;
+ tplt_linedir(out,strln,lemp->filename);
+ (*lineno)++;
while( *str ){
if( *str=='\n' ) (*lineno)++;
putc(*str,out);
str++;
}
- fprintf(out,"\n#line %d \"%s\"\n",*lineno+2,lemp->outname); (*lineno)+=2;
+ tplt_linedir(out,*lineno+2,lemp->outname);
+ (*lineno)+=2;
return;
}
if( sp->type==TERMINAL ){
cp = lemp->tokendest;
if( cp==0 ) return;
- fprintf(out,"#line %d \"%s\"\n{",lemp->tokendestln,lemp->filename);
+ tplt_linedir(out,lemp->tokendestln,lemp->filename);
+ fprintf(out,"{");
}else if( sp->destructor ){
cp = sp->destructor;
- fprintf(out,"#line %d \"%s\"\n{",sp->destructorln,lemp->filename);
+ tplt_linedir(out,sp->destructorln,lemp->filename);
+ fprintf(out,"{");
}else if( lemp->vardest ){
cp = lemp->vardest;
if( cp==0 ) return;
- fprintf(out,"#line %d \"%s\"\n{",lemp->vardestln,lemp->filename);
+ tplt_linedir(out,lemp->vardestln,lemp->filename);
+ fprintf(out,"{");
}else{
assert( 0 ); /* Cannot happen */
}
fputc(*cp,out);
}
(*lineno) += 3 + linecnt;
- fprintf(out,"}\n#line %d \"%s\"\n",*lineno,lemp->outname);
+ fprintf(out,"}\n");
+ tplt_linedir(out,*lineno,lemp->outname);
return;
}
static char *z = 0;
static int alloced = 0;
static int used = 0;
- int i, c;
+ int c;
char zInt[40];
if( zText==0 ){
/*
** zCode is a string that is the action associated with a rule. Expand
** the symbols in this string so that the refer to elements of the parser
-** stack. Return a new string stored in space obtained from malloc.
+** stack.
*/
-PRIVATE char *translate_code(struct lemon *lemp, struct rule *rp){
+PRIVATE void translate_code(struct lemon *lemp, struct rule *rp){
char *cp, *xp;
int i;
char lhsused = 0; /* True if the LHS element has been used */
/* Generate code to do the reduce action */
if( rp->code ){
- fprintf(out,"#line %d \"%s\"\n{",rp->line,lemp->filename);
- fprintf(out,"%s",rp->code);
+ tplt_linedir(out,rp->line,lemp->filename);
+ fprintf(out,"{%s",rp->code);
for(cp=rp->code; *cp; cp++){
if( *cp=='\n' ) linecnt++;
} /* End loop */
(*lineno) += 3 + linecnt;
- fprintf(out,"}\n#line %d \"%s\"\n",*lineno,lemp->outname);
+ fprintf(out,"}\n");
+ tplt_linedir(out,*lineno,lemp->outname);
} /* End if( rp->code ) */
return;