diff options
author | Morgan Deters <mdeters@cs.nyu.edu> | 2012-12-12 17:28:14 -0500 |
---|---|---|
committer | Morgan Deters <mdeters@cs.nyu.edu> | 2013-03-20 15:36:53 -0400 |
commit | 04e3d0ae6b6135f50cf119f3cf85150dcc87d774 (patch) | |
tree | 9e3bf2583ccbe75fdf5a78129a9d792b7e5681a3 /src/parser/antlr_input.cpp | |
parent | 0c661d41f7594ee3c761b173c1e709ce428ce89d (diff) |
Interactive mode support for multiline input
Diffstat (limited to 'src/parser/antlr_input.cpp')
-rw-r--r-- | src/parser/antlr_input.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/parser/antlr_input.cpp b/src/parser/antlr_input.cpp index fbf2b8650..2279865ae 100644 --- a/src/parser/antlr_input.cpp +++ b/src/parser/antlr_input.cpp @@ -283,16 +283,22 @@ void AntlrInput::warning(const std::string& message) { Warning() << getInputStream()->getName() << ':' << d_lexer->getLine(d_lexer) << '.' << d_lexer->getCharPositionInLine(d_lexer) << ": " << message << endl; } -void AntlrInput::parseError(const std::string& message) +void AntlrInput::parseError(const std::string& message, bool eofException) throw (ParserException) { Debug("parser") << "Throwing exception: " << getInputStream()->getName() << ":" << d_lexer->getLine(d_lexer) << "." << d_lexer->getCharPositionInLine(d_lexer) << ": " << message << endl; - throw ParserException(message, getInputStream()->getName(), - d_lexer->getLine(d_lexer), - d_lexer->getCharPositionInLine(d_lexer)); + if(eofException) { + throw ParserEndOfFileException(message, getInputStream()->getName(), + d_lexer->getLine(d_lexer), + d_lexer->getCharPositionInLine(d_lexer)); + } else { + throw ParserException(message, getInputStream()->getName(), + d_lexer->getLine(d_lexer), + d_lexer->getCharPositionInLine(d_lexer)); + } } |