diff options
author | albert-github <albert.tests@gmail.com> | 2018-03-04 17:54:04 (GMT) |
---|---|---|
committer | albert-github <albert.tests@gmail.com> | 2018-03-04 17:54:04 (GMT) |
commit | e5e75b7f713251dd6caa472f9c5fb8d49e36ff5a (patch) | |
tree | 5bcd8b94dc196d43bae809f545bc1630e44677a2 | |
parent | fd2e30508f50c2fe84d3619eaa1575545a25b1d3 (diff) | |
download | Doxygen-e5e75b7f713251dd6caa472f9c5fb8d49e36ff5a.zip Doxygen-e5e75b7f713251dd6caa472f9c5fb8d49e36ff5a.tar.gz Doxygen-e5e75b7f713251dd6caa472f9c5fb8d49e36ff5a.tar.bz2 |
Bug 778012 - Python List as Default Parameter not parsed correctly
Added handling of square brackets, single quoted strings and double quoted strings (could contain comma's as well) to default values of arguments.
-rw-r--r-- | src/pyscanner.l | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/src/pyscanner.l b/src/pyscanner.l index 9c21d41..1d964b4 100644 --- a/src/pyscanner.l +++ b/src/pyscanner.l @@ -109,7 +109,7 @@ static QCString g_packageName; //static bool g_hideClassDocs; -static QCString g_defVal; +static QGString g_defVal; static int g_braceCount; static bool g_lexInit = FALSE; @@ -993,35 +993,49 @@ STARTDOCSYMS "##" } <FunctionParamDefVal>{ - "(" { // internal opening brace + "[" | + "(" { // internal opening brace, assumption is that we have correct code so braces do match g_braceCount++; g_defVal+=*yytext; } "," | + "]" | ")" { if (g_braceCount==0) // end of default argument { if (current->argList->getLast()) { - current->argList->getLast()->defval=g_defVal.stripWhiteSpace(); + current->argList->getLast()->defval=QCString(g_defVal.data()).stripWhiteSpace(); } - if (*yytext == ')') + if (*yytext != ',') current->args = argListToString(current->argList); BEGIN(FunctionParams); } else // continue { - if (*yytext == ')')g_braceCount--; + if (*yytext != ',')g_braceCount--; g_defVal+=*yytext; } } - . { - g_defVal+=*yytext; - } + "'" { + g_defVal+=*yytext; + g_copyString=&g_defVal; + g_stringContext=FunctionParamDefVal; + BEGIN( SingleQuoteString ); + } + "\"" { + g_defVal+=*yytext; + g_copyString=&g_defVal; + g_stringContext=FunctionParamDefVal; + BEGIN( DoubleQuoteString ); + } \n { g_defVal+=*yytext; incLineNr(); } + . { + g_defVal+=*yytext; + } } |