diff --git a/runtime/Cpp/runtime/src/InputMismatchException.cpp b/runtime/Cpp/runtime/src/InputMismatchException.cpp index 1d5d1c1fb..0caa77a3c 100755 --- a/runtime/Cpp/runtime/src/InputMismatchException.cpp +++ b/runtime/Cpp/runtime/src/InputMismatchException.cpp @@ -10,6 +10,6 @@ using namespace antlr4; InputMismatchException::InputMismatchException(Parser *recognizer) - : RecognitionException("Input mismatch", recognizer, recognizer->getInputStream(), recognizer->getContext(), + : RecognitionException(recognizer, recognizer->getInputStream(), recognizer->getContext(), recognizer->getCurrentToken()) { } diff --git a/runtime/Cpp/runtime/src/RecognitionException.cpp b/runtime/Cpp/runtime/src/RecognitionException.cpp index 2dfe027b3..b51308feb 100755 --- a/runtime/Cpp/runtime/src/RecognitionException.cpp +++ b/runtime/Cpp/runtime/src/RecognitionException.cpp @@ -10,7 +10,6 @@ #include "misc/IntervalSet.h" #include "RecognitionException.h" -#include "Token.h" using namespace antlr4; @@ -21,8 +20,7 @@ RecognitionException::RecognitionException(Recognizer *recognizer, IntStream *in RecognitionException::RecognitionException(const std::string &message, Recognizer *recognizer, IntStream *input, ParserRuleContext *ctx, Token *offendingToken) - : RuntimeException(message + (offendingToken ? " near token " + offendingToken->getText() + " in line " + std::to_string(offendingToken->getLine()) : "")) - , _recognizer(recognizer), _input(input), _ctx(ctx), _offendingToken(offendingToken) { + : RuntimeException(message), _recognizer(recognizer), _input(input), _ctx(ctx), _offendingToken(offendingToken) { InitializeInstanceFields(); if (recognizer != nullptr) { _offendingState = recognizer->getState();