diff options
author | Dimitri van Heesch <dimitri@stack.nl> | 2018-04-22 09:54:00 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-22 09:54:00 (GMT) |
commit | 5ffe7e4cb6384a17ec2d7e07e6e2171e512d7c41 (patch) | |
tree | c7f776876e852ab6d822fd4068539e170b698002 | |
parent | 868ebec7daab90805af2583d18fb1fe54a80bd98 (diff) | |
parent | 6ad7854e72abda652bdf034d7cf355dcb136a7fe (diff) | |
download | Doxygen-5ffe7e4cb6384a17ec2d7e07e6e2171e512d7c41.zip Doxygen-5ffe7e4cb6384a17ec2d7e07e6e2171e512d7c41.tar.gz Doxygen-5ffe7e4cb6384a17ec2d7e07e6e2171e512d7c41.tar.bz2 |
Merge pull request #683 from albert-github/feature/bug_vhdl_debug
Adding debug options to vhdl parser generator
-rw-r--r-- | vhdlparser/Makefile | 42 | ||||
-rw-r--r-- | vhdlparser/vhdlstring.h | 8 |
2 files changed, 45 insertions, 5 deletions
diff --git a/vhdlparser/Makefile b/vhdlparser/Makefile index 4725470..84bdccf 100644 --- a/vhdlparser/Makefile +++ b/vhdlparser/Makefile @@ -7,16 +7,48 @@ # 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 +# Documents produced by doxygen are derivative works derived from the # input used in their production; they are not affected by this license. # -regenerate: - rm -f CharStream.cc CharStream.h ErrorHandler.h ParseException.cc ParseException.h \ +# +# Files generated by javacc +# +GEN_FILES=CharStream.cc CharStream.h ErrorHandler.h ParseException.cc ParseException.h \ Token.cc Token.h TokenManager.h TokenMgrError.cc TokenMgrError.h VhdlParser.cc VhdlParser.h \ VhdlParserConstants.h VhdlParserTokenManager.cc VhdlParserTokenManager.h \ JavaCC.h - javacc vhdlparser.jj - cp JavaCC.h.in JavaCC.h +# +# Generate parser (default target) +# +# when generating the parser with debug options it will look like: +# make JAVACC_FLAGS=-debug_parser +# or +# make JAVACC_FLAGS="-debug_parser -debug_lookahead" +# +# Available debug options: +# -debug_parser +# -debug_token_manager +# -debug_lookahead +# +# For other javacc settings / options consult the documentation of javacc. + +regenerate: + @rm -f $(GEN_FILES) + @javacc $(JAVACC_FLAGS) vhdlparser.jj + @cp JavaCC.h.in JavaCC.h + +# +# reset the generated files back to their versions from git. +# + +reset_gen_files: + @rm -f $(GEN_FILES) + @git checkout $(GEN_FILES) + +help: + @echo "Targets:" + @echo " regenerate (default)" + @echo " reset_gen_files" FORCE: diff --git a/vhdlparser/vhdlstring.h b/vhdlparser/vhdlstring.h index fde6ce4..4c64440 100644 --- a/vhdlparser/vhdlstring.h +++ b/vhdlparser/vhdlstring.h @@ -9,6 +9,7 @@ /** @brief Minimal string class with std::string like behaviour that fulfills the JavaCC * string requirements. */ + class VhdlString { public: @@ -93,6 +94,8 @@ class VhdlString void clear() { free(m_str); init(); } VhdlString &operator+=(char c) { char s[2]; s[0]=c; s[1]=0; return append(s); } VhdlString &operator+=(const char *s) { return append(s); } + VhdlString &operator+=(VhdlString s) { return append(s); } + VhdlString operator+ (const char *s) { return append(s); } private: void init() { m_str=(char*)calloc(1,1); m_len=0; } @@ -100,4 +103,9 @@ class VhdlString int m_len; }; +// declare it static otherwise we will get: +// multiple definition of `operator+(char const*, VhdlString)' +// as we are in an include file +static VhdlString operator+ (const char *s, VhdlString v) { return VhdlString(s).append(v); } + #endif |