summaryrefslogtreecommitdiffstats
path: root/contrib/libs/antlr4_cpp_runtime/src
diff options
context:
space:
mode:
authorelen-volodina <[email protected]>2025-09-01 10:54:34 +0300
committerelen-volodina <[email protected]>2025-09-01 11:19:20 +0300
commite425f78d97a33161a9cbe52e30fca0f799d98123 (patch)
tree3be29040395b0d05d9065f35973da2c0e2a1ad72 /contrib/libs/antlr4_cpp_runtime/src
parent38c78a52abdf5359d439eb3c71bd9cdbdd41a56b (diff)
Update antlr
commit_hash:0e419ee5e22aa5e20b90c88651b983539ded9a68
Diffstat (limited to 'contrib/libs/antlr4_cpp_runtime/src')
-rw-r--r--contrib/libs/antlr4_cpp_runtime/src/FlatHashMap.h6
-rw-r--r--contrib/libs/antlr4_cpp_runtime/src/FlatHashSet.h6
-rw-r--r--contrib/libs/antlr4_cpp_runtime/src/TokenStreamRewriter.cpp19
-rw-r--r--contrib/libs/antlr4_cpp_runtime/src/Version.h4
-rw-r--r--contrib/libs/antlr4_cpp_runtime/src/atn/ATNConfig.cpp2
-rw-r--r--contrib/libs/antlr4_cpp_runtime/src/atn/ATNConfigSet.cpp11
-rw-r--r--contrib/libs/antlr4_cpp_runtime/src/atn/ATNDeserializationOptions.cpp2
-rw-r--r--contrib/libs/antlr4_cpp_runtime/src/atn/ArrayPredictionContext.cpp40
-rw-r--r--contrib/libs/antlr4_cpp_runtime/src/atn/DecisionState.cpp2
-rw-r--r--contrib/libs/antlr4_cpp_runtime/src/atn/HashUtils.h18
-rw-r--r--contrib/libs/antlr4_cpp_runtime/src/atn/LexerATNSimulator.cpp20
-rw-r--r--contrib/libs/antlr4_cpp_runtime/src/atn/LexerActionExecutor.cpp5
-rw-r--r--contrib/libs/antlr4_cpp_runtime/src/atn/LexerIndexedCustomAction.cpp9
-rw-r--r--contrib/libs/antlr4_cpp_runtime/src/atn/ParserATNSimulator.cpp79
-rw-r--r--contrib/libs/antlr4_cpp_runtime/src/atn/PredictionContext.cpp24
-rw-r--r--contrib/libs/antlr4_cpp_runtime/src/atn/SingletonPredictionContext.cpp9
-rw-r--r--contrib/libs/antlr4_cpp_runtime/src/dfa/DFAState.cpp2
-rw-r--r--contrib/libs/antlr4_cpp_runtime/src/misc/IntervalSet.cpp2
-rw-r--r--contrib/libs/antlr4_cpp_runtime/src/tree/xpath/XPathLexer.cpp126
-rw-r--r--contrib/libs/antlr4_cpp_runtime/src/tree/xpath/XPathLexer.h26
20 files changed, 248 insertions, 164 deletions
diff --git a/contrib/libs/antlr4_cpp_runtime/src/FlatHashMap.h b/contrib/libs/antlr4_cpp_runtime/src/FlatHashMap.h
index ad5ffa24328..90afcad41f2 100644
--- a/contrib/libs/antlr4_cpp_runtime/src/FlatHashMap.h
+++ b/contrib/libs/antlr4_cpp_runtime/src/FlatHashMap.h
@@ -48,9 +48,9 @@ namespace antlr4 {
using FlatHashMap = absl::flat_hash_map<Key, Value, Hash, Equal, Allocator>;
#else
template <typename Key, typename Value,
- typename Hash = typename std::unordered_map<Key, Value>::hasher,
- typename Equal = typename std::unordered_map<Key, Value>::key_equal,
- typename Allocator = typename std::unordered_map<Key, Value>::allocator_type>
+ typename Hash = std::hash<Key>,
+ typename Equal = std::equal_to<Key>,
+ typename Allocator = std::allocator<std::pair<const Key, Value>>>
using FlatHashMap = std::unordered_map<Key, Value, Hash, Equal, Allocator>;
#endif
diff --git a/contrib/libs/antlr4_cpp_runtime/src/FlatHashSet.h b/contrib/libs/antlr4_cpp_runtime/src/FlatHashSet.h
index 5396c2bd5d4..4671234162d 100644
--- a/contrib/libs/antlr4_cpp_runtime/src/FlatHashSet.h
+++ b/contrib/libs/antlr4_cpp_runtime/src/FlatHashSet.h
@@ -48,9 +48,9 @@ namespace antlr4 {
using FlatHashSet = absl::flat_hash_set<Key, Hash, Equal, Allocator>;
#else
template <typename Key,
- typename Hash = typename std::unordered_set<Key>::hasher,
- typename Equal = typename std::unordered_set<Key>::key_equal,
- typename Allocator = typename std::unordered_set<Key>::allocator_type>
+ typename Hash = std::hash<Key>,
+ typename Equal = std::equal_to<Key>,
+ typename Allocator = std::allocator<Key>>
using FlatHashSet = std::unordered_set<Key, Hash, Equal, Allocator>;
#endif
diff --git a/contrib/libs/antlr4_cpp_runtime/src/TokenStreamRewriter.cpp b/contrib/libs/antlr4_cpp_runtime/src/TokenStreamRewriter.cpp
index 9050eb5c910..e3dcfa7b33a 100644
--- a/contrib/libs/antlr4_cpp_runtime/src/TokenStreamRewriter.cpp
+++ b/contrib/libs/antlr4_cpp_runtime/src/TokenStreamRewriter.cpp
@@ -313,6 +313,10 @@ std::string TokenStreamRewriter::getText(const std::string &programName, const I
std::unordered_map<size_t, TokenStreamRewriter::RewriteOperation*> TokenStreamRewriter::reduceToSingleOperationPerIndex(
std::vector<TokenStreamRewriter::RewriteOperation*> &rewrites) {
+ // Reset the instructionIndex
+ for (size_t i = 0; i < rewrites.size(); ++i) {
+ rewrites[i]->instructionIndex = i;
+ }
// WALK REPLACES
for (size_t i = 0; i < rewrites.size(); ++i) {
@@ -327,14 +331,14 @@ std::unordered_map<size_t, TokenStreamRewriter::RewriteOperation*> TokenStreamRe
if (iop->index == rop->index) {
// E.g., insert before 2, delete 2..2; update replace
// text to include insert before, kill insert
- delete rewrites[iop->instructionIndex];
- rewrites[iop->instructionIndex] = nullptr;
rop->text = iop->text + (!rop->text.empty() ? rop->text : "");
+ rewrites[iop->instructionIndex] = nullptr;
+ delete iop;
}
else if (iop->index > rop->index && iop->index <= rop->lastIndex) {
// delete insert as it's a no-op.
- delete rewrites[iop->instructionIndex];
rewrites[iop->instructionIndex] = nullptr;
+ delete iop;
}
}
// Drop any prior replaces contained within
@@ -342,8 +346,8 @@ std::unordered_map<size_t, TokenStreamRewriter::RewriteOperation*> TokenStreamRe
for (auto *prevRop : prevReplaces) {
if (prevRop->index >= rop->index && prevRop->lastIndex <= rop->lastIndex) {
// delete replace as it's a no-op.
- delete rewrites[prevRop->instructionIndex];
rewrites[prevRop->instructionIndex] = nullptr;
+ delete prevRop;
continue;
}
// throw exception unless disjoint or identical
@@ -351,11 +355,10 @@ std::unordered_map<size_t, TokenStreamRewriter::RewriteOperation*> TokenStreamRe
// Delete special case of replace (text==null):
// D.i-j.u D.x-y.v | boundaries overlap combine to max(min)..max(right)
if (prevRop->text.empty() && rop->text.empty() && !disjoint) {
- delete rewrites[prevRop->instructionIndex];
- rewrites[prevRop->instructionIndex] = nullptr; // kill first delete
rop->index = std::min(prevRop->index, rop->index);
rop->lastIndex = std::max(prevRop->lastIndex, rop->lastIndex);
- std::cout << "new rop " << rop << std::endl;
+ rewrites[prevRop->instructionIndex] = nullptr; // kill first delete
+ delete prevRop;
}
else if (!disjoint) {
throw IllegalArgumentException("replace op boundaries of " + rop->toString() +
@@ -379,8 +382,8 @@ std::unordered_map<size_t, TokenStreamRewriter::RewriteOperation*> TokenStreamRe
// whole token buffer so no lazy eval issue with any templates
iop->text = catOpText(&iop->text, &prevIop->text);
// delete redundant prior insert
- delete rewrites[prevIop->instructionIndex];
rewrites[prevIop->instructionIndex] = nullptr;
+ delete prevIop;
}
}
// look for replaces where iop.index is in range; error
diff --git a/contrib/libs/antlr4_cpp_runtime/src/Version.h b/contrib/libs/antlr4_cpp_runtime/src/Version.h
index 43f00ea65c8..179111909b7 100644
--- a/contrib/libs/antlr4_cpp_runtime/src/Version.h
+++ b/contrib/libs/antlr4_cpp_runtime/src/Version.h
@@ -28,8 +28,8 @@
#include "antlr4-common.h"
#define ANTLRCPP_VERSION_MAJOR 4
-#define ANTLRCPP_VERSION_MINOR 11
-#define ANTLRCPP_VERSION_PATCH 1
+#define ANTLRCPP_VERSION_MINOR 13
+#define ANTLRCPP_VERSION_PATCH 2
#define ANTLRCPP_MAKE_VERSION(major, minor, patch) ((major) * 100000 + (minor) * 1000 + (patch))
diff --git a/contrib/libs/antlr4_cpp_runtime/src/atn/ATNConfig.cpp b/contrib/libs/antlr4_cpp_runtime/src/atn/ATNConfig.cpp
index be4d5bfa8cf..2d7132f6fa6 100644
--- a/contrib/libs/antlr4_cpp_runtime/src/atn/ATNConfig.cpp
+++ b/contrib/libs/antlr4_cpp_runtime/src/atn/ATNConfig.cpp
@@ -95,7 +95,7 @@ std::string ATNConfig::toString(bool showAlt) const {
ss << ",[" << context->toString() << "]";
}
if (semanticContext != nullptr && semanticContext != SemanticContext::Empty::Instance) {
- ss << ",[" << semanticContext->toString() << "]";
+ ss << "," << semanticContext->toString();
}
if (getOuterContextDepth() > 0) {
ss << ",up=" << getOuterContextDepth();
diff --git a/contrib/libs/antlr4_cpp_runtime/src/atn/ATNConfigSet.cpp b/contrib/libs/antlr4_cpp_runtime/src/atn/ATNConfigSet.cpp
index 4ebdf8882bf..4c5e84700df 100644
--- a/contrib/libs/antlr4_cpp_runtime/src/atn/ATNConfigSet.cpp
+++ b/contrib/libs/antlr4_cpp_runtime/src/atn/ATNConfigSet.cpp
@@ -197,24 +197,25 @@ std::string ATNConfigSet::toString() const {
std::stringstream ss;
ss << "[";
for (size_t i = 0; i < configs.size(); i++) {
+ if ( i>0 ) ss << ", ";
ss << configs[i]->toString();
}
ss << "]";
if (hasSemanticContext) {
- ss << ",hasSemanticContext = " << hasSemanticContext;
+ ss << ",hasSemanticContext=" << (hasSemanticContext?"true":"false");
}
if (uniqueAlt != ATN::INVALID_ALT_NUMBER) {
- ss << ",uniqueAlt = " << uniqueAlt;
+ ss << ",uniqueAlt=" << uniqueAlt;
}
- if (conflictingAlts.size() > 0) {
- ss << ",conflictingAlts = ";
+ if (conflictingAlts.count() > 0) {
+ ss << ",conflictingAlts=";
ss << conflictingAlts.toString();
}
if (dipsIntoOuterContext) {
- ss << ", dipsIntoOuterContext";
+ ss << ",dipsIntoOuterContext";
}
return ss.str();
}
diff --git a/contrib/libs/antlr4_cpp_runtime/src/atn/ATNDeserializationOptions.cpp b/contrib/libs/antlr4_cpp_runtime/src/atn/ATNDeserializationOptions.cpp
index e0a7cb2b279..c3a39846191 100644
--- a/contrib/libs/antlr4_cpp_runtime/src/atn/ATNDeserializationOptions.cpp
+++ b/contrib/libs/antlr4_cpp_runtime/src/atn/ATNDeserializationOptions.cpp
@@ -14,7 +14,7 @@ ATNDeserializationOptions::ATNDeserializationOptions(ATNDeserializationOptions *
_generateRuleBypassTransitions(options->_generateRuleBypassTransitions) {}
const ATNDeserializationOptions& ATNDeserializationOptions::getDefaultOptions() {
- static const ATNDeserializationOptions* const defaultOptions = new ATNDeserializationOptions();
+ static const std::unique_ptr<const ATNDeserializationOptions> defaultOptions = std::make_unique<const ATNDeserializationOptions>();
return *defaultOptions;
}
diff --git a/contrib/libs/antlr4_cpp_runtime/src/atn/ArrayPredictionContext.cpp b/contrib/libs/antlr4_cpp_runtime/src/atn/ArrayPredictionContext.cpp
index e9478001b45..d378aa74ac6 100644
--- a/contrib/libs/antlr4_cpp_runtime/src/atn/ArrayPredictionContext.cpp
+++ b/contrib/libs/antlr4_cpp_runtime/src/atn/ArrayPredictionContext.cpp
@@ -8,6 +8,7 @@
#include <cstring>
#include "atn/SingletonPredictionContext.h"
+#include "atn/HashUtils.h"
#include "misc/MurmurHash.h"
#include "support/Casts.h"
@@ -17,12 +18,13 @@ using namespace antlrcpp;
namespace {
- bool cachedHashCodeEqual(size_t lhs, size_t rhs) {
- return lhs == rhs || lhs == 0 || rhs == 0;
- }
-
bool predictionContextEqual(const Ref<const PredictionContext> &lhs, const Ref<const PredictionContext> &rhs) {
- return *lhs == *rhs;
+ // parent PredictionContext pointers can be null during full context mode and
+ // the ctxs are in an ArrayPredictionContext. If both are null, return true
+ // if just one is null, return false. If both are non-null, do comparison.
+ if ( lhs == nullptr ) return rhs == nullptr;
+ if ( rhs == nullptr ) return false; // lhs!=null and rhs==null
+ return *lhs == *rhs; // both nonnull
}
}
@@ -75,11 +77,29 @@ bool ArrayPredictionContext::equals(const PredictionContext &other) const {
return false;
}
const auto &array = downCast<const ArrayPredictionContext&>(other);
- return returnStates.size() == array.returnStates.size() &&
- parents.size() == array.parents.size() &&
- cachedHashCodeEqual(cachedHashCode(), array.cachedHashCode()) &&
- std::memcmp(returnStates.data(), array.returnStates.data(), returnStates.size() * sizeof(decltype(returnStates)::value_type)) == 0 &&
- std::equal(parents.begin(), parents.end(), array.parents.begin(), predictionContextEqual);
+ const bool sameSize = returnStates.size() == array.returnStates.size() &&
+ parents.size() == array.parents.size();
+ if ( !sameSize ) {
+ return false;
+ }
+
+ const bool sameHash = cachedHashCodeEqual(cachedHashCode(), array.cachedHashCode());
+ if ( !sameHash ) {
+ return false;
+ }
+
+ const size_t stateSizeBytes = sizeof(decltype(returnStates)::value_type);
+ const bool returnStateArraysEqual =
+ std::memcmp(returnStates.data(), array.returnStates.data(),
+ returnStates.size() * stateSizeBytes) == 0;
+ if ( !returnStateArraysEqual ) {
+ return false;
+ }
+
+ // stack of contexts is the same
+ const bool parentCtxEqual =
+ std::equal(parents.begin(), parents.end(), array.parents.begin(), predictionContextEqual);
+ return parentCtxEqual;
}
std::string ArrayPredictionContext::toString() const {
diff --git a/contrib/libs/antlr4_cpp_runtime/src/atn/DecisionState.cpp b/contrib/libs/antlr4_cpp_runtime/src/atn/DecisionState.cpp
index 72adb210f56..2d19306e02c 100644
--- a/contrib/libs/antlr4_cpp_runtime/src/atn/DecisionState.cpp
+++ b/contrib/libs/antlr4_cpp_runtime/src/atn/DecisionState.cpp
@@ -8,5 +8,5 @@
using namespace antlr4::atn;
std::string DecisionState::toString() const {
- return "DECISION " + ATNState::toString();
+ return ATNState::toString();
}
diff --git a/contrib/libs/antlr4_cpp_runtime/src/atn/HashUtils.h b/contrib/libs/antlr4_cpp_runtime/src/atn/HashUtils.h
new file mode 100644
index 00000000000..690d204857e
--- /dev/null
+++ b/contrib/libs/antlr4_cpp_runtime/src/atn/HashUtils.h
@@ -0,0 +1,18 @@
+/* Copyright (c) 2022 The ANTLR Project. All rights reserved.
+ * Use of this file is governed by the BSD 3-clause license that
+ * can be found in the LICENSE.txt file in the project root.
+ */
+
+#pragma once
+
+#include <cstddef>
+
+namespace antlr4 {
+namespace atn {
+
+ inline bool cachedHashCodeEqual(size_t lhs, size_t rhs) {
+ return lhs == rhs || lhs == 0 || rhs == 0;
+ }
+
+} // namespace atn
+} // namespace antlr4
diff --git a/contrib/libs/antlr4_cpp_runtime/src/atn/LexerATNSimulator.cpp b/contrib/libs/antlr4_cpp_runtime/src/atn/LexerATNSimulator.cpp
index ef1b1cf2f14..cc42a23810c 100644
--- a/contrib/libs/antlr4_cpp_runtime/src/atn/LexerATNSimulator.cpp
+++ b/contrib/libs/antlr4_cpp_runtime/src/atn/LexerATNSimulator.cpp
@@ -24,8 +24,12 @@
#include "atn/LexerATNSimulator.h"
-#define DEBUG_ATN 0
-#define DEBUG_DFA 0
+#ifndef LEXER_DEBUG_ATN
+#define LEXER_DEBUG_ATN 0
+#endif
+#ifndef LEXER_DEBUG_DFA
+#define LEXER_DEBUG_DFA 0
+#endif
using namespace antlr4;
using namespace antlr4::atn;
@@ -172,7 +176,7 @@ dfa::DFAState *LexerATNSimulator::getExistingTargetState(dfa::DFAState *s, size_
SharedLock<SharedMutex> edgeLock(atn._edgeMutex);
if (t <= MAX_DFA_EDGE) {
auto iterator = s->edges.find(t - MIN_DFA_EDGE);
-#if DEBUG_ATN == 1
+#if LEXER_DEBUG_ATN == 1
if (iterator != s->edges.end()) {
std::cout << std::string("reuse state ") << s->stateNumber << std::string(" edge to ") << iterator->second->stateNumber << std::endl;
}
@@ -232,7 +236,7 @@ void LexerATNSimulator::getReachableConfigSet(CharStream *input, ATNConfigSet *c
continue;
}
-#if DEBUG_ATN == 1
+#if LEXER_DEBUG_ATN == 1
std::cout << "testing " << getTokenName((int)t) << " at " << c->toString(true) << std::endl;
#endif
@@ -263,7 +267,7 @@ void LexerATNSimulator::getReachableConfigSet(CharStream *input, ATNConfigSet *c
void LexerATNSimulator::accept(CharStream *input, const Ref<const LexerActionExecutor> &lexerActionExecutor, size_t /*startIndex*/,
size_t index, size_t line, size_t charPos) {
-#if DEBUG_ATN == 1
+#if LEXER_DEBUG_ATN == 1
std::cout << "ACTION ";
std::cout << toString(lexerActionExecutor) << std::endl;
#endif
@@ -300,12 +304,12 @@ std::unique_ptr<ATNConfigSet> LexerATNSimulator::computeStartState(CharStream *i
bool LexerATNSimulator::closure(CharStream *input, const Ref<LexerATNConfig> &config, ATNConfigSet *configs,
bool currentAltReachedAcceptState, bool speculative, bool treatEofAsEpsilon) {
-#if DEBUG_ATN == 1
+#if LEXER_DEBUG_ATN == 1
std::cout << "closure(" << config->toString(true) << ")" << std::endl;
#endif
if (config->state != nullptr && config->state->getStateType() == ATNStateType::RULE_STOP) {
-#if DEBUG_ATN == 1
+#if LEXER_DEBUG_ATN == 1
if (_recog != nullptr) {
std::cout << "closure at " << _recog->getRuleNames()[config->state->ruleIndex] << " rule stop " << config << std::endl;
} else {
@@ -392,7 +396,7 @@ Ref<LexerATNConfig> LexerATNSimulator::getEpsilonTarget(CharStream *input, const
*/
const PredicateTransition *pt = static_cast<const PredicateTransition*>(t);
-#if DEBUG_ATN == 1
+#if LEXER_DEBUG_ATN == 1
std::cout << "EVAL rule " << pt->getRuleIndex() << ":" << pt->getPredIndex() << std::endl;
#endif
diff --git a/contrib/libs/antlr4_cpp_runtime/src/atn/LexerActionExecutor.cpp b/contrib/libs/antlr4_cpp_runtime/src/atn/LexerActionExecutor.cpp
index 490351b892e..f6bb9e2c4a0 100644
--- a/contrib/libs/antlr4_cpp_runtime/src/atn/LexerActionExecutor.cpp
+++ b/contrib/libs/antlr4_cpp_runtime/src/atn/LexerActionExecutor.cpp
@@ -5,6 +5,7 @@
#include "misc/MurmurHash.h"
#include "atn/LexerIndexedCustomAction.h"
+#include "atn/HashUtils.h"
#include "support/CPPUtils.h"
#include "support/Arrays.h"
#include "support/Casts.h"
@@ -18,10 +19,6 @@ using namespace antlrcpp;
namespace {
- bool cachedHashCodeEqual(size_t lhs, size_t rhs) {
- return lhs == rhs || lhs == 0 || rhs == 0;
- }
-
bool lexerActionEqual(const Ref<const LexerAction> &lhs, const Ref<const LexerAction> &rhs) {
return *lhs == *rhs;
}
diff --git a/contrib/libs/antlr4_cpp_runtime/src/atn/LexerIndexedCustomAction.cpp b/contrib/libs/antlr4_cpp_runtime/src/atn/LexerIndexedCustomAction.cpp
index 114863702c9..d4137af473e 100644
--- a/contrib/libs/antlr4_cpp_runtime/src/atn/LexerIndexedCustomAction.cpp
+++ b/contrib/libs/antlr4_cpp_runtime/src/atn/LexerIndexedCustomAction.cpp
@@ -3,6 +3,7 @@
* can be found in the LICENSE.txt file in the project root.
*/
+#include "atn/HashUtils.h"
#include "misc/MurmurHash.h"
#include "Lexer.h"
#include "support/CPPUtils.h"
@@ -15,14 +16,6 @@ using namespace antlr4::atn;
using namespace antlr4::misc;
using namespace antlrcpp;
-namespace {
-
- bool cachedHashCodeEqual(size_t lhs, size_t rhs) {
- return lhs == rhs || lhs == 0 || rhs == 0;
- }
-
-}
-
LexerIndexedCustomAction::LexerIndexedCustomAction(int offset, Ref<const LexerAction> action)
: LexerAction(LexerActionType::INDEXED_CUSTOM, true), _action(std::move(action)), _offset(offset) {}
diff --git a/contrib/libs/antlr4_cpp_runtime/src/atn/ParserATNSimulator.cpp b/contrib/libs/antlr4_cpp_runtime/src/atn/ParserATNSimulator.cpp
index ad1da035702..f8cf7738058 100644
--- a/contrib/libs/antlr4_cpp_runtime/src/atn/ParserATNSimulator.cpp
+++ b/contrib/libs/antlr4_cpp_runtime/src/atn/ParserATNSimulator.cpp
@@ -36,10 +36,18 @@
#include "atn/ParserATNSimulator.h"
+#ifndef DEBUG_ATN
#define DEBUG_ATN 0
-#define DEBUG_LIST_ATN_DECISIONS 0
-#define DEBUG_DFA 0
+#endif
+#ifndef TRACE_ATN_SIM
+#define TRACE_ATN_SIM 0
+#endif
+#ifndef DFA_DEBUG
+#define DFA_DEBUG 0
+#endif
+#ifndef RETRY_DEBUG
#define RETRY_DEBUG 0
+#endif
using namespace antlr4;
using namespace antlr4::atn;
@@ -78,7 +86,7 @@ void ParserATNSimulator::clearDFA() {
size_t ParserATNSimulator::adaptivePredict(TokenStream *input, size_t decision, ParserRuleContext *outerContext) {
-#if DEBUG_ATN == 1 || DEBUG_LIST_ATN_DECISIONS == 1
+#if DEBUG_ATN == 1 || TRACE_ATN_SIM == 1
std::cout << "adaptivePredict decision " << decision << " exec LA(1)==" << getLookaheadName(input) << " line "
<< input->LT(1)->getLine() << ":" << input->LT(1)->getCharPositionInLine() << std::endl;
#endif
@@ -160,15 +168,16 @@ size_t ParserATNSimulator::adaptivePredict(TokenStream *input, size_t decision,
size_t ParserATNSimulator::execATN(dfa::DFA &dfa, dfa::DFAState *s0, TokenStream *input, size_t startIndex,
ParserRuleContext *outerContext) {
-#if DEBUG_ATN == 1 || DEBUG_LIST_ATN_DECISIONS == 1
- std::cout << "execATN decision " << dfa.decision << " exec LA(1)==" << getLookaheadName(input) <<
+#if DEBUG_ATN == 1 || TRACE_ATN_SIM == 1
+ std::cout << "execATN decision " << dfa.decision << ", DFA state " << s0->toString() <<
+ ", LA(1)==" << getLookaheadName(input) <<
" line " << input->LT(1)->getLine() << ":" << input->LT(1)->getCharPositionInLine() << std::endl;
#endif
dfa::DFAState *previousD = s0;
#if DEBUG_ATN == 1
- std::cout << "s0 = " << s0 << std::endl;
+ std::cout << "s0 = " << s0->toString() << std::endl;
#endif
size_t t = input->LA(1);
@@ -228,7 +237,7 @@ size_t ParserATNSimulator::execATN(dfa::DFA &dfa, dfa::DFAState *s0, TokenStream
}
}
-#if DEBUG_DFA == 1
+#if DFA_DEBUG == 1
std::cout << "ctx sensitive state " << outerContext << " in " << D << std::endl;
#endif
@@ -342,6 +351,10 @@ void ParserATNSimulator::predicateDFAState(dfa::DFAState *dfaState, DecisionStat
size_t ParserATNSimulator::execATNWithFullContext(dfa::DFA &dfa, dfa::DFAState *D, ATNConfigSet *s0,
TokenStream *input, size_t startIndex, ParserRuleContext *outerContext) {
+#if TRACE_ATN_SIM == 1
+ std::cout << "execATNWithFullContext " << s0->toString() << std::endl;
+#endif
+
bool fullCtx = true;
bool foundExactAmbig = false;
@@ -566,7 +579,11 @@ std::unique_ptr<ATNConfigSet> ParserATNSimulator::computeReachSet(ATNConfigSet *
}
}
- if (reach->isEmpty()) {
+#if DEBUG_ATN == 1 || TRACE_ATN_SIM == 1
+ std::cout << "computeReachSet " << closure_->toString() << " -> " << reach->toString() << std::endl;
+#endif
+
+ if (reach->isEmpty()) {
return nullptr;
}
return reach;
@@ -603,7 +620,11 @@ std::unique_ptr<ATNConfigSet> ParserATNSimulator::computeStartState(ATNState *p,
Ref<const PredictionContext> initialContext = PredictionContext::fromRuleContext(atn, ctx);
std::unique_ptr<ATNConfigSet> configs(new ATNConfigSet(fullCtx));
- for (size_t i = 0; i < p->transitions.size(); i++) {
+#if DEBUG_ATN == 1 || TRACE_ATN_SIM == 1
+ std::cout << "computeStartState from ATN state " << p->toString() << " initialContext=" << initialContext->toString() << std::endl;
+#endif
+
+ for (size_t i = 0; i < p->transitions.size(); i++) {
ATNState *target = p->transitions[i]->target;
Ref<ATNConfig> c = std::make_shared<ATNConfig>(target, (int)i + 1, initialContext);
ATNConfig::Set closureBusy;
@@ -798,12 +819,12 @@ BitSet ParserATNSimulator::evalSemanticContext(const std::vector<dfa::DFAState::
bool fullCtx = false; // in dfa
bool predicateEvaluationResult = evalSemanticContext(prediction.pred, outerContext, prediction.alt, fullCtx);
-#if DEBUG_ATN == 1 || DEBUG_DFA == 1
+#if DEBUG_ATN == 1 || DFA_DEBUG == 1
std::cout << "eval pred " << prediction.toString() << " = " << predicateEvaluationResult << std::endl;
#endif
if (predicateEvaluationResult) {
-#if DEBUG_ATN == 1 || DEBUG_DFA == 1
+#if DEBUG_ATN == 1 || DFA_DEBUG == 1
std::cout << "PREDICT " << prediction.alt << std::endl;
#endif
@@ -833,7 +854,7 @@ void ParserATNSimulator::closure(Ref<ATNConfig> const& config, ATNConfigSet *con
void ParserATNSimulator::closureCheckingStopState(Ref<ATNConfig> const& config, ATNConfigSet *configs,
ATNConfig::Set &closureBusy, bool collectPredicates, bool fullCtx, int depth, bool treatEofAsEpsilon) {
-#if DEBUG_ATN == 1
+#if TRACE_ATN_SIM == 1
std::cout << "closure(" << config->toString(true) << ")" << std::endl;
#endif
@@ -939,7 +960,7 @@ void ParserATNSimulator::closure_(Ref<ATNConfig> const& config, ATNConfigSet *co
assert(newDepth > INT_MIN);
newDepth--;
-#if DEBUG_DFA == 1
+#if DFA_DEBUG == 1
std::cout << "dips into outer ctx: " << c << std::endl;
#endif
@@ -1086,7 +1107,7 @@ Ref<ATNConfig> ParserATNSimulator::getEpsilonTarget(Ref<ATNConfig> const& config
}
Ref<ATNConfig> ParserATNSimulator::actionTransition(Ref<ATNConfig> const& config, const ActionTransition *t) {
-#if DEBUG_DFA == 1
+#if DFA_DEBUG == 1
std::cout << "ACTION edge " << t->ruleIndex << ":" << t->actionIndex << std::endl;
#endif
@@ -1095,7 +1116,7 @@ Ref<ATNConfig> ParserATNSimulator::actionTransition(Ref<ATNConfig> const& config
Ref<ATNConfig> ParserATNSimulator::precedenceTransition(Ref<ATNConfig> const& config, const PrecedencePredicateTransition *pt,
bool collectPredicates, bool inContext, bool fullCtx) {
-#if DEBUG_DFA == 1
+#if DFA_DEBUG == 1
std::cout << "PRED (collectPredicates=" << collectPredicates << ") " << pt->getPrecedence() << ">=_p" << ", ctx dependent=true" << std::endl;
if (parser != nullptr) {
std::cout << "context surrounding pred is " << Arrays::listToString(parser->getRuleInvocationStack(), ", ") << std::endl;
@@ -1126,7 +1147,7 @@ Ref<ATNConfig> ParserATNSimulator::precedenceTransition(Ref<ATNConfig> const& co
c = std::make_shared<ATNConfig>(*config, pt->target);
}
-#if DEBUG_DFA == 1
+#if DFA_DEBUG == 1
std::cout << "config from pred transition=" << c << std::endl;
#endif
@@ -1135,7 +1156,7 @@ Ref<ATNConfig> ParserATNSimulator::precedenceTransition(Ref<ATNConfig> const& co
Ref<ATNConfig> ParserATNSimulator::predTransition(Ref<ATNConfig> const& config, const PredicateTransition *pt,
bool collectPredicates, bool inContext, bool fullCtx) {
-#if DEBUG_DFA == 1
+#if DFA_DEBUG == 1
std::cout << "PRED (collectPredicates=" << collectPredicates << ") " << pt->getRuleIndex() << ":" << pt->getPredIndex() << ", ctx dependent=" << pt->isCtxDependent() << std::endl;
if (parser != nullptr) {
std::cout << "context surrounding pred is " << Arrays::listToString(parser->getRuleInvocationStack(), ", ") << std::endl;
@@ -1165,7 +1186,7 @@ Ref<ATNConfig> ParserATNSimulator::predTransition(Ref<ATNConfig> const& config,
c = std::make_shared<ATNConfig>(*config, pt->target);
}
-#if DEBUG_DFA == 1
+#if DFA_DEBUG == 1
std::cout << "config from pred transition=" << c << std::endl;
#endif
@@ -1173,7 +1194,7 @@ Ref<ATNConfig> ParserATNSimulator::predTransition(Ref<ATNConfig> const& config,
}
Ref<ATNConfig> ParserATNSimulator::ruleTransition(Ref<ATNConfig> const& config, const RuleTransition *t) {
-#if DEBUG_DFA == 1
+#if DFA_DEBUG == 1
std::cout << "CALL rule " << getRuleName(t->target->ruleIndex) << ", ctx=" << config->context << std::endl;
#endif
@@ -1256,7 +1277,7 @@ size_t ParserATNSimulator::getUniqueAlt(ATNConfigSet *configs) {
}
dfa::DFAState *ParserATNSimulator::addDFAEdge(dfa::DFA &dfa, dfa::DFAState *from, ssize_t t, dfa::DFAState *to) {
-#if DEBUG_DFA == 1
+#if DFA_DEBUG == 1
std::cout << "EDGE " << from << " -> " << to << " upon " << getTokenName(t) << std::endl;
#endif
@@ -1277,7 +1298,7 @@ dfa::DFAState *ParserATNSimulator::addDFAEdge(dfa::DFA &dfa, dfa::DFAState *from
from->edges[t] = to; // connect
}
-#if DEBUG_DFA == 1
+#if DFA_DEBUG == 1
std::string dfaText;
if (parser != nullptr) {
dfaText = dfa.toString(parser->getVocabulary());
@@ -1299,18 +1320,26 @@ dfa::DFAState *ParserATNSimulator::addDFAState(dfa::DFA &dfa, dfa::DFAState *D)
// which will only succeed if an equivalent DFAState does not already exist.
auto [existing, inserted] = dfa.states.insert(D);
if (!inserted) {
+#if TRACE_ATN_SIM == 1
+ std::cout << "addDFAState " << D->toString() << " exists" << std::endl;
+#endif
return *existing;
}
// Previously we did a lookup, then set fields, then inserted. It was `dfa.states.size()`, since
// we already inserted we need to subtract one.
D->stateNumber = static_cast<int>(dfa.states.size() - 1);
+
+#if TRACE_ATN_SIM == 1
+ std::cout << "addDFAState new " << D->toString() << std::endl;
+#endif
+
if (!D->configs->isReadonly()) {
D->configs->optimizeConfigs(this);
D->configs->setReadonly(true);
}
-#if DEBUG_DFA == 1
+#if DFA_DEBUG == 1
std::cout << "adding new DFA state: " << D << std::endl;
#endif
@@ -1319,7 +1348,7 @@ dfa::DFAState *ParserATNSimulator::addDFAState(dfa::DFA &dfa, dfa::DFAState *D)
void ParserATNSimulator::reportAttemptingFullContext(dfa::DFA &dfa, const antlrcpp::BitSet &conflictingAlts,
ATNConfigSet *configs, size_t startIndex, size_t stopIndex) {
-#if DEBUG_DFA == 1 || RETRY_DEBUG == 1
+#if DFA_DEBUG == 1 || RETRY_DEBUG == 1
misc::Interval interval = misc::Interval((int)startIndex, (int)stopIndex);
std::cout << "reportAttemptingFullContext decision=" << dfa.decision << ":" << configs << ", input=" << parser->getTokenStream()->getText(interval) << std::endl;
#endif
@@ -1331,7 +1360,7 @@ void ParserATNSimulator::reportAttemptingFullContext(dfa::DFA &dfa, const antlrc
void ParserATNSimulator::reportContextSensitivity(dfa::DFA &dfa, size_t prediction, ATNConfigSet *configs,
size_t startIndex, size_t stopIndex) {
-#if DEBUG_DFA == 1 || RETRY_DEBUG == 1
+#if DFA_DEBUG == 1 || RETRY_DEBUG == 1
misc::Interval interval = misc::Interval(startIndex, stopIndex);
std::cout << "reportContextSensitivity decision=" << dfa.decision << ":" << configs << ", input=" << parser->getTokenStream()->getText(interval) << std::endl;
#endif
@@ -1343,7 +1372,7 @@ void ParserATNSimulator::reportContextSensitivity(dfa::DFA &dfa, size_t predicti
void ParserATNSimulator::reportAmbiguity(dfa::DFA &dfa, dfa::DFAState * /*D*/, size_t startIndex, size_t stopIndex,
bool exact, const antlrcpp::BitSet &ambigAlts, ATNConfigSet *configs) {
-#if DEBUG_DFA == 1 || RETRY_DEBUG == 1
+#if DFA_DEBUG == 1 || RETRY_DEBUG == 1
misc::Interval interval = misc::Interval((int)startIndex, (int)stopIndex);
std::cout << "reportAmbiguity " << ambigAlts << ":" << configs << ", input=" << parser->getTokenStream()->getText(interval) << std::endl;
#endif
diff --git a/contrib/libs/antlr4_cpp_runtime/src/atn/PredictionContext.cpp b/contrib/libs/antlr4_cpp_runtime/src/atn/PredictionContext.cpp
index 704408f04d5..b976de8f1f8 100644
--- a/contrib/libs/antlr4_cpp_runtime/src/atn/PredictionContext.cpp
+++ b/contrib/libs/antlr4_cpp_runtime/src/atn/PredictionContext.cpp
@@ -325,14 +325,19 @@ Ref<const PredictionContext> PredictionContext::mergeRoot(Ref<const SingletonPre
Ref<const PredictionContext> PredictionContext::mergeArrays(Ref<const ArrayPredictionContext> a, Ref<const ArrayPredictionContext> b,
bool rootIsWildcard, PredictionContextMergeCache *mergeCache) {
-
if (mergeCache) {
auto existing = mergeCache->get(a, b);
if (existing) {
+#if TRACE_ATN_SIM == 1
+ std::cout << "mergeArrays a=" << a->toString() << ",b=" << b->toString() << " -> previous" << std::endl;
+#endif
return existing;
}
existing = mergeCache->get(b, a);
if (existing) {
+#if TRACE_ATN_SIM == 1
+ std::cout << "mergeArrays a=" << a->toString() << ",b=" << b->toString() << " -> previous" << std::endl;
+#endif
return existing;
}
}
@@ -410,19 +415,36 @@ Ref<const PredictionContext> PredictionContext::mergeArrays(Ref<const ArrayPredi
// TODO: track whether this is possible above during merge sort for speed
if (m == *a) {
if (mergeCache) {
+#if TRACE_ATN_SIM == 1
+ std::cout << "mergeArrays a=" << a->toString() << ",b=" << b->toString() << " -> a" << std::endl;
+#endif
return mergeCache->put(a, b, a);
}
+#if TRACE_ATN_SIM == 1
+ std::cout << "mergeArrays a=" << a->toString() << ",b=" << b->toString() << " -> a" << std::endl;
+#endif
return a;
}
if (m == *b) {
if (mergeCache) {
+#if TRACE_ATN_SIM == 1
+ std::cout << "mergeArrays a=" << a->toString() << ",b=" << b->toString() << " -> b" << std::endl;
+#endif
return mergeCache->put(a, b, b);
}
+#if TRACE_ATN_SIM == 1
+ std::cout << "mergeArrays a=" << a->toString() << ",b=" << b->toString() << " -> b" << std::endl;
+#endif
return b;
}
combineCommonParents(m.parents);
auto c = std::make_shared<ArrayPredictionContext>(std::move(m));
+
+#if TRACE_ATN_SIM == 1
+ std::cout << "mergeArrays a=" << a->toString() << ",b=" << b->toString() << " -> " << c->toString() << std::endl;
+#endif
+
if (mergeCache) {
return mergeCache->put(a, b, std::move(c));
}
diff --git a/contrib/libs/antlr4_cpp_runtime/src/atn/SingletonPredictionContext.cpp b/contrib/libs/antlr4_cpp_runtime/src/atn/SingletonPredictionContext.cpp
index 66a91936e91..8122bb79879 100644
--- a/contrib/libs/antlr4_cpp_runtime/src/atn/SingletonPredictionContext.cpp
+++ b/contrib/libs/antlr4_cpp_runtime/src/atn/SingletonPredictionContext.cpp
@@ -7,18 +7,11 @@
#include "support/Casts.h"
#include "misc/MurmurHash.h"
+#include "atn/HashUtils.h"
using namespace antlr4::atn;
using namespace antlrcpp;
-namespace {
-
- bool cachedHashCodeEqual(size_t lhs, size_t rhs) {
- return lhs == rhs || lhs == 0 || rhs == 0;
- }
-
-}
-
SingletonPredictionContext::SingletonPredictionContext(Ref<const PredictionContext> parent, size_t returnState)
: PredictionContext(PredictionContextType::SINGLETON), parent(std::move(parent)), returnState(returnState) {
assert(returnState != ATNState::INVALID_STATE_NUMBER);
diff --git a/contrib/libs/antlr4_cpp_runtime/src/dfa/DFAState.cpp b/contrib/libs/antlr4_cpp_runtime/src/dfa/DFAState.cpp
index e591b204c73..23ff003f94c 100644
--- a/contrib/libs/antlr4_cpp_runtime/src/dfa/DFAState.cpp
+++ b/contrib/libs/antlr4_cpp_runtime/src/dfa/DFAState.cpp
@@ -46,7 +46,7 @@ std::string DFAState::toString() const {
ss << ":" << configs->toString();
}
if (isAcceptState) {
- ss << " => ";
+ ss << "=>";
if (!predicates.empty()) {
for (size_t i = 0; i < predicates.size(); i++) {
ss << predicates[i].toString();
diff --git a/contrib/libs/antlr4_cpp_runtime/src/misc/IntervalSet.cpp b/contrib/libs/antlr4_cpp_runtime/src/misc/IntervalSet.cpp
index d230bf45f6a..dcfbe9c7608 100644
--- a/contrib/libs/antlr4_cpp_runtime/src/misc/IntervalSet.cpp
+++ b/contrib/libs/antlr4_cpp_runtime/src/misc/IntervalSet.cpp
@@ -37,7 +37,7 @@ IntervalSet& IntervalSet::operator=(const IntervalSet& other) {
}
IntervalSet& IntervalSet::operator=(IntervalSet&& other) {
- _intervals = move(other._intervals);
+ _intervals = std::move(other._intervals);
return *this;
}
diff --git a/contrib/libs/antlr4_cpp_runtime/src/tree/xpath/XPathLexer.cpp b/contrib/libs/antlr4_cpp_runtime/src/tree/xpath/XPathLexer.cpp
index 506d2e1179e..bba8a150b8d 100644
--- a/contrib/libs/antlr4_cpp_runtime/src/tree/xpath/XPathLexer.cpp
+++ b/contrib/libs/antlr4_cpp_runtime/src/tree/xpath/XPathLexer.cpp
@@ -1,5 +1,5 @@
-// Generated from XPathLexer.g4 by ANTLR 4.9.3
+// Generated from XPathLexer.g4 by ANTLR 4.13.1
#include "XPathLexer.h"
@@ -7,14 +7,18 @@
using namespace antlr4;
+
+
+using namespace antlr4;
+
namespace {
struct XPathLexerStaticData final {
XPathLexerStaticData(std::vector<std::string> ruleNames,
- std::vector<std::string> channelNames,
- std::vector<std::string> modeNames,
- std::vector<std::string> literalNames,
- std::vector<std::string> symbolicNames)
+ std::vector<std::string> channelNames,
+ std::vector<std::string> modeNames,
+ std::vector<std::string> literalNames,
+ std::vector<std::string> symbolicNames)
: ruleNames(std::move(ruleNames)), channelNames(std::move(channelNames)),
modeNames(std::move(modeNames)), literalNames(std::move(literalNames)),
symbolicNames(std::move(symbolicNames)),
@@ -37,14 +41,23 @@ struct XPathLexerStaticData final {
std::unique_ptr<antlr4::atn::ATN> atn;
};
-::antlr4::internal::OnceFlag xpathLexerOnceFlag;
-XPathLexerStaticData *xpathLexerStaticData = nullptr;
+::antlr4::internal::OnceFlag xpathlexerLexerOnceFlag;
+#if ANTLR4_USE_THREAD_LOCAL_CACHE
+static thread_local
+#endif
+std::unique_ptr<XPathLexerStaticData> xpathlexerLexerStaticData = nullptr;
-void xpathLexerInitialize() {
- assert(xpathLexerStaticData == nullptr);
+void xpathlexerLexerInitialize() {
+#if ANTLR4_USE_THREAD_LOCAL_CACHE
+ if (xpathlexerLexerStaticData != nullptr) {
+ return;
+ }
+#else
+ assert(xpathlexerLexerStaticData == nullptr);
+#endif
auto staticData = std::make_unique<XPathLexerStaticData>(
std::vector<std::string>{
- "ANYWHERE", "ROOT", "WILDCARD", "BANG", "ID", "NameChar", "NameStartChar",
+ "ANYWHERE", "ROOT", "WILDCARD", "BANG", "ID", "NameChar", "NameStartChar",
"STRING"
},
std::vector<std::string>{
@@ -57,69 +70,47 @@ void xpathLexerInitialize() {
"", "", "", "'//'", "'/'", "'*'", "'!'"
},
std::vector<std::string>{
- "", "TOKEN_REF", "RULE_REF", "ANYWHERE", "ROOT", "WILDCARD", "BANG", "ID",
- "STRING"
+ "", "TOKEN_REF", "RULE_REF", "ANYWHERE", "ROOT", "WILDCARD", "BANG",
+ "ID", "STRING"
}
);
static const int32_t serializedATNSegment[] = {
- 0x4, 0x0, 0x8, 0x32, 0x6, -1, 0x2, 0x0, 0x7, 0x0, 0x2, 0x1, 0x7,
- 0x1, 0x2, 0x2, 0x7, 0x2, 0x2, 0x3, 0x7, 0x3, 0x2, 0x4, 0x7, 0x4,
- 0x2, 0x5, 0x7, 0x5, 0x2, 0x6, 0x7, 0x6, 0x2, 0x7, 0x7, 0x7, 0x1,
- 0x0, 0x1, 0x0, 0x1, 0x0, 0x1, 0x1, 0x1, 0x1, 0x1, 0x2, 0x1, 0x2,
- 0x1, 0x3, 0x1, 0x3, 0x1, 0x4, 0x1, 0x4, 0x5, 0x4, 0x1d, 0x8, 0x4,
- 0xa, 0x4, 0xc, 0x4, 0x20, 0x9, 0x4, 0x1, 0x4, 0x1, 0x4, 0x1, 0x5,
- 0x1, 0x5, 0x3, 0x5, 0x26, 0x8, 0x5, 0x1, 0x6, 0x1, 0x6, 0x1, 0x7,
- 0x1, 0x7, 0x5, 0x7, 0x2c, 0x8, 0x7, 0xa, 0x7, 0xc, 0x7, 0x2f, 0x9,
- 0x7, 0x1, 0x7, 0x1, 0x7, 0x1, 0x2d, 0x0, 0x8, 0x1, 0x3, 0x3, 0x4,
- 0x5, 0x5, 0x7, 0x6, 0x9, 0x7, 0xb, 0x0, 0xd, 0x0, 0xf, 0x8, 0x1,
- 0x0, 0x2, 0x5, 0x0, 0x30, 0x39, 0x5f, 0x5f, 0xb7, 0xb7, 0x300, 0x36f,
- 0x203f, 0x2040, 0xd, 0x0, 0x41, 0x5a, 0x61, 0x7a, 0xc0, 0xd6, 0xd8,
- 0xf6, 0xf8, 0x2ff, 0x370, 0x37d, 0x37f, 0x1fff, 0x200c, 0x200d, 0x2070,
- 0x218f, 0x2c00, 0x2fef, 0x3001, 0xd7ff, 0xf900, 0xfdcf, 0xfdf0, -1,
- 0x0, 0x32, 0x0, 0x1, 0x1, 0x0, 0x0, 0x0, 0x0, 0x3, 0x1, 0x0, 0x0,
- 0x0, 0x0, 0x5, 0x1, 0x0, 0x0, 0x0, 0x0, 0x7, 0x1, 0x0, 0x0, 0x0,
- 0x0, 0x9, 0x1, 0x0, 0x0, 0x0, 0x0, 0xf, 0x1, 0x0, 0x0, 0x0, 0x1,
- 0x11, 0x1, 0x0, 0x0, 0x0, 0x3, 0x14, 0x1, 0x0, 0x0, 0x0, 0x5, 0x16,
- 0x1, 0x0, 0x0, 0x0, 0x7, 0x18, 0x1, 0x0, 0x0, 0x0, 0x9, 0x1a, 0x1,
- 0x0, 0x0, 0x0, 0xb, 0x25, 0x1, 0x0, 0x0, 0x0, 0xd, 0x27, 0x1, 0x0,
- 0x0, 0x0, 0xf, 0x29, 0x1, 0x0, 0x0, 0x0, 0x11, 0x12, 0x5, 0x2f, 0x0,
- 0x0, 0x12, 0x13, 0x5, 0x2f, 0x0, 0x0, 0x13, 0x2, 0x1, 0x0, 0x0, 0x0,
- 0x14, 0x15, 0x5, 0x2f, 0x0, 0x0, 0x15, 0x4, 0x1, 0x0, 0x0, 0x0, 0x16,
- 0x17, 0x5, 0x2a, 0x0, 0x0, 0x17, 0x6, 0x1, 0x0, 0x0, 0x0, 0x18, 0x19,
- 0x5, 0x21, 0x0, 0x0, 0x19, 0x8, 0x1, 0x0, 0x0, 0x0, 0x1a, 0x1e, 0x3,
- 0xd, 0x6, 0x0, 0x1b, 0x1d, 0x3, 0xb, 0x5, 0x0, 0x1c, 0x1b, 0x1, 0x0,
- 0x0, 0x0, 0x1d, 0x20, 0x1, 0x0, 0x0, 0x0, 0x1e, 0x1c, 0x1, 0x0, 0x0,
- 0x0, 0x1e, 0x1f, 0x1, 0x0, 0x0, 0x0, 0x1f, 0x21, 0x1, 0x0, 0x0, 0x0,
- 0x20, 0x1e, 0x1, 0x0, 0x0, 0x0, 0x21, 0x22, 0x6, 0x4, 0x0, 0x0, 0x22,
- 0xa, 0x1, 0x0, 0x0, 0x0, 0x23, 0x26, 0x3, 0xd, 0x6, 0x0, 0x24, 0x26,
- 0x7, 0x0, 0x0, 0x0, 0x25, 0x23, 0x1, 0x0, 0x0, 0x0, 0x25, 0x24, 0x1,
- 0x0, 0x0, 0x0, 0x26, 0xc, 0x1, 0x0, 0x0, 0x0, 0x27, 0x28, 0x7, 0x1,
- 0x0, 0x0, 0x28, 0xe, 0x1, 0x0, 0x0, 0x0, 0x29, 0x2d, 0x5, 0x27, 0x0,
- 0x0, 0x2a, 0x2c, 0x9, 0x0, 0x0, 0x0, 0x2b, 0x2a, 0x1, 0x0, 0x0, 0x0,
- 0x2c, 0x2f, 0x1, 0x0, 0x0, 0x0, 0x2d, 0x2e, 0x1, 0x0, 0x0, 0x0, 0x2d,
- 0x2b, 0x1, 0x0, 0x0, 0x0, 0x2e, 0x30, 0x1, 0x0, 0x0, 0x0, 0x2f, 0x2d,
- 0x1, 0x0, 0x0, 0x0, 0x30, 0x31, 0x5, 0x27, 0x0, 0x0, 0x31, 0x10,
- 0x1, 0x0, 0x0, 0x0, 0x4, 0x0, 0x1e, 0x25, 0x2d, 0x1, 0x1, 0x4, 0x0,
+ 4,0,8,50,6,-1,2,0,7,0,2,1,7,1,2,2,7,2,2,3,7,3,2,4,7,4,2,5,7,5,2,6,7,6,
+ 2,7,7,7,1,0,1,0,1,0,1,1,1,1,1,2,1,2,1,3,1,3,1,4,1,4,5,4,29,8,4,10,4,12,
+ 4,32,9,4,1,4,1,4,1,5,1,5,3,5,38,8,5,1,6,1,6,1,7,1,7,5,7,44,8,7,10,7,12,
+ 7,47,9,7,1,7,1,7,1,45,0,8,1,3,3,4,5,5,7,6,9,7,11,0,13,0,15,8,1,0,2,5,
+ 0,48,57,95,95,183,183,768,879,8255,8256,13,0,65,90,97,122,192,214,216,
+ 246,248,767,880,893,895,8191,8204,8205,8304,8591,11264,12271,12289,55295,
+ 63744,64975,65008,65535,50,0,1,1,0,0,0,0,3,1,0,0,0,0,5,1,0,0,0,0,7,1,
+ 0,0,0,0,9,1,0,0,0,0,15,1,0,0,0,1,17,1,0,0,0,3,20,1,0,0,0,5,22,1,0,0,0,
+ 7,24,1,0,0,0,9,26,1,0,0,0,11,37,1,0,0,0,13,39,1,0,0,0,15,41,1,0,0,0,17,
+ 18,5,47,0,0,18,19,5,47,0,0,19,2,1,0,0,0,20,21,5,47,0,0,21,4,1,0,0,0,22,
+ 23,5,42,0,0,23,6,1,0,0,0,24,25,5,33,0,0,25,8,1,0,0,0,26,30,3,13,6,0,27,
+ 29,3,11,5,0,28,27,1,0,0,0,29,32,1,0,0,0,30,28,1,0,0,0,30,31,1,0,0,0,31,
+ 33,1,0,0,0,32,30,1,0,0,0,33,34,6,4,0,0,34,10,1,0,0,0,35,38,3,13,6,0,36,
+ 38,7,0,0,0,37,35,1,0,0,0,37,36,1,0,0,0,38,12,1,0,0,0,39,40,7,1,0,0,40,
+ 14,1,0,0,0,41,45,5,39,0,0,42,44,9,0,0,0,43,42,1,0,0,0,44,47,1,0,0,0,45,
+ 46,1,0,0,0,45,43,1,0,0,0,46,48,1,0,0,0,47,45,1,0,0,0,48,49,5,39,0,0,49,
+ 16,1,0,0,0,4,0,30,37,45,1,1,4,0
};
-
staticData->serializedATN = antlr4::atn::SerializedATNView(serializedATNSegment, sizeof(serializedATNSegment) / sizeof(serializedATNSegment[0]));
- atn::ATNDeserializer deserializer;
+ antlr4::atn::ATNDeserializer deserializer;
staticData->atn = deserializer.deserialize(staticData->serializedATN);
- size_t count = staticData->atn->getNumberOfDecisions();
+ const size_t count = staticData->atn->getNumberOfDecisions();
staticData->decisionToDFA.reserve(count);
- for (size_t i = 0; i < count; i++) {
+ for (size_t i = 0; i < count; i++) {
staticData->decisionToDFA.emplace_back(staticData->atn->getDecisionState(i), i);
}
- xpathLexerStaticData = staticData.release();
+ xpathlexerLexerStaticData = std::move(staticData);
}
}
XPathLexer::XPathLexer(CharStream *input) : Lexer(input) {
XPathLexer::initialize();
- _interpreter = new atn::LexerATNSimulator(this, *xpathLexerStaticData->atn, xpathLexerStaticData->decisionToDFA, xpathLexerStaticData->sharedContextCache);
+ _interpreter = new atn::LexerATNSimulator(this, *xpathlexerLexerStaticData->atn, xpathlexerLexerStaticData->decisionToDFA, xpathlexerLexerStaticData->sharedContextCache);
}
XPathLexer::~XPathLexer() {
@@ -131,29 +122,30 @@ std::string XPathLexer::getGrammarFileName() const {
}
const std::vector<std::string>& XPathLexer::getRuleNames() const {
- return xpathLexerStaticData->ruleNames;
+ return xpathlexerLexerStaticData->ruleNames;
}
const std::vector<std::string>& XPathLexer::getChannelNames() const {
- return xpathLexerStaticData->channelNames;
+ return xpathlexerLexerStaticData->channelNames;
}
const std::vector<std::string>& XPathLexer::getModeNames() const {
- return xpathLexerStaticData->modeNames;
+ return xpathlexerLexerStaticData->modeNames;
}
const dfa::Vocabulary& XPathLexer::getVocabulary() const {
- return xpathLexerStaticData->vocabulary;
+ return xpathlexerLexerStaticData->vocabulary;
}
antlr4::atn::SerializedATNView XPathLexer::getSerializedATN() const {
- return xpathLexerStaticData->serializedATN;
+ return xpathlexerLexerStaticData->serializedATN;
}
const atn::ATN& XPathLexer::getATN() const {
- return *xpathLexerStaticData->atn;
+ return *xpathlexerLexerStaticData->atn;
}
+
void XPathLexer::action(RuleContext *context, size_t ruleIndex, size_t actionIndex) {
switch (ruleIndex) {
case 4: IDAction(antlrcpp::downCast<antlr4::RuleContext *>(context), actionIndex); break;
@@ -165,7 +157,7 @@ void XPathLexer::action(RuleContext *context, size_t ruleIndex, size_t actionInd
void XPathLexer::IDAction(antlr4::RuleContext *context, size_t actionIndex) {
switch (actionIndex) {
- case 0:
+ case 0:
if (isupper(getText()[0]))
setType(TOKEN_REF);
else
@@ -177,6 +169,12 @@ void XPathLexer::IDAction(antlr4::RuleContext *context, size_t actionIndex) {
}
}
+
+
void XPathLexer::initialize() {
- ::antlr4::internal::call_once(xpathLexerOnceFlag, xpathLexerInitialize);
+#if ANTLR4_USE_THREAD_LOCAL_CACHE
+ xpathlexerLexerInitialize();
+#else
+ ::antlr4::internal::call_once(xpathlexerLexerOnceFlag, xpathlexerLexerInitialize);
+#endif
}
diff --git a/contrib/libs/antlr4_cpp_runtime/src/tree/xpath/XPathLexer.h b/contrib/libs/antlr4_cpp_runtime/src/tree/xpath/XPathLexer.h
index 6926d2161e3..556e95050bc 100644
--- a/contrib/libs/antlr4_cpp_runtime/src/tree/xpath/XPathLexer.h
+++ b/contrib/libs/antlr4_cpp_runtime/src/tree/xpath/XPathLexer.h
@@ -1,5 +1,5 @@
-// Generated from XPathLexer.g4 by ANTLR 4.9.3
+// Generated from XPathLexer.g4 by ANTLR 4.13.1
#pragma once
@@ -7,10 +7,12 @@
#include "antlr4-runtime.h"
+
+
class XPathLexer : public antlr4::Lexer {
public:
enum {
- TOKEN_REF = 1, RULE_REF = 2, ANYWHERE = 3, ROOT = 4, WILDCARD = 5, BANG = 6,
+ TOKEN_REF = 1, RULE_REF = 2, ANYWHERE = 3, ROOT = 4, WILDCARD = 5, BANG = 6,
ID = 7, STRING = 8
};
@@ -18,30 +20,34 @@ public:
~XPathLexer() override;
- virtual std::string getGrammarFileName() const override;
- virtual const std::vector<std::string>& getRuleNames() const override;
+ std::string getGrammarFileName() const override;
+
+ const std::vector<std::string>& getRuleNames() const override;
- virtual const std::vector<std::string>& getChannelNames() const override;
+ const std::vector<std::string>& getChannelNames() const override;
- virtual const std::vector<std::string>& getModeNames() const override;
+ const std::vector<std::string>& getModeNames() const override;
- virtual const antlr4::dfa::Vocabulary& getVocabulary() const override;
+ const antlr4::dfa::Vocabulary& getVocabulary() const override;
- virtual antlr4::atn::SerializedATNView getSerializedATN() const override;
+ antlr4::atn::SerializedATNView getSerializedATN() const override;
- virtual const antlr4::atn::ATN& getATN() const override;
+ const antlr4::atn::ATN& getATN() const override;
- virtual void action(antlr4::RuleContext *context, size_t ruleIndex, size_t actionIndex) override;
+ void action(antlr4::RuleContext *context, size_t ruleIndex, size_t actionIndex) override;
// By default the static state used to implement the lexer is lazily initialized during the first
// call to the constructor. You can call this function if you wish to initialize the static state
// ahead of time.
static void initialize();
+
private:
+
// Individual action functions triggered by action() above.
void IDAction(antlr4::RuleContext *context, size_t actionIndex);
// Individual semantic predicate functions triggered by sempred() above.
+
};