/ Check-in [dc697c26]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fix a bug in the #line generator of lemon. Ticket #3214. (CVS 5404)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:dc697c26668929c4eed5ab8cde6975125a7e66c7
User & Date: drh 2008-07-14 12:21:08
Context
2008-07-14
12:27
Fix additional typos in comments within lemon. Ticket #3215. (CVS 5405) check-in: 37214769 user: drh tags: trunk
12:21
Fix a bug in the #line generator of lemon. Ticket #3214. (CVS 5404) check-in: dc697c26 user: drh tags: trunk
2008-07-13
03:55
Fix a typo in the documentation. (CVS 5403) check-in: d618a883 user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to tool/lemon.c.

2317
2318
2319
2320
2321
2322
2323

2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336

2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
        psp->errorcnt++;
      }
      break;
    case WAITING_FOR_DECL_ARG:
      if( x[0]=='{' || x[0]=='\"' || isalnum(x[0]) ){
        char *zOld, *zNew, *zBuf, *z;
        int nOld, n, nLine, nNew, nBack;

        char zLine[50];
        zNew = x;
        if( zNew[0]=='"' || zNew[0]=='{' ) zNew++;
        nNew = strlen(zNew);
        if( *psp->declargslot ){
          zOld = *psp->declargslot;
        }else{
          zOld = "";
        }
        nOld = strlen(zOld);
        n = nOld + nNew + 20;
        if( psp->insertLineMacro && psp->decllinenoslot
            && psp->decllinenoslot[0] ){

          for(z=psp->filename, nBack=0; *z; z++){
            if( *z=='\\' ) nBack++;
          }
          sprintf(zLine, "#line %d ", psp->tokenlineno);
          nLine = strlen(zLine);
          n += nLine + strlen(psp->filename) + nBack;
        }
        *psp->declargslot = zBuf = realloc(*psp->declargslot, n);
        zBuf += nOld;
        if( psp->insertLineMacro && psp->decllinenoslot
            && psp->decllinenoslot[0] ){
          if( nOld && zBuf[-1]!='\n' ){
            *(zBuf++) = '\n';
          }
          memcpy(zBuf, zLine, nLine);
          zBuf += nLine;
          *(zBuf++) = '"';
          for(z=psp->filename; *z; z++){







>











|
|
>









|
<







2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348

2349
2350
2351
2352
2353
2354
2355
        psp->errorcnt++;
      }
      break;
    case WAITING_FOR_DECL_ARG:
      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++;
        nNew = strlen(zNew);
        if( *psp->declargslot ){
          zOld = *psp->declargslot;
        }else{
          zOld = "";
        }
        nOld = strlen(zOld);
        n = nOld + nNew + 20;
        addLineMacro = psp->insertLineMacro &&
                        (psp->decllinenoslot==0 || psp->decllinenoslot[0]!=0);
        if( addLineMacro ){
          for(z=psp->filename, nBack=0; *z; z++){
            if( *z=='\\' ) nBack++;
          }
          sprintf(zLine, "#line %d ", psp->tokenlineno);
          nLine = strlen(zLine);
          n += nLine + strlen(psp->filename) + nBack;
        }
        *psp->declargslot = zBuf = realloc(*psp->declargslot, n);
        zBuf += nOld;
        if( addLineMacro ){

          if( nOld && zBuf[-1]!='\n' ){
            *(zBuf++) = '\n';
          }
          memcpy(zBuf, zLine, nLine);
          zBuf += nLine;
          *(zBuf++) = '"';
          for(z=psp->filename; *z; z++){