summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--addon/doxywizard/CMakeLists.txt13
-rw-r--r--addon/doxywizard/config_doxyw.l4
-rw-r--r--libmscgen/CMakeLists.txt17
-rw-r--r--libmscgen/mscgen_lexer.l6
-rw-r--r--src/CMakeLists.txt103
-rw-r--r--src/code.l3
-rw-r--r--src/commentcnv.l3
-rw-r--r--src/commentscan.l3
-rw-r--r--src/configimpl.l3
-rw-r--r--src/constexp.l2
-rw-r--r--src/declinfo.l2
-rw-r--r--src/defargs.l2
-rw-r--r--src/doctokenizer.l2
-rw-r--r--src/fortrancode.l3
-rw-r--r--src/fortranscanner.l45
-rw-r--r--src/pre.l3
-rw-r--r--src/pycode.l2
-rw-r--r--src/pyscanner.l2
-rw-r--r--src/scan_states.py53
-rw-r--r--src/scanner.l2
-rw-r--r--src/sqlcode.l2
-rw-r--r--src/tclscanner.l3
-rw-r--r--src/vhdlcode.l4
-rw-r--r--src/xmlcode.l3
24 files changed, 199 insertions, 86 deletions
diff --git a/addon/doxywizard/CMakeLists.txt b/addon/doxywizard/CMakeLists.txt
index 0347f61..6aacd8b 100644
--- a/addon/doxywizard/CMakeLists.txt
+++ b/addon/doxywizard/CMakeLists.txt
@@ -71,7 +71,17 @@ OUTPUT ${GENERATED_SRC_WIZARD}/configdoc.cpp
)
set_source_files_properties(${GENERATED_SRC_WIZARD}/configdoc.cpp PROPERTIES GENERATED 1)
-FLEX_TARGET(config_doxyw config_doxyw.l ${GENERATED_SRC_WIZARD}/config_doxyw.cpp COMPILE_FLAGS "${LEX_FLAGS}")
+set(LEX_FILES config_doxyw)
+foreach(lex_file ${LEX_FILES})
+ add_custom_command(
+ COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/src/scan_states.py ${CMAKE_SOURCE_DIR}/addon/doxywizard/${lex_file}.l > ${GENERATED_SRC_WIZARD}/${lex_file}.l.h
+ DEPENDS ${CMAKE_SOURCE_DIR}/src/scan_states.py ${CMAKE_SOURCE_DIR}/addon/doxywizard/${lex_file}.l
+ OUTPUT ${GENERATED_SRC_WIZARD}/${lex_file}.l.h
+ )
+ set_source_files_properties(${GENERATED_SRC_WIZARD}/${lex_file}.l.h PROPERTIES GENERATED 1)
+
+ FLEX_TARGET(${lex_file} ${lex_file}.l ${GENERATED_SRC_WIZARD}/${lex_file}.cpp COMPILE_FLAGS "${LEX_FLAGS}")
+endforeach()
qt_wrap_cpp(doxywizard_MOC
doxywizard.h
@@ -96,6 +106,7 @@ inputint.cpp
inputstrlist.cpp
${GENERATED_SRC_WIZARD}/settings.h
${GENERATED_SRC_WIZARD}/config_doxyw.cpp
+${GENERATED_SRC_WIZARD}/config_doxyw.l.h
${GENERATED_SRC_WIZARD}/configdoc.cpp
${doxywizard_MOC}
${doxywizard_RESOURCES_RCC}
diff --git a/addon/doxywizard/config_doxyw.l b/addon/doxywizard/config_doxyw.l
index 193e6ed..59fa427 100644
--- a/addon/doxywizard/config_doxyw.l
+++ b/addon/doxywizard/config_doxyw.l
@@ -64,6 +64,8 @@ static QString g_codecName = QString::fromLatin1("UTF-8")
static int g_lastState;
static QByteArray g_tmpString;
+static const char *stateToString(int state);
+
/* -----------------------------------------------------------------
*/
#undef YY_INPUT
@@ -585,4 +587,4 @@ void writeStringValue(QTextStream &t,QTextCodec *codec,const QString &s)
}
}
}
-
+#include "config_doxyw.l.h"
diff --git a/libmscgen/CMakeLists.txt b/libmscgen/CMakeLists.txt
index 3d67ed3..079fcfc 100644
--- a/libmscgen/CMakeLists.txt
+++ b/libmscgen/CMakeLists.txt
@@ -4,6 +4,18 @@ include_directories(
${GENERATED_SRC}
)
+set(LEX_FILES mscgen_lexer)
+foreach(lex_file ${LEX_FILES})
+ add_custom_command(
+ COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/src/scan_states.py ${CMAKE_SOURCE_DIR}/libmscgen/${lex_file}.l > ${GENERATED_SRC}/${lex_file}.l.h
+ DEPENDS ${CMAKE_SOURCE_DIR}/src/scan_states.py ${CMAKE_SOURCE_DIR}/libmscgen/${lex_file}.l
+ OUTPUT ${GENERATED_SRC}/${lex_file}.l.h
+ )
+ set_source_files_properties(${GENERATED_SRC}/${lex_file}.l.h PROPERTIES GENERATED 1)
+
+ FLEX_TARGET(${lex_file} ${lex_file}.l ${GENERATED_SRC}/${lex_file}.cpp COMPILE_FLAGS "${LEX_FLAGS}")
+endforeach()
+
add_library(mscgen
gd.c
gd_security.c
@@ -19,6 +31,7 @@ mscgen_ps_out.c
mscgen_null_out.c
${GENERATED_SRC}/mscgen_language.cpp
${GENERATED_SRC}/mscgen_lexer.cpp
+${GENERATED_SRC}/mscgen_lexer.l.h
mscgen_api.c
mscgen_msc.c
mscgen_safe.c
@@ -28,10 +41,6 @@ mscgen_utf8.c
)
-FLEX_TARGET(mscgen_lexer
- mscgen_lexer.l
- ${GENERATED_SRC}/mscgen_lexer.cpp
- COMPILE_FLAGS "${LEX_FLAGS}")
BISON_TARGET(mscgen_language
mscgen_language.y
${GENERATED_SRC}/mscgen_language.cpp
diff --git a/libmscgen/mscgen_lexer.l b/libmscgen/mscgen_lexer.l
index 29d6aea..8410e07 100644
--- a/libmscgen/mscgen_lexer.l
+++ b/libmscgen/mscgen_lexer.l
@@ -41,7 +41,7 @@ static Boolean lex_utf8 = FALSE;
/* Local function prototypes */
static void newline(const char *text, unsigned int n);
static char *trimQstring(char *s);
-
+static const char *stateToString(int state);
%}
/* Not used, so prevent compiler warning */
@@ -49,7 +49,8 @@ static char *trimQstring(char *s);
%option noinput
%option noyywrap
-%x IN_COMMENT BODY
+%x IN_COMMENT
+%x BODY
%%
<INITIAL>{
@@ -233,4 +234,5 @@ Boolean lex_getutf8(void)
return lex_utf8;
}
+#include "mscgen_lexer.l.h"
/* END OF FILE */
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 217f391..7e54b2b 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -100,25 +100,39 @@ add_custom_command(
)
set_source_files_properties(${GENERATED_SRC}/layout_default.xml.h PROPERTIES GENERATED 1)
-# Targets for flex/bison generated files
-FLEX_TARGET(scanner scanner.l ${GENERATED_SRC}/scanner.cpp COMPILE_FLAGS "${LEX_FLAGS}")
-FLEX_TARGET(code code.l ${GENERATED_SRC}/code.cpp COMPILE_FLAGS "${LEX_FLAGS}")
-FLEX_TARGET(pyscanner pyscanner.l ${GENERATED_SRC}/pyscanner.cpp COMPILE_FLAGS "${LEX_FLAGS}")
-FLEX_TARGET(pycode pycode.l ${GENERATED_SRC}/pycode.cpp COMPILE_FLAGS "${LEX_FLAGS}")
-FLEX_TARGET(fortranscanner fortranscanner.l ${GENERATED_SRC}/fortranscanner.cpp COMPILE_FLAGS "${LEX_FLAGS}")
-FLEX_TARGET(fortrancode fortrancode.l ${GENERATED_SRC}/fortrancode.cpp COMPILE_FLAGS "${LEX_FLAGS}")
-FLEX_TARGET(vhdlcode vhdlcode.l ${GENERATED_SRC}/vhdlcode.cpp COMPILE_FLAGS "${LEX_FLAGS}")
-FLEX_TARGET(tclscanner tclscanner.l ${GENERATED_SRC}/tclscanner.cpp COMPILE_FLAGS "${LEX_FLAGS}")
-FLEX_TARGET(pre pre.l ${GENERATED_SRC}/pre.cpp COMPILE_FLAGS "${LEX_FLAGS}")
-FLEX_TARGET(declinfo declinfo.l ${GENERATED_SRC}/declinfo.cpp COMPILE_FLAGS "${LEX_FLAGS}")
-FLEX_TARGET(defargs defargs.l ${GENERATED_SRC}/defargs.cpp COMPILE_FLAGS "${LEX_FLAGS}")
-FLEX_TARGET(doctokenizer doctokenizer.l ${GENERATED_SRC}/doctokenizer.cpp COMPILE_FLAGS "${LEX_FLAGS}")
-FLEX_TARGET(commentcnv commentcnv.l ${GENERATED_SRC}/commentcnv.cpp COMPILE_FLAGS "${LEX_FLAGS}")
-FLEX_TARGET(commentscan commentscan.l ${GENERATED_SRC}/commentscan.cpp COMPILE_FLAGS "${LEX_FLAGS}")
-FLEX_TARGET(constexp constexp.l ${GENERATED_SRC}/constexp.cpp COMPILE_FLAGS "${LEX_FLAGS}")
-FLEX_TARGET(xmlcode xmlcode.l ${GENERATED_SRC}/xmlcode.cpp COMPILE_FLAGS "${LEX_FLAGS}")
-FLEX_TARGET(sqlcode sqlcode.l ${GENERATED_SRC}/sqlcode.cpp COMPILE_FLAGS "${LEX_FLAGS}")
-FLEX_TARGET(configimpl configimpl.l ${GENERATED_SRC}/configimpl.cpp COMPILE_FLAGS "${LEX_FLAGS}")
+set(LEX_FILES scanner
+ code
+ pyscanner
+ pycode
+ fortranscanner
+ fortrancode
+ vhdlcode
+ tclscanner
+ pre
+ declinfo
+ defargs
+ doctokenizer
+ commentcnv
+ commentscan
+ constexp
+ xmlcode
+ sqlcode
+ configimpl)
+
+# unfortunately ${LEX_FILES_H} and ${LEX_FILES_CPP} don't work in older versions of CMake (like 3.6.2) for add_library
+foreach(lex_file ${LEX_FILES})
+ set(LEX_FILES_H ${LEX_FILES_H} " " ${GENERATED_SRC}/${lex_file}.l.h CACHE INTERNAL "Stores generated files")
+ set(LEX_FILES_CPP ${LEX_FILES_CPP} " " ${GENERATED_SRC}/${lex_file}.cpp CACHE INTERNAL "Stores generated files")
+ add_custom_command(
+ COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/src/scan_states.py ${CMAKE_SOURCE_DIR}/src/${lex_file}.l > ${GENERATED_SRC}/${lex_file}.l.h
+ DEPENDS ${CMAKE_SOURCE_DIR}/src/scan_states.py ${CMAKE_SOURCE_DIR}/src/${lex_file}.l
+ OUTPUT ${GENERATED_SRC}/${lex_file}.l.h
+ )
+ set_source_files_properties(${GENERATED_SRC}/${lex_file}.l.h PROPERTIES GENERATED 1)
+
+ FLEX_TARGET(${lex_file} ${lex_file}.l ${GENERATED_SRC}/${lex_file}.cpp COMPILE_FLAGS "${LEX_FLAGS}")
+endforeach()
+
BISON_TARGET(constexp constexp.y ${GENERATED_SRC}/ce_parse.cpp COMPILE_FLAGS "${YACC_FLAGS}")
@@ -140,24 +154,45 @@ add_library(_doxygen STATIC
${GENERATED_SRC}/ce_parse.h
${GENERATED_SRC}/configvalues.h
${GENERATED_SRC}/resources.cpp
- # generated by flex/bison
- ${GENERATED_SRC}/scanner.cpp
+ # generated for/by flex/bison
+ #${LEX_FILES_H} #unfortunately doesn't work in older versions of CMake (like 3.6.2)
+ #${LEX_FILES_CPP} #unfortunately doesn't work in older versions of CMake (like 3.6.2)
+ ${GENERATED_SRC}/code.l.h
+ ${GENERATED_SRC}/commentcnv.l.h
+ ${GENERATED_SRC}/commentscan.l.h
+ ${GENERATED_SRC}/configimpl.l.h
+ ${GENERATED_SRC}/constexp.l.h
+ ${GENERATED_SRC}/declinfo.l.h
+ ${GENERATED_SRC}/defargs.l.h
+ ${GENERATED_SRC}/doctokenizer.l.h
+ ${GENERATED_SRC}/fortrancode.l.h
+ ${GENERATED_SRC}/fortranscanner.l.h
+ ${GENERATED_SRC}/pre.l.h
+ ${GENERATED_SRC}/pycode.l.h
+ ${GENERATED_SRC}/pyscanner.l.h
+ ${GENERATED_SRC}/scanner.l.h
+ ${GENERATED_SRC}/sqlcode.l.h
+ ${GENERATED_SRC}/tclscanner.l.h
+ ${GENERATED_SRC}/vhdlcode.l.h
+ ${GENERATED_SRC}/xmlcode.l.h
${GENERATED_SRC}/code.cpp
- ${GENERATED_SRC}/pyscanner.cpp
- ${GENERATED_SRC}/pycode.cpp
- ${GENERATED_SRC}/fortranscanner.cpp
- ${GENERATED_SRC}/fortrancode.cpp
- ${GENERATED_SRC}/vhdlcode.cpp
- ${GENERATED_SRC}/tclscanner.cpp
- ${GENERATED_SRC}/pre.cpp
- ${GENERATED_SRC}/declinfo.cpp
- ${GENERATED_SRC}/defargs.cpp
- ${GENERATED_SRC}/doctokenizer.cpp
${GENERATED_SRC}/commentcnv.cpp
${GENERATED_SRC}/commentscan.cpp
+ ${GENERATED_SRC}/configimpl.cpp
${GENERATED_SRC}/constexp.cpp
- ${GENERATED_SRC}/xmlcode.cpp
+ ${GENERATED_SRC}/declinfo.cpp
+ ${GENERATED_SRC}/defargs.cpp
+ ${GENERATED_SRC}/doctokenizer.cpp
+ ${GENERATED_SRC}/fortrancode.cpp
+ ${GENERATED_SRC}/fortranscanner.cpp
+ ${GENERATED_SRC}/pre.cpp
+ ${GENERATED_SRC}/pycode.cpp
+ ${GENERATED_SRC}/pyscanner.cpp
+ ${GENERATED_SRC}/scanner.cpp
${GENERATED_SRC}/sqlcode.cpp
+ ${GENERATED_SRC}/tclscanner.cpp
+ ${GENERATED_SRC}/vhdlcode.cpp
+ ${GENERATED_SRC}/xmlcode.cpp
#
${GENERATED_SRC}/ce_parse.cpp
#
@@ -252,6 +287,10 @@ add_library(_doxygen STATIC
docgroup.cpp
)
+##foreach(lex_file ${LEX_FILES})
+##add_library(_doxygen STATIC ${GENERATED_SRC}/${lex_file}.l.h)
+##endforeach()
+
add_executable(doxygen main.cpp)
if (use_libclang)
diff --git a/src/code.l b/src/code.l
index d66ccc8..5ed8866 100644
--- a/src/code.l
+++ b/src/code.l
@@ -165,6 +165,8 @@ static int g_braceCount=0;
static void saveObjCContext();
static void restoreObjCContext();
+static const char *stateToString(int state);
+
static QCString g_forceTagReference;
@@ -3875,3 +3877,4 @@ extern "C" { // some bogus code to keep the compiler happy
#error "You seem to be using a version of flex newer than 2.5.4. These are currently incompatible with 2.5.4, and do NOT work with doxygen! Please use version 2.5.4 or expect things to be parsed wrongly! A bug report has been submitted (#732132)."
#endif
+#include "code.l.h"
diff --git a/src/commentcnv.l b/src/commentcnv.l
index 2550227..f144aec 100644
--- a/src/commentcnv.l
+++ b/src/commentcnv.l
@@ -94,6 +94,8 @@ static bool g_vhdl; // for VHDL old style --! comment
static SrcLangExt g_lang;
static bool isFixedForm; // For Fortran
+static const char *stateToString(int state);
+
static void replaceCommentMarker(const char *s,int len)
{
const char *p=s;
@@ -1145,3 +1147,4 @@ extern "C" { // some bogus code to keep the compiler happy
}
#endif
+#include "commentcnv.l.h"
diff --git a/src/commentscan.l b/src/commentscan.l
index a495c5e..d8de073 100644
--- a/src/commentscan.l
+++ b/src/commentscan.l
@@ -132,6 +132,8 @@ static bool handleEndParBlock(const QCString &, const QCStringList &);
static bool handleParam(const QCString &, const QCStringList &);
static bool handleRetval(const QCString &, const QCStringList &);
+static const char *stateToString(int state);
+
typedef bool (*DocCmdFunc)(const QCString &name, const QCStringList &optList);
struct DocCmdMap
@@ -3278,3 +3280,4 @@ extern "C" { // some bogus code to keep the compiler happy
}
#endif
+#include "commentscan.l.h"
diff --git a/src/configimpl.l b/src/configimpl.l
index e52a757..7d22859 100644
--- a/src/configimpl.l
+++ b/src/configimpl.l
@@ -44,6 +44,8 @@
#define YY_NO_INPUT 1
#define YY_NO_UNISTD_H 1
+static const char *stateToString(int state);
+
static const char *warning_str = "warning: ";
static const char *error_str = "error: ";
@@ -1909,3 +1911,4 @@ void Config::deinit()
ConfigImpl::instance()->deleteInstance();
}
+#include "configimpl.l.h"
diff --git a/src/constexp.l b/src/constexp.l
index c9b984a..b6b3c5c 100644
--- a/src/constexp.l
+++ b/src/constexp.l
@@ -32,6 +32,7 @@
#define YY_NO_UNISTD_H 1
+static const char *stateToString(int state);
static int yyread(char *buf,int max_size,yyscan_t yyscanner);
#undef YY_INPUT
@@ -139,3 +140,4 @@ bool parseconstexp(const char *fileName,int lineNr,const QCString &s)
extern "C" {
int constexpYYwrap(yyscan_t yyscanner) { return 1; }
}
+#include "constexp.l.h"
diff --git a/src/declinfo.l b/src/declinfo.l
index 36ef94a..0ac1516 100644
--- a/src/declinfo.l
+++ b/src/declinfo.l
@@ -63,6 +63,7 @@ struct declinfoYY_state
bool insidePHP;
};
+static const char *stateToString(int state);
static void addType(yyscan_t yyscanner);
static void addTypeName(yyscan_t yyscanner);
static int yyread(char *buf,int max_size, yyscan_t yyscanner);
@@ -391,3 +392,4 @@ extern "C" { // some bogus code to keep the compiler happy
}
#endif
+#include "declinfo.l.h"
diff --git a/src/defargs.l b/src/defargs.l
index 37d904f..070103a 100644
--- a/src/defargs.l
+++ b/src/defargs.l
@@ -87,6 +87,7 @@ static int g_lastDocChar;
static int g_lastExtendsContext;
static QCString g_delimiter;
+static const char *stateToString(int state);
/* -----------------------------------------------------------------
*/
#undef YY_INPUT
@@ -637,3 +638,4 @@ extern "C" { // some bogus code to keep the compiler happy
}
#endif
+#include "defargs.l.h"
diff --git a/src/doctokenizer.l b/src/doctokenizer.l
index 4527855..9786720 100644
--- a/src/doctokenizer.l
+++ b/src/doctokenizer.l
@@ -76,6 +76,7 @@ struct DocLexerContext
static QStack<DocLexerContext> g_lexerStack;
+static const char *stateToString(int state);
//--------------------------------------------------------------------------
void doctokenizerYYpushContext()
@@ -1616,3 +1617,4 @@ extern "C" { // some bogus code to keep the compiler happy
}
#endif
+#include "doctokenizer.l.h"
diff --git a/src/fortrancode.l b/src/fortrancode.l
index 38188ef..eee4d47 100644
--- a/src/fortrancode.l
+++ b/src/fortrancode.l
@@ -166,6 +166,8 @@ static int inTypeDecl = 0;
static bool g_endComment;
+static const char *stateToString(int state);
+
static void endFontClass()
{
if (g_currentFontClass)
@@ -1405,3 +1407,4 @@ extern "C" { // some bogus code to keep the compiler happy
}
#endif
+#include "fortrancode.l.h"
diff --git a/src/fortranscanner.l b/src/fortranscanner.l
index 09c4490..38abb89 100644
--- a/src/fortranscanner.l
+++ b/src/fortranscanner.l
@@ -2882,47 +2882,4 @@ extern "C" { // some bogus code to keep the compiler happy
}
#endif
-#define scanStateToString(x) case x: resultString = #x; break;
-static const char *stateToString(int state)
-{
- const char *resultString;
- switch(state)
- {
- scanStateToString(INITIAL)
- scanStateToString(Subprog)
- scanStateToString(SubprogPrefix)
- scanStateToString(Parameterlist)
- scanStateToString(SubprogBody)
- scanStateToString(SubprogBodyContains)
- scanStateToString(Start)
- scanStateToString(Comment)
- scanStateToString(Module)
- scanStateToString(Program)
- scanStateToString(ModuleBody)
- scanStateToString(ModuleBodyContains)
- scanStateToString(AttributeList)
- scanStateToString(Variable)
- scanStateToString(Initialization)
- scanStateToString(ArrayInitializer)
- scanStateToString(Enum)
- scanStateToString(Typedef)
- scanStateToString(TypedefBody)
- scanStateToString(TypedefBodyContains)
- scanStateToString(InterfaceBody)
- scanStateToString(StrIgnore)
- scanStateToString(String)
- scanStateToString(Use)
- scanStateToString(UseOnly)
- scanStateToString(ModuleProcedure)
- scanStateToString(Prepass)
- scanStateToString(DocBlock)
- scanStateToString(DocBackLine)
- scanStateToString(EndDoc)
- scanStateToString(BlockData)
- scanStateToString(Prototype)
- scanStateToString(PrototypeSubprog)
- scanStateToString(PrototypeArgs)
- default: resultString = "Unknown"; break;
- }
- return resultString;
-}
+#include "fortranscanner.l.h"
diff --git a/src/pre.l b/src/pre.l
index 596108f..c413a11 100644
--- a/src/pre.l
+++ b/src/pre.l
@@ -62,6 +62,8 @@
//#define DBG_CTX(x) fprintf x
#define DBG_CTX(x) do { } while(0)
+static const char *stateToString(int state);
+
struct CondCtx
{
CondCtx(int line,QCString id,bool b)
@@ -3337,3 +3339,4 @@ extern "C" { // some bogus code to keep the compiler happy
}
#endif
+#include "pre.l.h"
diff --git a/src/pycode.l b/src/pycode.l
index 0f04baa..a76129d 100644
--- a/src/pycode.l
+++ b/src/pycode.l
@@ -97,6 +97,7 @@ static bool g_endComment;
static void endFontClass();
static void adjustScopesAndSuites(unsigned indentLength);
+static const char *stateToString(int state);
/*! Represents a stack of variable to class mappings as found in the
@@ -1646,3 +1647,4 @@ extern "C" { // some bogus code to keep the compiler happy
#error "You seem to be using a version of flex newer than 2.5.4. These are currently incompatible with 2.5.4, and do NOT work with doxygen! Please use version 2.5.4 or expect things to be parsed wrongly! A bug report has been submitted (#732132)."
#endif
+#include "pycode.l.h"
diff --git a/src/pyscanner.l b/src/pyscanner.l
index 3fe66f2..2320bca 100644
--- a/src/pyscanner.l
+++ b/src/pyscanner.l
@@ -123,6 +123,7 @@ static int g_search_count = 0;
static QCString g_argType = "";
static bool g_funcParamsEnd;
//-----------------------------------------------------------------------------
+static const char *stateToString(int state);
static void initParser()
@@ -1994,3 +1995,4 @@ extern "C" { // some bogus code to keep the compiler happy
}
#endif
+#include "pyscanner.l.h"
diff --git a/src/scan_states.py b/src/scan_states.py
new file mode 100644
index 0000000..7f69fdd
--- /dev/null
+++ b/src/scan_states.py
@@ -0,0 +1,53 @@
+#!/usr/bin/python
+# python script to generate an overview of the staes based on the input lex file.
+#
+# Copyright (C) 1997-2019 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
+# for any purpose. It is provided "as is" without express or implied warranty.
+# See the GNU General Public License for more details.
+#
+# Documents produced by Doxygen are derivative works derived from the
+# input used in their production; they are not affected by this license.
+#
+import sys
+import os
+import re
+
+
+def main():
+ if len(sys.argv)!=2:
+ sys.exit('Usage: %s <lex_file>' % sys.argv[0])
+
+ lex_file = sys.argv[1]
+ if (os.path.exists(lex_file)):
+ #write preamble
+ print("#define scanStateToString(x) case x: resultString = #x; break;");
+ print("static const char *stateToString(int state)");
+ print("{");
+ print(" const char *resultString;");
+ print(" switch(state)");
+ print(" {");
+ print(" scanStateToString(INITIAL)");
+
+ with open(lex_file) as f:
+ for line in f:
+ if re.search(r'^%x', line) or re.search(r'^%s', line):
+ print(" scanStateToString(%s)"%line.split()[1]);
+ elif re.search(r'^%%', line):
+ break
+ else:
+ pass
+ f.close()
+ #write post
+ print(" default: resultString = \"Unknown\"; break;")
+ print(" }")
+ print(" return resultString;")
+ print("}")
+
+
+
+if __name__ == '__main__':
+ main()
diff --git a/src/scanner.l b/src/scanner.l
index 75786ef..f6ffdff 100644
--- a/src/scanner.l
+++ b/src/scanner.l
@@ -193,6 +193,7 @@ static int g_column;
static int g_fencedSize=0;
static bool g_nestedComment=0;
+static const char *stateToString(int state);
//-----------------------------------------------------------------------------
// forward declarations
@@ -7490,3 +7491,4 @@ extern "C" { // some bogus code to keep the compiler happy
}
#endif
+#include "scanner.l.h"
diff --git a/src/sqlcode.l b/src/sqlcode.l
index eec9732..2685c46 100644
--- a/src/sqlcode.l
+++ b/src/sqlcode.l
@@ -63,6 +63,7 @@ struct sqlcodeYY_state
};
static void codify(const char* text);
+static const char *stateToString(int state);
static void setCurrentDoc(const QCString &anchor,yyscan_t yyscanner);
static void startCodeLine(yyscan_t yyscanner);
static void endFontClass(yyscan_t yyscanner);
@@ -461,3 +462,4 @@ extern "C" { // some bogus code to keep the compiler happy
#error "You seem to be using a version of flex newer than 2.5.4. These are currently incompatible with 2.5.4, and do NOT work with doxygen! Please use version 2.5.4 or expect things to be parsed wrongly! A bug report has been submitted (#732132)."
#endif
+#include "sqlcode.l.h"
diff --git a/src/tclscanner.l b/src/tclscanner.l
index 88bd474..a680cf9 100644
--- a/src/tclscanner.l
+++ b/src/tclscanner.l
@@ -59,6 +59,8 @@
#define MAX_INCLUDE_DEPTH 10
+static const char *stateToString(int state);
+
//! Application error.
#define tcl_err \
printf("Error %d %s() at line %d! ",__LINE__,tcl.file_name.data(),yylineno); \
@@ -3121,3 +3123,4 @@ extern "C" { // some bogus code to keep the compiler happy
}
#endif
+#include "tclscanner.l.h"
diff --git a/src/vhdlcode.l b/src/vhdlcode.l
index 5f668c6..03bf883 100644
--- a/src/vhdlcode.l
+++ b/src/vhdlcode.l
@@ -112,6 +112,7 @@ static bool writeColoredWord(QCString& word );
static void generateClassOrGlobalLink(CodeOutputInterface &ol,const char *clName, bool typeOnly=FALSE, const char *curr_class=0);
static void endFontClass();
static void startFontClass(const char *s);
+static const char *stateToString(int state);
//-------------------------------------------------------------------
@@ -1646,6 +1647,5 @@ extern "C" { // some bogus code to keep the compiler happy
#error "You seem to be using a version of flex newer than 2.5.4 but older than 2.5.33. These versions do NOT work with doxygen! Please use version <=2.5.4 or >=2.5.33 or expect things to be parsed wrongly!"
#endif
-
-
+#include "vhdlcode.l.h"
diff --git a/src/xmlcode.l b/src/xmlcode.l
index 42218b1..bd6e8a8 100644
--- a/src/xmlcode.l
+++ b/src/xmlcode.l
@@ -69,6 +69,8 @@ static MemberDef * g_currentMemberDef;
static bool g_includeCodeFragment;
static const char * g_currentFontClass;
+static const char *stateToString(int state);
+
static void codify(const char* text)
{
g_code->codify(text);
@@ -413,3 +415,4 @@ extern "C" { // some bogus code to keep the compiler happy
#error "You seem to be using a version of flex newer than 2.5.4. These are currently incompatible with 2.5.4, and do NOT work with doxygen! Please use version 2.5.4 or expect things to be parsed wrongly! A bug report has been submitted (#732132)."
#endif
+#include "xmlcode.l.h"