diff options
author | Christopher L. Conway <christopherleeconway@gmail.com> | 2010-10-20 20:41:03 +0000 |
---|---|---|
committer | Christopher L. Conway <christopherleeconway@gmail.com> | 2010-10-20 20:41:03 +0000 |
commit | 93e8bc35db891c6041f9690366be933433a0ad52 (patch) | |
tree | e946c0824d6d91c44ecc97a627411e5d6c334ea9 /src/parser/antlr_input.h | |
parent | daad722774087de1cf35714868d3762b3ea7cb21 (diff) |
Adding support for interactive mode
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); |