summaryrefslogtreecommitdiffstats
path: root/src/pre.l
diff options
context:
space:
mode:
authordimitri <dimitri@afe2bf4a-e733-0410-8a33-86f594647bc7>2000-12-03 19:13:07 (GMT)
committerdimitri <dimitri@afe2bf4a-e733-0410-8a33-86f594647bc7>2000-12-03 19:13:07 (GMT)
commitfe67b8eb68129713327965c201f2d7226b83202f (patch)
tree485fb83c5a301dd4b0edb3c534b1f31eeb08ab1f /src/pre.l
parenta30c2e3c5ea41ae1947e9893c82ed8c8b6d7c5a2 (diff)
downloadDoxygen-fe67b8eb68129713327965c201f2d7226b83202f.zip
Doxygen-fe67b8eb68129713327965c201f2d7226b83202f.tar.gz
Doxygen-fe67b8eb68129713327965c201f2d7226b83202f.tar.bz2
Release-1.2.3-20001203
Diffstat (limited to 'src/pre.l')
-rw-r--r--src/pre.l29
1 files changed, 25 insertions, 4 deletions
diff --git a/src/pre.l b/src/pre.l
index 823e6e7..2c3c67b 100644
--- a/src/pre.l
+++ b/src/pre.l
@@ -93,6 +93,7 @@ static QCString g_lastGuardName;
static QCString g_incName;
static QCString g_guardExpr;
static int g_curlyCount;
+static bool g_nospaces; // add extra spaces during macro expansion
static void setFileName(const char *name)
{
@@ -494,6 +495,7 @@ static bool replaceFunctionMacro(const QCString &expr,QCString *rest,int pos,int
if (key.length()>1 && (subst=argTable[key]))
{
QCString substArg=*subst;
+ //printf("substArg=`%s'\n",substArg.data());
// only if no ## operator is before or after the argument
// marker we do macro expansion.
if (!hash) expandExpression(substArg,0,0);
@@ -507,7 +509,14 @@ static bool replaceFunctionMacro(const QCString &expr,QCString *rest,int pos,int
}
else
{
- resExpr+=" "+substArg+" ";
+ if (g_nospaces)
+ {
+ resExpr+=substArg;
+ }
+ else
+ {
+ resExpr+=" "+substArg+" ";
+ }
}
}
}
@@ -597,7 +606,15 @@ static void expandExpression(QCString &expr,QCString *rest,int pos)
{
// substitute the definition of the macro
//printf("macro `%s'->`%s'\n",macroName.data(),def->definition.data());
- expMacro=" "+def->definition.stripWhiteSpace()+" ";
+ if (g_nospaces)
+ {
+ expMacro=def->definition.stripWhiteSpace();
+ }
+ else
+ {
+ expMacro=" "+def->definition.stripWhiteSpace()+" ";
+ }
+ //expMacro=def->definition.stripWhiteSpace();
replaced=TRUE;
len=l;
//printf("simple macro expansion=`%s'->`%s'\n",macroName.data(),expMacro.data());
@@ -1086,6 +1103,7 @@ BN [ \t\r\n]
else // g_findDefArgContext==IncludeID
{
readIncludeFile(result);
+ g_nospaces=FALSE;
BEGIN(Start);
}
}
@@ -1339,12 +1357,14 @@ BN [ \t\r\n]
BEGIN(SkipCPPBlock);
}
<IncludeID>{ID}{B}*/"(" {
+ g_nospaces=TRUE;
g_roundCount=0;
g_defArgsStr=yytext;
g_findDefArgContext = IncludeID;
BEGIN(FindDefineArgs);
}
<IncludeID>{ID} {
+ g_nospaces=TRUE;
readIncludeFile(expandMacro(yytext));
BEGIN(Start);
}
@@ -1529,12 +1549,12 @@ BN [ \t\r\n]
int *n;
if ((n=(*g_argDict)[yytext]))
{
- if (!g_quoteArg) g_defText+=' ';
+ //if (!g_quoteArg) g_defText+=' ';
g_defText+='@';
QCString numStr;
numStr.sprintf("%d",*n);
g_defText+=numStr;
- if (!g_quoteArg) g_defText+=' ';
+ //if (!g_quoteArg) g_defText+=' ';
}
else
{
@@ -1768,6 +1788,7 @@ void preprocessFile(const char *fileName,BufStr &output)
//#endif
g_curlyCount=0;
+ g_nospaces=FALSE;
g_outputBuf=&output;
g_includeStack.setAutoDelete(TRUE);
g_includeStack.clear();