Loading src/commentcnv.l +23 −3 Original line number Original line Diff line number Diff line Loading @@ -78,6 +78,7 @@ static int g_blockCount; static bool g_lastEscaped; static bool g_lastEscaped; static int g_lastBlockContext; static int g_lastBlockContext; static bool g_pythonDocString; static bool g_pythonDocString; static int g_nestingCount; static SrcLangExt g_lang; static SrcLangExt g_lang; static bool isFixedForm; // For Fortran static bool isFixedForm; // For Fortran Loading Loading @@ -251,6 +252,7 @@ void replaceComment(int offset); else else { { g_pythonDocString = TRUE; g_pythonDocString = TRUE; g_nestingCount=0; copyToOutput(yytext,(int)yyleng); copyToOutput(yytext,(int)yyleng); BEGIN(CComment); BEGIN(CComment); } } Loading @@ -263,6 +265,7 @@ void replaceComment(int offset); else else { { copyToOutput(yytext,(int)yyleng); copyToOutput(yytext,(int)yyleng); g_nestingCount=0; BEGIN(CComment); BEGIN(CComment); } } } } Loading @@ -277,6 +280,7 @@ void replaceComment(int offset); if (isFixedForm && (g_col == 0)) if (isFixedForm && (g_col == 0)) { { copyToOutput(yytext,(int)yyleng); copyToOutput(yytext,(int)yyleng); g_nestingCount=0; BEGIN(CComment); BEGIN(CComment); } } else else Loading Loading @@ -367,6 +371,7 @@ void replaceComment(int offset); } } <Scan>"/*"[*!]? { /* start of a C comment */ <Scan>"/*"[*!]? { /* start of a C comment */ g_specialComment=(int)yyleng==3; g_specialComment=(int)yyleng==3; g_nestingCount=0; copyToOutput(yytext,(int)yyleng); copyToOutput(yytext,(int)yyleng); BEGIN(CComment); BEGIN(CComment); } } Loading @@ -378,6 +383,7 @@ void replaceComment(int offset); else else { { copyToOutput(yytext,(int)yyleng); copyToOutput(yytext,(int)yyleng); g_nestingCount=0; BEGIN(CComment); BEGIN(CComment); } } } } Loading @@ -389,6 +395,7 @@ void replaceComment(int offset); else else { { copyToOutput(yytext,(int)yyleng); copyToOutput(yytext,(int)yyleng); g_nestingCount=0; BEGIN(CComment); BEGIN(CComment); } } } } Loading @@ -400,6 +407,7 @@ void replaceComment(int offset); else else { { copyToOutput(yytext,(int)yyleng); copyToOutput(yytext,(int)yyleng); g_nestingCount=0; BEGIN(CComment); BEGIN(CComment); } } } } Loading Loading @@ -564,7 +572,7 @@ void replaceComment(int offset); copyToOutput(yytext,(int)yyleng); copyToOutput(yytext,(int)yyleng); } } <CComment>[^\\!@*\n{\"]* { /* anything that is not a '*' or command */ <CComment>[^\\!@*\n{\"\/]* { /* anything that is not a '*' or command */ copyToOutput(yytext,(int)yyleng); copyToOutput(yytext,(int)yyleng); } } <CComment>"*"+[^*/\\@\n{\"]* { /* stars without slashes */ <CComment>"*"+[^*/\\@\n{\"]* { /* stars without slashes */ Loading @@ -590,16 +598,27 @@ void replaceComment(int offset); BEGIN(Scan); BEGIN(Scan); } } } } <CComment>"/"+"*" { /* nested C comment */ g_nestingCount++; copyToOutput(yytext,(int)yyleng); } <CComment>"*"+"/" { /* end of C comment */ <CComment>"*"+"/" { /* end of C comment */ if (g_lang==SrcLangExt_Python) if (g_lang==SrcLangExt_Python) { { REJECT; REJECT; } } else else { if (g_nestingCount<=0) { { copyToOutput(yytext,(int)yyleng); copyToOutput(yytext,(int)yyleng); BEGIN(Scan); BEGIN(Scan); } } else { g_nestingCount--; } } } } <CComment>"\n"/[ \t]*[^#] { /* end of Python comment */ <CComment>"\n"/[ \t]*[^#] { /* end of Python comment */ if (g_lang!=SrcLangExt_Python || g_pythonDocString) if (g_lang!=SrcLangExt_Python || g_pythonDocString) Loading Loading @@ -935,6 +954,7 @@ void convertCppComments(BufStr *inBuf,BufStr *outBuf,const char *fileName) if (g_lang==SrcLangExt_Markdown) if (g_lang==SrcLangExt_Markdown) { { g_nestingCount=0; BEGIN(CComment); BEGIN(CComment); } } else else Loading Loading
src/commentcnv.l +23 −3 Original line number Original line Diff line number Diff line Loading @@ -78,6 +78,7 @@ static int g_blockCount; static bool g_lastEscaped; static bool g_lastEscaped; static int g_lastBlockContext; static int g_lastBlockContext; static bool g_pythonDocString; static bool g_pythonDocString; static int g_nestingCount; static SrcLangExt g_lang; static SrcLangExt g_lang; static bool isFixedForm; // For Fortran static bool isFixedForm; // For Fortran Loading Loading @@ -251,6 +252,7 @@ void replaceComment(int offset); else else { { g_pythonDocString = TRUE; g_pythonDocString = TRUE; g_nestingCount=0; copyToOutput(yytext,(int)yyleng); copyToOutput(yytext,(int)yyleng); BEGIN(CComment); BEGIN(CComment); } } Loading @@ -263,6 +265,7 @@ void replaceComment(int offset); else else { { copyToOutput(yytext,(int)yyleng); copyToOutput(yytext,(int)yyleng); g_nestingCount=0; BEGIN(CComment); BEGIN(CComment); } } } } Loading @@ -277,6 +280,7 @@ void replaceComment(int offset); if (isFixedForm && (g_col == 0)) if (isFixedForm && (g_col == 0)) { { copyToOutput(yytext,(int)yyleng); copyToOutput(yytext,(int)yyleng); g_nestingCount=0; BEGIN(CComment); BEGIN(CComment); } } else else Loading Loading @@ -367,6 +371,7 @@ void replaceComment(int offset); } } <Scan>"/*"[*!]? { /* start of a C comment */ <Scan>"/*"[*!]? { /* start of a C comment */ g_specialComment=(int)yyleng==3; g_specialComment=(int)yyleng==3; g_nestingCount=0; copyToOutput(yytext,(int)yyleng); copyToOutput(yytext,(int)yyleng); BEGIN(CComment); BEGIN(CComment); } } Loading @@ -378,6 +383,7 @@ void replaceComment(int offset); else else { { copyToOutput(yytext,(int)yyleng); copyToOutput(yytext,(int)yyleng); g_nestingCount=0; BEGIN(CComment); BEGIN(CComment); } } } } Loading @@ -389,6 +395,7 @@ void replaceComment(int offset); else else { { copyToOutput(yytext,(int)yyleng); copyToOutput(yytext,(int)yyleng); g_nestingCount=0; BEGIN(CComment); BEGIN(CComment); } } } } Loading @@ -400,6 +407,7 @@ void replaceComment(int offset); else else { { copyToOutput(yytext,(int)yyleng); copyToOutput(yytext,(int)yyleng); g_nestingCount=0; BEGIN(CComment); BEGIN(CComment); } } } } Loading Loading @@ -564,7 +572,7 @@ void replaceComment(int offset); copyToOutput(yytext,(int)yyleng); copyToOutput(yytext,(int)yyleng); } } <CComment>[^\\!@*\n{\"]* { /* anything that is not a '*' or command */ <CComment>[^\\!@*\n{\"\/]* { /* anything that is not a '*' or command */ copyToOutput(yytext,(int)yyleng); copyToOutput(yytext,(int)yyleng); } } <CComment>"*"+[^*/\\@\n{\"]* { /* stars without slashes */ <CComment>"*"+[^*/\\@\n{\"]* { /* stars without slashes */ Loading @@ -590,16 +598,27 @@ void replaceComment(int offset); BEGIN(Scan); BEGIN(Scan); } } } } <CComment>"/"+"*" { /* nested C comment */ g_nestingCount++; copyToOutput(yytext,(int)yyleng); } <CComment>"*"+"/" { /* end of C comment */ <CComment>"*"+"/" { /* end of C comment */ if (g_lang==SrcLangExt_Python) if (g_lang==SrcLangExt_Python) { { REJECT; REJECT; } } else else { if (g_nestingCount<=0) { { copyToOutput(yytext,(int)yyleng); copyToOutput(yytext,(int)yyleng); BEGIN(Scan); BEGIN(Scan); } } else { g_nestingCount--; } } } } <CComment>"\n"/[ \t]*[^#] { /* end of Python comment */ <CComment>"\n"/[ \t]*[^#] { /* end of Python comment */ if (g_lang!=SrcLangExt_Python || g_pythonDocString) if (g_lang!=SrcLangExt_Python || g_pythonDocString) Loading Loading @@ -935,6 +954,7 @@ void convertCppComments(BufStr *inBuf,BufStr *outBuf,const char *fileName) if (g_lang==SrcLangExt_Markdown) if (g_lang==SrcLangExt_Markdown) { { g_nestingCount=0; BEGIN(CComment); BEGIN(CComment); } } else else Loading