summaryrefslogtreecommitdiff
path: root/src/commentcnv.l
diff options
context:
space:
mode:
authorDongHun Kwak <dh0128.kwak@samsung.com>2021-10-15 11:15:28 +0900
committerDongHun Kwak <dh0128.kwak@samsung.com>2021-10-15 11:15:28 +0900
commit4aa4e498d10e343b3b2a49e06195f62a49120002 (patch)
treeff9645788017052b9d83d196cc25bddcfcf1708b /src/commentcnv.l
parentfd5021ef77ddac91004a2b9c549e08ea952bce89 (diff)
downloaddoxygen-4aa4e498d10e343b3b2a49e06195f62a49120002.tar.gz
doxygen-4aa4e498d10e343b3b2a49e06195f62a49120002.tar.bz2
doxygen-4aa4e498d10e343b3b2a49e06195f62a49120002.zip
Imported Upstream version 1.9.0upstream/1.9.0
Diffstat (limited to 'src/commentcnv.l')
-rw-r--r--src/commentcnv.l80
1 files changed, 37 insertions, 43 deletions
diff --git a/src/commentcnv.l b/src/commentcnv.l
index a7d74ef..036f830 100644
--- a/src/commentcnv.l
+++ b/src/commentcnv.l
@@ -142,12 +142,44 @@ MAILADR ("mailto:")?[a-z_A-Z0-9.+-]+"@"[a-z_A-Z0-9-]+("."[a-z_A-Z0-9\-]+)+[a-z
%x CondLine
%x ReadAliasArgs
+ //- start: NUMBER -------------------------------------------------------------------------
+ // Note same defines in code.l: keep in sync
+DECIMAL_INTEGER [1-9][0-9']*[0-9]?[uU]?[lL]?[lL]?
+HEXADECIMAL_INTEGER "0"[xX][0-9a-zA-Z']+[0-9a-zA-Z]?
+OCTAL_INTEGER "0"[0-7][0-7']+[0-7]?
+BINARY_INTEGER "0"[bB][01][01']*[01]?
+INTEGER_NUMBER {DECIMAL_INTEGER}|{HEXADECIMAL_INTEGER}|{OCTAL_INTEGER}|{BINARY_INTEGER}
+
+FP_SUF [fFlL]
+
+DIGIT_SEQ [0-9][0-9']*[0-9]?
+FRAC_CONST {DIGIT_SEQ}"."|{DIGIT_SEQ}?"."{DIGIT_SEQ}
+FP_EXP [eE][+-]?{DIGIT_SEQ}
+DEC_FP1 {FRAC_CONST}{FP_EXP}?{FP_SUF}?
+DEC_FP2 {DIGIT_SEQ}{FP_EXP}{FP_SUF}
+
+HEX_DIGIT_SEQ [0-9a-fA-F][0-9a-fA-F']*[0-9a-fA-F]?
+HEX_FRAC_CONST {HEX_DIGIT_SEQ}"."|{HEX_DIGIT_SEQ}?"."{HEX_DIGIT_SEQ}
+BIN_EXP [pP][+-]?{DIGIT_SEQ}
+HEX_FP1 "0"[xX]{HEX_FRAC_CONST}{BIN_EXP}{FP_SUF}?
+HEX_FP2 "0"[xX]{HEX_DIGIT_SEQ}{BIN_EXP}{FP_SUF}?
+
+FLOAT_DECIMAL {DEC_FP1}|{DEC_FP2}
+FLOAT_HEXADECIMAL {HEX_FP1}|{HEX_FP2}
+FLOAT_NUMBER {FLOAT_DECIMAL}|{FLOAT_HEXADECIMAL}
+NUMBER {INTEGER_NUMBER}|{FLOAT_NUMBER}
+ //- end: NUMBER ---------------------------------------------------------------------------
+
%%
-<Scan>[^"'!\/\n\\#,\-]* { /* eat anything that is not " / , or \n */
+<Scan>{NUMBER} { //Note similar code in code.l
+ if (yyextra->lang!=SrcLangExt_Cpp) REJECT;
+ copyToOutput(yyscanner,yytext,(int)yyleng);
+ }
+<Scan>[^"'!\/\n\\#,\-=; \t]* { /* eat anything that is not " / , or \n */
copyToOutput(yyscanner,yytext,(int)yyleng);
}
-<Scan>[,] { /* 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 */
@@ -1076,45 +1108,6 @@ static void replaceComment(yyscan_t yyscanner,int offset)
}
}
-// simplified way to know if this is fixed form
-// duplicate in fortrancode.l
-static bool recognizeFixedForm(const char* contents)
-{
- int column=0;
- bool skipLine=FALSE;
-
- for(int i=0;;i++) {
- column++;
-
- switch(contents[i]) {
- case '\n':
- column=0;
- skipLine=FALSE;
- break;
- case ' ':
- break;
- case '\000':
- return FALSE;
- case 'C':
- case 'c':
- case '*':
- if(column==1) return TRUE;
- if(skipLine) break;
- return FALSE;
- case '!':
- if(column>1 && column<7) return FALSE;
- skipLine=TRUE;
- break;
- default:
- if(skipLine) break;
- if(column==7) return TRUE;
- return FALSE;
- }
- }
- return FALSE;
-}
-
-
/*! This function does three things:
* -# It converts multi-line C++ style comment blocks (that are aligned)
* to C style comment blocks (if MULTILINE_CPP_IS_BRIEF is set to NO).
@@ -1151,7 +1144,8 @@ void convertCppComments(BufStr *inBuf,BufStr *outBuf,const char *fileName)
yyextra->isFixedForm = FALSE;
if (yyextra->lang==SrcLangExt_Fortran)
{
- yyextra->isFixedForm = recognizeFixedForm(inBuf->data());
+ FortranFormat fmt = convertFileNameFortranParserCode(fileName);
+ yyextra->isFixedForm = recognizeFixedForm(inBuf->data(),fmt);
}
if (yyextra->lang==SrcLangExt_Markdown)
@@ -1173,7 +1167,7 @@ void convertCppComments(BufStr *inBuf,BufStr *outBuf,const char *fileName)
warn(yyextra->fileName,ctx->lineNr,"Conditional section%sdoes not have "
"a corresponding \\endcond command within this file.",sectionInfo.data());
}
- if (yyextra->nestingCount>0 && yyextra->lang!=SrcLangExt_Markdown)
+ if (yyextra->nestingCount>0 && yyextra->lang!=SrcLangExt_Markdown && yyextra->lang!=SrcLangExt_Fortran)
{
QCString tmp= "(probable line reference: ";
bool first = TRUE;