]> gitweb.ps.run Git - toc/blob - antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/EmptyPredictionContext.cpp
add antlr source code and ReadMe
[toc] / antlr4-cpp-runtime-4.9.2-source / runtime / src / atn / EmptyPredictionContext.cpp
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 "atn/EmptyPredictionContext.h"
7
8 using namespace antlr4::atn;
9
10 EmptyPredictionContext::EmptyPredictionContext() : SingletonPredictionContext(nullptr, EMPTY_RETURN_STATE) {
11 }
12
13 bool EmptyPredictionContext::isEmpty() const {
14   return true;
15 }
16
17 size_t EmptyPredictionContext::size() const {
18   return 1;
19 }
20
21 Ref<PredictionContext> EmptyPredictionContext::getParent(size_t /*index*/) const {
22   return nullptr;
23 }
24
25 size_t EmptyPredictionContext::getReturnState(size_t /*index*/) const {
26   return returnState;
27 }
28
29 bool EmptyPredictionContext::operator == (const PredictionContext &o) const {
30   return this == &o;
31 }
32
33 std::string EmptyPredictionContext::toString() const {
34   return "$";
35 }