summaryrefslogtreecommitdiff
path: root/src/parser
diff options
context:
space:
mode:
authorMorgan Deters <mdeters@gmail.com>2010-10-12 21:49:07 +0000
committerMorgan Deters <mdeters@gmail.com>2010-10-12 21:49:07 +0000
commitb5a68d2181e23094558069058663460b04b2303a (patch)
treedd8ae9d705988623183e0a1b53258c9d6c1587e2 /src/parser
parent3d97646be5eb3f2b50028875f4d899698228e8c7 (diff)
fix some leaks in parser, add debug code to node manager to find more
Diffstat (limited to 'src/parser')
-rw-r--r--src/parser/antlr_input.cpp8
-rw-r--r--src/parser/antlr_input.h12
2 files changed, 11 insertions, 9 deletions
diff --git a/src/parser/antlr_input.cpp b/src/parser/antlr_input.cpp
index 39c8e11b3..74157acd7 100644
--- a/src/parser/antlr_input.cpp
+++ b/src/parser/antlr_input.cpp
@@ -171,7 +171,7 @@ AntlrInput::AntlrInput(AntlrInputStream& inputStream, unsigned int lookahead) :
d_lexer(NULL),
d_parser(NULL),
d_antlr3InputStream( inputStream.getAntlr3InputStream() ),
- d_tokenStream(NULL) {
+ d_tokenBuffer(NULL) {
}
/*
@@ -204,11 +204,11 @@ AntlrInput::Input(ExprManager* exprManager, const std::string& input, const std:
*/
AntlrInput::~AntlrInput() {
- d_tokenStream->free(d_tokenStream);
+ BoundedTokenBufferFree(d_tokenBuffer);
}
pANTLR3_COMMON_TOKEN_STREAM AntlrInput::getTokenStream() {
- return d_tokenStream;
+ return d_tokenBuffer->commonTstream;
}
void AntlrInput::lexerError(pANTLR3_BASE_RECOGNIZER recognizer) {
@@ -260,7 +260,7 @@ void AntlrInput::setAntlr3Lexer(pANTLR3_LEXER pLexer) {
throw ParserException("Couldn't create token buffer.");
}
- d_tokenStream = buffer->commonTstream;
+ d_tokenBuffer = buffer;
// Override default lexer error reporting
d_lexer->rec->reportError = &lexerError;
diff --git a/src/parser/antlr_input.h b/src/parser/antlr_input.h
index 82b15d199..e55e07efd 100644
--- a/src/parser/antlr_input.h
+++ b/src/parser/antlr_input.h
@@ -28,9 +28,10 @@
#include <string>
#include <vector>
-#include "input.h"
-#include "parser_options.h"
-#include "parser_exception.h"
+#include "parser/input.h"
+#include "parser/parser_options.h"
+#include "parser/parser_exception.h"
+#include "parser/bounded_token_buffer.h"
#include "expr/expr.h"
#include "expr/expr_manager.h"
#include "util/Assert.h"
@@ -117,10 +118,11 @@ class AntlrInput : public Input {
/** The ANTLR3 input stream associated with this input. */
pANTLR3_INPUT_STREAM d_antlr3InputStream;
- /** The ANTLR3 token stream associated with this input. We only need this so we can free it on exit.
+ /** The ANTLR3 bounded token buffer associated with this input.
+ * We only need this so we can free it on exit.
* This is set by <code>setLexer</code>.
* NOTE: We assume that we <em>can</em> free it on exit. No sharing! */
- pANTLR3_COMMON_TOKEN_STREAM d_tokenStream;
+ pBOUNDED_TOKEN_BUFFER d_tokenBuffer;
/** Turns an ANTLR3 exception into a message for the user and calls <code>parseError</code>. */
static void reportError(pANTLR3_BASE_RECOGNIZER recognizer);
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback