/*****************************************************************************
*
- *
- *
- * Copyright (C) 1997-2015 by Dimitri van Heesch.
+ * Copyright (C) 1997-2023 by Dimitri van Heesch.
*
* Permission to use, copy, modify, and distribute this software and its
- * documentation under the terms of the GNU General Public License is hereby
- * granted. No representations are made about the suitability of this software
+ * documentation under the terms of the GNU General Public License is hereby
+ * granted. No representations are made about the suitability of this software
* for any purpose. It is provided "as is" without express or implied warranty.
* See the GNU General Public License for more details.
*
%{
-
+
#include <stdio.h>
#include <stdlib.h>
#include <stack>
#include "config.h"
#include "doxygen.h"
#include "util.h"
+#include "aliases.h"
#include "condparser.h"
#include <assert.h>
#define YY_NO_INPUT 1
#define YY_NO_UNISTD_H 1
-#define ADDCHAR(c) yyextra->outBuf->addChar(c)
-#define ADDARRAY(a,s) yyextra->outBuf->addArray(a,s)
+#define ADDCHAR(c) yyextra->outBuf.addChar(c)
+#define ADDARRAY(a,s) yyextra->outBuf.addArray(a,s)
#define USE_STATE2STRING 0
-
+
struct commentcnvYY_CondCtx
{
- commentcnvYY_CondCtx(int line,QCString id,bool b)
+ commentcnvYY_CondCtx(int line,const QCString &id,bool b)
: lineNr(line),sectionId(id), skip(b) {}
int lineNr;
QCString sectionId;
bool skip;
};
-
+
struct CommentCtx
{
- CommentCtx(int line)
+ CommentCtx(int line)
: lineNr(line) {}
int lineNr;
};
-
+
struct commentcnvYY_state
{
- BufStr * inBuf = 0;
- BufStr * outBuf = 0;
- yy_size_t inBufPos = 0;
+ commentcnvYY_state(const BufStr &i,BufStr &o) : inBuf(i), outBuf(o) {}
+ const BufStr &inBuf;
+ BufStr &outBuf;
+ int inBufPos = 0;
int col = 0;
int blockHeadCol = 0;
bool mlBrief = FALSE;
static void endCondSection(yyscan_t yyscanner);
static void handleCondSectionId(yyscan_t yyscanner,const char *expression);
static void replaceAliases(yyscan_t yyscanner,const QCString &s);
-static yy_size_t yyread(yyscan_t yyscanner,char *buf,yy_size_t max_size);
+static int yyread(yyscan_t yyscanner,char *buf,int max_size);
static void replaceComment(yyscan_t yyscanner,int offset);
static void clearCommentStack(yyscan_t yyscanner);
NUMBER {INTEGER_NUMBER}|{FLOAT_NUMBER}
//- end: NUMBER ---------------------------------------------------------------------------
- // C start comment
+ // C start comment
CCS "/\*"
// C end comment
CCE "*\/"
- // Cpp comment
+ // Cpp comment
CPPC "/\/"
// Optional any character
<Scan>{NUMBER} { //Note similar code in code.l
if (yyextra->lang!=SrcLangExt_Cpp) REJECT;
- copyToOutput(yyscanner,yytext,(int)yyleng);
+ copyToOutput(yyscanner,yytext,(int)yyleng);
}
<Scan>[^"'!\/\n\\#,\-=; \t]* { /* eat anything that is not " / , or \n */
copyToOutput(yyscanner,yytext,(int)yyleng);
}
-<Scan>[,= ;\t] { /* eat , so we have a nice separator in long initialization lines */
+<Scan>[,= ;\t] { /* eat , so we have a nice separator in long initialization lines */
copyToOutput(yyscanner,yytext,(int)yyleng);
}
<Scan>"\"\"\""! { /* start of python long comment */
yyextra->commentStack.push(yyextra->lineNr);
}
}
+<Scan>"\"\"\"" { /* start of python long comment */
+ if (yyextra->lang!=SrcLangExt_Python)
+ {
+ REJECT;
+ }
+ else if (Config_getBool(PYTHON_DOCSTRING))
+ {
+ REJECT;
+ }
+ else
+ { /* handle as if """! */
+ yyextra->pythonDocString = TRUE;
+ yyextra->nestingCount=1;
+ clearCommentStack(yyscanner); /* to be on the save side */
+ copyToOutput(yyscanner,yytext,(int)yyleng);
+ BEGIN(CComment);
+ yyextra->commentStack.push(yyextra->lineNr);
+ }
+ }
<Scan>![><!]/.*\n {
if (yyextra->lang!=SrcLangExt_Fortran)
{
}
else
{
- copyToOutput(yyscanner,yytext,(int)yyleng);
+ copyToOutput(yyscanner,yytext,(int)yyleng);
yyextra->nestingCount=0; // Fortran doesn't have an end comment
clearCommentStack(yyscanner); /* to be on the save side */
BEGIN(CComment);
/* check for fixed format; we might have some conditional as part of multiline if like C<5 .and. & */
if (yyextra->isFixedForm && (yyextra->col == 0))
{
- copyToOutput(yyscanner,yytext,(int)yyleng);
+ copyToOutput(yyscanner,yytext,(int)yyleng);
yyextra->nestingCount=0; // Fortran doesn't have an end comment
clearCommentStack(yyscanner); /* to be on the save side */
BEGIN(CComment);
}
else
{
- copyToOutput(yyscanner,yytext,(int)yyleng);
+ copyToOutput(yyscanner,yytext,(int)yyleng);
}
}
<Scan>[Cc\*].*\n {
{
if (yyextra->col == 0)
{
- copyToOutput(yyscanner,yytext,(int)yyleng);
+ copyToOutput(yyscanner,yytext,(int)yyleng);
}
else
{
}
}
}
-<Scan>"\"" { /* start of a string */
- copyToOutput(yyscanner,yytext,(int)yyleng);
+<Scan>"\"" { /* start of a string */
+ copyToOutput(yyscanner,yytext,(int)yyleng);
yyextra->stringContext = YY_START;
- BEGIN(SkipString);
+ BEGIN(SkipString);
}
<Scan>' {
- copyToOutput(yyscanner,yytext,(int)yyleng);
+ copyToOutput(yyscanner,yytext,(int)yyleng);
yyextra->charContext = YY_START;
if (yyextra->lang!=SrcLangExt_VHDL)
{
BEGIN(SkipChar);
}
}
-<Scan>\n { /* new line */
- copyToOutput(yyscanner,yytext,(int)yyleng);
+<Scan>\n { /* new line */
+ copyToOutput(yyscanner,yytext,(int)yyleng);
}
<Scan>{CPPC}"!"/.*\n[ \t]*{CPPC}[\/!][^\/] | /* start C++ style special comment block */
<Scan>({CPPC}"/"[/]*)/[^/].*\n[ \t]*{CPPC}[\/!][^\/] { /* start C++ style special comment block */
- if (yyextra->mlBrief)
+ if (yyextra->mlBrief)
{
REJECT; // bail out if we do not need to convert
}
while (i<(int)yyleng && yytext[i]=='/') i++;
}
yyextra->blockHeadCol=yyextra->col;
- copyToOutput(yyscanner,"/**",3);
+ copyToOutput(yyscanner,"/**",3);
replaceAliases(yyscanner,QCString(yytext+i));
yyextra->inSpecialComment=TRUE;
- //BEGIN(SComment);
+ //BEGIN(SComment);
yyextra->readLineCtx=SComment;
BEGIN(ReadLine);
}
}
<Scan>{CPPC}[!\/]/.*\n[ \t]*{CPPC}[|\/][ \t]*[@\\]"}" { // next line contains an end marker, see bug 752712
yyextra->inSpecialComment=yytext[2]=='/' || yytext[2]=='!';
- copyToOutput(yyscanner,yytext,(int)yyleng);
+ copyToOutput(yyscanner,yytext,(int)yyleng);
yyextra->readLineCtx=YY_START;
BEGIN(ReadLine);
}
-<Scan>{CPPC}/.*\n { /* one line C++ comment */
+<Scan>{CPPC}/.*\n { /* one line C++ comment */
yyextra->inSpecialComment=yytext[2]=='/' || yytext[2]=='!';
- copyToOutput(yyscanner,yytext,(int)yyleng);
+ copyToOutput(yyscanner,yytext,(int)yyleng);
yyextra->readLineCtx=YY_START;
BEGIN(ReadLine);
}
yyextra->specialComment=(int)yyleng==3;
yyextra->nestingCount=1;
clearCommentStack(yyscanner); /* to be on the save side */
- copyToOutput(yyscanner,yytext,(int)yyleng);
+ copyToOutput(yyscanner,yytext,(int)yyleng);
if (yyextra->specialComment)
- BEGIN(CComment);
+ BEGIN(CComment);
else
- BEGIN(CNComment);
+ BEGIN(CNComment);
yyextra->commentStack.push(yyextra->lineNr);
}
+<Scan>"#"[^\n]*\n {
+ if (yyextra->lang!=SrcLangExt_PHP)
+ {
+ REJECT;
+ }
+ copyToOutput(yyscanner,yytext,(int)yyleng);
+ }
<Scan>"#"("#")? {
if (yyextra->lang!=SrcLangExt_Python)
{
}
else
{
- copyToOutput(yyscanner,yytext,(int)yyleng);
+ copyToOutput(yyscanner,yytext,(int)yyleng);
yyextra->nestingCount=0; // Python doesn't have an end comment for #
clearCommentStack(yyscanner); /* to be on the save side */
BEGIN(CComment);
}
else
{
- copyToOutput(yyscanner,yytext,(int)yyleng);
+ copyToOutput(yyscanner,yytext,(int)yyleng);
}
}
<Scan>"--!" {
else
{
yyextra->vhdl = TRUE;
- copyToOutput(yyscanner,yytext,(int)yyleng);
+ copyToOutput(yyscanner,yytext,(int)yyleng);
yyextra->nestingCount=0; // VHDL doesn't have an end comment
clearCommentStack(yyscanner); /* to be on the save side */
BEGIN(CComment);
}
else
{
- copyToOutput(yyscanner,yytext,(int)yyleng);
+ copyToOutput(yyscanner,yytext,(int)yyleng);
yyextra->nestingCount=0; // Fortran doesn't have an end comment
clearCommentStack(yyscanner); /* to be on the save side */
BEGIN(CComment);
copyToOutput(yyscanner,yytext,(int)yyleng);
}
<CComment>"{"[ \t]*"@code"/[ \t\n] {
- copyToOutput(yyscanner,"@iliteral{code}",15);
+ copyToOutput(yyscanner,"@iliteral{code}",15);
yyextra->lastCommentContext = YY_START;
yyextra->javaBlock=1;
yyextra->blockName=&yytext[1];
BEGIN(VerbatimCode);
}
<CComment>"{"[ \t]*"@literal"/[ \t\n] {
- copyToOutput(yyscanner,"@iliteral",9);
+ copyToOutput(yyscanner,"@iliteral",9);
yyextra->lastCommentContext = YY_START;
yyextra->javaBlock=1;
yyextra->blockName=&yytext[1];
copyToOutput(yyscanner,yytext,(int)yyleng);
yyextra->lastCommentContext = YY_START;
yyextra->javaBlock=0;
- yyextra->blockName=QCString(yytext).stripWhiteSpace().left(3);
+ yyextra->blockName=QCString(yytext).stripWhiteSpace().left(3); // take the ``` or ~~~ part
BEGIN(VerbatimCode);
}
<CComment,ReadLine>[\\@]("dot"|"code"|"msc"|"startuml")/[^a-z_A-Z0-9] { /* start of a verbatim block */
- copyToOutput(yyscanner,yytext,(int)yyleng);
+ copyToOutput(yyscanner,yytext,(int)yyleng);
yyextra->lastCommentContext = YY_START;
yyextra->javaBlock=0;
if (qstrcmp(&yytext[1],"startuml")==0)
BEGIN(VerbatimCode);
}
<CComment,ReadLine>[\\@]("f$"|"f["|"f{"|"f(") {
- copyToOutput(yyscanner,yytext,(int)yyleng);
+ copyToOutput(yyscanner,yytext,(int)yyleng);
yyextra->blockName=&yytext[1];
if (yyextra->blockName.at(1)=='[')
{
BEGIN(Verbatim);
}
<CComment,ReadLine>[\\@]("verbatim"|"iliteral"|"latexonly"|"htmlonly"|"xmlonly"|"docbookonly"|"rtfonly"|"manonly")/[^a-z_A-Z0-9] { /* start of a verbatim block */
- copyToOutput(yyscanner,yytext,(int)yyleng);
+ copyToOutput(yyscanner,yytext,(int)yyleng);
yyextra->blockName=&yytext[1];
yyextra->lastCommentContext = YY_START;
BEGIN(Verbatim);
<VerbatimCode>^[ \t]*{CPPC}[\!\/]? { /* skip leading comments */
if (!yyextra->inSpecialComment)
{
- copyToOutput(yyscanner,yytext,(int)yyleng);
+ copyToOutput(yyscanner,yytext,(int)yyleng);
}
else
{
}
}
<Verbatim,VerbatimCode>[^`~@\/\\\n{}]* { /* any character not a backslash or new line or } */
- copyToOutput(yyscanner,yytext,(int)yyleng);
+ copyToOutput(yyscanner,yytext,(int)yyleng);
}
<Verbatim,VerbatimCode>\n { /* new line in verbatim block */
- copyToOutput(yyscanner,yytext,(int)yyleng);
+ copyToOutput(yyscanner,yytext,(int)yyleng);
}
<Verbatim>^[ \t]*{CPPC}[/!] {
if (yyextra->blockName=="dot" || yyextra->blockName=="msc" || yyextra->blockName=="uml" || yyextra->blockName.at(0)=='f')
}
}
<Verbatim,VerbatimCode>. { /* any other character */
- copyToOutput(yyscanner,yytext,(int)yyleng);
+ copyToOutput(yyscanner,yytext,(int)yyleng);
}
<SkipString>\\. { /* escaped character in string */
if (yyextra->lang==SrcLangExt_Fortran || yyextra->lang==SrcLangExt_VHDL)
copyToOutput(yyscanner,yytext,(int)yyleng);
}
}
-<SkipString>"\"" { /* end of string */
- copyToOutput(yyscanner,yytext,(int)yyleng);
- BEGIN(yyextra->stringContext);
+<SkipString>"\"" { /* end of string */
+ copyToOutput(yyscanner,yytext,(int)yyleng);
+ BEGIN(yyextra->stringContext);
}
-<SkipString>. { /* any other string character */
- copyToOutput(yyscanner,yytext,(int)yyleng);
+<SkipString>. { /* any other string character */
+ copyToOutput(yyscanner,yytext,(int)yyleng);
}
-<SkipString>\n { /* new line inside string (illegal for some compilers) */
- copyToOutput(yyscanner,yytext,(int)yyleng);
+<SkipString>\n { /* new line inside string (illegal for some compilers) */
+ copyToOutput(yyscanner,yytext,(int)yyleng);
}
<SkipChar>\\. { /* escaped character */
if (yyextra->lang==SrcLangExt_Fortran || yyextra->lang==SrcLangExt_VHDL)
copyToOutput(yyscanner,yytext,(int)yyleng);
}
}
-<SkipChar>' { /* end of character literal */
- copyToOutput(yyscanner,yytext,(int)yyleng);
+<SkipChar>' { /* end of character literal */
+ copyToOutput(yyscanner,yytext,(int)yyleng);
BEGIN(yyextra->charContext);
}
-<SkipChar>. { /* any other string character */
- copyToOutput(yyscanner,yytext,(int)yyleng);
+<SkipChar>. { /* any other string character */
+ copyToOutput(yyscanner,yytext,(int)yyleng);
}
<SkipChar>\n { /* new line character */
- copyToOutput(yyscanner,yytext,(int)yyleng);
+ copyToOutput(yyscanner,yytext,(int)yyleng);
}
-<CComment,CNComment>[^ `~<\\!@*\n{\"\/]* { /* anything that is not a '*' or command */
- copyToOutput(yyscanner,yytext,(int)yyleng);
+<CComment,CNComment>[^ `~<\\!@*\n{\"\/]* { /* anything that is not a '*' or command */
+ copyToOutput(yyscanner,yytext,(int)yyleng);
}
<CComment,CNComment>"*"+[^*\/\\@\n{\"]* { /* stars without slashes */
- copyToOutput(yyscanner,yytext,(int)yyleng);
+ copyToOutput(yyscanner,yytext,(int)yyleng);
}
<CComment>"\"\"\"" { /* end of Python docstring */
if (yyextra->lang!=SrcLangExt_Python)
BEGIN(Scan);
}
}
+<CComment,CNComment>"/""/"+/"*/" { /* we are already in C-comment so not a start of a nested comment but
+ * just the end of the comment (the end part is handled later). */
+ copyToOutput(yyscanner,yytext,(int)yyleng);
+ }
<CComment,CNComment>"/"+"*" { /* nested C comment */
if (yyextra->lang==SrcLangExt_Python ||
yyextra->lang==SrcLangExt_Markdown)
}
*/
<CComment,CNComment>. {
- copyToOutput(yyscanner,yytext,(int)yyleng);
+ copyToOutput(yyscanner,yytext,(int)yyleng);
}
<SComment>^[ \t]*{CPPC}"/"{SLASHopt}/\n {
replaceComment(yyscanner,0);
}
<SComment>\n[ \t]*{CPPC}"/"{SLASHopt}/\n {
- replaceComment(yyscanner,1);
+ replaceComment(yyscanner,1);
}
-<SComment>^[ \t]*{CPPC}"/"[^\/\n]/.*\n {
+<SComment>^[ \t]*{CPPC}"/"[^\/\n]/.*\n {
replaceComment(yyscanner,0);
yyextra->readLineCtx=YY_START;
BEGIN(ReadLine);
}
-<SComment>\n[ \t]*{CPPC}[\/!]("<")?[ \t]*[\\@]"}".*\n {
+<SComment>\n[ \t]*{CPPC}[\/!]("<")?[ \t]*[\\@]"}".*\n {
/* See Bug 752712: end the multiline comment when finding a @} or \} command */
- copyToOutput(yyscanner," */",3);
- copyToOutput(yyscanner,yytext,(int)yyleng);
+ copyToOutput(yyscanner," */",3);
+ copyToOutput(yyscanner,yytext,(int)yyleng);
yyextra->inSpecialComment=FALSE;
yyextra->inRoseComment=FALSE;
- BEGIN(Scan);
+ BEGIN(Scan);
}
-<SComment>\n[ \t]*{CPPC}"/"[^\/\n]/.*\n {
- replaceComment(yyscanner,1);
+<SComment>\n[ \t]*{CPPC}"/"[^\/\n]/.*\n {
+ replaceComment(yyscanner,1);
yyextra->readLineCtx=YY_START;
BEGIN(ReadLine);
}
}
<SComment>\n[ \t]*{CPPC}"!" |
<SComment>\n[ \t]*{CPPC}"!<"/.*\n |
-<SComment>\n[ \t]*{CPPC}"!"[^<\n]/.*\n {
- replaceComment(yyscanner,1);
+<SComment>\n[ \t]*{CPPC}"!"[^<\n]/.*\n {
+ replaceComment(yyscanner,1);
yyextra->readLineCtx=YY_START;
BEGIN(ReadLine);
}
}
else
{
- replaceComment(yyscanner,1);
+ replaceComment(yyscanner,1);
yyextra->readLineCtx=YY_START;
BEGIN(ReadLine);
}
}
<SComment>\n { /* end of special comment */
- copyToOutput(yyscanner," */",3);
- copyToOutput(yyscanner,yytext,(int)yyleng);
+ copyToOutput(yyscanner," */",3);
+ copyToOutput(yyscanner,yytext,(int)yyleng);
yyextra->inSpecialComment=FALSE;
yyextra->inRoseComment=FALSE;
yyextra->readLineCtx = Scan; // reset, otherwise there will be problems with:
// static void handleCondSectionId
- BEGIN(Scan);
+ BEGIN(Scan);
}
<ReadLine>{CCS}"*" {
copyToOutput(yyscanner,"/‍**",8);
copyToOutput(yyscanner,yytext,(int)yyleng);
}
<CComment,ReadLine>[\\@]"cond"/[^a-z_A-Z0-9] { // conditional section
- yyextra->condCtx = YY_START;
+ yyextra->condCtx = YY_START;
BEGIN(CondLine);
}
<CComment,ReadLine>[\\@]"endcond"/[^a-z_A-Z0-9] { // end of conditional section
bool oldSkip=yyextra->skip;
endCondSection(yyscanner);
- if (YY_START==CComment && oldSkip && !yyextra->skip)
+ if (YY_START==CComment && oldSkip && !yyextra->skip)
{
//printf("** Adding start of comment!\n");
if (yyextra->lang!=SrcLangExt_Python &&
handleCondSectionId(yyscanner," "); // fake section id causing the section to be hidden unconditionally
if (*yytext=='\n') { yyextra->lineNr++; copyToOutput(yyscanner,"\n",1);}
}
-<CComment,ReadLine>[\\@][a-z_A-Z][a-z_A-Z0-9]* { // expand alias without arguments
+<CComment,ReadLine>[\\@][a-z_A-Z][a-z_A-Z0-9-]* { // expand alias without arguments
replaceAliases(yyscanner,QCString(yytext));
}
-<CComment,ReadLine>[\\@][a-z_A-Z][a-z_A-Z0-9]*"{" { // expand alias with arguments
+<CComment,ReadLine>[\\@][a-z_A-Z][a-z_A-Z0-9-]*"{" { // expand alias with arguments
yyextra->lastBlockContext=YY_START;
yyextra->blockCount=1;
yyextra->aliasString=yytext;
const char *p=s;
char c;
// copy leading blanks
- while ((c=*p) && (c==' ' || c=='\t' || c=='\n'))
+ while ((c=*p) && (c==' ' || c=='\t' || c=='\n'))
{
ADDCHAR(c);
yyextra->lineNr += c=='\n';
}
// replace start of comment marker by blanks and the last character by a *
int blanks=0;
- while ((c=*p) && (c=='/' || c=='!' || c=='#'))
+ while ((c=*p) && (c=='/' || c=='!' || c=='#'))
{
blanks++;
p++;
- if (*p=='<') // comment-after-item marker
- {
+ if (*p=='<') // comment-after-item marker
+ {
blanks++;
- p++;
+ p++;
}
if (c=='!') // end after first !
{
while ((c=*p++))
{
if (c==' ') col++;
- else if (c=='\t') col+=tabSize-(col%tabSize);
+ else if (c=='\t') col+=tabSize-(col%tabSize);
else break;
}
return col;
else if (len>0)
{
ADDARRAY(s,len);
- for (i=0;i<len;i++)
+ for (i=0;i<len;i++)
{
switch (s[i])
{
- case '\n': yyextra->col=0;
+ case '\n': yyextra->col=0;
//fprintf(stderr,"---> copy %d\n",g_lineNr);
yyextra->lineNr++; break;
case '\t': yyextra->col+=tabSize-(yyextra->col%tabSize); break;
struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
bool oldSkip=yyextra->skip;
startCondSection(yyscanner,QCString(expression));
- if ((yyextra->condCtx==CComment || yyextra->readLineCtx==SComment) &&
- !oldSkip && yyextra->skip)
+ if ((yyextra->condCtx==CComment || yyextra->readLineCtx==SComment) &&
+ !oldSkip && yyextra->skip)
{
if (yyextra->lang!=SrcLangExt_Python &&
yyextra->lang!=SrcLangExt_VHDL &&
}
}
-/** copies string \a s with length \a len to the output, while
+/** copies string \a s with length \a len to the output, while
* replacing any alias commands found in the string.
*/
static void replaceAliases(yyscan_t yyscanner,const QCString &s)
{
QCString result = resolveAliasCmd(s);
- //printf("replaceAliases(%s)->'%s'\n",s,result.data());
+ //printf("replaceAliases(%s)->'%s'\n",qPrint(s),qPrint(result));
copyToOutput(yyscanner,result.data(),result.length());
}
-static yy_size_t yyread(yyscan_t yyscanner,char *buf,yy_size_t max_size)
+static int yyread(yyscan_t yyscanner,char *buf,int max_size)
{
struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
- yy_size_t bytesInBuf = yyextra->inBuf->curPos()-yyextra->inBufPos;
- yy_size_t bytesToCopy = std::min(max_size,bytesInBuf);
- memcpy(buf,yyextra->inBuf->data()+yyextra->inBufPos,bytesToCopy);
+ int bytesInBuf = static_cast<int>(yyextra->inBuf.curPos())-yyextra->inBufPos;
+ int bytesToCopy = std::min(max_size,bytesInBuf);
+ memcpy(buf,yyextra->inBuf.data()+yyextra->inBufPos,bytesToCopy);
yyextra->inBufPos+=bytesToCopy;
return bytesToCopy;
}
* -# It replaces aliases with their definition (see ALIASES)
* -# It handles conditional sections (cond...endcond blocks)
*/
-void convertCppComments(BufStr *inBuf,BufStr *outBuf,const QCString &fileName)
+void convertCppComments(const BufStr &inBuf,BufStr &outBuf,const QCString &fileName)
{
yyscan_t yyscanner;
- commentcnvYY_state extra;
+ commentcnvYY_state extra(inBuf,outBuf);
commentcnvYYlex_init_extra(&extra,&yyscanner);
#ifdef FLEX_DEBUG
- commentcnvYYset_debug(1,yyscanner);
+ commentcnvYYset_debug(Debug::isFlagSet(Debug::Lex_commentcnv)?1:0,yyscanner);
#endif
struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
//printf("convertCppComments(%s)\n",fileName);
- yyextra->inBuf = inBuf;
- yyextra->outBuf = outBuf;
yyextra->inBufPos = 0;
yyextra->col = 0;
yyextra->mlBrief = Config_getBool(MULTILINE_CPP_IS_BRIEF);
clearCommentStack(yyscanner);
yyextra->vhdl = FALSE;
- printlex(yy_flex_debug, TRUE, __FILE__, qPrint(fileName));
+ DebugLex debugLex(Debug::Lex_commentcnv,__FILE__, qPrint(fileName));
yyextra->isFixedForm = FALSE;
if (yyextra->lang==SrcLangExt_Fortran)
{
FortranFormat fmt = convertFileNameFortranParserCode(fileName);
- yyextra->isFixedForm = recognizeFixedForm(QCString(inBuf->data()),fmt);
+ yyextra->isFixedForm = recognizeFixedForm(QCString(inBuf.data()),fmt);
}
if (yyextra->lang==SrcLangExt_Markdown)
yyextra->nestingCount = 0;
if (Debug::isFlagSet(Debug::CommentCnv))
{
- yyextra->outBuf->at(yyextra->outBuf->curPos())='\0';
+ yyextra->outBuf.at(yyextra->outBuf.curPos())='\0';
Debug::print(Debug::CommentCnv,0,"-----------\nCommentCnv: %s\n"
- "output=[\n%s]\n-----------\n",qPrint(fileName),yyextra->outBuf->data()
+ "output=[\n%s]\n-----------\n",qPrint(fileName),yyextra->outBuf.data()
);
}
- printlex(yy_flex_debug, FALSE, __FILE__, qPrint(fileName));
commentcnvYYlex_destroy(yyscanner);
}