diff options
Diffstat (limited to 'src/parser/antlr_input.h')
-rw-r--r-- | src/parser/antlr_input.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/parser/antlr_input.h b/src/parser/antlr_input.h index e55e07efd..d86a18004 100644 --- a/src/parser/antlr_input.h +++ b/src/parser/antlr_input.h @@ -180,6 +180,8 @@ public: /** Get a bitvector constant from the text of the number and the size token */ static BitVector tokenToBitvector(pANTLR3_COMMON_TOKEN number, pANTLR3_COMMON_TOKEN size); + std::string getUnparsedText(); + protected: /** Create an input. This input takes ownership of the given input stream, * and will delete it at destruction time. @@ -210,6 +212,14 @@ protected: virtual void setParser(Parser& parser); }; +inline std::string AntlrInput::getUnparsedText() { + const char *base = (const char *)d_antlr3InputStream->data; + const char *cur = (const char *)d_antlr3InputStream->nextChar; + + return std::string(cur, d_antlr3InputStream->sizeBuf - (cur - base)); +} + + inline std::string AntlrInput::tokenText(pANTLR3_COMMON_TOKEN token) { ANTLR3_MARKER start = token->getStartIndex(token); ANTLR3_MARKER end = token->getStopIndex(token); |