summaryrefslogtreecommitdiffstats
path: root/src/pre.l
diff options
context:
space:
mode:
Diffstat (limited to 'src/pre.l')
-rw-r--r--src/pre.l20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/pre.l b/src/pre.l
index 564dc27..596108f 100644
--- a/src/pre.l
+++ b/src/pre.l
@@ -73,9 +73,10 @@ struct CondCtx
struct FileState
{
- FileState(int size) : lineNr(1), fileBuf(size),
+ FileState(int size) : lineNr(1), curlyCount(0),fileBuf(size),
oldFileBuf(0), oldFileBufPos(0), bufState(0) {}
int lineNr;
+ int curlyCount;
BufStr fileBuf;
BufStr *oldFileBuf;
int oldFileBufPos;
@@ -1088,7 +1089,12 @@ static void expandExpression(QCString &expr,QCString *rest,int pos)
if (g_expandedDict->find(macroName)==0) // expand macro
{
Define *def=DefineManager::instance().isDefined(macroName);
- if (definedTest) // macro name was found after defined
+ if (macroName=="defined")
+ {
+ //printf("found defined inside macro definition '%s'\n",expr.right(expr.length()-p).data());
+ definedTest=TRUE;
+ }
+ else if (definedTest) // macro name was found after defined
{
if (def) expMacro = " 1 "; else expMacro = " 0 ";
replaced=TRUE;
@@ -1117,11 +1123,6 @@ static void expandExpression(QCString &expr,QCString *rest,int pos)
replaced=replaceFunctionMacro(expr,rest,p+l,len,def,expMacro);
len+=l;
}
- else if (macroName=="defined")
- {
- //printf("found defined inside macro definition '%s'\n",expr.right(expr.length()-p).data());
- definedTest=TRUE;
- }
if (replaced) // expand the macro and rescan the expression
{
@@ -1606,6 +1607,8 @@ static void readIncludeFile(const QCString &inc)
fs->bufState = YY_CURRENT_BUFFER;
fs->lineNr = oldLineNr;
fs->fileName = oldFileName;
+ fs->curlyCount = g_curlyCount;
+ g_curlyCount = 0;
// push the state on the stack
g_includeStack.push(fs);
// set the scanner to the include file
@@ -2091,6 +2094,8 @@ CHARLIT (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^'\\\n]{1,4}"'"))
<ReadString>"//"|"/*" {
g_defArgsStr+=yytext;
}
+<ReadString>\\/\r?\n { // line continuation
+ }
<ReadString>\\. {
g_defArgsStr+=yytext;
}
@@ -2949,6 +2954,7 @@ CHARLIT (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^'\\\n]{1,4}"'"))
//preYYin = fs->oldYYin;
g_inputBuf = fs->oldFileBuf;
g_inputBufPos = fs->oldFileBufPos;
+ g_curlyCount = fs->curlyCount;
setFileName(fs->fileName);
DBG_CTX((stderr,"######## FileName %s\n",g_yyFileName.data()));