|
Packit |
1c1d7e |
/*****************************************************************************
|
|
Packit |
1c1d7e |
*
|
|
Packit |
1c1d7e |
*
|
|
Packit |
1c1d7e |
*
|
|
Packit |
1c1d7e |
* Copyright (C) 1997-2015 by Dimitri van Heesch.
|
|
Packit |
1c1d7e |
*
|
|
Packit |
1c1d7e |
* Permission to use, copy, modify, and distribute this software and its
|
|
Packit |
1c1d7e |
* documentation under the terms of the GNU General Public License is hereby
|
|
Packit |
1c1d7e |
* granted. No representations are made about the suitability of this software
|
|
Packit |
1c1d7e |
* for any purpose. It is provided "as is" without express or implied warranty.
|
|
Packit |
1c1d7e |
* See the GNU General Public License for more details.
|
|
Packit |
1c1d7e |
*
|
|
Packit |
1c1d7e |
* Documents produced by Doxygen are derivative works derived from the
|
|
Packit |
1c1d7e |
* input used in their production; they are not affected by this license.
|
|
Packit |
1c1d7e |
*
|
|
Packit |
1c1d7e |
*/
|
|
Packit |
1c1d7e |
%option never-interactive
|
|
Packit |
1c1d7e |
%option prefix="commentcnvYY"
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
%{
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
#include <stdio.h>
|
|
Packit |
1c1d7e |
#include <stdlib.h>
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
#include <qstack.h>
|
|
Packit |
1c1d7e |
#include <qregexp.h>
|
|
Packit |
1c1d7e |
#include <qtextstream.h>
|
|
Packit |
1c1d7e |
#include <qglobal.h>
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
#include "bufstr.h"
|
|
Packit |
1c1d7e |
#include "debug.h"
|
|
Packit |
1c1d7e |
#include "message.h"
|
|
Packit |
1c1d7e |
#include "config.h"
|
|
Packit |
1c1d7e |
#include "doxygen.h"
|
|
Packit |
1c1d7e |
#include "util.h"
|
|
Packit |
1c1d7e |
#include "condparser.h"
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
#include <assert.h>
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
#define YY_NO_INPUT 1
|
|
Packit |
1c1d7e |
#define YY_NO_UNISTD_H 1
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
#define ADDCHAR(c) g_outBuf->addChar(c)
|
|
Packit |
1c1d7e |
#define ADDARRAY(a,s) g_outBuf->addArray(a,s)
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
struct CondCtx
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
CondCtx(int line,QCString id,bool b)
|
|
Packit |
1c1d7e |
: lineNr(line),sectionId(id), skip(b) {}
|
|
Packit |
1c1d7e |
int lineNr;
|
|
Packit |
1c1d7e |
QCString sectionId;
|
|
Packit |
1c1d7e |
bool skip;
|
|
Packit |
1c1d7e |
};
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
struct CommentCtx
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
CommentCtx(int line)
|
|
Packit |
1c1d7e |
: lineNr(line) {}
|
|
Packit |
1c1d7e |
int lineNr;
|
|
Packit |
1c1d7e |
};
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
static BufStr * g_inBuf;
|
|
Packit |
1c1d7e |
static BufStr * g_outBuf;
|
|
Packit |
1c1d7e |
static int g_inBufPos;
|
|
Packit |
1c1d7e |
static int g_col;
|
|
Packit |
1c1d7e |
static int g_blockHeadCol;
|
|
Packit |
1c1d7e |
static bool g_mlBrief;
|
|
Packit |
1c1d7e |
static int g_readLineCtx;
|
|
Packit |
1c1d7e |
static bool g_skip;
|
|
Packit |
1c1d7e |
static QCString g_fileName;
|
|
Packit |
1c1d7e |
static int g_lineNr;
|
|
Packit |
1c1d7e |
static int g_condCtx;
|
|
Packit |
1c1d7e |
static QStack<CondCtx> g_condStack;
|
|
Packit |
1c1d7e |
static QStack<CommentCtx> g_commentStack;
|
|
Packit |
1c1d7e |
static QCString g_blockName;
|
|
Packit |
1c1d7e |
static int g_lastCommentContext;
|
|
Packit |
1c1d7e |
static bool g_inSpecialComment;
|
|
Packit |
1c1d7e |
static bool g_inRoseComment;
|
|
Packit |
1c1d7e |
static int g_stringContext;
|
|
Packit |
1c1d7e |
static int g_charContext;
|
|
Packit |
1c1d7e |
static int g_javaBlock;
|
|
Packit |
1c1d7e |
static bool g_specialComment;
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
static QCString g_aliasString;
|
|
Packit |
1c1d7e |
static int g_blockCount;
|
|
Packit |
1c1d7e |
static bool g_lastEscaped;
|
|
Packit |
1c1d7e |
static int g_lastBlockContext;
|
|
Packit |
1c1d7e |
static bool g_pythonDocString;
|
|
Packit |
1c1d7e |
static int g_nestingCount;
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
static bool g_vhdl; // for VHDL old style --! comment
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
static SrcLangExt g_lang;
|
|
Packit |
1c1d7e |
static bool isFixedForm; // For Fortran
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
static void replaceCommentMarker(const char *s,int len)
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
const char *p=s;
|
|
Packit |
1c1d7e |
char c;
|
|
Packit |
1c1d7e |
// copy leading blanks
|
|
Packit |
1c1d7e |
while ((c=*p) && (c==' ' || c=='\t' || c=='\n'))
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
ADDCHAR(c);
|
|
Packit |
1c1d7e |
g_lineNr += c=='\n';
|
|
Packit |
1c1d7e |
p++;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
// replace start of comment marker by blanks and the last character by a *
|
|
Packit |
1c1d7e |
int blanks=0;
|
|
Packit |
1c1d7e |
while ((c=*p) && (c=='/' || c=='!' || c=='#'))
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
blanks++;
|
|
Packit |
1c1d7e |
p++;
|
|
Packit |
1c1d7e |
if (*p=='<') // comment-after-item marker
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
blanks++;
|
|
Packit |
1c1d7e |
p++;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
if (c=='!') // end after first !
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
break;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
if (blanks>0)
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
while (blanks>2)
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
ADDCHAR(' ');
|
|
Packit |
1c1d7e |
blanks--;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
if (blanks>1) ADDCHAR('*');
|
|
Packit |
1c1d7e |
ADDCHAR(' ');
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
// copy comment line to output
|
|
Packit |
1c1d7e |
ADDARRAY(p,len-(int)(p-s));
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
static inline int computeIndent(const char *s)
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
int col=0;
|
|
Packit |
1c1d7e |
static int tabSize=Config_getInt(TAB_SIZE);
|
|
Packit |
1c1d7e |
const char *p=s;
|
|
Packit |
1c1d7e |
char c;
|
|
Packit |
1c1d7e |
while ((c=*p++))
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
if (c==' ') col++;
|
|
Packit |
1c1d7e |
else if (c=='\t') col+=tabSize-(col%tabSize);
|
|
Packit |
1c1d7e |
else break;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
return col;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
static inline void copyToOutput(const char *s,int len)
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
int i;
|
|
Packit |
1c1d7e |
if (g_skip) // only add newlines.
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
for (i=0;i
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
if (s[i]=='\n')
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
ADDCHAR('\n');
|
|
Packit |
1c1d7e |
//fprintf(stderr,"---> skip %d\n",g_lineNr);
|
|
Packit |
1c1d7e |
g_lineNr++;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
else if (len>0)
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
ADDARRAY(s,len);
|
|
Packit |
1c1d7e |
static int tabSize=Config_getInt(TAB_SIZE);
|
|
Packit |
1c1d7e |
for (i=0;i
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
switch (s[i])
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
case '\n': g_col=0;
|
|
Packit |
1c1d7e |
//fprintf(stderr,"---> copy %d\n",g_lineNr);
|
|
Packit |
1c1d7e |
g_lineNr++; break;
|
|
Packit |
1c1d7e |
case '\t': g_col+=tabSize-(g_col%tabSize); break;
|
|
Packit |
1c1d7e |
default: g_col++; break;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
static void startCondSection(const char *sectId)
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
//printf("startCondSection: skip=%d stack=%d\n",g_skip,g_condStack.count());
|
|
Packit |
1c1d7e |
CondParser prs;
|
|
Packit |
1c1d7e |
bool expResult = prs.parse(g_fileName,g_lineNr,sectId);
|
|
Packit |
1c1d7e |
g_condStack.push(new CondCtx(g_lineNr,sectId,g_skip));
|
|
Packit |
1c1d7e |
if (!expResult) // not enabled
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
g_skip=TRUE;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
static void endCondSection()
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
if (g_condStack.isEmpty())
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
warn(g_fileName,g_lineNr,"Found \\endcond command without matching \\cond");
|
|
Packit |
1c1d7e |
g_skip=FALSE;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
else
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
CondCtx *ctx = g_condStack.pop();
|
|
Packit |
1c1d7e |
g_skip=ctx->skip;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
//printf("endCondSection: skip=%d stack=%d\n",g_skip,g_condStack.count());
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
/** copies string \a s with length \a len to the output, while
|
|
Packit |
1c1d7e |
* replacing any alias commands found in the string.
|
|
Packit |
1c1d7e |
*/
|
|
Packit |
1c1d7e |
static void replaceAliases(const char *s)
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
QCString result = resolveAliasCmd(s);
|
|
Packit |
1c1d7e |
//printf("replaceAliases(%s)->'%s'\n",s,result.data());
|
|
Packit |
1c1d7e |
copyToOutput(result,result.length());
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
#undef YY_INPUT
|
|
Packit |
1c1d7e |
#define YY_INPUT(buf,result,max_size) result=yyread(buf,max_size);
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
static int yyread(char *buf,int max_size)
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
int bytesInBuf = g_inBuf->curPos()-g_inBufPos;
|
|
Packit |
1c1d7e |
int bytesToCopy = QMIN(max_size,bytesInBuf);
|
|
Packit |
1c1d7e |
memcpy(buf,g_inBuf->data()+g_inBufPos,bytesToCopy);
|
|
Packit |
1c1d7e |
g_inBufPos+=bytesToCopy;
|
|
Packit |
1c1d7e |
return bytesToCopy;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
void replaceComment(int offset);
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
%}
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
%option noyywrap
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
%x Scan
|
|
Packit |
1c1d7e |
%x SkipString
|
|
Packit |
1c1d7e |
%x SkipChar
|
|
Packit |
1c1d7e |
%x SComment
|
|
Packit |
1c1d7e |
%x CComment
|
|
Packit |
1c1d7e |
%x Verbatim
|
|
Packit |
1c1d7e |
%x VerbatimCode
|
|
Packit |
1c1d7e |
%x ReadLine
|
|
Packit |
1c1d7e |
%x CondLine
|
|
Packit |
1c1d7e |
%x ReadAliasArgs
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
%%
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
<Scan>[^"'!\/\n\\#,\-]* { /* eat anything that is not " / , or \n */
|
|
Packit |
1c1d7e |
copyToOutput(yytext,(int)yyleng);
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
<Scan>[,] { /* eat , so we have a nice separator in long initialization lines */
|
|
Packit |
1c1d7e |
copyToOutput(yytext,(int)yyleng);
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
<Scan>"\"\"\""! { /* start of python long comment */
|
|
Packit |
1c1d7e |
if (g_lang!=SrcLangExt_Python)
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
REJECT;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
else
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
g_pythonDocString = TRUE;
|
|
Packit |
1c1d7e |
g_nestingCount=0;
|
|
Packit |
1c1d7e |
g_commentStack.clear(); /* to be on the save side */
|
|
Packit |
1c1d7e |
copyToOutput(yytext,(int)yyleng);
|
|
Packit |
1c1d7e |
BEGIN(CComment);
|
|
Packit |
1c1d7e |
g_commentStack.push(new CommentCtx(g_lineNr));
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
<Scan>![>
|
|
Packit |
1c1d7e |
if (g_lang!=SrcLangExt_Fortran)
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
REJECT;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
else
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
copyToOutput(yytext,(int)yyleng);
|
|
Packit |
1c1d7e |
g_nestingCount=0;
|
|
Packit |
1c1d7e |
g_commentStack.clear(); /* to be on the save side */
|
|
Packit |
1c1d7e |
BEGIN(CComment);
|
|
Packit |
1c1d7e |
g_commentStack.push(new CommentCtx(g_lineNr));
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
<Scan>[Cc\*][>
|
|
Packit |
1c1d7e |
if (g_lang!=SrcLangExt_Fortran)
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
REJECT;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
else
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
/* check for fixed format; we might have some conditional as part of multilene if like C<5 .and. & */
|
|
Packit |
1c1d7e |
if (isFixedForm && (g_col == 0))
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
copyToOutput(yytext,(int)yyleng);
|
|
Packit |
1c1d7e |
g_nestingCount=0;
|
|
Packit |
1c1d7e |
g_commentStack.clear(); /* to be on the save side */
|
|
Packit |
1c1d7e |
BEGIN(CComment);
|
|
Packit |
1c1d7e |
g_commentStack.push(new CommentCtx(g_lineNr));
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
else
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
REJECT;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
<Scan>!.*\n {
|
|
Packit |
1c1d7e |
if (g_lang!=SrcLangExt_Fortran)
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
REJECT;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
else
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
copyToOutput(yytext,(int)yyleng);
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
<Scan>[Cc\*].*\n {
|
|
Packit |
1c1d7e |
if (g_lang!=SrcLangExt_Fortran)
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
REJECT;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
else
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
if (g_col == 0)
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
copyToOutput(yytext,(int)yyleng);
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
else
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
REJECT;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
<Scan>"\"" { /* start of a string */
|
|
Packit |
1c1d7e |
copyToOutput(yytext,(int)yyleng);
|
|
Packit |
1c1d7e |
g_stringContext = YY_START;
|
|
Packit |
1c1d7e |
BEGIN(SkipString);
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
<Scan>' {
|
|
Packit |
1c1d7e |
copyToOutput(yytext,(int)yyleng);
|
|
Packit |
1c1d7e |
g_charContext = YY_START;
|
|
Packit |
1c1d7e |
if (g_lang!=SrcLangExt_VHDL)
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
BEGIN(SkipChar);
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
<Scan>\n { /* new line */
|
|
Packit |
1c1d7e |
copyToOutput(yytext,(int)yyleng);
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
<Scan>"//!"/.*\n[ \t]*"//"[\/!][^\/] | /* start C++ style special comment block */
|
|
Packit |
1c1d7e |
<Scan>("///"[/]*)/[^/].*\n[ \t]*"//"[\/!][^\/] { /* start C++ style special comment block */
|
|
Packit |
1c1d7e |
if (g_mlBrief)
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
REJECT; // bail out if we do not need to convert
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
else
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
int i=3;
|
|
Packit |
1c1d7e |
if (yytext[2]=='/')
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
while (i<(int)yyleng && yytext[i]=='/') i++;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
g_blockHeadCol=g_col;
|
|
Packit |
1c1d7e |
copyToOutput("/**",3);
|
|
Packit |
1c1d7e |
replaceAliases(yytext+i);
|
|
Packit |
1c1d7e |
g_inSpecialComment=TRUE;
|
|
Packit |
1c1d7e |
//BEGIN(SComment);
|
|
Packit |
1c1d7e |
g_readLineCtx=SComment;
|
|
Packit |
1c1d7e |
BEGIN(ReadLine);
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
<Scan>"//##Documentation".*/\n { /* Start of Rational Rose ANSI C++ comment block */
|
|
Packit |
1c1d7e |
if (g_mlBrief) REJECT;
|
|
Packit |
1c1d7e |
int i=17; //=strlen("//##Documentation");
|
|
Packit |
1c1d7e |
g_blockHeadCol=g_col;
|
|
Packit |
1c1d7e |
copyToOutput("/**",3);
|
|
Packit |
1c1d7e |
replaceAliases(yytext+i);
|
|
Packit |
1c1d7e |
g_inRoseComment=TRUE;
|
|
Packit |
1c1d7e |
BEGIN(SComment);
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
<Scan>"//"[!\/]/.*\n[ \t]*"//"[|\/][ \t]*[@\\]"}" { // next line contains an end marker, see bug 752712
|
|
Packit |
1c1d7e |
g_inSpecialComment=yytext[2]=='/' || yytext[2]=='!';
|
|
Packit |
1c1d7e |
copyToOutput(yytext,(int)yyleng);
|
|
Packit |
1c1d7e |
g_readLineCtx=YY_START;
|
|
Packit |
1c1d7e |
BEGIN(ReadLine);
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
<Scan>"//"/.*\n { /* one line C++ comment */
|
|
Packit |
1c1d7e |
g_inSpecialComment=yytext[2]=='/' || yytext[2]=='!';
|
|
Packit |
1c1d7e |
copyToOutput(yytext,(int)yyleng);
|
|
Packit |
1c1d7e |
g_readLineCtx=YY_START;
|
|
Packit |
1c1d7e |
BEGIN(ReadLine);
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
<Scan>"/**/" { /* avoid matching next rule for empty C comment, see bug 711723 */
|
|
Packit |
1c1d7e |
copyToOutput(yytext,(int)yyleng);
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
<Scan>"/*"[*!]? { /* start of a C comment */
|
|
Packit |
1c1d7e |
g_specialComment=(int)yyleng==3;
|
|
Packit |
1c1d7e |
g_nestingCount=0;
|
|
Packit |
1c1d7e |
g_commentStack.clear(); /* to be on the save side */
|
|
Packit |
1c1d7e |
copyToOutput(yytext,(int)yyleng);
|
|
Packit |
1c1d7e |
BEGIN(CComment);
|
|
Packit |
1c1d7e |
g_commentStack.push(new CommentCtx(g_lineNr));
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
<Scan>"#"("#")? {
|
|
Packit |
1c1d7e |
if (g_lang!=SrcLangExt_Python)
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
REJECT;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
else
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
copyToOutput(yytext,(int)yyleng);
|
|
Packit |
1c1d7e |
g_nestingCount=0;
|
|
Packit |
1c1d7e |
g_commentStack.clear(); /* to be on the save side */
|
|
Packit |
1c1d7e |
BEGIN(CComment);
|
|
Packit |
1c1d7e |
g_commentStack.push(new CommentCtx(g_lineNr));
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
<Scan>"--!" {
|
|
Packit |
1c1d7e |
if (g_lang!=SrcLangExt_VHDL)
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
REJECT;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
else
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
g_vhdl = TRUE;
|
|
Packit |
1c1d7e |
copyToOutput(yytext,(int)yyleng);
|
|
Packit |
1c1d7e |
g_nestingCount=0;
|
|
Packit |
1c1d7e |
g_commentStack.clear(); /* to be on the save side */
|
|
Packit |
1c1d7e |
BEGIN(CComment);
|
|
Packit |
1c1d7e |
g_commentStack.push(new CommentCtx(g_lineNr));
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
<Scan>![>
|
|
Packit |
1c1d7e |
if (g_lang!=SrcLangExt_Fortran)
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
REJECT;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
else
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
copyToOutput(yytext,(int)yyleng);
|
|
Packit |
1c1d7e |
g_nestingCount=0;
|
|
Packit |
1c1d7e |
g_commentStack.clear(); /* to be on the save side */
|
|
Packit |
1c1d7e |
BEGIN(CComment);
|
|
Packit |
1c1d7e |
g_commentStack.push(new CommentCtx(g_lineNr));
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
<CComment>"{@code"/[ \t\n] {
|
|
Packit |
1c1d7e |
copyToOutput("@code",5);
|
|
Packit |
1c1d7e |
g_lastCommentContext = YY_START;
|
|
Packit |
1c1d7e |
g_javaBlock=1;
|
|
Packit |
1c1d7e |
g_blockName=&yytext[1];
|
|
Packit |
1c1d7e |
BEGIN(VerbatimCode);
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
<CComment,ReadLine>[\\@]("dot"|"code"|"msc"|"startuml")/[^a-z_A-Z0-9] { /* start of a verbatim block */
|
|
Packit |
1c1d7e |
copyToOutput(yytext,(int)yyleng);
|
|
Packit |
1c1d7e |
g_lastCommentContext = YY_START;
|
|
Packit |
1c1d7e |
g_javaBlock=0;
|
|
Packit |
1c1d7e |
if (qstrcmp(&yytext[1],"startuml")==0)
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
g_blockName="uml";
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
else
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
g_blockName=&yytext[1];
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
BEGIN(VerbatimCode);
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
<CComment,ReadLine>[\\@]("f$"|"f["|"f{") {
|
|
Packit |
1c1d7e |
copyToOutput(yytext,(int)yyleng);
|
|
Packit |
1c1d7e |
g_blockName=&yytext[1];
|
|
Packit |
1c1d7e |
if (g_blockName.at(1)=='[')
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
g_blockName.at(1)=']';
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
else if (g_blockName.at(1)=='{')
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
g_blockName.at(1)='}';
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
g_lastCommentContext = YY_START;
|
|
Packit |
1c1d7e |
BEGIN(Verbatim);
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
<CComment,ReadLine>[\\@]("verbatim"|"latexonly"|"htmlonly"|"xmlonly"|"docbookonly"|"rtfonly"|"manonly")/[^a-z_A-Z0-9] { /* start of a verbatim block */
|
|
Packit |
1c1d7e |
copyToOutput(yytext,(int)yyleng);
|
|
Packit |
1c1d7e |
g_blockName=&yytext[1];
|
|
Packit |
1c1d7e |
g_lastCommentContext = YY_START;
|
|
Packit |
1c1d7e |
BEGIN(Verbatim);
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
<Scan>. { /* any ather character */
|
|
Packit |
1c1d7e |
copyToOutput(yytext,(int)yyleng);
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
<Verbatim>[\\@]("endverbatim"|"endlatexonly"|"endhtmlonly"|"endxmlonly"|"enddocbookonly"|"endrtfonly"|"endmanonly"|"f$"|"f]"|"f}") { /* end of verbatim block */
|
|
Packit |
1c1d7e |
copyToOutput(yytext,(int)yyleng);
|
|
Packit |
1c1d7e |
if (&yytext[1]==g_blockName) // end of formula
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
BEGIN(g_lastCommentContext);
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
else if (&yytext[4]==g_blockName)
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
BEGIN(g_lastCommentContext);
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
<VerbatimCode>"{" {
|
|
Packit |
1c1d7e |
if (g_javaBlock==0)
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
REJECT;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
else
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
g_javaBlock++;
|
|
Packit |
1c1d7e |
copyToOutput(yytext,(int)yyleng);
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
<VerbatimCode>"}" {
|
|
Packit |
1c1d7e |
if (g_javaBlock==0)
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
REJECT;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
else
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
g_javaBlock--;
|
|
Packit |
1c1d7e |
if (g_javaBlock==0)
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
copyToOutput(" @endcode ",10);
|
|
Packit |
1c1d7e |
BEGIN(g_lastCommentContext);
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
else
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
copyToOutput(yytext,(int)yyleng);
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
<VerbatimCode>[\\@]("enddot"|"endcode"|"endmsc"|"enduml") { /* end of verbatim block */
|
|
Packit |
1c1d7e |
copyToOutput(yytext,(int)yyleng);
|
|
Packit |
1c1d7e |
if (&yytext[4]==g_blockName)
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
BEGIN(g_lastCommentContext);
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
<VerbatimCode>^[ \t]*"//"[\!\/]? { /* skip leading comments */
|
|
Packit |
1c1d7e |
if (!g_inSpecialComment)
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
copyToOutput(yytext,(int)yyleng);
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
else
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
int l=0;
|
|
Packit |
1c1d7e |
while (yytext[l]==' ' || yytext[l]=='\t')
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
l++;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
copyToOutput(yytext,l);
|
|
Packit |
1c1d7e |
if (yyleng-l==3) // ends with //! or ///
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
copyToOutput(" * ",3);
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
else // ends with //
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
copyToOutput("//",2);
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
<Verbatim,VerbatimCode>[^@\/\\\n{}]* { /* any character not a backslash or new line or } */
|
|
Packit |
1c1d7e |
copyToOutput(yytext,(int)yyleng);
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
<Verbatim,VerbatimCode>\n { /* new line in verbatim block */
|
|
Packit |
1c1d7e |
copyToOutput(yytext,(int)yyleng);
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
<Verbatim>^[ \t]*"///" {
|
|
Packit |
1c1d7e |
if (g_blockName=="dot" || g_blockName=="msc" || g_blockName=="uml" || g_blockName.at(0)=='f')
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
// see bug 487871, strip /// from dot images and formulas.
|
|
Packit |
1c1d7e |
int l=0;
|
|
Packit |
1c1d7e |
while (yytext[l]==' ' || yytext[l]=='\t')
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
l++;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
copyToOutput(yytext,l);
|
|
Packit |
1c1d7e |
copyToOutput(" ",3);
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
else // even slashes are verbatim (e.g. \verbatim, \code)
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
REJECT;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
<Verbatim,VerbatimCode>. { /* any other character */
|
|
Packit |
1c1d7e |
copyToOutput(yytext,(int)yyleng);
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
<SkipString>\\. { /* escaped character in string */
|
|
Packit |
1c1d7e |
copyToOutput(yytext,(int)yyleng);
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
<SkipString>"\"" { /* end of string */
|
|
Packit |
1c1d7e |
copyToOutput(yytext,(int)yyleng);
|
|
Packit |
1c1d7e |
BEGIN(g_stringContext);
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
<SkipString>. { /* any other string character */
|
|
Packit |
1c1d7e |
copyToOutput(yytext,(int)yyleng);
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
<SkipString>\n { /* new line inside string (illegal for some compilers) */
|
|
Packit |
1c1d7e |
copyToOutput(yytext,(int)yyleng);
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
<SkipChar>\\. { /* escaped character */
|
|
Packit |
1c1d7e |
copyToOutput(yytext,(int)yyleng);
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
<SkipChar>' { /* end of character literal */
|
|
Packit |
1c1d7e |
copyToOutput(yytext,(int)yyleng);
|
|
Packit |
1c1d7e |
BEGIN(g_charContext);
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
<SkipChar>. { /* any other string character */
|
|
Packit |
1c1d7e |
copyToOutput(yytext,(int)yyleng);
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
<SkipChar>\n { /* new line character */
|
|
Packit |
1c1d7e |
copyToOutput(yytext,(int)yyleng);
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
<CComment>[^\\!@*\n{\"\/]* { /* anything that is not a '*' or command */
|
|
Packit |
1c1d7e |
copyToOutput(yytext,(int)yyleng);
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
<CComment>"*"+[^*/\\@\n{\"]* { /* stars without slashes */
|
|
Packit |
1c1d7e |
copyToOutput(yytext,(int)yyleng);
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
<CComment>"\"\"\"" { /* end of Python docstring */
|
|
Packit |
1c1d7e |
if (g_lang!=SrcLangExt_Python)
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
REJECT;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
else
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
g_pythonDocString = FALSE;
|
|
Packit |
1c1d7e |
copyToOutput(yytext,(int)yyleng);
|
|
Packit |
1c1d7e |
BEGIN(Scan);
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
<CComment>\n { /* new line in comment */
|
|
Packit |
1c1d7e |
copyToOutput(yytext,(int)yyleng);
|
|
Packit |
1c1d7e |
/* in case of Fortran always end of comment */
|
|
Packit |
1c1d7e |
if (g_lang==SrcLangExt_Fortran)
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
BEGIN(Scan);
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
<CComment>"/"+"*" { /* nested C comment */
|
|
Packit |
1c1d7e |
g_nestingCount++;
|
|
Packit |
1c1d7e |
g_commentStack.push(new CommentCtx(g_lineNr));
|
|
Packit |
1c1d7e |
copyToOutput(yytext,(int)yyleng);
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
<CComment>"*"+"/" { /* end of C comment */
|
|
Packit |
1c1d7e |
if (g_lang==SrcLangExt_Python)
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
REJECT;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
else
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
copyToOutput(yytext,(int)yyleng);
|
|
Packit |
1c1d7e |
if (g_nestingCount<=0)
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
BEGIN(Scan);
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
else
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
g_nestingCount--;
|
|
Packit |
1c1d7e |
delete g_commentStack.pop();
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
/* Python an VHDL share CComment, so special attention for ending comments is required */
|
|
Packit |
1c1d7e |
<CComment>"\n"/[ \t]*"#" {
|
|
Packit |
1c1d7e |
if (g_lang!=SrcLangExt_VHDL)
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
REJECT;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
else
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
if (g_vhdl) // inside --! comment
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
g_vhdl = FALSE;
|
|
Packit |
1c1d7e |
copyToOutput(yytext,(int)yyleng);
|
|
Packit |
1c1d7e |
BEGIN(Scan);
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
else // C-type comment
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
REJECT;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
<CComment>"\n"/[ \t]*"-" {
|
|
Packit |
1c1d7e |
if (g_lang!=SrcLangExt_Python || g_pythonDocString)
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
REJECT;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
else
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
copyToOutput(yytext,(int)yyleng);
|
|
Packit |
1c1d7e |
BEGIN(Scan);
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
<CComment>"\n"/[ \t]*[^ \t#\-] {
|
|
Packit |
1c1d7e |
if (g_lang==SrcLangExt_Python)
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
if (g_pythonDocString)
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
REJECT;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
else
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
copyToOutput(yytext,(int)yyleng);
|
|
Packit |
1c1d7e |
BEGIN(Scan);
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
else if (g_lang==SrcLangExt_VHDL)
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
if (g_vhdl) // inside --! comment
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
g_vhdl = FALSE;
|
|
Packit |
1c1d7e |
copyToOutput(yytext,(int)yyleng);
|
|
Packit |
1c1d7e |
BEGIN(Scan);
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
else // C-type comment
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
REJECT;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
else
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
REJECT;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
/* removed for bug 674842 (bug was introduced in rev 768)
|
|
Packit |
1c1d7e |
<CComment>"'" {
|
|
Packit |
1c1d7e |
g_charContext = YY_START;
|
|
Packit |
1c1d7e |
copyToOutput(yytext,(int)yyleng);
|
|
Packit |
1c1d7e |
BEGIN(SkipChar);
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
<CComment>"\"" {
|
|
Packit |
1c1d7e |
g_stringContext = YY_START;
|
|
Packit |
1c1d7e |
copyToOutput(yytext,(int)yyleng);
|
|
Packit |
1c1d7e |
BEGIN(SkipString);
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
*/
|
|
Packit |
1c1d7e |
<CComment>. {
|
|
Packit |
1c1d7e |
copyToOutput(yytext,(int)yyleng);
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
<SComment>^[ \t]*"///"[\/]*/\n {
|
|
Packit |
1c1d7e |
replaceComment(0);
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
<SComment>\n[ \t]*"///"[\/]*/\n {
|
|
Packit |
1c1d7e |
replaceComment(1);
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
<SComment>^[ \t]*"///"[^\/\n]/.*\n {
|
|
Packit |
1c1d7e |
replaceComment(0);
|
|
Packit |
1c1d7e |
g_readLineCtx=YY_START;
|
|
Packit |
1c1d7e |
BEGIN(ReadLine);
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
<SComment>\n[ \t]*"//"[\/!]("<")?[ \t]*[\\@]"}".*\n {
|
|
Packit |
1c1d7e |
/* See Bug 752712: end the multiline comment when finding a @} or \} command */
|
|
Packit |
1c1d7e |
copyToOutput(" */",3);
|
|
Packit |
1c1d7e |
copyToOutput(yytext,(int)yyleng);
|
|
Packit |
1c1d7e |
g_inSpecialComment=FALSE;
|
|
Packit |
1c1d7e |
g_inRoseComment=FALSE;
|
|
Packit |
1c1d7e |
BEGIN(Scan);
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
<SComment>\n[ \t]*"///"[^\/\n]/.*\n {
|
|
Packit |
1c1d7e |
replaceComment(1);
|
|
Packit |
1c1d7e |
g_readLineCtx=YY_START;
|
|
Packit |
1c1d7e |
BEGIN(ReadLine);
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
<SComment>^[ \t]*"//!" | // just //!
|
|
Packit |
1c1d7e |
<SComment>^[ \t]*"//!<"/.*\n | // or //!< something
|
|
Packit |
1c1d7e |
<SComment>^[ \t]*"//!"[^<]/.*\n { // or //!something
|
|
Packit |
1c1d7e |
replaceComment(0);
|
|
Packit |
1c1d7e |
g_readLineCtx=YY_START;
|
|
Packit |
1c1d7e |
BEGIN(ReadLine);
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
<SComment>\n[ \t]*"//!" |
|
|
Packit |
1c1d7e |
<SComment>\n[ \t]*"//!<"/.*\n |
|
|
Packit |
1c1d7e |
<SComment>\n[ \t]*"//!"[^<\n]/.*\n {
|
|
Packit |
1c1d7e |
replaceComment(1);
|
|
Packit |
1c1d7e |
g_readLineCtx=YY_START;
|
|
Packit |
1c1d7e |
BEGIN(ReadLine);
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
<SComment>^[ \t]*"//##"/.*\n {
|
|
Packit |
1c1d7e |
if (!g_inRoseComment)
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
REJECT;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
else
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
replaceComment(0);
|
|
Packit |
1c1d7e |
g_readLineCtx=YY_START;
|
|
Packit |
1c1d7e |
BEGIN(ReadLine);
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
<SComment>\n[ \t]*"//##"/.*\n {
|
|
Packit |
1c1d7e |
if (!g_inRoseComment)
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
REJECT;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
else
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
replaceComment(1);
|
|
Packit |
1c1d7e |
g_readLineCtx=YY_START;
|
|
Packit |
1c1d7e |
BEGIN(ReadLine);
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
<SComment>\n { /* end of special comment */
|
|
Packit |
1c1d7e |
copyToOutput(" */",3);
|
|
Packit |
1c1d7e |
copyToOutput(yytext,(int)yyleng);
|
|
Packit |
1c1d7e |
g_inSpecialComment=FALSE;
|
|
Packit |
1c1d7e |
g_inRoseComment=FALSE;
|
|
Packit |
1c1d7e |
BEGIN(Scan);
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
<ReadLine>[^\\@\n]*/\n {
|
|
Packit |
1c1d7e |
copyToOutput(yytext,(int)yyleng);
|
|
Packit |
1c1d7e |
BEGIN(g_readLineCtx);
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
<CComment,ReadLine>[\\@][\\@][~a-z_A-Z][a-z_A-Z0-9]*[ \t]* { // escaped command
|
|
Packit |
1c1d7e |
copyToOutput(yytext,(int)yyleng);
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
<CComment,ReadLine>[\\@]"cond"/[^a-z_A-Z0-9] { // conditional section
|
|
Packit |
1c1d7e |
g_condCtx = YY_START;
|
|
Packit |
1c1d7e |
BEGIN(CondLine);
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
<CComment,ReadLine>[\\@]"endcond"/[^a-z_A-Z0-9] { // end of conditional section
|
|
Packit |
1c1d7e |
bool oldSkip=g_skip;
|
|
Packit |
1c1d7e |
endCondSection();
|
|
Packit |
1c1d7e |
if (YY_START==CComment && oldSkip && !g_skip)
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
//printf("** Adding start of comment!\n");
|
|
Packit |
1c1d7e |
if (g_lang!=SrcLangExt_Python &&
|
|
Packit |
1c1d7e |
g_lang!=SrcLangExt_VHDL &&
|
|
Packit |
1c1d7e |
g_lang!=SrcLangExt_Markdown &&
|
|
Packit |
1c1d7e |
g_lang!=SrcLangExt_Fortran)
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
ADDCHAR('/');
|
|
Packit |
1c1d7e |
ADDCHAR('*');
|
|
Packit |
1c1d7e |
if (g_specialComment)
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
ADDCHAR('*');
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
<CondLine>[!()&| \ta-z_A-Z0-9.\-]+ {
|
|
Packit |
1c1d7e |
bool oldSkip=g_skip;
|
|
Packit |
1c1d7e |
startCondSection(yytext);
|
|
Packit |
1c1d7e |
if ((g_condCtx==CComment || g_readLineCtx==SComment) &&
|
|
Packit |
1c1d7e |
!oldSkip && g_skip)
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
if (g_lang!=SrcLangExt_Python &&
|
|
Packit |
1c1d7e |
g_lang!=SrcLangExt_VHDL &&
|
|
Packit |
1c1d7e |
g_lang!=SrcLangExt_Markdown &&
|
|
Packit |
1c1d7e |
g_lang!=SrcLangExt_Fortran)
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
ADDCHAR('*');
|
|
Packit |
1c1d7e |
ADDCHAR('/');
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
if (g_readLineCtx==SComment)
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
BEGIN(SComment);
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
else
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
BEGIN(g_condCtx);
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
<CondLine>[ \t]*
|
|
Packit |
1c1d7e |
<CComment,ReadLine>[\\@]"cond"[ \t\r]*/\n |
|
|
Packit |
1c1d7e |
<CondLine>. { // forgot section id?
|
|
Packit |
1c1d7e |
if (YY_START!=CondLine) g_condCtx=YY_START;
|
|
Packit |
1c1d7e |
bool oldSkip=g_skip;
|
|
Packit |
1c1d7e |
startCondSection(" "); // fake section id causing the section to be hidden unconditionally
|
|
Packit |
1c1d7e |
if ((g_condCtx==CComment || g_readLineCtx==SComment) &&
|
|
Packit |
1c1d7e |
!oldSkip && g_skip)
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
//printf("** Adding terminator for comment!\n");
|
|
Packit |
1c1d7e |
if (g_lang!=SrcLangExt_Python &&
|
|
Packit |
1c1d7e |
g_lang!=SrcLangExt_VHDL)
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
ADDCHAR('*');
|
|
Packit |
1c1d7e |
ADDCHAR('/');
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
if (*yytext=='\n') g_lineNr++;
|
|
Packit |
1c1d7e |
if (g_readLineCtx==SComment)
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
BEGIN(SComment);
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
else
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
BEGIN(g_condCtx);
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
<CComment,ReadLine>[\\@][a-z_A-Z][a-z_A-Z0-9]* { // expand alias without arguments
|
|
Packit |
1c1d7e |
replaceAliases(yytext);
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
<CComment,ReadLine>[\\@][a-z_A-Z][a-z_A-Z0-9]*"{" { // expand alias with arguments
|
|
Packit |
1c1d7e |
g_lastBlockContext=YY_START;
|
|
Packit |
1c1d7e |
g_blockCount=1;
|
|
Packit |
1c1d7e |
g_aliasString=yytext;
|
|
Packit |
1c1d7e |
g_lastEscaped=0;
|
|
Packit |
1c1d7e |
BEGIN( ReadAliasArgs );
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
<ReadAliasArgs>^[ \t]*"//"[/!]/[^\n]+ { // skip leading special comments (see bug 618079)
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
<ReadAliasArgs>"*/" { // oops, end of comment in the middle of an alias?
|
|
Packit |
1c1d7e |
if (g_lang==SrcLangExt_Python)
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
REJECT;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
else // abort the alias, restart scanning
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
copyToOutput(g_aliasString,g_aliasString.length());
|
|
Packit |
1c1d7e |
copyToOutput(yytext,(int)yyleng);
|
|
Packit |
1c1d7e |
BEGIN(Scan);
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
<ReadAliasArgs>[^{}\n\\\*]+ {
|
|
Packit |
1c1d7e |
g_aliasString+=yytext;
|
|
Packit |
1c1d7e |
g_lastEscaped=FALSE;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
<ReadAliasArgs>"\\" {
|
|
Packit |
1c1d7e |
if (g_lastEscaped) g_lastEscaped=FALSE;
|
|
Packit |
1c1d7e |
else g_lastEscaped=TRUE;
|
|
Packit |
1c1d7e |
g_aliasString+=yytext;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
<ReadAliasArgs>\n {
|
|
Packit |
1c1d7e |
g_aliasString+=yytext;
|
|
Packit |
1c1d7e |
g_lineNr++;
|
|
Packit |
1c1d7e |
g_lastEscaped=FALSE;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
<ReadAliasArgs>"{" {
|
|
Packit |
1c1d7e |
g_aliasString+=yytext;
|
|
Packit |
1c1d7e |
if (!g_lastEscaped) g_blockCount++;
|
|
Packit |
1c1d7e |
g_lastEscaped=FALSE;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
<ReadAliasArgs>"}" {
|
|
Packit |
1c1d7e |
g_aliasString+=yytext;
|
|
Packit |
1c1d7e |
if (!g_lastEscaped) g_blockCount--;
|
|
Packit |
1c1d7e |
if (g_blockCount==0)
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
replaceAliases(g_aliasString);
|
|
Packit |
1c1d7e |
BEGIN( g_lastBlockContext );
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
g_lastEscaped=FALSE;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
<ReadAliasArgs>. {
|
|
Packit |
1c1d7e |
g_aliasString+=yytext;
|
|
Packit |
1c1d7e |
g_lastEscaped=FALSE;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
<ReadLine>. {
|
|
Packit |
1c1d7e |
copyToOutput(yytext,(int)yyleng);
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
%%
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
void replaceComment(int offset)
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
if (g_mlBrief || g_skip)
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
copyToOutput(yytext,(int)yyleng);
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
else
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
//printf("replaceComment(%s)\n",yytext);
|
|
Packit |
1c1d7e |
int i=computeIndent(&yytext[offset]);
|
|
Packit |
1c1d7e |
if (i==g_blockHeadCol)
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
replaceCommentMarker(yytext,(int)yyleng);
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
else
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
copyToOutput(" */",3);
|
|
Packit |
1c1d7e |
int i;for (i=(int)yyleng-1;i>=0;i--) unput(yytext[i]);
|
|
Packit |
1c1d7e |
g_inSpecialComment=FALSE;
|
|
Packit |
1c1d7e |
BEGIN(Scan);
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
// simplified way to know if this is fixed form
|
|
Packit |
1c1d7e |
// duplicate in fortrancode.l
|
|
Packit |
1c1d7e |
static bool recognizeFixedForm(const char* contents)
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
int column=0;
|
|
Packit |
1c1d7e |
bool skipLine=FALSE;
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
for(int i=0;;i++) {
|
|
Packit |
1c1d7e |
column++;
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
switch(contents[i]) {
|
|
Packit |
1c1d7e |
case '\n':
|
|
Packit |
1c1d7e |
column=0;
|
|
Packit |
1c1d7e |
skipLine=FALSE;
|
|
Packit |
1c1d7e |
break;
|
|
Packit |
1c1d7e |
case ' ':
|
|
Packit |
1c1d7e |
break;
|
|
Packit |
1c1d7e |
case '\000':
|
|
Packit |
1c1d7e |
return FALSE;
|
|
Packit |
1c1d7e |
case 'C':
|
|
Packit |
1c1d7e |
case 'c':
|
|
Packit |
1c1d7e |
case '*':
|
|
Packit |
1c1d7e |
if(column==1) return TRUE;
|
|
Packit |
1c1d7e |
if(skipLine) break;
|
|
Packit |
1c1d7e |
return FALSE;
|
|
Packit |
1c1d7e |
case '!':
|
|
Packit |
1c1d7e |
if(column>1 && column<7) return FALSE;
|
|
Packit |
1c1d7e |
skipLine=TRUE;
|
|
Packit |
1c1d7e |
break;
|
|
Packit |
1c1d7e |
default:
|
|
Packit |
1c1d7e |
if(skipLine) break;
|
|
Packit |
1c1d7e |
if(column==7) return TRUE;
|
|
Packit |
1c1d7e |
return FALSE;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
return FALSE;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
/*! This function does three things:
|
|
Packit |
1c1d7e |
* -# It converts multi-line C++ style comment blocks (that are aligned)
|
|
Packit |
1c1d7e |
* to C style comment blocks (if MULTILINE_CPP_IS_BRIEF is set to NO).
|
|
Packit |
1c1d7e |
* -# It replaces aliases with their definition (see ALIASES)
|
|
Packit |
1c1d7e |
* -# It handles conditional sections (cond...endcond blocks)
|
|
Packit |
1c1d7e |
*/
|
|
Packit |
1c1d7e |
void convertCppComments(BufStr *inBuf,BufStr *outBuf,const char *fileName)
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
//printf("convertCppComments(%s)\n",fileName);
|
|
Packit |
1c1d7e |
g_inBuf = inBuf;
|
|
Packit |
1c1d7e |
g_outBuf = outBuf;
|
|
Packit |
1c1d7e |
g_inBufPos = 0;
|
|
Packit |
1c1d7e |
g_col = 0;
|
|
Packit |
1c1d7e |
g_mlBrief = Config_getBool(MULTILINE_CPP_IS_BRIEF);
|
|
Packit |
1c1d7e |
g_skip = FALSE;
|
|
Packit |
1c1d7e |
g_fileName = fileName;
|
|
Packit |
1c1d7e |
g_lang = getLanguageFromFileName(fileName);
|
|
Packit |
1c1d7e |
g_pythonDocString = FALSE;
|
|
Packit |
1c1d7e |
g_lineNr = 1;
|
|
Packit |
1c1d7e |
g_condStack.clear();
|
|
Packit |
1c1d7e |
g_condStack.setAutoDelete(TRUE);
|
|
Packit |
1c1d7e |
g_commentStack.clear();
|
|
Packit |
1c1d7e |
g_commentStack.setAutoDelete(TRUE);
|
|
Packit |
1c1d7e |
g_vhdl = FALSE;
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
printlex(yy_flex_debug, TRUE, __FILE__, fileName);
|
|
Packit |
1c1d7e |
isFixedForm = FALSE;
|
|
Packit |
1c1d7e |
if (g_lang==SrcLangExt_Fortran)
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
isFixedForm = recognizeFixedForm(inBuf->data());
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
if (g_lang==SrcLangExt_Markdown)
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
g_nestingCount=0;
|
|
Packit |
1c1d7e |
BEGIN(CComment);
|
|
Packit |
1c1d7e |
g_commentStack.push(new CommentCtx(g_lineNr));
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
else
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
BEGIN(Scan);
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
yylex();
|
|
Packit |
1c1d7e |
while (!g_condStack.isEmpty())
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
CondCtx *ctx = g_condStack.pop();
|
|
Packit |
1c1d7e |
QCString sectionInfo = " ";
|
|
Packit |
1c1d7e |
if (ctx->sectionId!=" ") sectionInfo.sprintf(" with label %s ",ctx->sectionId.data());
|
|
Packit |
1c1d7e |
warn(g_fileName,ctx->lineNr,"Conditional section%sdoes not have "
|
|
Packit |
1c1d7e |
"a corresponding \\endcond command within this file.",sectionInfo.data());
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
if (g_nestingCount>0 && g_lang!=SrcLangExt_Markdown)
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
QCString tmp= "(probable line reference: ";
|
|
Packit |
1c1d7e |
bool first = TRUE;
|
|
Packit |
1c1d7e |
while (!g_commentStack.isEmpty())
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
CommentCtx *ctx = g_commentStack.pop();
|
|
Packit |
1c1d7e |
if (!first) tmp += ", ";
|
|
Packit |
1c1d7e |
tmp += QCString().setNum(ctx->lineNr);
|
|
Packit |
1c1d7e |
first = FALSE;
|
|
Packit |
1c1d7e |
delete ctx;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
tmp += ")";
|
|
Packit |
1c1d7e |
warn(g_fileName,g_lineNr,"Reached end of file while still inside a (nested) comment. "
|
|
Packit |
1c1d7e |
"Nesting level %d %s",g_nestingCount+1,tmp.data()); // add one for "normal" expected end of comment
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
g_commentStack.clear();
|
|
Packit |
1c1d7e |
g_nestingCount = 0;
|
|
Packit |
1c1d7e |
if (Debug::isFlagSet(Debug::CommentCnv))
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
g_outBuf->at(g_outBuf->curPos())='\0';
|
|
Packit |
1c1d7e |
msg("-------------\n%s\n-------------\n",g_outBuf->data());
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
printlex(yy_flex_debug, FALSE, __FILE__, fileName);
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
//----------------------------------------------------------------------------
|
|
Packit |
1c1d7e |
#if !defined(YY_FLEX_SUBMINOR_VERSION)
|
|
Packit |
1c1d7e |
extern "C" { // some bogus code to keep the compiler happy
|
|
Packit |
1c1d7e |
void commentcnvYYdummy() { yy_flex_realloc(0,0); }
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
#endif
|
|
Packit |
1c1d7e |
|