| 1 |
Index: commentcnv.l |
|---|
| 2 |
=================================================================== |
|---|
| 3 |
RCS file: /cvsroot/doxygen/src/commentcnv.l,v |
|---|
| 4 |
retrieving revision 1.32 |
|---|
| 5 |
diff -u -3 -p -r1.32 commentcnv.l |
|---|
| 6 |
--- commentcnv.l 16 Jul 2006 20:10:06 -0000 1.32 |
|---|
| 7 |
+++ commentcnv.l 29 Sep 2006 21:45:49 -0000 |
|---|
| 8 |
@@ -225,7 +225,7 @@ static QCString handleCondCmdInAliases(c |
|---|
| 9 |
*/ |
|---|
| 10 |
static void replaceAliases(const char *s,int len) |
|---|
| 11 |
{ |
|---|
| 12 |
- static QRegExp cmd("[@\\\\][a-z_A-Z][a-z_A-Z0-9]*"); |
|---|
| 13 |
+ static QRegExp cmd("[@\\\\][a-z_A-Z][a-z_A-Z0-9(),]*"); |
|---|
| 14 |
QCString in=s; |
|---|
| 15 |
int p=0,i,l; |
|---|
| 16 |
while ((i=cmd.match(in,p,&l))!=-1) |
|---|
| 17 |
@@ -507,16 +507,107 @@ CHARLIT (("'"\\[0-7]{1,3}"'")|("'"\\." |
|---|
| 18 |
if (*yytext=='\n') g_lineNr++; |
|---|
| 19 |
BEGIN(g_condCtx); |
|---|
| 20 |
} |
|---|
| 21 |
-<CComment,ReadLine>[\\@][a-z_A-Z][a-z_A-Z0-9]* { // expand alias |
|---|
| 22 |
- QCString *pValue=Doxygen::aliasDict[yytext+1]; |
|---|
| 23 |
- if (pValue) |
|---|
| 24 |
- { |
|---|
| 25 |
- QCString val = handleCondCmdInAliases(*pValue); |
|---|
| 26 |
- copyToOutput(val.data(),val.length()); |
|---|
| 27 |
+<CComment,ReadLine>[\\@][a-z_A-Z][a-z_A-Z0-9(),\\]* { // expand alias |
|---|
| 28 |
+ |
|---|
| 29 |
+ QCString com(yytext+1); |
|---|
| 30 |
+ int ind; |
|---|
| 31 |
+ ind = com.find('('); |
|---|
| 32 |
+ if(ind < 0) // command with no args? |
|---|
| 33 |
+ { |
|---|
| 34 |
+ QCString *pValue=Doxygen::aliasDict[yytext+1]; |
|---|
| 35 |
+ if (pValue) |
|---|
| 36 |
+ { |
|---|
| 37 |
+ QCString val = handleCondCmdInAliases(*pValue); |
|---|
| 38 |
+ copyToOutput(val.data(),val.length()); |
|---|
| 39 |
+ } |
|---|
| 40 |
+ else |
|---|
| 41 |
+ { |
|---|
| 42 |
+ copyToOutput(yytext,yyleng); |
|---|
| 43 |
+ } |
|---|
| 44 |
} |
|---|
| 45 |
- else |
|---|
| 46 |
+ else // args! |
|---|
| 47 |
{ |
|---|
| 48 |
- copyToOutput(yytext,yyleng); |
|---|
| 49 |
+ QCString rawcom(com.data(), ind); |
|---|
| 50 |
+ |
|---|
| 51 |
+ QCString *pValue=Doxygen::aliasDict[rawcom]; |
|---|
| 52 |
+ if (pValue) |
|---|
| 53 |
+ { |
|---|
| 54 |
+ // Split args |
|---|
| 55 |
+ // This should probably be put into the scanner, |
|---|
| 56 |
+ // but this is simpler for now. |
|---|
| 57 |
+ const unsigned int MAXARGS = 20; |
|---|
| 58 |
+ QCString args[MAXARGS]; |
|---|
| 59 |
+ unsigned nargs = 0; |
|---|
| 60 |
+ QCString argval; |
|---|
| 61 |
+ bool esc = false; |
|---|
| 62 |
+ for(unsigned int i = ind + 1; i < com.length(); ++i) |
|---|
| 63 |
+ { |
|---|
| 64 |
+ char c = com[i]; |
|---|
| 65 |
+ if(c == '\\') |
|---|
| 66 |
+ { |
|---|
| 67 |
+ esc = true; |
|---|
| 68 |
+ continue; |
|---|
| 69 |
+ } |
|---|
| 70 |
+ if((c == ',' || c == ')') && !esc) |
|---|
| 71 |
+ { |
|---|
| 72 |
+ args[nargs++] = argval; |
|---|
| 73 |
+ argval = ""; |
|---|
| 74 |
+ if(nargs == MAXARGS) |
|---|
| 75 |
+ { |
|---|
| 76 |
+ warn(g_fileName,g_lineNr,"Too many arguments in alias"); |
|---|
| 77 |
+ break; |
|---|
| 78 |
+ } |
|---|
| 79 |
+ continue; |
|---|
| 80 |
+ } |
|---|
| 81 |
+ char dum[2]; |
|---|
| 82 |
+ dum[0] = c; |
|---|
| 83 |
+ dum[1] = 0; |
|---|
| 84 |
+ argval.append(dum); |
|---|
| 85 |
+ esc = false; |
|---|
| 86 |
+ } |
|---|
| 87 |
+ |
|---|
| 88 |
+ // Replace args in alias |
|---|
| 89 |
+ QCString fullalias; |
|---|
| 90 |
+ int ind = -1, lastind = 0; |
|---|
| 91 |
+ |
|---|
| 92 |
+ while((ind = pValue->find('^', lastind)) > 0) |
|---|
| 93 |
+ { |
|---|
| 94 |
+ QCString copy(pValue->data() + lastind, ind - lastind); |
|---|
| 95 |
+ lastind = ind; |
|---|
| 96 |
+ fullalias.append(copy); |
|---|
| 97 |
+ |
|---|
| 98 |
+ int nextind = pValue->find('^', ind + 1); |
|---|
| 99 |
+ if(nextind < 0) |
|---|
| 100 |
+ break; |
|---|
| 101 |
+ QCString index(&(*pValue)[ind+1], nextind - ind - 1); |
|---|
| 102 |
+ bool ok; |
|---|
| 103 |
+ unsigned short argi = index.toUShort(&ok) - 1; |
|---|
| 104 |
+ if(!ok) |
|---|
| 105 |
+ { |
|---|
| 106 |
+ lastind = ind + 1; |
|---|
| 107 |
+ continue; |
|---|
| 108 |
+ } |
|---|
| 109 |
+ if(argi >= nargs) |
|---|
| 110 |
+ { |
|---|
| 111 |
+ warn(g_fileName,g_lineNr,"Not enough arguments in alias call!"); |
|---|
| 112 |
+ fullalias.append("*Illegal Argument*"); |
|---|
| 113 |
+ } |
|---|
| 114 |
+ else |
|---|
| 115 |
+ { |
|---|
| 116 |
+ fullalias.append(args[argi]); |
|---|
| 117 |
+ } |
|---|
| 118 |
+ lastind = nextind + 1; |
|---|
| 119 |
+ } |
|---|
| 120 |
+ fullalias.append(pValue->data() + lastind); |
|---|
| 121 |
+ |
|---|
| 122 |
+ QCString val = handleCondCmdInAliases(fullalias); |
|---|
| 123 |
+ copyToOutput(val.data(),val.length()); |
|---|
| 124 |
+ } |
|---|
| 125 |
+ else |
|---|
| 126 |
+ { |
|---|
| 127 |
+ // Not alias, but args? This is wrong... |
|---|
| 128 |
+ copyToOutput(yytext,yyleng); |
|---|
| 129 |
+ } |
|---|
| 130 |
} |
|---|
| 131 |
} |
|---|
| 132 |
<ReadLine>. { |
|---|