/proc/self/cwd/external/antlr4-cpp-runtime~/runtime/src/LexerNoViableAltException.cpp
Line | Count | Source |
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. |
4 | | */ |
5 | | |
6 | | #include "misc/Interval.h" |
7 | | #include "support/CPPUtils.h" |
8 | | #include "CharStream.h" |
9 | | #include "Lexer.h" |
10 | | |
11 | | #include "LexerNoViableAltException.h" |
12 | | |
13 | | using namespace antlr4; |
14 | | |
15 | | LexerNoViableAltException::LexerNoViableAltException(Lexer *lexer, CharStream *input, size_t startIndex, |
16 | | atn::ATNConfigSet *deadEndConfigs) |
17 | 1.76M | : RecognitionException(lexer, input, nullptr, nullptr), _startIndex(startIndex), _deadEndConfigs(deadEndConfigs) { |
18 | 1.76M | } |
19 | | |
20 | 0 | size_t LexerNoViableAltException::getStartIndex() { |
21 | 0 | return _startIndex; |
22 | 0 | } |
23 | | |
24 | 0 | atn::ATNConfigSet* LexerNoViableAltException::getDeadEndConfigs() { |
25 | 0 | return _deadEndConfigs; |
26 | 0 | } |
27 | | |
28 | 0 | std::string LexerNoViableAltException::toString() { |
29 | 0 | std::string symbol; |
30 | 0 | if (_startIndex < getInputStream()->size()) { |
31 | 0 | symbol = static_cast<CharStream *>(getInputStream())->getText(misc::Interval(_startIndex, _startIndex)); |
32 | 0 | symbol = antlrcpp::escapeWhitespace(symbol, false); |
33 | 0 | } |
34 | 0 | std::string format = "LexerNoViableAltException('" + symbol + "')"; |
35 | 0 | return format; |
36 | 0 | } |