diff options
-rw-r--r-- | src/code.l | 64 |
1 files changed, 56 insertions, 8 deletions
@@ -109,6 +109,7 @@ static int g_lastSpecialCContext; static int g_lastStringContext; static int g_lastSkipCppContext; static int g_lastVerbStringContext; +static int g_lastObjCCallContext; static int g_memCallContext; static int g_lastCContext; static int g_skipInlineInitContext; @@ -132,6 +133,7 @@ struct ObjCCallCtx int id; QCString methodName; QCString objectTypeOrName; + QGString comment; ClassDef *objectType; MemberDef *objectVar; MemberDef *method; @@ -146,11 +148,13 @@ static int g_currentCtxId=0; static int g_currentNameId=0; static int g_currentObjId=0; static int g_currentWordId=0; +static int g_currentCommentId=0; static QStack<ObjCCallCtx> g_contextStack; static QIntDict<ObjCCallCtx> g_contextDict; static QIntDict<QCString> g_nameDict; static QIntDict<QCString> g_objectDict; static QIntDict<QCString> g_wordDict; +static QIntDict<QCString> g_commentDict; static int g_braceCount=0; static void saveObjCContext(); @@ -1714,6 +1718,21 @@ static void writeObjCMethodCall(ObjCCallCtx *ctx) codifyLines(pWord->data()); } } + else if (nc=='d') // comment block + { + nc=*p++; + QCString refIdStr; + while (nc!=0 && isdigit(nc)) { refIdStr+=nc; nc=*p++; } + p--; + int refId=refIdStr.toInt(); + QCString *pComment = g_commentDict.find(refId); + if (pComment) + { + startFontClass("comment"); + codifyLines(pComment->data()); + endFontClass(); + } + } else // illegal marker { ASSERT(!"invalid escape sequence"); @@ -1726,7 +1745,7 @@ static void writeObjCMethodCall(ObjCCallCtx *ctx) s[0]=c;s[1]=0; codifyLines(s); } - } + } //printf("%s %s]\n",ctx->objectTypeOrName.data(),ctx->methodName.data()); //printf("}=(type='%s',name='%s')", // ctx->objectTypeOrName.data(), @@ -1763,6 +1782,15 @@ static QCString escapeWord(const char *s) return result; } +static QCString escapeComment(const char *s) +{ + QCString result; + result.sprintf("$d%d",g_currentCommentId); + g_commentDict.insert(g_currentCommentId,new QCString(s)); + g_currentCommentId++; + return result; +} + /* ----------------------------------------------------------------- */ #undef YY_INPUT @@ -1836,6 +1864,7 @@ RAWEND ")"[^ \t\(\)\\]{0,16}\" %x ObjCCall %x ObjCMName %x ObjCSkipStr +%x ObjCCallComment %x OldStyleArgs %x UsingName %x RawString @@ -2732,10 +2761,12 @@ RAWEND ")"[^ \t\(\)\\]{0,16}\" g_nameDict.setAutoDelete(TRUE); g_objectDict.setAutoDelete(TRUE); g_wordDict.setAutoDelete(TRUE); + g_commentDict.setAutoDelete(TRUE); g_contextDict.clear(); g_nameDict.clear(); g_objectDict.clear(); g_wordDict.clear(); + g_commentDict.clear(); g_currentCtxId = 0; g_currentNameId = 0; g_currentObjId = 0; @@ -2820,13 +2851,13 @@ RAWEND ")"[^ \t\(\)\\]{0,16}\" BEGIN(Body); } */ -<ObjCCall,ObjCMName>"[" { - saveObjCContext(); - g_currentCtx->format+=*yytext; - BEGIN(ObjCCall); - //printf("open\n"); - } -<ObjCCall,ObjCMName>"]" { +<ObjCCall,ObjCMName>"["|"{" { + saveObjCContext(); + g_currentCtx->format+=*yytext; + BEGIN(ObjCCall); + //printf("open\n"); + } +<ObjCCall,ObjCMName>"]"|"}" { g_currentCtx->format+=*yytext; restoreObjCContext(); BEGIN(ObjCMName); @@ -2838,6 +2869,23 @@ RAWEND ")"[^ \t\(\)\\]{0,16}\" } //printf("close\n"); } +<ObjCCall,ObjCMName>"//".* { + g_currentCtx->format+=escapeComment(yytext); + } +<ObjCCall,ObjCMName>"/*" { + g_lastObjCCallContext = YY_START; + g_currentCtx->comment=yytext; + BEGIN(ObjCCallComment); + } +<ObjCCallComment>"*/" { + g_currentCtx->comment+=yytext; + g_currentCtx->format+=escapeComment(g_currentCtx->comment); + BEGIN(g_lastObjCCallContext); + } +<ObjCCallComment>[^*\n]+ { g_currentCtx->comment+=yytext; } +<ObjCCallComment>"//"|"/*" { g_currentCtx->comment+=yytext; } +<ObjCCallComment>\n { g_currentCtx->comment+=*yytext; } +<ObjCCallComment>. { g_currentCtx->comment+=*yytext; } <ObjCCall>{ID} { g_currentCtx->format+=escapeObject(yytext); if (g_braceCount==0) |