summaryrefslogtreecommitdiff
path: root/src/parser/antlr_input.h
diff options
context:
space:
mode:
authorTim King <taking@google.com>2015-11-23 16:30:24 -0800
committerTim King <taking@google.com>2015-11-23 20:40:00 -0800
commitb95f93789c8695365bc1741fe88fca9473a0d02c (patch)
treedb317660f85743b48281e6011a6d41c1d219cddc /src/parser/antlr_input.h
parent90ebc5e036f122b6705b3dd2f703f40d39de7aac (diff)
Isolating the dependencies on CVC4_ANTLR3_OLD_INPUT_STREAM. Also freeing more memory for antlr input.
Diffstat (limited to 'src/parser/antlr_input.h')
-rw-r--r--src/parser/antlr_input.h25
1 files changed, 19 insertions, 6 deletions
diff --git a/src/parser/antlr_input.h b/src/parser/antlr_input.h
index a869fa1e8..2086db714 100644
--- a/src/parser/antlr_input.h
+++ b/src/parser/antlr_input.h
@@ -55,11 +55,21 @@ namespace parser {
/** Wrapper around an ANTLR3 input stream. */
class AntlrInputStream : public InputStream {
+private:
pANTLR3_INPUT_STREAM d_input;
+ /**
+ * If the AntlrInputStream corresponds to reading from a string,
+ * this is the string literal. The memory is owned by the Antlr3Input. It is
+ * assumed to be copied from malloc, and can be free'd at destruction time.
+ * It is otherwise NULL.
+ */
+ pANTLR3_UINT8 d_inputString;
+
AntlrInputStream(std::string name,
pANTLR3_INPUT_STREAM input,
- bool fileIsTemporary = false);
+ bool fileIsTemporary,
+ pANTLR3_UINT8 inputString);
/* This is private and unimplemented, because you should never use it. */
AntlrInputStream(const AntlrInputStream& inputStream) CVC4_UNUSED;
@@ -79,22 +89,24 @@ public:
* @param useMmap <code>true</code> if the input should use memory-mapped I/O; otherwise, the
* input will use the standard ANTLR3 I/O implementation.
*/
- static AntlrInputStream* newFileInputStream(const std::string& name,
+ static AntlrInputStream* newFileInputStream(const std::string& name,
bool useMmap = false)
throw (InputStreamException);
/** Create an input from an istream. */
- static AntlrInputStream* newStreamInputStream(std::istream& input,
+ static AntlrInputStream* newStreamInputStream(std::istream& input,
const std::string& name,
bool lineBuffered = false)
throw (InputStreamException);
/** Create a string input.
+ * NOTE: the new AntlrInputStream will take ownership of input over
+ * and free it at destruction time.
*
* @param input the string to read
* @param name the "filename" to use when reporting errors
*/
- static AntlrInputStream* newStringInputStream(const std::string& input,
+ static AntlrInputStream* newStringInputStream(const std::string& input,
const std::string& name)
throw (InputStreamException);
};/* class AntlrInputStream */
@@ -156,8 +168,9 @@ public:
/** Destructor. Frees the token stream and closes the input. */
virtual ~AntlrInput();
- /** Create an input for the given AntlrInputStream. NOTE: the new Input
- * will take ownership of the input stream and delete it at destruction time.
+ /** Create an input for the given AntlrInputStream.
+ * NOTE: the new Input will take ownership of the input stream and delete it
+ * at destruction time.
*
* @param lang the input language
* @param inputStream the input stream
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback