diff options
Diffstat (limited to 'vhdlparser/vhdlstring.h')
-rwxr-xr-x[-rw-r--r--] | vhdlparser/vhdlstring.h | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/vhdlparser/vhdlstring.h b/vhdlparser/vhdlstring.h index 4c64440..59e9e22 100644..100755 --- a/vhdlparser/vhdlstring.h +++ b/vhdlparser/vhdlstring.h @@ -5,6 +5,26 @@ #include <stdlib.h> #include <string.h> +#include "VhdlParser.h" +// super class for VhdlParserTokenManager +// is generated in vhdlparser.jj +// -option TOKEN_MANAGER_SUPER_CLASS = "TokenParser" +// sets the Vhdlparser in vhdljjparser.cpp +// tokenManager->setLexParser(vhdlParser); + +namespace vhdl { + namespace parser { + class TokenParser { + public: + VhdlParser* parser = nullptr; + void setLexParser(VhdlParser* p) + { + parser = p; + } + }; + } +} + /** @brief Minimal string class with std::string like behaviour that fulfills the JavaCC * string requirements. @@ -38,7 +58,7 @@ class VhdlString } VhdlString(const char *s) { - m_len = strlen(s); + m_len = (int)strlen(s); m_str=(char*)malloc(m_len+1); memcpy(m_str,s,m_len+1); } @@ -67,7 +87,7 @@ class VhdlString } VhdlString& append(const char *s) { - return append(s,strlen(s)); + return append(s,(int)strlen(s)); } VhdlString& append(const VhdlString &other) { @@ -103,9 +123,6 @@ 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); } +inline VhdlString operator+ (const char *s, VhdlString v) { return VhdlString(s).append(v); } #endif |