@@ -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
@@ -1273,13 +1273,15 @@ static int getAmpersandAtTheStart(const char *buf, int length)
1273
1273
}
1274
1274
1275
1275
/* Returns ampersand index, comment start index or -1 if neither exist.*/
1276
- static int getAmpOrExclAtTheEnd(const char *buf, int length)
1276
+ static int getAmpOrExclAtTheEnd(const char *buf, int length, char ch )
1277
1277
{
1278
1278
// Avoid ampersands in string and comments
1279
1279
int parseState = Start;
1280
1280
char quoteSymbol = 0;
1281
1281
int ampIndex = -1;
1282
1282
int commentIndex = -1;
1283
+ quoteSymbol = ch;
1284
+ if (ch != '\0') parseState = String;
1283
1285
1284
1286
for(int i=0; i<length && parseState!=Comment; i++)
1285
1287
{
@@ -1410,6 +1412,8 @@ static const char* prepassFixedForm(const char* contents)
1410
1412
int column=0;
1411
1413
int prevLineLength=0;
1412
1414
int prevLineAmpOrExclIndex=-1;
1415
+ char prevQuote = '\0';
1416
+ char thisQuote = '\0';
1413
1417
bool emptyLabel=TRUE;
1414
1418
bool commented=FALSE;
1415
1419
bool inSingle=FALSE;
@@ -1429,11 +1433,12 @@ static const char* prepassFixedForm(const char* contents)
1429
1433
switch(c) {
1430
1434
case '\n':
1431
1435
prevLineLength=column;
1432
- prevLineAmpOrExclIndex=getAmpOrExclAtTheEnd(&contents[i-prevLineLength+1], prevLineLength);
1436
+ prevLineAmpOrExclIndex=getAmpOrExclAtTheEnd(&contents[i-prevLineLength+1], prevLineLength,prevQuote );
1433
1437
column=0;
1434
1438
emptyLabel=TRUE;
1435
1439
commented=FALSE;
1436
1440
newContents[j]=c;
1441
+ prevQuote = thisQuote;
1437
1442
break;
1438
1443
case ' ':
1439
1444
case '\t':
@@ -1464,12 +1469,22 @@ static const char* prepassFixedForm(const char* contents)
1464
1469
}
1465
1470
else if (c == '\'')
1466
1471
{
1467
- if (!inDouble) inSingle = !inSingle;
1472
+ if (!inDouble)
1473
+ {
1474
+ inSingle = !inSingle;
1475
+ if (inSingle) thisQuote = c;
1476
+ else thisQuote = '\0';
1477
+ }
1468
1478
break;
1469
1479
}
1470
1480
else if (c == '"')
1471
1481
{
1472
- if (!inSingle) inDouble = !inDouble;
1482
+ if (!inSingle)
1483
+ {
1484
+ inDouble = !inDouble;
1485
+ if (inDouble) thisQuote = c;
1486
+ else thisQuote = '\0';
1487
+ }
1473
1488
break;
1474
1489
}
1475
1490
}
0 commit comments