Merge branch 'master' into master

This commit is contained in:
Terence Parr 2017-03-10 13:54:21 -08:00 committed by GitHub
commit bd1054a57e
3 changed files with 5 additions and 2 deletions

View File

@ -140,3 +140,4 @@ YYYY/MM/DD, github id, Full name, email
2017/02/26, jvasileff, John Vasileff, john@vasileff.com
2017/03/08, harry-tallbelt, Igor Vysokopoyasny, harry.tallbelt@gmail.com
2017/03/09, teverett, Tom Everett, tom@khubla.com
2017/03/03, chund, Christian Hund, christian.hund@gmail.com

View File

@ -10,6 +10,6 @@
using namespace antlr4;
InputMismatchException::InputMismatchException(Parser *recognizer)
: RecognitionException(recognizer, recognizer->getInputStream(), recognizer->getContext(),
: RecognitionException("Input mismatch", recognizer, recognizer->getInputStream(), recognizer->getContext(),
recognizer->getCurrentToken()) {
}

View File

@ -10,6 +10,7 @@
#include "misc/IntervalSet.h"
#include "RecognitionException.h"
#include "Token.h"
using namespace antlr4;
@ -20,7 +21,8 @@ RecognitionException::RecognitionException(Recognizer *recognizer, IntStream *in
RecognitionException::RecognitionException(const std::string &message, Recognizer *recognizer, IntStream *input,
ParserRuleContext *ctx, Token *offendingToken)
: RuntimeException(message), _recognizer(recognizer), _input(input), _ctx(ctx), _offendingToken(offendingToken) {
: RuntimeException(message + (offendingToken ? " near token " + offendingToken->getText() + " in line " + std::to_string(offendingToken->getLine()) : ""))
, _recognizer(recognizer), _input(input), _ctx(ctx), _offendingToken(offendingToken) {
InitializeInstanceFields();
if (recognizer != nullptr) {
_offendingState = recognizer->getState();