@@ -214,7 +214,7 @@ static bool endScope(Entry *scope, bool isGlobalRoot=FALSE);
214
214
//static bool isTypeName(QCString name);
215
215
static void resolveModuleProcedures(QList<Entry> &moduleProcedures, Entry *current_root);
216
216
static int getAmpersandAtTheStart(const char *buf, int length);
217
- static int getAmpOrExclAtTheEnd(const char *buf, int length);
217
+ static int getAmpOrExclAtTheEnd(const char *buf, int length, char ch );
218
218
static void truncatePrepass(int index);
219
219
static void pushBuffer(QCString &buffer);
220
220
static void popBuffer();
@@ -328,7 +328,7 @@ SCOPENAME ({ID}{BS}"::"{BS})*
328
328
DBG_CTX((stderr, "---%s", yytext));
329
329
330
330
int indexStart = getAmpersandAtTheStart(yytext, (int)yyleng);
331
- int indexEnd = getAmpOrExclAtTheEnd(yytext, (int)yyleng);
331
+ int indexEnd = getAmpOrExclAtTheEnd(yytext, (int)yyleng, '\0' );
332
332
if (indexEnd>=0 && yytext[indexEnd]!='&') //we are only interested in amp
333
333
indexEnd=-1;
334
334
@@ -1276,13 +1276,15 @@ static int getAmpersandAtTheStart(const char *buf, int length)
1276
1276
}
1277
1277
1278
1278
/* Returns ampersand index, comment start index or -1 if neither exist.*/
1279
- static int getAmpOrExclAtTheEnd(const char *buf, int length)
1279
+ static int getAmpOrExclAtTheEnd(const char *buf, int length, char ch )
1280
1280
{
1281
1281
// Avoid ampersands in string and comments
1282
1282
int parseState = Start;
1283
1283
char quoteSymbol = 0;
1284
1284
int ampIndex = -1;
1285
1285
int commentIndex = -1;
1286
+ quoteSymbol = ch;
1287
+ if (ch != '\0') parseState = String;
1286
1288
1287
1289
for(int i=0; i<length && parseState!=Comment; i++)
1288
1290
{
@@ -1413,6 +1415,8 @@ static const char* prepassFixedForm(const char* contents)
1413
1415
int column=0;
1414
1416
int prevLineLength=0;
1415
1417
int prevLineAmpOrExclIndex=-1;
1418
+ char prevQuote = '\0';
1419
+ char thisQuote = '\0';
1416
1420
bool emptyLabel=TRUE;
1417
1421
bool commented=FALSE;
1418
1422
bool inSingle=FALSE;
@@ -1432,11 +1436,12 @@ static const char* prepassFixedForm(const char* contents)
1432
1436
switch(c) {
1433
1437
case '\n':
1434
1438
prevLineLength=column;
1435
- prevLineAmpOrExclIndex=getAmpOrExclAtTheEnd(&contents[i-prevLineLength+1], prevLineLength);
1439
+ prevLineAmpOrExclIndex=getAmpOrExclAtTheEnd(&contents[i-prevLineLength+1], prevLineLength,prevQuote );
1436
1440
column=0;
1437
1441
emptyLabel=TRUE;
1438
1442
commented=FALSE;
1439
1443
newContents[j]=c;
1444
+ prevQuote = thisQuote;
1440
1445
break;
1441
1446
case ' ':
1442
1447
case '\t':
@@ -1467,12 +1472,22 @@ static const char* prepassFixedForm(const char* contents)
1467
1472
}
1468
1473
else if (c == '\'')
1469
1474
{
1470
- if (!inDouble) inSingle = !inSingle;
1475
+ if (!inDouble)
1476
+ {
1477
+ inSingle = !inSingle;
1478
+ if (inSingle) thisQuote = c;
1479
+ else thisQuote = '\0';
1480
+ }
1471
1481
break;
1472
1482
}
1473
1483
else if (c == '"')
1474
1484
{
1475
- if (!inSingle) inDouble = !inDouble;
1485
+ if (!inSingle)
1486
+ {
1487
+ inDouble = !inDouble;
1488
+ if (inDouble) thisQuote = c;
1489
+ else thisQuote = '\0';
1490
+ }
1476
1491
break;
1477
1492
}
1478
1493
}
0 commit comments