1 /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
2 * Use of this file is governed by the BSD 3-clause license that
3 * can be found in the LICENSE.txt file in the project root.
8 #include "RecognitionException.h"
10 #include "atn/ATNConfigSet.h"
14 /// Indicates that the parser could not decide which of two or more paths
15 /// to take based upon the remaining input. It tracks the starting token
16 /// of the offending input and also knows where the parser was
17 /// in the various paths when the error. Reported by reportNoViableAlternative()
18 class ANTLR4CPP_PUBLIC NoViableAltException : public RecognitionException {
20 NoViableAltException(Parser *recognizer); // LL(1) error
21 NoViableAltException(Parser *recognizer, TokenStream *input,Token *startToken,
22 Token *offendingToken, atn::ATNConfigSet *deadEndConfigs, ParserRuleContext *ctx, bool deleteConfigs);
23 ~NoViableAltException();
25 virtual Token* getStartToken() const;
26 virtual atn::ATNConfigSet* getDeadEndConfigs() const;
29 /// Which configurations did we try at input.index() that couldn't match input.LT(1)?
30 /// Shared pointer that conditionally deletes the configurations (based on flag
31 /// passed during construction)
32 Ref<atn::ATNConfigSet> _deadEndConfigs;
34 /// The token object at the start index; the input stream might
35 /// not be buffering tokens so get a reference to it. (At the
36 /// time the error occurred, of course the stream needs to keep a
37 /// buffer all of the tokens but later we might not have access to those.)