From c73dccc6af02de46485b66caef63253aeb9fd5fe Mon Sep 17 00:00:00 2001 From: Dimitri van Heesch Date: Fri, 25 Dec 2020 14:08:47 +0100 Subject: Refactoring: removed some dead code --- addon/doxywizard/config_doxyw.l | 140 ---------------------------------------- src/configimpl.l | 2 - 2 files changed, 142 deletions(-) diff --git a/addon/doxywizard/config_doxyw.l b/addon/doxywizard/config_doxyw.l index cde4e8e..8fe4194 100644 --- a/addon/doxywizard/config_doxyw.l +++ b/addon/doxywizard/config_doxyw.l @@ -68,9 +68,7 @@ static Input *g_curOption=0; static QByteArray g_str; static QTextCodec *g_codec = QTextCodec::codecForName("UTF-8"); static QString g_codecName = QString::fromLatin1("UTF-8"); -static int g_lastState; static QString g_cmd; -static int g_part; static bool g_isEnum; static const char *stateToString(int state); @@ -142,13 +140,11 @@ static void processString() int l = s.length(); // remove surrounding quotes if present (and not escaped) - bool quotedString=false; if (l>=2 && s.at(0)=='"' && s.at(l-1)=='"' && // remove quotes (s.at(l-2)!='\\' || (s.at(l-2)=='\\' && s.at(l-3)=='\\'))) { s=s.mid(1,s.length()-2); l=s.length(); - quotedString=true; } // check for invalid and/or escaped quotes @@ -403,7 +399,6 @@ static void readIncludeFile(const QString &incName) /*-------------- TAG start ---------------*/ [a-z_A-Z][a-z_A-Z0-9]*[ \t]*"=" { g_cmd = g_codec->toUnicode(yytext); - g_part = 0; g_cmd=g_cmd.left(g_cmd.length()-1).trimmed(); g_curOption = g_options->value(g_cmd); if (g_curOption==0) // oops not known @@ -557,141 +552,6 @@ static void readIncludeFile(const QString &incName) g_str+=yytext; } - /* - -\n { BEGIN(Start); } -\n { - if (!g_str.isEmpty()) - { - //printf("elemStr1='%s'\n",qPrintable(elemStr)); - *g_arg = QVariant(g_arg->toStringList() << g_str); - } - BEGIN(Start); - } -[ \t]+ { - if (!g_str.isEmpty()) - { - //printf("elemStr2='%s'\n",qPrintable(elemStr)); - *g_arg = QVariant(g_arg->toStringList() << g_str); - } - g_str = QString(); - } -[^ \"\t\r\n]+ { - if (g_part == 1) // multiple unquoted parts, reset to default - { - config_warn("Invalid value for '%s' tag in line %d, file %s\n" - "Value should not contain unquoted whitespace, " - "using the default\n", - qPrintable(g_cmd),yylineno,qPrintable(g_yyFileName)); - *g_arg=QVariant(g_codec->toUnicode("")); - } - else if (g_part > 1) // multiple unquoted parts, reset to default - { - *g_arg=QVariant(g_codec->toUnicode("")); - } - else - { - *g_arg = QVariant(g_codec->toUnicode(yytext)); - checkEncoding(); - } - g_part++; - } -[^ \"\t\r\n]+ { - InputString *cur = dynamic_cast(g_curOption); - if (g_part == 1) // multiple unquoted parts, reset to default - { - config_warn("Invalid value for '%s' tag in line %d, file %s\n" - "Value should not contain unquoted whitespace, " - "using the default\n", - qPrintable(g_cmd),yylineno,qPrintable(g_yyFileName)); - *g_arg=QVariant(g_codec->toUnicode("")); - } - else if (g_part > 1) // multiple unquoted parts, reset to default - { - *g_arg=QVariant(g_codec->toUnicode("")); - } - else - { - *g_arg = cur->checkEnumVal(g_codec->toUnicode(yytext)); - } - g_part++; - } -"\"" { g_lastState=YY_START; - BEGIN(GetQuotedString); - g_tmpString=""; - } -"\""|"\n" { - // we add a bogus space to signal that the string was quoted. This space will be stripped later on. - g_tmpString+=" "; - //printf("Quoted String = '%s'\n",qPrintable(tmpString)); - if (g_lastState==GetString) - { - if (g_part == 1) // multiple unquoted parts, reset to default - { - config_warn("Invalid value for '%s' tag in line %d, file %s\n" - "Value should not contain unquoted whitespace, " - "using the default\n", - qPrintable(g_cmd),yylineno,qPrintable(g_yyFileName)); - *g_arg=g_codec->toUnicode(""); - } - else if (g_part > 1) // multiple unquoted parts, reset to default - { - *g_arg=g_codec->toUnicode(""); - } - else - { - *g_arg = g_codec->toUnicode(g_tmpString); - checkEncoding(); - } - g_part++; - } - else if (g_lastState==GetEnum) - { - if (g_part == 1) // multiple unquoted parts, reset to default - { - config_warn("Invalid value for '%s' tag in line %d, file %s\n" - "Value should not contain unquoted whitespace, " - "using the default\n", - qPrintable(g_cmd),yylineno,qPrintable(g_yyFileName)); - *g_arg=g_codec->toUnicode(""); - } - else if (g_part > 1) // multiple unquoted parts, reset to default - { - *g_arg=g_codec->toUnicode(""); - } - else - { - InputString *cur = dynamic_cast(g_curOption); - *g_arg = cur->checkEnumVal(g_codec->toUnicode(g_tmpString)); - } - g_part++; - } - else - { - g_str+=g_codec->toUnicode(g_tmpString); - } - if (*yytext=='\n') - { - config_warn("Missing end quote (\") on line %d, file %s\n",yylineno, - qPrintable(g_yyFileName)); - } - BEGIN(g_lastState); - } -("\\\\"|"@\\"|"\\@"|"@@") { - g_tmpString+=yytext; - } -"\\\"" { - g_tmpString+='"'; - } -. { g_tmpString+=*yytext; } -[^ \#\"\t\r\n]+ { - g_str+=g_codec->toUnicode(yytext); - } -\n { BEGIN(Start); } -\\[ \r\t]*\n { BEGIN(Start); } -. { } - */ - /*-------------- fall through -------------*/ <*>\\[ \r\t]*\n { } diff --git a/src/configimpl.l b/src/configimpl.l index d256c06..e2ef8eb 100644 --- a/src/configimpl.l +++ b/src/configimpl.l @@ -627,13 +627,11 @@ static void processString() int l = s.length(); // remove surrounding quotes if present (and not escaped) - bool quotedString=false; if (l>=2 && s.at(0)=='"' && s.at(l-1)=='"' && // remove quotes (s.at(l-2)!='\\' || (s.at(l-2)=='\\' && s.at(l-3)=='\\'))) { s=s.mid(1,s.length()-2); l=s.length(); - quotedString=true; } // check for invalid and/or escaped quotes -- cgit v0.12