From a4bc611fd5874d1c09ebb0bb91689b806631d8e0 Mon Sep 17 00:00:00 2001 From: Mike Lischke Date: Mon, 6 Jun 2016 15:55:27 +0200 Subject: [PATCH] Changed namespaces + fixed runtime tests. - Changed namespace chain (org::antlr::v4::runtime) to just antlr4 in all files. - Fixed runtime tests for that. - Added conversion of the xpath code, which compiles now (no tests, tho, as there are runtime tests for it). - Removed TestRig stuff. That doesn't work in C++. --- .../v4/test/runtime/cpp/BaseCppTest.java | 4 +- runtime/Cpp/demo/Mac/antlr4-cpp-demo/main.cpp | 2 +- .../Mac/antlrcpp Tests/InputHandlingTests.mm | 4 +- .../demo/Mac/antlrcpp Tests/MiscClassTests.mm | 4 +- .../demo/Mac/antlrcpp Tests/antlrcpp_Tests.mm | 4 +- .../antlrcpp.xcodeproj/project.pbxproj | 186 ++++++++++- runtime/Cpp/runtime/src/ANTLRErrorListener.h | 10 +- runtime/Cpp/runtime/src/ANTLRErrorStrategy.h | 10 +- runtime/Cpp/runtime/src/ANTLRFileStream.cpp | 2 +- runtime/Cpp/runtime/src/ANTLRFileStream.h | 10 +- runtime/Cpp/runtime/src/ANTLRInputStream.cpp | 2 +- runtime/Cpp/runtime/src/ANTLRInputStream.h | 10 +- runtime/Cpp/runtime/src/BailErrorStrategy.cpp | 2 +- runtime/Cpp/runtime/src/BailErrorStrategy.h | 10 +- runtime/Cpp/runtime/src/BaseErrorListener.cpp | 2 +- runtime/Cpp/runtime/src/BaseErrorListener.h | 10 +- .../Cpp/runtime/src/BufferedTokenStream.cpp | 2 +- runtime/Cpp/runtime/src/BufferedTokenStream.h | 10 +- runtime/Cpp/runtime/src/CharStream.cpp | 2 +- runtime/Cpp/runtime/src/CharStream.h | 10 +- runtime/Cpp/runtime/src/CommonToken.cpp | 6 +- runtime/Cpp/runtime/src/CommonToken.h | 10 +- .../Cpp/runtime/src/CommonTokenFactory.cpp | 2 +- runtime/Cpp/runtime/src/CommonTokenFactory.h | 10 +- runtime/Cpp/runtime/src/CommonTokenStream.cpp | 2 +- runtime/Cpp/runtime/src/CommonTokenStream.h | 10 +- .../Cpp/runtime/src/ConsoleErrorListener.cpp | 2 +- .../Cpp/runtime/src/ConsoleErrorListener.h | 10 +- .../Cpp/runtime/src/DefaultErrorStrategy.cpp | 2 +- .../Cpp/runtime/src/DefaultErrorStrategy.h | 10 +- .../runtime/src/DiagnosticErrorListener.cpp | 2 +- .../Cpp/runtime/src/DiagnosticErrorListener.h | 10 +- runtime/Cpp/runtime/src/Exceptions.cpp | 2 +- runtime/Cpp/runtime/src/Exceptions.h | 10 +- .../runtime/src/FailedPredicateException.cpp | 2 +- .../runtime/src/FailedPredicateException.h | 10 +- runtime/Cpp/runtime/src/IRecognizer.h | 10 +- .../runtime/src/InputMismatchException.cpp | 2 +- .../Cpp/runtime/src/InputMismatchException.h | 10 +- runtime/Cpp/runtime/src/IntStream.cpp | 2 +- runtime/Cpp/runtime/src/IntStream.h | 10 +- .../runtime/src/InterpreterRuleContext.cpp | 2 +- .../Cpp/runtime/src/InterpreterRuleContext.h | 10 +- runtime/Cpp/runtime/src/Lexer.cpp | 2 +- runtime/Cpp/runtime/src/Lexer.h | 10 +- runtime/Cpp/runtime/src/LexerInterpreter.cpp | 2 +- runtime/Cpp/runtime/src/LexerInterpreter.h | 10 +- .../runtime/src/LexerNoViableAltException.cpp | 2 +- .../runtime/src/LexerNoViableAltException.h | 10 +- runtime/Cpp/runtime/src/ListTokenSource.cpp | 2 +- runtime/Cpp/runtime/src/ListTokenSource.h | 10 +- .../Cpp/runtime/src/NoViableAltException.cpp | 2 +- .../Cpp/runtime/src/NoViableAltException.h | 10 +- runtime/Cpp/runtime/src/Parser.cpp | 2 +- runtime/Cpp/runtime/src/Parser.h | 10 +- runtime/Cpp/runtime/src/ParserInterpreter.cpp | 4 +- runtime/Cpp/runtime/src/ParserInterpreter.h | 10 +- runtime/Cpp/runtime/src/ParserRuleContext.cpp | 2 +- runtime/Cpp/runtime/src/ParserRuleContext.h | 10 +- .../Cpp/runtime/src/ProxyErrorListener.cpp | 2 +- runtime/Cpp/runtime/src/ProxyErrorListener.h | 10 +- .../Cpp/runtime/src/RecognitionException.cpp | 2 +- .../Cpp/runtime/src/RecognitionException.h | 13 +- runtime/Cpp/runtime/src/Recognizer.cpp | 2 +- runtime/Cpp/runtime/src/Recognizer.h | 10 +- runtime/Cpp/runtime/src/RuleContext.cpp | 2 +- runtime/Cpp/runtime/src/RuleContext.h | 10 +- .../Cpp/runtime/src/RuleContextWithAltNum.cpp | 4 +- .../Cpp/runtime/src/RuleContextWithAltNum.h | 10 +- runtime/Cpp/runtime/src/RuntimeMetaData.cpp | 2 +- runtime/Cpp/runtime/src/RuntimeMetaData.h | 10 +- runtime/Cpp/runtime/src/Token.cpp | 2 +- runtime/Cpp/runtime/src/Token.h | 10 +- runtime/Cpp/runtime/src/TokenFactory.h | 10 +- runtime/Cpp/runtime/src/TokenSource.h | 10 +- runtime/Cpp/runtime/src/TokenStream.cpp | 2 +- runtime/Cpp/runtime/src/TokenStream.h | 10 +- .../Cpp/runtime/src/TokenStreamRewriter.cpp | 4 +- runtime/Cpp/runtime/src/TokenStreamRewriter.h | 10 +- .../Cpp/runtime/src/UnbufferedCharStream.cpp | 2 +- .../Cpp/runtime/src/UnbufferedCharStream.h | 10 +- .../Cpp/runtime/src/UnbufferedTokenStream.cpp | 2 +- .../Cpp/runtime/src/UnbufferedTokenStream.h | 10 +- runtime/Cpp/runtime/src/Vocabulary.h | 10 +- runtime/Cpp/runtime/src/VocabularyImpl.cpp | 2 +- runtime/Cpp/runtime/src/VocabularyImpl.h | 10 +- runtime/Cpp/runtime/src/WritableToken.h | 10 +- runtime/Cpp/runtime/src/antlr4-runtime.h | 12 +- runtime/Cpp/runtime/src/atn/ATN.cpp | 4 +- runtime/Cpp/runtime/src/atn/ATN.h | 10 +- runtime/Cpp/runtime/src/atn/ATNConfig.cpp | 2 +- runtime/Cpp/runtime/src/atn/ATNConfig.h | 12 +- runtime/Cpp/runtime/src/atn/ATNConfigSet.cpp | 2 +- runtime/Cpp/runtime/src/atn/ATNConfigSet.h | 10 +- .../src/atn/ATNDeserializationOptions.cpp | 2 +- .../src/atn/ATNDeserializationOptions.h | 10 +- .../Cpp/runtime/src/atn/ATNDeserializer.cpp | 4 +- runtime/Cpp/runtime/src/atn/ATNDeserializer.h | 10 +- runtime/Cpp/runtime/src/atn/ATNSerializer.cpp | 2 +- runtime/Cpp/runtime/src/atn/ATNSerializer.h | 10 +- runtime/Cpp/runtime/src/atn/ATNSimulator.cpp | 6 +- runtime/Cpp/runtime/src/atn/ATNSimulator.h | 10 +- runtime/Cpp/runtime/src/atn/ATNState.cpp | 2 +- runtime/Cpp/runtime/src/atn/ATNState.h | 10 +- runtime/Cpp/runtime/src/atn/ATNType.h | 10 +- .../src/atn/AbstractPredicateTransition.cpp | 2 +- .../src/atn/AbstractPredicateTransition.h | 10 +- .../Cpp/runtime/src/atn/ActionTransition.cpp | 2 +- .../Cpp/runtime/src/atn/ActionTransition.h | 11 +- runtime/Cpp/runtime/src/atn/AmbiguityInfo.cpp | 4 +- runtime/Cpp/runtime/src/atn/AmbiguityInfo.h | 10 +- .../src/atn/ArrayPredictionContext.cpp | 2 +- .../runtime/src/atn/ArrayPredictionContext.h | 10 +- .../Cpp/runtime/src/atn/AtomTransition.cpp | 4 +- runtime/Cpp/runtime/src/atn/AtomTransition.h | 10 +- .../runtime/src/atn/BasicBlockStartState.cpp | 2 +- .../runtime/src/atn/BasicBlockStartState.h | 10 +- runtime/Cpp/runtime/src/atn/BasicState.cpp | 2 +- runtime/Cpp/runtime/src/atn/BasicState.h | 10 +- runtime/Cpp/runtime/src/atn/BlockEndState.cpp | 2 +- runtime/Cpp/runtime/src/atn/BlockEndState.h | 10 +- runtime/Cpp/runtime/src/atn/BlockStartState.h | 10 +- runtime/Cpp/runtime/src/atn/ConfigLookup.h | 10 +- .../src/atn/ContextSensitivityInfo.cpp | 4 +- .../runtime/src/atn/ContextSensitivityInfo.h | 10 +- .../Cpp/runtime/src/atn/DecisionEventInfo.cpp | 4 +- .../Cpp/runtime/src/atn/DecisionEventInfo.h | 10 +- runtime/Cpp/runtime/src/atn/DecisionInfo.cpp | 2 +- runtime/Cpp/runtime/src/atn/DecisionInfo.h | 10 +- runtime/Cpp/runtime/src/atn/DecisionState.cpp | 2 +- runtime/Cpp/runtime/src/atn/DecisionState.h | 10 +- .../src/atn/EmptyPredictionContext.cpp | 2 +- .../runtime/src/atn/EmptyPredictionContext.h | 10 +- .../Cpp/runtime/src/atn/EpsilonTransition.cpp | 2 +- .../Cpp/runtime/src/atn/EpsilonTransition.h | 10 +- runtime/Cpp/runtime/src/atn/ErrorInfo.cpp | 4 +- runtime/Cpp/runtime/src/atn/ErrorInfo.h | 10 +- runtime/Cpp/runtime/src/atn/LL1Analyzer.cpp | 4 +- runtime/Cpp/runtime/src/atn/LL1Analyzer.h | 10 +- .../Cpp/runtime/src/atn/LexerATNConfig.cpp | 2 +- runtime/Cpp/runtime/src/atn/LexerATNConfig.h | 10 +- .../Cpp/runtime/src/atn/LexerATNSimulator.cpp | 6 +- .../Cpp/runtime/src/atn/LexerATNSimulator.h | 10 +- runtime/Cpp/runtime/src/atn/LexerAction.h | 10 +- .../runtime/src/atn/LexerActionExecutor.cpp | 6 +- .../Cpp/runtime/src/atn/LexerActionExecutor.h | 10 +- runtime/Cpp/runtime/src/atn/LexerActionType.h | 10 +- .../runtime/src/atn/LexerChannelAction.cpp | 4 +- .../Cpp/runtime/src/atn/LexerChannelAction.h | 12 +- .../Cpp/runtime/src/atn/LexerCustomAction.cpp | 6 +- .../Cpp/runtime/src/atn/LexerCustomAction.h | 10 +- .../src/atn/LexerIndexedCustomAction.cpp | 6 +- .../src/atn/LexerIndexedCustomAction.h | 10 +- .../Cpp/runtime/src/atn/LexerModeAction.cpp | 6 +- runtime/Cpp/runtime/src/atn/LexerModeAction.h | 10 +- .../Cpp/runtime/src/atn/LexerMoreAction.cpp | 6 +- runtime/Cpp/runtime/src/atn/LexerMoreAction.h | 10 +- .../runtime/src/atn/LexerPopModeAction.cpp | 6 +- .../Cpp/runtime/src/atn/LexerPopModeAction.h | 10 +- .../runtime/src/atn/LexerPushModeAction.cpp | 6 +- .../Cpp/runtime/src/atn/LexerPushModeAction.h | 10 +- .../Cpp/runtime/src/atn/LexerSkipAction.cpp | 6 +- runtime/Cpp/runtime/src/atn/LexerSkipAction.h | 10 +- .../Cpp/runtime/src/atn/LexerTypeAction.cpp | 6 +- runtime/Cpp/runtime/src/atn/LexerTypeAction.h | 10 +- .../runtime/src/atn/LookaheadEventInfo.cpp | 4 +- .../Cpp/runtime/src/atn/LookaheadEventInfo.h | 10 +- runtime/Cpp/runtime/src/atn/LoopEndState.cpp | 2 +- runtime/Cpp/runtime/src/atn/LoopEndState.h | 10 +- .../Cpp/runtime/src/atn/NotSetTransition.cpp | 4 +- .../Cpp/runtime/src/atn/NotSetTransition.h | 10 +- .../runtime/src/atn/OrderedATNConfigSet.cpp | 2 +- .../Cpp/runtime/src/atn/OrderedATNConfigSet.h | 10 +- runtime/Cpp/runtime/src/atn/ParseInfo.cpp | 2 +- runtime/Cpp/runtime/src/atn/ParseInfo.h | 10 +- .../runtime/src/atn/ParserATNSimulator.cpp | 4 +- .../Cpp/runtime/src/atn/ParserATNSimulator.h | 10 +- .../runtime/src/atn/PlusBlockStartState.cpp | 2 +- .../Cpp/runtime/src/atn/PlusBlockStartState.h | 10 +- .../Cpp/runtime/src/atn/PlusLoopbackState.cpp | 2 +- .../Cpp/runtime/src/atn/PlusLoopbackState.h | 10 +- .../src/atn/PrecedencePredicateTransition.cpp | 2 +- .../src/atn/PrecedencePredicateTransition.h | 10 +- .../Cpp/runtime/src/atn/PredicateEvalInfo.cpp | 4 +- .../Cpp/runtime/src/atn/PredicateEvalInfo.h | 10 +- .../runtime/src/atn/PredicateTransition.cpp | 2 +- .../Cpp/runtime/src/atn/PredicateTransition.h | 10 +- .../Cpp/runtime/src/atn/PredictionContext.cpp | 6 +- .../Cpp/runtime/src/atn/PredictionContext.h | 10 +- .../Cpp/runtime/src/atn/PredictionMode.cpp | 4 +- runtime/Cpp/runtime/src/atn/PredictionMode.h | 10 +- .../runtime/src/atn/ProfilingATNSimulator.cpp | 6 +- .../runtime/src/atn/ProfilingATNSimulator.h | 10 +- .../Cpp/runtime/src/atn/RangeTransition.cpp | 4 +- runtime/Cpp/runtime/src/atn/RangeTransition.h | 10 +- .../Cpp/runtime/src/atn/RuleStartState.cpp | 2 +- runtime/Cpp/runtime/src/atn/RuleStartState.h | 10 +- runtime/Cpp/runtime/src/atn/RuleStopState.cpp | 2 +- runtime/Cpp/runtime/src/atn/RuleStopState.h | 10 +- .../Cpp/runtime/src/atn/RuleTransition.cpp | 2 +- runtime/Cpp/runtime/src/atn/RuleTransition.h | 10 +- .../Cpp/runtime/src/atn/SemanticContext.cpp | 4 +- runtime/Cpp/runtime/src/atn/SemanticContext.h | 12 +- runtime/Cpp/runtime/src/atn/SetTransition.cpp | 4 +- runtime/Cpp/runtime/src/atn/SetTransition.h | 10 +- .../src/atn/SingletonPredictionContext.cpp | 2 +- .../src/atn/SingletonPredictionContext.h | 10 +- .../runtime/src/atn/StarBlockStartState.cpp | 2 +- .../Cpp/runtime/src/atn/StarBlockStartState.h | 10 +- .../runtime/src/atn/StarLoopEntryState.cpp | 2 +- .../Cpp/runtime/src/atn/StarLoopEntryState.h | 10 +- .../Cpp/runtime/src/atn/StarLoopbackState.cpp | 2 +- .../Cpp/runtime/src/atn/StarLoopbackState.h | 10 +- .../Cpp/runtime/src/atn/TokensStartState.cpp | 2 +- .../Cpp/runtime/src/atn/TokensStartState.h | 10 +- runtime/Cpp/runtime/src/atn/Transition.cpp | 4 +- runtime/Cpp/runtime/src/atn/Transition.h | 10 +- .../runtime/src/atn/WildcardTransition.cpp | 2 +- .../Cpp/runtime/src/atn/WildcardTransition.h | 10 +- runtime/Cpp/runtime/src/dfa/DFA.cpp | 4 +- runtime/Cpp/runtime/src/dfa/DFA.h | 10 +- runtime/Cpp/runtime/src/dfa/DFASerializer.cpp | 2 +- runtime/Cpp/runtime/src/dfa/DFASerializer.h | 10 +- runtime/Cpp/runtime/src/dfa/DFAState.cpp | 4 +- runtime/Cpp/runtime/src/dfa/DFAState.h | 10 +- .../runtime/src/dfa/LexerDFASerializer.cpp | 2 +- .../Cpp/runtime/src/dfa/LexerDFASerializer.h | 10 +- runtime/Cpp/runtime/src/misc/Interval.cpp | 2 +- runtime/Cpp/runtime/src/misc/Interval.h | 10 +- runtime/Cpp/runtime/src/misc/IntervalSet.cpp | 6 +- runtime/Cpp/runtime/src/misc/IntervalSet.h | 12 +- runtime/Cpp/runtime/src/misc/MurmurHash.cpp | 2 +- runtime/Cpp/runtime/src/misc/MurmurHash.h | 10 +- runtime/Cpp/runtime/src/misc/Predicate.h | 10 +- runtime/Cpp/runtime/src/misc/TestRig.cpp | 236 ------------- runtime/Cpp/runtime/src/support/Arrays.cpp | 2 +- runtime/Cpp/runtime/src/support/Arrays.h | 2 +- .../Cpp/runtime/src/support/Declarations.h | 316 +++++++++--------- .../src/tree/AbstractParseTreeVisitor.h | 10 +- runtime/Cpp/runtime/src/tree/ErrorNode.h | 10 +- .../Cpp/runtime/src/tree/ErrorNodeImpl.cpp | 6 +- runtime/Cpp/runtime/src/tree/ErrorNodeImpl.h | 10 +- runtime/Cpp/runtime/src/tree/ParseTree.h | 10 +- .../Cpp/runtime/src/tree/ParseTreeListener.h | 10 +- .../Cpp/runtime/src/tree/ParseTreeProperty.h | 10 +- .../Cpp/runtime/src/tree/ParseTreeVisitor.h | 10 +- .../Cpp/runtime/src/tree/ParseTreeWalker.cpp | 2 +- .../Cpp/runtime/src/tree/ParseTreeWalker.h | 10 +- runtime/Cpp/runtime/src/tree/RuleNode.h | 13 +- runtime/Cpp/runtime/src/tree/SyntaxTree.h | 10 +- runtime/Cpp/runtime/src/tree/TerminalNode.h | 10 +- .../Cpp/runtime/src/tree/TerminalNodeImpl.cpp | 4 +- .../Cpp/runtime/src/tree/TerminalNodeImpl.h | 10 +- runtime/Cpp/runtime/src/tree/Tree.cpp | 2 +- runtime/Cpp/runtime/src/tree/Tree.h | 10 +- runtime/Cpp/runtime/src/tree/Trees.cpp | 6 +- runtime/Cpp/runtime/src/tree/Trees.h | 10 +- runtime/Cpp/runtime/src/tree/pattern/Chunk.h | 10 +- .../src/tree/pattern/ParseTreeMatch.cpp | 4 +- .../runtime/src/tree/pattern/ParseTreeMatch.h | 10 +- .../src/tree/pattern/ParseTreePattern.cpp | 33 +- .../src/tree/pattern/ParseTreePattern.h | 20 +- .../tree/pattern/ParseTreePatternMatcher.cpp | 6 +- .../tree/pattern/ParseTreePatternMatcher.h | 10 +- .../runtime/src/tree/pattern/RuleTagToken.cpp | 6 +- .../runtime/src/tree/pattern/RuleTagToken.h | 10 +- .../Cpp/runtime/src/tree/pattern/TagChunk.cpp | 2 +- .../Cpp/runtime/src/tree/pattern/TagChunk.h | 10 +- .../runtime/src/tree/pattern/TextChunk.cpp | 2 +- .../Cpp/runtime/src/tree/pattern/TextChunk.h | 10 +- .../src/tree/pattern/TokenTagToken.cpp | 2 +- .../runtime/src/tree/pattern/TokenTagToken.h | 10 +- runtime/Cpp/runtime/src/tree/xpath/XPath.cpp | 179 ++++++++++ runtime/Cpp/runtime/src/tree/xpath/XPath.h | 113 +++++++ .../runtime/src/tree/xpath/XPathElement.cpp | 54 +++ .../TestRig.h => tree/xpath/XPathElement.h} | 75 ++--- .../Cpp/runtime/src/tree/xpath/XPathLexer.cpp | 232 ++++++++----- .../Cpp/runtime/src/tree/xpath/XPathLexer.g4 | 64 ++++ .../Cpp/runtime/src/tree/xpath/XPathLexer.h | 103 +++--- .../runtime/src/tree/xpath/XPathLexer.tokens | 12 + .../tree/xpath/XPathLexerErrorListener.cpp | 38 +++ .../src/tree/xpath/XPathLexerErrorListener.h | 48 +++ .../tree/xpath/XPathRuleAnywhereElement.cpp | 46 +++ .../src/tree/xpath/XPathRuleAnywhereElement.h | 53 +++ .../src/tree/xpath/XPathRuleElement.cpp | 56 ++++ .../runtime/src/tree/xpath/XPathRuleElement.h | 52 +++ .../tree/xpath/XPathTokenAnywhereElement.cpp | 46 +++ .../tree/xpath/XPathTokenAnywhereElement.h | 51 +++ .../src/tree/xpath/XPathTokenElement.cpp | 59 ++++ .../src/tree/xpath/XPathTokenElement.h | 52 +++ .../xpath/XPathWildcardAnywhereElement.cpp | 49 +++ .../tree/xpath/XPathWildcardAnywhereElement.h | 49 +++ .../src/tree/xpath/XPathWildcardElement.cpp | 53 +++ .../src/tree/xpath/XPathWildcardElement.h | 49 +++ .../v4/tool/templates/codegen/Cpp/Cpp.stg | 2 +- .../v4/tool/templates/codegen/Cpp/Files.stg | 10 +- 296 files changed, 2194 insertions(+), 1963 deletions(-) delete mode 100755 runtime/Cpp/runtime/src/misc/TestRig.cpp create mode 100755 runtime/Cpp/runtime/src/tree/xpath/XPath.cpp create mode 100755 runtime/Cpp/runtime/src/tree/xpath/XPath.h create mode 100755 runtime/Cpp/runtime/src/tree/xpath/XPathElement.cpp rename runtime/Cpp/runtime/src/{misc/TestRig.h => tree/xpath/XPathElement.h} (53%) mode change 100755 => 100644 runtime/Cpp/runtime/src/tree/xpath/XPathLexer.cpp create mode 100644 runtime/Cpp/runtime/src/tree/xpath/XPathLexer.g4 mode change 100755 => 100644 runtime/Cpp/runtime/src/tree/xpath/XPathLexer.h create mode 100644 runtime/Cpp/runtime/src/tree/xpath/XPathLexer.tokens create mode 100755 runtime/Cpp/runtime/src/tree/xpath/XPathLexerErrorListener.cpp create mode 100755 runtime/Cpp/runtime/src/tree/xpath/XPathLexerErrorListener.h create mode 100755 runtime/Cpp/runtime/src/tree/xpath/XPathRuleAnywhereElement.cpp create mode 100755 runtime/Cpp/runtime/src/tree/xpath/XPathRuleAnywhereElement.h create mode 100755 runtime/Cpp/runtime/src/tree/xpath/XPathRuleElement.cpp create mode 100755 runtime/Cpp/runtime/src/tree/xpath/XPathRuleElement.h create mode 100755 runtime/Cpp/runtime/src/tree/xpath/XPathTokenAnywhereElement.cpp create mode 100755 runtime/Cpp/runtime/src/tree/xpath/XPathTokenAnywhereElement.h create mode 100755 runtime/Cpp/runtime/src/tree/xpath/XPathTokenElement.cpp create mode 100755 runtime/Cpp/runtime/src/tree/xpath/XPathTokenElement.h create mode 100755 runtime/Cpp/runtime/src/tree/xpath/XPathWildcardAnywhereElement.cpp create mode 100755 runtime/Cpp/runtime/src/tree/xpath/XPathWildcardAnywhereElement.h create mode 100755 runtime/Cpp/runtime/src/tree/xpath/XPathWildcardElement.cpp create mode 100755 runtime/Cpp/runtime/src/tree/xpath/XPathWildcardElement.h diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/cpp/BaseCppTest.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/cpp/BaseCppTest.java index e449be07b..1c18c5a44 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/cpp/BaseCppTest.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/cpp/BaseCppTest.java @@ -888,7 +888,7 @@ public abstract class BaseCppTest { + "\n" + "#include \"support/StringUtils.h\"\n" + "\n" - + "using namespace org::antlr::v4::runtime;\n" + + "using namespace antlr4;\n" + "\n" + "class TreeShapeListener : public tree::ParseTreeListener {\n" + "public:\n" @@ -953,7 +953,7 @@ public abstract class BaseCppTest { + "\n" + "#include \"support/StringUtils.h\"\n" + "\n" - + "using namespace org::antlr::v4::runtime;\n" + + "using namespace antlr4;\n" + "\n" + "int main(int argc, const char* argv[]) {\n" + " std::wifstream stream;\n" diff --git a/runtime/Cpp/demo/Mac/antlr4-cpp-demo/main.cpp b/runtime/Cpp/demo/Mac/antlr4-cpp-demo/main.cpp index 87ccaaa56..5fa0afdbc 100644 --- a/runtime/Cpp/demo/Mac/antlr4-cpp-demo/main.cpp +++ b/runtime/Cpp/demo/Mac/antlr4-cpp-demo/main.cpp @@ -12,7 +12,7 @@ #include "TParser.h" using namespace antlrcpptest; -using namespace org::antlr::v4::runtime; +using namespace antlr4; int main(int , const char **) { ANTLRInputStream input(u8"🍴 = 🍐 + \"😎\";(((x * π))) * µ + ∰; a + (x * (y ? 0 : 1) + z);"); diff --git a/runtime/Cpp/demo/Mac/antlrcpp Tests/InputHandlingTests.mm b/runtime/Cpp/demo/Mac/antlrcpp Tests/InputHandlingTests.mm index a9afca63f..6ad5dd37d 100644 --- a/runtime/Cpp/demo/Mac/antlrcpp Tests/InputHandlingTests.mm +++ b/runtime/Cpp/demo/Mac/antlrcpp Tests/InputHandlingTests.mm @@ -36,8 +36,8 @@ #include "StringUtils.h" using namespace antlrcpp; -using namespace org::antlr::v4::runtime; -using namespace org::antlr::v4::runtime::misc; +using namespace antlr4; +using namespace antlr4::misc; @interface InputHandlingTests : XCTestCase diff --git a/runtime/Cpp/demo/Mac/antlrcpp Tests/MiscClassTests.mm b/runtime/Cpp/demo/Mac/antlrcpp Tests/MiscClassTests.mm index db80ee147..25c55dd97 100644 --- a/runtime/Cpp/demo/Mac/antlrcpp Tests/MiscClassTests.mm +++ b/runtime/Cpp/demo/Mac/antlrcpp Tests/MiscClassTests.mm @@ -37,8 +37,8 @@ #include "Lexer.h" #include "CPPUtils.h" -using namespace org::antlr::v4::runtime; -using namespace org::antlr::v4::runtime::misc; +using namespace antlr4; +using namespace antlr4::misc; using namespace antlrcpp; @interface MiscClassTests : XCTestCase diff --git a/runtime/Cpp/demo/Mac/antlrcpp Tests/antlrcpp_Tests.mm b/runtime/Cpp/demo/Mac/antlrcpp Tests/antlrcpp_Tests.mm index da02b6b17..ebc265ba0 100644 --- a/runtime/Cpp/demo/Mac/antlrcpp Tests/antlrcpp_Tests.mm +++ b/runtime/Cpp/demo/Mac/antlrcpp Tests/antlrcpp_Tests.mm @@ -36,7 +36,7 @@ #include -using namespace org::antlr::v4::runtime; +using namespace antlr4; @interface antlrcpp_Tests : XCTestCase @@ -59,7 +59,7 @@ using namespace org::antlr::v4::runtime; std::vector decisionToDFA; atn::ATN atn; - org::antlr::v4::runtime::atn::ParserATNSimulator foo(nullptr, atn, decisionToDFA, nullptr); + antlr4::atn::ParserATNSimulator foo(nullptr, atn, decisionToDFA, nullptr); } catch (std::exception &e) { diff --git a/runtime/Cpp/runtime/antlrcpp.xcodeproj/project.pbxproj b/runtime/Cpp/runtime/antlrcpp.xcodeproj/project.pbxproj index 1ab2bbb56..af9bcc1da 100644 --- a/runtime/Cpp/runtime/antlrcpp.xcodeproj/project.pbxproj +++ b/runtime/Cpp/runtime/antlrcpp.xcodeproj/project.pbxproj @@ -582,12 +582,6 @@ 276E5F741CDB57AA003FF4B4 /* Predicate.h in Headers */ = {isa = PBXBuildFile; fileRef = 276E5CD11CDB57AA003FF4B4 /* Predicate.h */; }; 276E5F751CDB57AA003FF4B4 /* Predicate.h in Headers */ = {isa = PBXBuildFile; fileRef = 276E5CD11CDB57AA003FF4B4 /* Predicate.h */; }; 276E5F761CDB57AA003FF4B4 /* Predicate.h in Headers */ = {isa = PBXBuildFile; fileRef = 276E5CD11CDB57AA003FF4B4 /* Predicate.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 276E5F771CDB57AA003FF4B4 /* TestRig.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 276E5CD21CDB57AA003FF4B4 /* TestRig.cpp */; }; - 276E5F781CDB57AA003FF4B4 /* TestRig.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 276E5CD21CDB57AA003FF4B4 /* TestRig.cpp */; }; - 276E5F791CDB57AA003FF4B4 /* TestRig.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 276E5CD21CDB57AA003FF4B4 /* TestRig.cpp */; }; - 276E5F7A1CDB57AA003FF4B4 /* TestRig.h in Headers */ = {isa = PBXBuildFile; fileRef = 276E5CD31CDB57AA003FF4B4 /* TestRig.h */; }; - 276E5F7B1CDB57AA003FF4B4 /* TestRig.h in Headers */ = {isa = PBXBuildFile; fileRef = 276E5CD31CDB57AA003FF4B4 /* TestRig.h */; }; - 276E5F7C1CDB57AA003FF4B4 /* TestRig.h in Headers */ = {isa = PBXBuildFile; fileRef = 276E5CD31CDB57AA003FF4B4 /* TestRig.h */; settings = {ATTRIBUTES = (Public, ); }; }; 276E5F7D1CDB57AA003FF4B4 /* NoViableAltException.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 276E5CD41CDB57AA003FF4B4 /* NoViableAltException.cpp */; }; 276E5F7E1CDB57AA003FF4B4 /* NoViableAltException.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 276E5CD41CDB57AA003FF4B4 /* NoViableAltException.cpp */; }; 276E5F7F1CDB57AA003FF4B4 /* NoViableAltException.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 276E5CD41CDB57AA003FF4B4 /* NoViableAltException.cpp */; }; @@ -836,6 +830,66 @@ 27AC52D01CE773A80093AAAB /* antlr4-runtime.h in Headers */ = {isa = PBXBuildFile; fileRef = 27AC52CF1CE773A80093AAAB /* antlr4-runtime.h */; }; 27AC52D11CE773A80093AAAB /* antlr4-runtime.h in Headers */ = {isa = PBXBuildFile; fileRef = 27AC52CF1CE773A80093AAAB /* antlr4-runtime.h */; }; 27AC52D21CE773A80093AAAB /* antlr4-runtime.h in Headers */ = {isa = PBXBuildFile; fileRef = 27AC52CF1CE773A80093AAAB /* antlr4-runtime.h */; }; + 27DB449D1D045537007E790B /* XPath.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 27DB448B1D045537007E790B /* XPath.cpp */; }; + 27DB449E1D045537007E790B /* XPath.h in Headers */ = {isa = PBXBuildFile; fileRef = 27DB448C1D045537007E790B /* XPath.h */; }; + 27DB449F1D045537007E790B /* XPathElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 27DB448D1D045537007E790B /* XPathElement.cpp */; }; + 27DB44A01D045537007E790B /* XPathElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 27DB448E1D045537007E790B /* XPathElement.h */; }; + 27DB44A11D045537007E790B /* XPathLexerErrorListener.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 27DB448F1D045537007E790B /* XPathLexerErrorListener.cpp */; }; + 27DB44A21D045537007E790B /* XPathLexerErrorListener.h in Headers */ = {isa = PBXBuildFile; fileRef = 27DB44901D045537007E790B /* XPathLexerErrorListener.h */; }; + 27DB44A31D045537007E790B /* XPathRuleAnywhereElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 27DB44911D045537007E790B /* XPathRuleAnywhereElement.cpp */; }; + 27DB44A41D045537007E790B /* XPathRuleAnywhereElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 27DB44921D045537007E790B /* XPathRuleAnywhereElement.h */; }; + 27DB44A51D045537007E790B /* XPathRuleElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 27DB44931D045537007E790B /* XPathRuleElement.cpp */; }; + 27DB44A61D045537007E790B /* XPathRuleElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 27DB44941D045537007E790B /* XPathRuleElement.h */; }; + 27DB44A71D045537007E790B /* XPathTokenAnywhereElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 27DB44951D045537007E790B /* XPathTokenAnywhereElement.cpp */; }; + 27DB44A81D045537007E790B /* XPathTokenAnywhereElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 27DB44961D045537007E790B /* XPathTokenAnywhereElement.h */; }; + 27DB44A91D045537007E790B /* XPathTokenElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 27DB44971D045537007E790B /* XPathTokenElement.cpp */; }; + 27DB44AA1D045537007E790B /* XPathTokenElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 27DB44981D045537007E790B /* XPathTokenElement.h */; }; + 27DB44AB1D045537007E790B /* XPathWildcardAnywhereElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 27DB44991D045537007E790B /* XPathWildcardAnywhereElement.cpp */; }; + 27DB44AC1D045537007E790B /* XPathWildcardAnywhereElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 27DB449A1D045537007E790B /* XPathWildcardAnywhereElement.h */; }; + 27DB44AD1D045537007E790B /* XPathWildcardElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 27DB449B1D045537007E790B /* XPathWildcardElement.cpp */; }; + 27DB44AE1D045537007E790B /* XPathWildcardElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 27DB449C1D045537007E790B /* XPathWildcardElement.h */; }; + 27DB44B11D0463CC007E790B /* XPathLexer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 27DB44AF1D0463CC007E790B /* XPathLexer.cpp */; }; + 27DB44B21D0463CC007E790B /* XPathLexer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 27DB44AF1D0463CC007E790B /* XPathLexer.cpp */; }; + 27DB44B31D0463CC007E790B /* XPathLexer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 27DB44AF1D0463CC007E790B /* XPathLexer.cpp */; }; + 27DB44B41D0463CC007E790B /* XPathLexer.h in Headers */ = {isa = PBXBuildFile; fileRef = 27DB44B01D0463CC007E790B /* XPathLexer.h */; }; + 27DB44B51D0463CC007E790B /* XPathLexer.h in Headers */ = {isa = PBXBuildFile; fileRef = 27DB44B01D0463CC007E790B /* XPathLexer.h */; }; + 27DB44B61D0463CC007E790B /* XPathLexer.h in Headers */ = {isa = PBXBuildFile; fileRef = 27DB44B01D0463CC007E790B /* XPathLexer.h */; }; + 27DB44B71D0463DA007E790B /* XPath.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 27DB448B1D045537007E790B /* XPath.cpp */; }; + 27DB44B81D0463DA007E790B /* XPath.h in Headers */ = {isa = PBXBuildFile; fileRef = 27DB448C1D045537007E790B /* XPath.h */; }; + 27DB44B91D0463DA007E790B /* XPathElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 27DB448D1D045537007E790B /* XPathElement.cpp */; }; + 27DB44BA1D0463DA007E790B /* XPathElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 27DB448E1D045537007E790B /* XPathElement.h */; }; + 27DB44BB1D0463DA007E790B /* XPathLexerErrorListener.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 27DB448F1D045537007E790B /* XPathLexerErrorListener.cpp */; }; + 27DB44BC1D0463DA007E790B /* XPathLexerErrorListener.h in Headers */ = {isa = PBXBuildFile; fileRef = 27DB44901D045537007E790B /* XPathLexerErrorListener.h */; }; + 27DB44BD1D0463DA007E790B /* XPathRuleAnywhereElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 27DB44911D045537007E790B /* XPathRuleAnywhereElement.cpp */; }; + 27DB44BE1D0463DA007E790B /* XPathRuleAnywhereElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 27DB44921D045537007E790B /* XPathRuleAnywhereElement.h */; }; + 27DB44BF1D0463DA007E790B /* XPathRuleElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 27DB44931D045537007E790B /* XPathRuleElement.cpp */; }; + 27DB44C01D0463DA007E790B /* XPathRuleElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 27DB44941D045537007E790B /* XPathRuleElement.h */; }; + 27DB44C11D0463DA007E790B /* XPathTokenAnywhereElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 27DB44951D045537007E790B /* XPathTokenAnywhereElement.cpp */; }; + 27DB44C21D0463DA007E790B /* XPathTokenAnywhereElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 27DB44961D045537007E790B /* XPathTokenAnywhereElement.h */; }; + 27DB44C31D0463DA007E790B /* XPathTokenElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 27DB44971D045537007E790B /* XPathTokenElement.cpp */; }; + 27DB44C41D0463DA007E790B /* XPathTokenElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 27DB44981D045537007E790B /* XPathTokenElement.h */; }; + 27DB44C51D0463DA007E790B /* XPathWildcardAnywhereElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 27DB44991D045537007E790B /* XPathWildcardAnywhereElement.cpp */; }; + 27DB44C61D0463DA007E790B /* XPathWildcardAnywhereElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 27DB449A1D045537007E790B /* XPathWildcardAnywhereElement.h */; }; + 27DB44C71D0463DA007E790B /* XPathWildcardElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 27DB449B1D045537007E790B /* XPathWildcardElement.cpp */; }; + 27DB44C81D0463DA007E790B /* XPathWildcardElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 27DB449C1D045537007E790B /* XPathWildcardElement.h */; }; + 27DB44C91D0463DB007E790B /* XPath.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 27DB448B1D045537007E790B /* XPath.cpp */; }; + 27DB44CA1D0463DB007E790B /* XPath.h in Headers */ = {isa = PBXBuildFile; fileRef = 27DB448C1D045537007E790B /* XPath.h */; }; + 27DB44CB1D0463DB007E790B /* XPathElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 27DB448D1D045537007E790B /* XPathElement.cpp */; }; + 27DB44CC1D0463DB007E790B /* XPathElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 27DB448E1D045537007E790B /* XPathElement.h */; }; + 27DB44CD1D0463DB007E790B /* XPathLexerErrorListener.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 27DB448F1D045537007E790B /* XPathLexerErrorListener.cpp */; }; + 27DB44CE1D0463DB007E790B /* XPathLexerErrorListener.h in Headers */ = {isa = PBXBuildFile; fileRef = 27DB44901D045537007E790B /* XPathLexerErrorListener.h */; }; + 27DB44CF1D0463DB007E790B /* XPathRuleAnywhereElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 27DB44911D045537007E790B /* XPathRuleAnywhereElement.cpp */; }; + 27DB44D01D0463DB007E790B /* XPathRuleAnywhereElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 27DB44921D045537007E790B /* XPathRuleAnywhereElement.h */; }; + 27DB44D11D0463DB007E790B /* XPathRuleElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 27DB44931D045537007E790B /* XPathRuleElement.cpp */; }; + 27DB44D21D0463DB007E790B /* XPathRuleElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 27DB44941D045537007E790B /* XPathRuleElement.h */; }; + 27DB44D31D0463DB007E790B /* XPathTokenAnywhereElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 27DB44951D045537007E790B /* XPathTokenAnywhereElement.cpp */; }; + 27DB44D41D0463DB007E790B /* XPathTokenAnywhereElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 27DB44961D045537007E790B /* XPathTokenAnywhereElement.h */; }; + 27DB44D51D0463DB007E790B /* XPathTokenElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 27DB44971D045537007E790B /* XPathTokenElement.cpp */; }; + 27DB44D61D0463DB007E790B /* XPathTokenElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 27DB44981D045537007E790B /* XPathTokenElement.h */; }; + 27DB44D71D0463DB007E790B /* XPathWildcardAnywhereElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 27DB44991D045537007E790B /* XPathWildcardAnywhereElement.cpp */; }; + 27DB44D81D0463DB007E790B /* XPathWildcardAnywhereElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 27DB449A1D045537007E790B /* XPathWildcardAnywhereElement.h */; }; + 27DB44D91D0463DB007E790B /* XPathWildcardElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 27DB449B1D045537007E790B /* XPathWildcardElement.cpp */; }; + 27DB44DA1D0463DB007E790B /* XPathWildcardElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 27DB449C1D045537007E790B /* XPathWildcardElement.h */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ @@ -1034,8 +1088,6 @@ 276E5CCE1CDB57AA003FF4B4 /* MurmurHash.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MurmurHash.cpp; sourceTree = ""; }; 276E5CCF1CDB57AA003FF4B4 /* MurmurHash.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MurmurHash.h; sourceTree = ""; }; 276E5CD11CDB57AA003FF4B4 /* Predicate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Predicate.h; sourceTree = ""; }; - 276E5CD21CDB57AA003FF4B4 /* TestRig.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TestRig.cpp; sourceTree = ""; }; - 276E5CD31CDB57AA003FF4B4 /* TestRig.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TestRig.h; sourceTree = ""; }; 276E5CD41CDB57AA003FF4B4 /* NoViableAltException.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NoViableAltException.cpp; sourceTree = ""; wrapsLines = 0; }; 276E5CD51CDB57AA003FF4B4 /* NoViableAltException.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NoViableAltException.h; sourceTree = ""; }; 276E5CD61CDB57AA003FF4B4 /* Parser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Parser.cpp; sourceTree = ""; }; @@ -1047,7 +1099,7 @@ 276E5CDC1CDB57AA003FF4B4 /* ProxyErrorListener.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ProxyErrorListener.cpp; sourceTree = ""; }; 276E5CDD1CDB57AA003FF4B4 /* ProxyErrorListener.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ProxyErrorListener.h; sourceTree = ""; }; 276E5CDE1CDB57AA003FF4B4 /* RecognitionException.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RecognitionException.cpp; sourceTree = ""; }; - 276E5CDF1CDB57AA003FF4B4 /* RecognitionException.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RecognitionException.h; sourceTree = ""; }; + 276E5CDF1CDB57AA003FF4B4 /* RecognitionException.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RecognitionException.h; sourceTree = ""; wrapsLines = 0; }; 276E5CE01CDB57AA003FF4B4 /* Recognizer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Recognizer.cpp; sourceTree = ""; }; 276E5CE11CDB57AA003FF4B4 /* Recognizer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Recognizer.h; sourceTree = ""; }; 276E5CE21CDB57AA003FF4B4 /* RuleContext.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RuleContext.cpp; sourceTree = ""; wrapsLines = 0; }; @@ -1119,6 +1171,26 @@ 27874F1D1CCB7A0700AF1C53 /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = System/Library/Frameworks/CoreFoundation.framework; sourceTree = SDKROOT; }; 2794D8551CE7821B00FADD0F /* antlr4-common.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "antlr4-common.h"; sourceTree = ""; }; 27AC52CF1CE773A80093AAAB /* antlr4-runtime.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "antlr4-runtime.h"; sourceTree = ""; }; + 27DB448B1D045537007E790B /* XPath.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XPath.cpp; sourceTree = ""; wrapsLines = 0; }; + 27DB448C1D045537007E790B /* XPath.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XPath.h; sourceTree = ""; wrapsLines = 0; }; + 27DB448D1D045537007E790B /* XPathElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XPathElement.cpp; sourceTree = ""; wrapsLines = 0; }; + 27DB448E1D045537007E790B /* XPathElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XPathElement.h; sourceTree = ""; wrapsLines = 0; }; + 27DB448F1D045537007E790B /* XPathLexerErrorListener.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XPathLexerErrorListener.cpp; sourceTree = ""; wrapsLines = 0; }; + 27DB44901D045537007E790B /* XPathLexerErrorListener.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XPathLexerErrorListener.h; sourceTree = ""; wrapsLines = 0; }; + 27DB44911D045537007E790B /* XPathRuleAnywhereElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XPathRuleAnywhereElement.cpp; sourceTree = ""; wrapsLines = 0; }; + 27DB44921D045537007E790B /* XPathRuleAnywhereElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XPathRuleAnywhereElement.h; sourceTree = ""; wrapsLines = 0; }; + 27DB44931D045537007E790B /* XPathRuleElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XPathRuleElement.cpp; sourceTree = ""; wrapsLines = 0; }; + 27DB44941D045537007E790B /* XPathRuleElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XPathRuleElement.h; sourceTree = ""; wrapsLines = 0; }; + 27DB44951D045537007E790B /* XPathTokenAnywhereElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XPathTokenAnywhereElement.cpp; sourceTree = ""; wrapsLines = 0; }; + 27DB44961D045537007E790B /* XPathTokenAnywhereElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XPathTokenAnywhereElement.h; sourceTree = ""; wrapsLines = 0; }; + 27DB44971D045537007E790B /* XPathTokenElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XPathTokenElement.cpp; sourceTree = ""; wrapsLines = 0; }; + 27DB44981D045537007E790B /* XPathTokenElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XPathTokenElement.h; sourceTree = ""; wrapsLines = 0; }; + 27DB44991D045537007E790B /* XPathWildcardAnywhereElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XPathWildcardAnywhereElement.cpp; sourceTree = ""; wrapsLines = 0; }; + 27DB449A1D045537007E790B /* XPathWildcardAnywhereElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XPathWildcardAnywhereElement.h; sourceTree = ""; wrapsLines = 0; }; + 27DB449B1D045537007E790B /* XPathWildcardElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XPathWildcardElement.cpp; sourceTree = ""; wrapsLines = 0; }; + 27DB449C1D045537007E790B /* XPathWildcardElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XPathWildcardElement.h; sourceTree = ""; wrapsLines = 0; }; + 27DB44AF1D0463CC007E790B /* XPathLexer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XPathLexer.cpp; sourceTree = ""; }; + 27DB44B01D0463CC007E790B /* XPathLexer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XPathLexer.h; sourceTree = ""; wrapsLines = 0; }; 37C147171B4D5A04008EDDDB /* libantlrcpp_static.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libantlrcpp_static.a; sourceTree = BUILT_PRODUCTS_DIR; }; 37D727AA1867AF1E007B6D10 /* antlrcpp.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = antlrcpp.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; /* End PBXFileReference section */ @@ -1419,8 +1491,6 @@ 276E5CCE1CDB57AA003FF4B4 /* MurmurHash.cpp */, 276E5CCF1CDB57AA003FF4B4 /* MurmurHash.h */, 276E5CD11CDB57AA003FF4B4 /* Predicate.h */, - 276E5CD21CDB57AA003FF4B4 /* TestRig.cpp */, - 276E5CD31CDB57AA003FF4B4 /* TestRig.h */, ); path = misc; sourceTree = ""; @@ -1446,6 +1516,7 @@ isa = PBXGroup; children = ( 276E5D061CDB57AA003FF4B4 /* pattern */, + 27DB448A1D045537007E790B /* xpath */, 276E5CFA1CDB57AA003FF4B4 /* AbstractParseTreeVisitor.h */, 276E5CFB1CDB57AA003FF4B4 /* ErrorNode.h */, 276E5CFC1CDB57AA003FF4B4 /* ErrorNodeImpl.cpp */, @@ -1500,6 +1571,33 @@ name = "Linked Frameworks"; sourceTree = ""; }; + 27DB448A1D045537007E790B /* xpath */ = { + isa = PBXGroup; + children = ( + 27DB448B1D045537007E790B /* XPath.cpp */, + 27DB448C1D045537007E790B /* XPath.h */, + 27DB448D1D045537007E790B /* XPathElement.cpp */, + 27DB448E1D045537007E790B /* XPathElement.h */, + 27DB44AF1D0463CC007E790B /* XPathLexer.cpp */, + 27DB44B01D0463CC007E790B /* XPathLexer.h */, + 27DB448F1D045537007E790B /* XPathLexerErrorListener.cpp */, + 27DB44901D045537007E790B /* XPathLexerErrorListener.h */, + 27DB44911D045537007E790B /* XPathRuleAnywhereElement.cpp */, + 27DB44921D045537007E790B /* XPathRuleAnywhereElement.h */, + 27DB44931D045537007E790B /* XPathRuleElement.cpp */, + 27DB44941D045537007E790B /* XPathRuleElement.h */, + 27DB44951D045537007E790B /* XPathTokenAnywhereElement.cpp */, + 27DB44961D045537007E790B /* XPathTokenAnywhereElement.h */, + 27DB44971D045537007E790B /* XPathTokenElement.cpp */, + 27DB44981D045537007E790B /* XPathTokenElement.h */, + 27DB44991D045537007E790B /* XPathWildcardAnywhereElement.cpp */, + 27DB449A1D045537007E790B /* XPathWildcardAnywhereElement.h */, + 27DB449B1D045537007E790B /* XPathWildcardElement.cpp */, + 27DB449C1D045537007E790B /* XPathWildcardElement.h */, + ); + path = xpath; + sourceTree = ""; + }; 37D727A11867AF1E007B6D10 = { isa = PBXGroup; children = ( @@ -1537,8 +1635,10 @@ 276E5DA81CDB57AA003FF4B4 /* BlockStartState.h in Headers */, 276E5FE21CDB57AA003FF4B4 /* TokenStream.h in Headers */, 276E5D6F1CDB57AA003FF4B4 /* ATNDeserializationOptions.h in Headers */, + 27DB44CA1D0463DB007E790B /* XPath.h in Headers */, 276E5EDD1CDB57AA003FF4B4 /* BaseErrorListener.h in Headers */, 276E5DB71CDB57AA003FF4B4 /* DecisionEventInfo.h in Headers */, + 27DB44D01D0463DB007E790B /* XPathRuleAnywhereElement.h in Headers */, 27AC52D21CE773A80093AAAB /* antlr4-runtime.h in Headers */, 276E5E2C1CDB57AA003FF4B4 /* LL1Analyzer.h in Headers */, 276E5D7B1CDB57AA003FF4B4 /* ATNSerializer.h in Headers */, @@ -1546,6 +1646,7 @@ 276E5E1A1CDB57AA003FF4B4 /* LexerPushModeAction.h in Headers */, 276E5ECB1CDB57AA003FF4B4 /* Transition.h in Headers */, 276E5EA11CDB57AA003FF4B4 /* SemanticContext.h in Headers */, + 27DB44DA1D0463DB007E790B /* XPathWildcardElement.h in Headers */, 276E5F5E1CDB57AA003FF4B4 /* ListTokenSource.h in Headers */, 276E5F8E1CDB57AA003FF4B4 /* ParserInterpreter.h in Headers */, 276E603C1CDB57AA003FF4B4 /* RuleNode.h in Headers */, @@ -1602,15 +1703,17 @@ 276E5F251CDB57AA003FF4B4 /* DiagnosticErrorListener.h in Headers */, 276E5E141CDB57AA003FF4B4 /* LexerPopModeAction.h in Headers */, 276E5ED71CDB57AA003FF4B4 /* BailErrorStrategy.h in Headers */, + 27DB44CE1D0463DB007E790B /* XPathLexerErrorListener.h in Headers */, 276E5DCF1CDB57AA003FF4B4 /* EpsilonTransition.h in Headers */, 276E5FBE1CDB57AA003FF4B4 /* Declarations.h in Headers */, 276E600C1CDB57AA003FF4B4 /* ParseTreeWalker.h in Headers */, 276E5E771CDB57AA003FF4B4 /* PredictionContext.h in Headers */, 276E60151CDB57AA003FF4B4 /* ParseTreeMatch.h in Headers */, - 276E5F7C1CDB57AA003FF4B4 /* TestRig.h in Headers */, + 27DB44CC1D0463DB007E790B /* XPathElement.h in Headers */, 276E5F581CDB57AA003FF4B4 /* LexerNoViableAltException.h in Headers */, 276E5D811CDB57AA003FF4B4 /* ATNSimulator.h in Headers */, 276E5F461CDB57AA003FF4B4 /* IRecognizer.h in Headers */, + 27DB44B61D0463CC007E790B /* XPathLexer.h in Headers */, 276E5FC41CDB57AA003FF4B4 /* guid.h in Headers */, 276E602D1CDB57AA003FF4B4 /* TagChunk.h in Headers */, 276E5E951CDB57AA003FF4B4 /* RuleStopState.h in Headers */, @@ -1635,6 +1738,7 @@ 276E5F9A1CDB57AA003FF4B4 /* ProxyErrorListener.h in Headers */, 276E5E411CDB57AA003FF4B4 /* NotSetTransition.h in Headers */, 276E5E891CDB57AA003FF4B4 /* RangeTransition.h in Headers */, + 27DB44D21D0463DB007E790B /* XPathRuleElement.h in Headers */, 276E601B1CDB57AA003FF4B4 /* ParseTreePattern.h in Headers */, 276E5DFC1CDB57AA003FF4B4 /* LexerCustomAction.h in Headers */, 276E5FE81CDB57AA003FF4B4 /* TokenStreamRewriter.h in Headers */, @@ -1642,6 +1746,7 @@ 276E5DAB1CDB57AA003FF4B4 /* ConfigLookup.h in Headers */, 276E5DD51CDB57AA003FF4B4 /* ErrorInfo.h in Headers */, 276E5E261CDB57AA003FF4B4 /* LexerTypeAction.h in Headers */, + 27DB44D61D0463DB007E790B /* XPathTokenElement.h in Headers */, 276E5DE41CDB57AA003FF4B4 /* LexerActionType.h in Headers */, 276E5D511CDB57AA003FF4B4 /* AmbiguityInfo.h in Headers */, 276E5E711CDB57AA003FF4B4 /* PredicateTransition.h in Headers */, @@ -1670,6 +1775,8 @@ 276E5F701CDB57AA003FF4B4 /* MurmurHash.h in Headers */, 276E60211CDB57AA003FF4B4 /* ParseTreePatternMatcher.h in Headers */, 276E5D631CDB57AA003FF4B4 /* ATNConfig.h in Headers */, + 27DB44D41D0463DB007E790B /* XPathTokenAnywhereElement.h in Headers */, + 27DB44D81D0463DB007E790B /* XPathWildcardAnywhereElement.h in Headers */, 276E5E4D1CDB57AA003FF4B4 /* ParseInfo.h in Headers */, 276E5F881CDB57AA003FF4B4 /* Parser.h in Headers */, 276E603F1CDB57AA003FF4B4 /* SyntaxTree.h in Headers */, @@ -1701,6 +1808,7 @@ 276E5EDC1CDB57AA003FF4B4 /* BaseErrorListener.h in Headers */, 276E5DB61CDB57AA003FF4B4 /* DecisionEventInfo.h in Headers */, 276E5E2B1CDB57AA003FF4B4 /* LL1Analyzer.h in Headers */, + 27DB44BA1D0463DA007E790B /* XPathElement.h in Headers */, 276E5D7A1CDB57AA003FF4B4 /* ATNSerializer.h in Headers */, 276E5EAC1CDB57AA003FF4B4 /* SingletonPredictionContext.h in Headers */, 276E5E191CDB57AA003FF4B4 /* LexerPushModeAction.h in Headers */, @@ -1713,9 +1821,12 @@ 276E5F4B1CDB57AA003FF4B4 /* Lexer.h in Headers */, 276E5F631CDB57AA003FF4B4 /* Interval.h in Headers */, 276E5DA41CDB57AA003FF4B4 /* BlockEndState.h in Headers */, + 27DB44C21D0463DA007E790B /* XPathTokenAnywhereElement.h in Headers */, 276E5E821CDB57AA003FF4B4 /* ProfilingATNSimulator.h in Headers */, + 27DB44C41D0463DA007E790B /* XPathTokenElement.h in Headers */, 276E5D981CDB57AA003FF4B4 /* BasicBlockStartState.h in Headers */, 276E5E9A1CDB57AA003FF4B4 /* RuleTransition.h in Headers */, + 27DB44B81D0463DA007E790B /* XPath.h in Headers */, 276E60021CDB57AA003FF4B4 /* ParseTreeProperty.h in Headers */, 276E5D8C1CDB57AA003FF4B4 /* ATNType.h in Headers */, 276E5FFC1CDB57AA003FF4B4 /* ParseTreeListener.h in Headers */, @@ -1731,6 +1842,7 @@ 276E5E371CDB57AA003FF4B4 /* LoopEndState.h in Headers */, 276E5D681CDB57AA003FF4B4 /* ATNConfigSet.h in Headers */, 276E5D381CDB57AA003FF4B4 /* ANTLRFileStream.h in Headers */, + 27DB44C01D0463DA007E790B /* XPathRuleElement.h in Headers */, 276E5D2F1CDB57AA003FF4B4 /* ANTLRErrorListener.h in Headers */, 276E5FC91CDB57AA003FF4B4 /* StringUtils.h in Headers */, 276E5EF41CDB57AA003FF4B4 /* CommonTokenFactory.h in Headers */, @@ -1741,10 +1853,12 @@ 276E5FCF1CDB57AA003FF4B4 /* Token.h in Headers */, 276E60411CDB57AA003FF4B4 /* TerminalNode.h in Headers */, 276E5D741CDB57AA003FF4B4 /* ATNDeserializer.h in Headers */, + 27DB44B51D0463CC007E790B /* XPathLexer.h in Headers */, 276E5D861CDB57AA003FF4B4 /* ATNState.h in Headers */, 276E5E7C1CDB57AA003FF4B4 /* PredictionMode.h in Headers */, 276E5EBE1CDB57AA003FF4B4 /* StarLoopEntryState.h in Headers */, 276E5F9F1CDB57AA003FF4B4 /* RecognitionException.h in Headers */, + 27DB44BE1D0463DA007E790B /* XPathRuleAnywhereElement.h in Headers */, 27745F071CE49C000067C6A3 /* RuntimeMetaData.h in Headers */, 276E5EA61CDB57AA003FF4B4 /* SetTransition.h in Headers */, 276E5F1E1CDB57AA003FF4B4 /* LexerDFASerializer.h in Headers */, @@ -1759,6 +1873,7 @@ 276E5DC81CDB57AA003FF4B4 /* EmptyPredictionContext.h in Headers */, 276E5D441CDB57AA003FF4B4 /* AbstractPredicateTransition.h in Headers */, 276E5F2A1CDB57AA003FF4B4 /* Exceptions.h in Headers */, + 27DB44C61D0463DA007E790B /* XPathWildcardAnywhereElement.h in Headers */, 276E5F241CDB57AA003FF4B4 /* DiagnosticErrorListener.h in Headers */, 276E5E131CDB57AA003FF4B4 /* LexerPopModeAction.h in Headers */, 276E5ED61CDB57AA003FF4B4 /* BailErrorStrategy.h in Headers */, @@ -1767,7 +1882,6 @@ 276E600B1CDB57AA003FF4B4 /* ParseTreeWalker.h in Headers */, 276E5E761CDB57AA003FF4B4 /* PredictionContext.h in Headers */, 276E60141CDB57AA003FF4B4 /* ParseTreeMatch.h in Headers */, - 276E5F7B1CDB57AA003FF4B4 /* TestRig.h in Headers */, 276E5F571CDB57AA003FF4B4 /* LexerNoViableAltException.h in Headers */, 276E5D801CDB57AA003FF4B4 /* ATNSimulator.h in Headers */, 276E5F451CDB57AA003FF4B4 /* IRecognizer.h in Headers */, @@ -1814,6 +1928,7 @@ 276E5E641CDB57AA003FF4B4 /* PrecedencePredicateTransition.h in Headers */, 276E5F061CDB57AA003FF4B4 /* DefaultErrorStrategy.h in Headers */, 276E5F3C1CDB57AA003FF4B4 /* InterpreterRuleContext.h in Headers */, + 27DB44BC1D0463DA007E790B /* XPathLexerErrorListener.h in Headers */, 276E5F121CDB57AA003FF4B4 /* DFASerializer.h in Headers */, 276E5F361CDB57AA003FF4B4 /* InputMismatchException.h in Headers */, 276E5FDB1CDB57AA003FF4B4 /* TokenSource.h in Headers */, @@ -1827,6 +1942,7 @@ 276E5EFA1CDB57AA003FF4B4 /* CommonTokenStream.h in Headers */, 276E5EB21CDB57AA003FF4B4 /* StarBlockStartState.h in Headers */, 276E5F6F1CDB57AA003FF4B4 /* MurmurHash.h in Headers */, + 27DB44C81D0463DA007E790B /* XPathWildcardElement.h in Headers */, 276E60201CDB57AA003FF4B4 /* ParseTreePatternMatcher.h in Headers */, 276E5D621CDB57AA003FF4B4 /* ATNConfig.h in Headers */, 276E5E4C1CDB57AA003FF4B4 /* ParseInfo.h in Headers */, @@ -1846,11 +1962,13 @@ files = ( 276E5FE91CDB57AA003FF4B4 /* AbstractParseTreeVisitor.h in Headers */, 27745F001CE49C000067C6A3 /* RuleContextWithAltNum.h in Headers */, + 27DB44AC1D045537007E790B /* XPathWildcardAnywhereElement.h in Headers */, 276E60311CDB57AA003FF4B4 /* TextChunk.h in Headers */, 276E5F411CDB57AA003FF4B4 /* IntStream.h in Headers */, 276E5D5B1CDB57AA003FF4B4 /* ATN.h in Headers */, 276E605E1CDB57AA003FF4B4 /* UnbufferedCharStream.h in Headers */, 276E5DD61CDB57AA003FF4B4 /* LexerAction.h in Headers */, + 27DB44A41D045537007E790B /* XPathRuleAnywhereElement.h in Headers */, 276E5FF51CDB57AA003FF4B4 /* ParseTree.h in Headers */, 27AC52D01CE773A80093AAAB /* antlr4-runtime.h in Headers */, 276E5DA61CDB57AA003FF4B4 /* BlockStartState.h in Headers */, @@ -1889,6 +2007,7 @@ 276E5E361CDB57AA003FF4B4 /* LoopEndState.h in Headers */, 276E5D671CDB57AA003FF4B4 /* ATNConfigSet.h in Headers */, 276E5D371CDB57AA003FF4B4 /* ANTLRFileStream.h in Headers */, + 27DB44B41D0463CC007E790B /* XPathLexer.h in Headers */, 276E5D2E1CDB57AA003FF4B4 /* ANTLRErrorListener.h in Headers */, 276E5FC81CDB57AA003FF4B4 /* StringUtils.h in Headers */, 276E5EF31CDB57AA003FF4B4 /* CommonTokenFactory.h in Headers */, @@ -1918,6 +2037,7 @@ 276E5D431CDB57AA003FF4B4 /* AbstractPredicateTransition.h in Headers */, 276E5F291CDB57AA003FF4B4 /* Exceptions.h in Headers */, 276E5F231CDB57AA003FF4B4 /* DiagnosticErrorListener.h in Headers */, + 27DB449E1D045537007E790B /* XPath.h in Headers */, 276E5E121CDB57AA003FF4B4 /* LexerPopModeAction.h in Headers */, 276E5ED51CDB57AA003FF4B4 /* BailErrorStrategy.h in Headers */, 276E5DCD1CDB57AA003FF4B4 /* EpsilonTransition.h in Headers */, @@ -1925,7 +2045,6 @@ 276E600A1CDB57AA003FF4B4 /* ParseTreeWalker.h in Headers */, 276E5E751CDB57AA003FF4B4 /* PredictionContext.h in Headers */, 276E60131CDB57AA003FF4B4 /* ParseTreeMatch.h in Headers */, - 276E5F7A1CDB57AA003FF4B4 /* TestRig.h in Headers */, 276E5F561CDB57AA003FF4B4 /* LexerNoViableAltException.h in Headers */, 276E5D7F1CDB57AA003FF4B4 /* ATNSimulator.h in Headers */, 276E5F441CDB57AA003FF4B4 /* IRecognizer.h in Headers */, @@ -1942,6 +2061,7 @@ 276E5D911CDB57AA003FF4B4 /* AtomTransition.h in Headers */, 276E604C1CDB57AA003FF4B4 /* Tree.h in Headers */, 276E5F501CDB57AA003FF4B4 /* LexerInterpreter.h in Headers */, + 27DB44AE1D045537007E790B /* XPathWildcardElement.h in Headers */, 276E60671CDB57AA003FF4B4 /* Vocabulary.h in Headers */, 276E5F2F1CDB57AA003FF4B4 /* FailedPredicateException.h in Headers */, 276E5E301CDB57AA003FF4B4 /* LookaheadEventInfo.h in Headers */, @@ -1949,6 +2069,7 @@ 276E606D1CDB57AA003FF4B4 /* VocabularyImpl.h in Headers */, 276E60521CDB57AA003FF4B4 /* Trees.h in Headers */, 276E5FB31CDB57AA003FF4B4 /* BitSet.h in Headers */, + 27DB44AA1D045537007E790B /* XPathTokenElement.h in Headers */, 276E5F981CDB57AA003FF4B4 /* ProxyErrorListener.h in Headers */, 276E5E3F1CDB57AA003FF4B4 /* NotSetTransition.h in Headers */, 276E5E871CDB57AA003FF4B4 /* RangeTransition.h in Headers */, @@ -1957,6 +2078,7 @@ 276E5FE61CDB57AA003FF4B4 /* TokenStreamRewriter.h in Headers */, 276E5DEE1CDB57AA003FF4B4 /* LexerATNSimulator.h in Headers */, 276E5DA91CDB57AA003FF4B4 /* ConfigLookup.h in Headers */, + 27DB44A61D045537007E790B /* XPathRuleElement.h in Headers */, 276E5DD31CDB57AA003FF4B4 /* ErrorInfo.h in Headers */, 276E5E241CDB57AA003FF4B4 /* LexerTypeAction.h in Headers */, 276E5DE21CDB57AA003FF4B4 /* LexerActionType.h in Headers */, @@ -1981,15 +2103,18 @@ 276E5EE11CDB57AA003FF4B4 /* BufferedTokenStream.h in Headers */, 276E5DAF1CDB57AA003FF4B4 /* ContextSensitivityInfo.h in Headers */, 276E5E001CDB57AA003FF4B4 /* LexerIndexedCustomAction.h in Headers */, + 27DB44A81D045537007E790B /* XPathTokenAnywhereElement.h in Headers */, 276E5FD41CDB57AA003FF4B4 /* TokenFactory.h in Headers */, 276E5EF91CDB57AA003FF4B4 /* CommonTokenStream.h in Headers */, 276E5EB11CDB57AA003FF4B4 /* StarBlockStartState.h in Headers */, 276E5F6E1CDB57AA003FF4B4 /* MurmurHash.h in Headers */, 276E601F1CDB57AA003FF4B4 /* ParseTreePatternMatcher.h in Headers */, 276E5D611CDB57AA003FF4B4 /* ATNConfig.h in Headers */, + 27DB44A21D045537007E790B /* XPathLexerErrorListener.h in Headers */, 276E5E4B1CDB57AA003FF4B4 /* ParseInfo.h in Headers */, 276E5F861CDB57AA003FF4B4 /* Parser.h in Headers */, 276E603D1CDB57AA003FF4B4 /* SyntaxTree.h in Headers */, + 27DB44A01D045537007E790B /* XPathElement.h in Headers */, 276E5DBB1CDB57AA003FF4B4 /* DecisionInfo.h in Headers */, 276E5DC11CDB57AA003FF4B4 /* DecisionState.h in Headers */, 276E5E691CDB57AA003FF4B4 /* PredicateEvalInfo.h in Headers */, @@ -2129,6 +2254,7 @@ 276E5E051CDB57AA003FF4B4 /* LexerModeAction.cpp in Sources */, 276E5F491CDB57AA003FF4B4 /* Lexer.cpp in Sources */, 276E5EDA1CDB57AA003FF4B4 /* BaseErrorListener.cpp in Sources */, + 27DB44C91D0463DB007E790B /* XPath.cpp in Sources */, 276E5DBA1CDB57AA003FF4B4 /* DecisionInfo.cpp in Sources */, 276E5F611CDB57AA003FF4B4 /* Interval.cpp in Sources */, 276E5F911CDB57AA003FF4B4 /* ParserRuleContext.cpp in Sources */, @@ -2137,7 +2263,9 @@ 276E5E7A1CDB57AA003FF4B4 /* PredictionMode.cpp in Sources */, 276E605D1CDB57AA003FF4B4 /* UnbufferedCharStream.cpp in Sources */, 276E5F341CDB57AA003FF4B4 /* InputMismatchException.cpp in Sources */, + 27DB44D91D0463DB007E790B /* XPathWildcardElement.cpp in Sources */, 276E5E741CDB57AA003FF4B4 /* PredictionContext.cpp in Sources */, + 27DB44CB1D0463DB007E790B /* XPathElement.cpp in Sources */, 276E5E171CDB57AA003FF4B4 /* LexerPushModeAction.cpp in Sources */, 276E5DA21CDB57AA003FF4B4 /* BlockEndState.cpp in Sources */, 276E5EF21CDB57AA003FF4B4 /* CommonTokenFactory.cpp in Sources */, @@ -2156,6 +2284,8 @@ 276E5FA31CDB57AA003FF4B4 /* Recognizer.cpp in Sources */, 276E5D6C1CDB57AA003FF4B4 /* ATNDeserializationOptions.cpp in Sources */, 276E60361CDB57AA003FF4B4 /* TokenTagToken.cpp in Sources */, + 27DB44D51D0463DB007E790B /* XPathTokenElement.cpp in Sources */, + 27DB44D11D0463DB007E790B /* XPathRuleElement.cpp in Sources */, 276E5DED1CDB57AA003FF4B4 /* LexerATNSimulator.cpp in Sources */, 276E606C1CDB57AA003FF4B4 /* VocabularyImpl.cpp in Sources */, 276E5F1C1CDB57AA003FF4B4 /* LexerDFASerializer.cpp in Sources */, @@ -2167,6 +2297,7 @@ 276E5D4E1CDB57AA003FF4B4 /* AmbiguityInfo.cpp in Sources */, 276E5F161CDB57AA003FF4B4 /* DFAState.cpp in Sources */, 276E60091CDB57AA003FF4B4 /* ParseTreeWalker.cpp in Sources */, + 27DB44CD1D0463DB007E790B /* XPathLexerErrorListener.cpp in Sources */, 276E5F9D1CDB57AA003FF4B4 /* RecognitionException.cpp in Sources */, 276E5E8C1CDB57AA003FF4B4 /* RuleStartState.cpp in Sources */, 276E5EA41CDB57AA003FF4B4 /* SetTransition.cpp in Sources */, @@ -2184,7 +2315,6 @@ 276E5ECE1CDB57AA003FF4B4 /* WildcardTransition.cpp in Sources */, 276E5E861CDB57AA003FF4B4 /* RangeTransition.cpp in Sources */, 276E5D7E1CDB57AA003FF4B4 /* ATNSimulator.cpp in Sources */, - 276E5F791CDB57AA003FF4B4 /* TestRig.cpp in Sources */, 276E5D9C1CDB57AA003FF4B4 /* BasicState.cpp in Sources */, 276E5FC11CDB57AA003FF4B4 /* guid.cpp in Sources */, 276E5E801CDB57AA003FF4B4 /* ProfilingATNSimulator.cpp in Sources */, @@ -2193,10 +2323,13 @@ 276E5F6D1CDB57AA003FF4B4 /* MurmurHash.cpp in Sources */, 276E5FDF1CDB57AA003FF4B4 /* TokenStream.cpp in Sources */, 276E5FF11CDB57AA003FF4B4 /* ErrorNodeImpl.cpp in Sources */, + 27DB44D71D0463DB007E790B /* XPathWildcardAnywhereElement.cpp in Sources */, 276E5D961CDB57AA003FF4B4 /* BasicBlockStartState.cpp in Sources */, 276E5E4A1CDB57AA003FF4B4 /* ParseInfo.cpp in Sources */, 276E5E3E1CDB57AA003FF4B4 /* NotSetTransition.cpp in Sources */, + 27DB44B31D0463CC007E790B /* XPathLexer.cpp in Sources */, 276E60301CDB57AA003FF4B4 /* TextChunk.cpp in Sources */, + 27DB44CF1D0463DB007E790B /* XPathRuleAnywhereElement.cpp in Sources */, 276E5E441CDB57AA003FF4B4 /* OrderedATNConfigSet.cpp in Sources */, 276E5DCC1CDB57AA003FF4B4 /* EpsilonTransition.cpp in Sources */, 276E5D5A1CDB57AA003FF4B4 /* ATN.cpp in Sources */, @@ -2227,6 +2360,7 @@ 276E5F4F1CDB57AA003FF4B4 /* LexerInterpreter.cpp in Sources */, 276E5E291CDB57AA003FF4B4 /* LL1Analyzer.cpp in Sources */, 276E5EB01CDB57AA003FF4B4 /* StarBlockStartState.cpp in Sources */, + 27DB44D31D0463DB007E790B /* XPathTokenAnywhereElement.cpp in Sources */, 276E5FB81CDB57AA003FF4B4 /* CPPUtils.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -2260,6 +2394,7 @@ 276E5E041CDB57AA003FF4B4 /* LexerModeAction.cpp in Sources */, 276E5F481CDB57AA003FF4B4 /* Lexer.cpp in Sources */, 276E5ED91CDB57AA003FF4B4 /* BaseErrorListener.cpp in Sources */, + 27DB44B71D0463DA007E790B /* XPath.cpp in Sources */, 276E5DB91CDB57AA003FF4B4 /* DecisionInfo.cpp in Sources */, 276E5F601CDB57AA003FF4B4 /* Interval.cpp in Sources */, 276E5F901CDB57AA003FF4B4 /* ParserRuleContext.cpp in Sources */, @@ -2268,7 +2403,9 @@ 276E5E791CDB57AA003FF4B4 /* PredictionMode.cpp in Sources */, 276E605C1CDB57AA003FF4B4 /* UnbufferedCharStream.cpp in Sources */, 276E5F331CDB57AA003FF4B4 /* InputMismatchException.cpp in Sources */, + 27DB44C71D0463DA007E790B /* XPathWildcardElement.cpp in Sources */, 276E5E731CDB57AA003FF4B4 /* PredictionContext.cpp in Sources */, + 27DB44B91D0463DA007E790B /* XPathElement.cpp in Sources */, 276E5E161CDB57AA003FF4B4 /* LexerPushModeAction.cpp in Sources */, 276E5DA11CDB57AA003FF4B4 /* BlockEndState.cpp in Sources */, 276E5EF11CDB57AA003FF4B4 /* CommonTokenFactory.cpp in Sources */, @@ -2287,6 +2424,8 @@ 276E5FA21CDB57AA003FF4B4 /* Recognizer.cpp in Sources */, 276E5D6B1CDB57AA003FF4B4 /* ATNDeserializationOptions.cpp in Sources */, 276E60351CDB57AA003FF4B4 /* TokenTagToken.cpp in Sources */, + 27DB44C31D0463DA007E790B /* XPathTokenElement.cpp in Sources */, + 27DB44BF1D0463DA007E790B /* XPathRuleElement.cpp in Sources */, 276E5DEC1CDB57AA003FF4B4 /* LexerATNSimulator.cpp in Sources */, 276E606B1CDB57AA003FF4B4 /* VocabularyImpl.cpp in Sources */, 276E5F1B1CDB57AA003FF4B4 /* LexerDFASerializer.cpp in Sources */, @@ -2298,6 +2437,7 @@ 276E5D4D1CDB57AA003FF4B4 /* AmbiguityInfo.cpp in Sources */, 276E5F151CDB57AA003FF4B4 /* DFAState.cpp in Sources */, 276E60081CDB57AA003FF4B4 /* ParseTreeWalker.cpp in Sources */, + 27DB44BB1D0463DA007E790B /* XPathLexerErrorListener.cpp in Sources */, 276E5F9C1CDB57AA003FF4B4 /* RecognitionException.cpp in Sources */, 276E5E8B1CDB57AA003FF4B4 /* RuleStartState.cpp in Sources */, 276E5EA31CDB57AA003FF4B4 /* SetTransition.cpp in Sources */, @@ -2315,7 +2455,6 @@ 276E5ECD1CDB57AA003FF4B4 /* WildcardTransition.cpp in Sources */, 276E5E851CDB57AA003FF4B4 /* RangeTransition.cpp in Sources */, 276E5D7D1CDB57AA003FF4B4 /* ATNSimulator.cpp in Sources */, - 276E5F781CDB57AA003FF4B4 /* TestRig.cpp in Sources */, 276E5D9B1CDB57AA003FF4B4 /* BasicState.cpp in Sources */, 276E5FC01CDB57AA003FF4B4 /* guid.cpp in Sources */, 276E5E7F1CDB57AA003FF4B4 /* ProfilingATNSimulator.cpp in Sources */, @@ -2324,10 +2463,13 @@ 276E5F6C1CDB57AA003FF4B4 /* MurmurHash.cpp in Sources */, 276E5FDE1CDB57AA003FF4B4 /* TokenStream.cpp in Sources */, 276E5FF01CDB57AA003FF4B4 /* ErrorNodeImpl.cpp in Sources */, + 27DB44C51D0463DA007E790B /* XPathWildcardAnywhereElement.cpp in Sources */, 276E5D951CDB57AA003FF4B4 /* BasicBlockStartState.cpp in Sources */, 276E5E491CDB57AA003FF4B4 /* ParseInfo.cpp in Sources */, 276E5E3D1CDB57AA003FF4B4 /* NotSetTransition.cpp in Sources */, + 27DB44B21D0463CC007E790B /* XPathLexer.cpp in Sources */, 276E602F1CDB57AA003FF4B4 /* TextChunk.cpp in Sources */, + 27DB44BD1D0463DA007E790B /* XPathRuleAnywhereElement.cpp in Sources */, 276E5E431CDB57AA003FF4B4 /* OrderedATNConfigSet.cpp in Sources */, 276E5DCB1CDB57AA003FF4B4 /* EpsilonTransition.cpp in Sources */, 276E5D591CDB57AA003FF4B4 /* ATN.cpp in Sources */, @@ -2358,6 +2500,7 @@ 276E5F4E1CDB57AA003FF4B4 /* LexerInterpreter.cpp in Sources */, 276E5E281CDB57AA003FF4B4 /* LL1Analyzer.cpp in Sources */, 276E5EAF1CDB57AA003FF4B4 /* StarBlockStartState.cpp in Sources */, + 27DB44C11D0463DA007E790B /* XPathTokenAnywhereElement.cpp in Sources */, 276E5FB71CDB57AA003FF4B4 /* CPPUtils.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -2374,6 +2517,7 @@ 276E5D521CDB57AA003FF4B4 /* ArrayPredictionContext.cpp in Sources */, 276E5F081CDB57AA003FF4B4 /* DFA.cpp in Sources */, 276E5E211CDB57AA003FF4B4 /* LexerTypeAction.cpp in Sources */, + 27DB449F1D045537007E790B /* XPathElement.cpp in Sources */, 276E5EC01CDB57AA003FF4B4 /* TokensStartState.cpp in Sources */, 276E5DB21CDB57AA003FF4B4 /* DecisionEventInfo.cpp in Sources */, 276E60431CDB57AA003FF4B4 /* TerminalNodeImpl.cpp in Sources */, @@ -2388,6 +2532,7 @@ 276E604F1CDB57AA003FF4B4 /* Trees.cpp in Sources */, 276E5EB41CDB57AA003FF4B4 /* StarLoopbackState.cpp in Sources */, 276E5E601CDB57AA003FF4B4 /* PrecedencePredicateTransition.cpp in Sources */, + 27DB44A31D045537007E790B /* XPathRuleAnywhereElement.cpp in Sources */, 276E5E031CDB57AA003FF4B4 /* LexerModeAction.cpp in Sources */, 276E5F471CDB57AA003FF4B4 /* Lexer.cpp in Sources */, 276E5ED81CDB57AA003FF4B4 /* BaseErrorListener.cpp in Sources */, @@ -2407,9 +2552,12 @@ 276E5E901CDB57AA003FF4B4 /* RuleStopState.cpp in Sources */, 276E60611CDB57AA003FF4B4 /* UnbufferedTokenStream.cpp in Sources */, 276E5DD91CDB57AA003FF4B4 /* LexerActionExecutor.cpp in Sources */, + 27DB449D1D045537007E790B /* XPath.cpp in Sources */, 276E5E9C1CDB57AA003FF4B4 /* SemanticContext.cpp in Sources */, + 27DB44AD1D045537007E790B /* XPathWildcardElement.cpp in Sources */, 276E5EC61CDB57AA003FF4B4 /* Transition.cpp in Sources */, 276E601C1CDB57AA003FF4B4 /* ParseTreePatternMatcher.cpp in Sources */, + 27DB44A51D045537007E790B /* XPathRuleElement.cpp in Sources */, 276E5F201CDB57AA003FF4B4 /* DiagnosticErrorListener.cpp in Sources */, 276E5D461CDB57AA003FF4B4 /* ActionTransition.cpp in Sources */, 276E60491CDB57AA003FF4B4 /* Tree.cpp in Sources */, @@ -2425,6 +2573,7 @@ 276E5DE51CDB57AA003FF4B4 /* LexerATNConfig.cpp in Sources */, 276E5F0E1CDB57AA003FF4B4 /* DFASerializer.cpp in Sources */, 276E5F2C1CDB57AA003FF4B4 /* FailedPredicateException.cpp in Sources */, + 27DB44A71D045537007E790B /* XPathTokenAnywhereElement.cpp in Sources */, 276E5F891CDB57AA003FF4B4 /* ParserInterpreter.cpp in Sources */, 276E5D4C1CDB57AA003FF4B4 /* AmbiguityInfo.cpp in Sources */, 276E5F141CDB57AA003FF4B4 /* DFAState.cpp in Sources */, @@ -2446,7 +2595,6 @@ 276E5ECC1CDB57AA003FF4B4 /* WildcardTransition.cpp in Sources */, 276E5E841CDB57AA003FF4B4 /* RangeTransition.cpp in Sources */, 276E5D7C1CDB57AA003FF4B4 /* ATNSimulator.cpp in Sources */, - 276E5F771CDB57AA003FF4B4 /* TestRig.cpp in Sources */, 276E5D9A1CDB57AA003FF4B4 /* BasicState.cpp in Sources */, 276E5FBF1CDB57AA003FF4B4 /* guid.cpp in Sources */, 276E5E7E1CDB57AA003FF4B4 /* ProfilingATNSimulator.cpp in Sources */, @@ -2463,13 +2611,16 @@ 276E5DCA1CDB57AA003FF4B4 /* EpsilonTransition.cpp in Sources */, 276E5D581CDB57AA003FF4B4 /* ATN.cpp in Sources */, 276E5EE41CDB57AA003FF4B4 /* CharStream.cpp in Sources */, + 27DB44AB1D045537007E790B /* XPathWildcardAnywhereElement.cpp in Sources */, 276E5EDE1CDB57AA003FF4B4 /* BufferedTokenStream.cpp in Sources */, 276E5F021CDB57AA003FF4B4 /* DefaultErrorStrategy.cpp in Sources */, 276E5D401CDB57AA003FF4B4 /* AbstractPredicateTransition.cpp in Sources */, 276E5E5A1CDB57AA003FF4B4 /* PlusLoopbackState.cpp in Sources */, 276E5E331CDB57AA003FF4B4 /* LoopEndState.cpp in Sources */, 276E5FE31CDB57AA003FF4B4 /* TokenStreamRewriter.cpp in Sources */, + 27DB44A11D045537007E790B /* XPathLexerErrorListener.cpp in Sources */, 276E5FA71CDB57AA003FF4B4 /* RuleContext.cpp in Sources */, + 27DB44B11D0463CC007E790B /* XPathLexer.cpp in Sources */, 276E5D5E1CDB57AA003FF4B4 /* ATNConfig.cpp in Sources */, 276E5EFC1CDB57AA003FF4B4 /* ConsoleErrorListener.cpp in Sources */, 276E5EA81CDB57AA003FF4B4 /* SingletonPredictionContext.cpp in Sources */, @@ -2489,6 +2640,7 @@ 276E5F4D1CDB57AA003FF4B4 /* LexerInterpreter.cpp in Sources */, 276E5E271CDB57AA003FF4B4 /* LL1Analyzer.cpp in Sources */, 276E5EAE1CDB57AA003FF4B4 /* StarBlockStartState.cpp in Sources */, + 27DB44A91D045537007E790B /* XPathTokenElement.cpp in Sources */, 276E5FB61CDB57AA003FF4B4 /* CPPUtils.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; diff --git a/runtime/Cpp/runtime/src/ANTLRErrorListener.h b/runtime/Cpp/runtime/src/ANTLRErrorListener.h index 13cc0fd79..069752ce8 100755 --- a/runtime/Cpp/runtime/src/ANTLRErrorListener.h +++ b/runtime/Cpp/runtime/src/ANTLRErrorListener.h @@ -37,10 +37,7 @@ namespace antlrcpp { class BitSet; } -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { /// How to emit recognition errors (an interface in Java). class ANTLR4CPP_PUBLIC ANTLRErrorListener { @@ -193,7 +190,4 @@ namespace runtime { int prediction, Ref configs) = 0; }; -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/ANTLRErrorStrategy.h b/runtime/Cpp/runtime/src/ANTLRErrorStrategy.h index 4293485cc..6f173ed32 100755 --- a/runtime/Cpp/runtime/src/ANTLRErrorStrategy.h +++ b/runtime/Cpp/runtime/src/ANTLRErrorStrategy.h @@ -33,10 +33,7 @@ #include "Token.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { /// /// The interface for defining strategies to deal with syntax errors encountered @@ -146,7 +143,4 @@ namespace runtime { virtual void reportError(Parser *recognizer, const RecognitionException &e) = 0; }; -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/ANTLRFileStream.cpp b/runtime/Cpp/runtime/src/ANTLRFileStream.cpp index d41cea557..9c4626856 100755 --- a/runtime/Cpp/runtime/src/ANTLRFileStream.cpp +++ b/runtime/Cpp/runtime/src/ANTLRFileStream.cpp @@ -31,7 +31,7 @@ #include "ANTLRFileStream.h" -using namespace org::antlr::v4::runtime; +using namespace antlr4; ANTLRFileStream::ANTLRFileStream(const std::string &fileName) { _fileName = fileName; diff --git a/runtime/Cpp/runtime/src/ANTLRFileStream.h b/runtime/Cpp/runtime/src/ANTLRFileStream.h index fe1db6812..11f278153 100755 --- a/runtime/Cpp/runtime/src/ANTLRFileStream.h +++ b/runtime/Cpp/runtime/src/ANTLRFileStream.h @@ -33,10 +33,7 @@ #include "ANTLRInputStream.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { /// This is an ANTLRInputStream that is loaded from a file all at once /// when you construct the object (or call load()). @@ -53,7 +50,4 @@ namespace runtime { virtual std::string getSourceName() const override; }; -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/ANTLRInputStream.cpp b/runtime/Cpp/runtime/src/ANTLRInputStream.cpp index 959d5821d..2de82788b 100755 --- a/runtime/Cpp/runtime/src/ANTLRInputStream.cpp +++ b/runtime/Cpp/runtime/src/ANTLRInputStream.cpp @@ -38,7 +38,7 @@ #include "ANTLRInputStream.h" -using namespace org::antlr::v4::runtime; +using namespace antlr4; using namespace antlrcpp; using misc::Interval; diff --git a/runtime/Cpp/runtime/src/ANTLRInputStream.h b/runtime/Cpp/runtime/src/ANTLRInputStream.h index dcd0a9533..d515b1504 100755 --- a/runtime/Cpp/runtime/src/ANTLRInputStream.h +++ b/runtime/Cpp/runtime/src/ANTLRInputStream.h @@ -33,10 +33,7 @@ #include "CharStream.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { // Vacuum all input from a stream and then treat it // like a string. Can also pass in a string or char[] to use. @@ -94,7 +91,4 @@ namespace runtime { void InitializeInstanceFields(); }; -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/BailErrorStrategy.cpp b/runtime/Cpp/runtime/src/BailErrorStrategy.cpp index 099e1872f..5439d26ec 100755 --- a/runtime/Cpp/runtime/src/BailErrorStrategy.cpp +++ b/runtime/Cpp/runtime/src/BailErrorStrategy.cpp @@ -36,7 +36,7 @@ #include "BailErrorStrategy.h" -using namespace org::antlr::v4::runtime; +using namespace antlr4; void BailErrorStrategy::recover(Parser *recognizer, std::exception_ptr e) { Ref context = recognizer->getContext(); diff --git a/runtime/Cpp/runtime/src/BailErrorStrategy.h b/runtime/Cpp/runtime/src/BailErrorStrategy.h index 6eb14033c..fd3719405 100755 --- a/runtime/Cpp/runtime/src/BailErrorStrategy.h +++ b/runtime/Cpp/runtime/src/BailErrorStrategy.h @@ -33,10 +33,7 @@ #include "DefaultErrorStrategy.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { /** * This implementation of {@link ANTLRErrorStrategy} responds to syntax errors @@ -87,7 +84,4 @@ namespace runtime { virtual void sync(Parser *recognizer) override; }; -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/BaseErrorListener.cpp b/runtime/Cpp/runtime/src/BaseErrorListener.cpp index 98e820cbb..6809f46c7 100755 --- a/runtime/Cpp/runtime/src/BaseErrorListener.cpp +++ b/runtime/Cpp/runtime/src/BaseErrorListener.cpp @@ -32,7 +32,7 @@ #include "BaseErrorListener.h" #include "RecognitionException.h" -using namespace org::antlr::v4::runtime; +using namespace antlr4; void BaseErrorListener::syntaxError(IRecognizer * /*recognizer*/, Ref /*offendingSymbol*/, size_t /*line*/, int /*charPositionInLine*/, const std::string &/*msg*/, std::exception_ptr /*e*/) { diff --git a/runtime/Cpp/runtime/src/BaseErrorListener.h b/runtime/Cpp/runtime/src/BaseErrorListener.h index e0eeee2a1..19bd2b7d9 100755 --- a/runtime/Cpp/runtime/src/BaseErrorListener.h +++ b/runtime/Cpp/runtime/src/BaseErrorListener.h @@ -37,10 +37,7 @@ namespace antlrcpp { class BitSet; } -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { /** * Provides an empty default implementation of {@link ANTLRErrorListener}. The @@ -62,7 +59,4 @@ namespace runtime { int prediction, Ref configs) override; }; -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/BufferedTokenStream.cpp b/runtime/Cpp/runtime/src/BufferedTokenStream.cpp index 6b776f19a..9a7a20064 100755 --- a/runtime/Cpp/runtime/src/BufferedTokenStream.cpp +++ b/runtime/Cpp/runtime/src/BufferedTokenStream.cpp @@ -38,7 +38,7 @@ #include "BufferedTokenStream.h" -using namespace org::antlr::v4::runtime; +using namespace antlr4; using namespace antlrcpp; BufferedTokenStream::BufferedTokenStream(TokenSource *tokenSource) : _tokenSource(tokenSource){ diff --git a/runtime/Cpp/runtime/src/BufferedTokenStream.h b/runtime/Cpp/runtime/src/BufferedTokenStream.h index 500c538a2..bd2ba0158 100755 --- a/runtime/Cpp/runtime/src/BufferedTokenStream.h +++ b/runtime/Cpp/runtime/src/BufferedTokenStream.h @@ -33,10 +33,7 @@ #include "TokenStream.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { /** * This implementation of {@link TokenStream} loads tokens from a @@ -224,7 +221,4 @@ namespace runtime { void InitializeInstanceFields(); }; -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/CharStream.cpp b/runtime/Cpp/runtime/src/CharStream.cpp index f2529c053..0870baab0 100755 --- a/runtime/Cpp/runtime/src/CharStream.cpp +++ b/runtime/Cpp/runtime/src/CharStream.cpp @@ -31,7 +31,7 @@ #include "CharStream.h" -using namespace org::antlr::v4::runtime; +using namespace antlr4; CharStream::~CharStream() { } diff --git a/runtime/Cpp/runtime/src/CharStream.h b/runtime/Cpp/runtime/src/CharStream.h index 50d09ec62..f2068a193 100755 --- a/runtime/Cpp/runtime/src/CharStream.h +++ b/runtime/Cpp/runtime/src/CharStream.h @@ -34,10 +34,7 @@ #include "IntStream.h" #include "misc/Interval.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { /// A source of characters for an ANTLR lexer. class ANTLR4CPP_PUBLIC CharStream : public IntStream { @@ -63,7 +60,4 @@ namespace runtime { virtual std::string toString() const = 0; }; -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/CommonToken.cpp b/runtime/Cpp/runtime/src/CommonToken.cpp index 47ae374bf..5fe82df21 100755 --- a/runtime/Cpp/runtime/src/CommonToken.cpp +++ b/runtime/Cpp/runtime/src/CommonToken.cpp @@ -37,7 +37,7 @@ #include "CommonToken.h" -using namespace org::antlr::v4::runtime; +using namespace antlr4; using namespace antlrcpp; const std::pair CommonToken::EMPTY_SOURCE; @@ -164,11 +164,11 @@ void CommonToken::setTokenIndex(int index) { _index = index; } -org::antlr::v4::runtime::TokenSource *CommonToken::getTokenSource() const { +antlr4::TokenSource *CommonToken::getTokenSource() const { return _source.first; } -org::antlr::v4::runtime::CharStream *CommonToken::getInputStream() const { +antlr4::CharStream *CommonToken::getInputStream() const { return _source.second; } diff --git a/runtime/Cpp/runtime/src/CommonToken.h b/runtime/Cpp/runtime/src/CommonToken.h index 33e4846f4..199c19119 100755 --- a/runtime/Cpp/runtime/src/CommonToken.h +++ b/runtime/Cpp/runtime/src/CommonToken.h @@ -33,10 +33,7 @@ #include "WritableToken.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { class ANTLR4CPP_PUBLIC CommonToken : public WritableToken { protected: @@ -183,7 +180,4 @@ namespace runtime { void InitializeInstanceFields(); }; -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/CommonTokenFactory.cpp b/runtime/Cpp/runtime/src/CommonTokenFactory.cpp index bff6db57e..9819472b3 100755 --- a/runtime/Cpp/runtime/src/CommonTokenFactory.cpp +++ b/runtime/Cpp/runtime/src/CommonTokenFactory.cpp @@ -35,7 +35,7 @@ #include "CommonTokenFactory.h" -using namespace org::antlr::v4::runtime; +using namespace antlr4; const Ref> CommonTokenFactory::DEFAULT = std::make_shared(); diff --git a/runtime/Cpp/runtime/src/CommonTokenFactory.h b/runtime/Cpp/runtime/src/CommonTokenFactory.h index f21e9e6d8..c6cb3ab5c 100755 --- a/runtime/Cpp/runtime/src/CommonTokenFactory.h +++ b/runtime/Cpp/runtime/src/CommonTokenFactory.h @@ -33,10 +33,7 @@ #include "TokenFactory.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { /** * This default implementation of {@link TokenFactory} creates @@ -100,7 +97,4 @@ namespace runtime { virtual Ref create(int type, const std::string &text) override; }; -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/CommonTokenStream.cpp b/runtime/Cpp/runtime/src/CommonTokenStream.cpp index ff3b8760a..bd53c6cf7 100755 --- a/runtime/Cpp/runtime/src/CommonTokenStream.cpp +++ b/runtime/Cpp/runtime/src/CommonTokenStream.cpp @@ -33,7 +33,7 @@ #include "CommonTokenStream.h" -using namespace org::antlr::v4::runtime; +using namespace antlr4; CommonTokenStream::CommonTokenStream(TokenSource *tokenSource) : BufferedTokenStream(tokenSource) { InitializeInstanceFields(); diff --git a/runtime/Cpp/runtime/src/CommonTokenStream.h b/runtime/Cpp/runtime/src/CommonTokenStream.h index b0de9c375..0ff274b64 100755 --- a/runtime/Cpp/runtime/src/CommonTokenStream.h +++ b/runtime/Cpp/runtime/src/CommonTokenStream.h @@ -33,10 +33,7 @@ #include "BufferedTokenStream.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { /** * This class extends {@link BufferedTokenStream} with functionality to filter @@ -109,7 +106,4 @@ namespace runtime { void InitializeInstanceFields(); }; -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/ConsoleErrorListener.cpp b/runtime/Cpp/runtime/src/ConsoleErrorListener.cpp index b9f2c4c1b..b816c2127 100755 --- a/runtime/Cpp/runtime/src/ConsoleErrorListener.cpp +++ b/runtime/Cpp/runtime/src/ConsoleErrorListener.cpp @@ -31,7 +31,7 @@ #include "ConsoleErrorListener.h" -using namespace org::antlr::v4::runtime; +using namespace antlr4; ConsoleErrorListener ConsoleErrorListener::INSTANCE; diff --git a/runtime/Cpp/runtime/src/ConsoleErrorListener.h b/runtime/Cpp/runtime/src/ConsoleErrorListener.h index 9993bc600..23676589c 100755 --- a/runtime/Cpp/runtime/src/ConsoleErrorListener.h +++ b/runtime/Cpp/runtime/src/ConsoleErrorListener.h @@ -33,10 +33,7 @@ #include "BaseErrorListener.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { class ANTLR4CPP_PUBLIC ConsoleErrorListener : public BaseErrorListener { public: @@ -61,7 +58,4 @@ namespace runtime { const std::string &msg, std::exception_ptr e) override; }; -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/DefaultErrorStrategy.cpp b/runtime/Cpp/runtime/src/DefaultErrorStrategy.cpp index 8eecd100b..c99b531c3 100755 --- a/runtime/Cpp/runtime/src/DefaultErrorStrategy.cpp +++ b/runtime/Cpp/runtime/src/DefaultErrorStrategy.cpp @@ -45,7 +45,7 @@ #include "DefaultErrorStrategy.h" -using namespace org::antlr::v4::runtime; +using namespace antlr4; using namespace antlrcpp; void DefaultErrorStrategy::reset(Parser *recognizer) { diff --git a/runtime/Cpp/runtime/src/DefaultErrorStrategy.h b/runtime/Cpp/runtime/src/DefaultErrorStrategy.h index b7d742423..c38ae4b0d 100755 --- a/runtime/Cpp/runtime/src/DefaultErrorStrategy.h +++ b/runtime/Cpp/runtime/src/DefaultErrorStrategy.h @@ -34,10 +34,7 @@ #include "ANTLRErrorStrategy.h" #include "misc/IntervalSet.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { /** * This is the default implementation of {@link ANTLRErrorStrategy} used for @@ -490,7 +487,4 @@ namespace runtime { }; -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/DiagnosticErrorListener.cpp b/runtime/Cpp/runtime/src/DiagnosticErrorListener.cpp index a9e4cd660..4e7892b7e 100755 --- a/runtime/Cpp/runtime/src/DiagnosticErrorListener.cpp +++ b/runtime/Cpp/runtime/src/DiagnosticErrorListener.cpp @@ -38,7 +38,7 @@ #include "DiagnosticErrorListener.h" -using namespace org::antlr::v4::runtime; +using namespace antlr4; DiagnosticErrorListener::DiagnosticErrorListener() : DiagnosticErrorListener(true) { } diff --git a/runtime/Cpp/runtime/src/DiagnosticErrorListener.h b/runtime/Cpp/runtime/src/DiagnosticErrorListener.h index 3ed073284..fc0b854a8 100755 --- a/runtime/Cpp/runtime/src/DiagnosticErrorListener.h +++ b/runtime/Cpp/runtime/src/DiagnosticErrorListener.h @@ -33,10 +33,7 @@ #include "BaseErrorListener.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { /// /// This implementation of can be used to identify @@ -106,7 +103,4 @@ namespace runtime { virtual antlrcpp::BitSet getConflictingAlts(const antlrcpp::BitSet &reportedAlts, Ref configs); }; -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/Exceptions.cpp b/runtime/Cpp/runtime/src/Exceptions.cpp index 6b0b112e4..de8291ab5 100644 --- a/runtime/Cpp/runtime/src/Exceptions.cpp +++ b/runtime/Cpp/runtime/src/Exceptions.cpp @@ -30,7 +30,7 @@ #include "Exceptions.h" -using namespace org::antlr::v4::runtime; +using namespace antlr4; RuntimeException::RuntimeException(const std::string &msg) : std::exception(), _message(msg) { } diff --git a/runtime/Cpp/runtime/src/Exceptions.h b/runtime/Cpp/runtime/src/Exceptions.h index fc5d46d65..aae382d5b 100644 --- a/runtime/Cpp/runtime/src/Exceptions.h +++ b/runtime/Cpp/runtime/src/Exceptions.h @@ -32,10 +32,7 @@ #include "antlr4-common.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { // An exception hierarchy modelled loosely after java.lang.* exceptions. class ANTLR4CPP_PUBLIC RuntimeException : public std::exception { @@ -99,7 +96,4 @@ namespace runtime { ParseCancellationException(const std::string &msg = "") : CancellationException(msg) {}; }; -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/FailedPredicateException.cpp b/runtime/Cpp/runtime/src/FailedPredicateException.cpp index 97f1fba0a..ff2834a50 100755 --- a/runtime/Cpp/runtime/src/FailedPredicateException.cpp +++ b/runtime/Cpp/runtime/src/FailedPredicateException.cpp @@ -38,7 +38,7 @@ #include "FailedPredicateException.h" -using namespace org::antlr::v4::runtime; +using namespace antlr4; using namespace antlrcpp; FailedPredicateException::FailedPredicateException(Parser *recognizer) : FailedPredicateException(recognizer, "", "") { diff --git a/runtime/Cpp/runtime/src/FailedPredicateException.h b/runtime/Cpp/runtime/src/FailedPredicateException.h index 17efcd5f1..eb9970fdf 100755 --- a/runtime/Cpp/runtime/src/FailedPredicateException.h +++ b/runtime/Cpp/runtime/src/FailedPredicateException.h @@ -33,10 +33,7 @@ #include "RecognitionException.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { /// A semantic predicate failed during validation. Validation of predicates /// occurs when normally parsing the alternative just like matching a token. @@ -58,7 +55,4 @@ namespace runtime { std::string _predicate; }; -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/IRecognizer.h b/runtime/Cpp/runtime/src/IRecognizer.h index 738e9612d..18e32ce9c 100644 --- a/runtime/Cpp/runtime/src/IRecognizer.h +++ b/runtime/Cpp/runtime/src/IRecognizer.h @@ -31,10 +31,7 @@ #pragma once -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { class ANTLR4CPP_PUBLIC IRecognizer { public: @@ -47,7 +44,4 @@ namespace runtime { }; -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/InputMismatchException.cpp b/runtime/Cpp/runtime/src/InputMismatchException.cpp index a51718ff2..9fb86f139 100755 --- a/runtime/Cpp/runtime/src/InputMismatchException.cpp +++ b/runtime/Cpp/runtime/src/InputMismatchException.cpp @@ -33,7 +33,7 @@ #include "InputMismatchException.h" -using namespace org::antlr::v4::runtime; +using namespace antlr4; InputMismatchException::InputMismatchException(Parser *recognizer) : RecognitionException(recognizer, recognizer->getInputStream(), recognizer->getContext(), diff --git a/runtime/Cpp/runtime/src/InputMismatchException.h b/runtime/Cpp/runtime/src/InputMismatchException.h index 537f3bf8f..8feb23448 100755 --- a/runtime/Cpp/runtime/src/InputMismatchException.h +++ b/runtime/Cpp/runtime/src/InputMismatchException.h @@ -33,10 +33,7 @@ #include "RecognitionException.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { /// /// This signifies any kind of mismatched input exceptions such as @@ -47,7 +44,4 @@ namespace runtime { InputMismatchException(Parser *recognizer); }; -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/IntStream.cpp b/runtime/Cpp/runtime/src/IntStream.cpp index 68e7a1102..ff27da433 100755 --- a/runtime/Cpp/runtime/src/IntStream.cpp +++ b/runtime/Cpp/runtime/src/IntStream.cpp @@ -31,6 +31,6 @@ #include "IntStream.h" -using namespace org::antlr::v4::runtime; +using namespace antlr4; const std::string IntStream::UNKNOWN_SOURCE_NAME = ""; diff --git a/runtime/Cpp/runtime/src/IntStream.h b/runtime/Cpp/runtime/src/IntStream.h index ba3bbb9fc..b2024e7cd 100755 --- a/runtime/Cpp/runtime/src/IntStream.h +++ b/runtime/Cpp/runtime/src/IntStream.h @@ -33,10 +33,7 @@ #include "antlr4-common.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { /// /// A simple stream of symbols whose values are represented as integers. This @@ -244,7 +241,4 @@ namespace runtime { virtual std::string getSourceName() const = 0; }; -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/InterpreterRuleContext.cpp b/runtime/Cpp/runtime/src/InterpreterRuleContext.cpp index d7531e483..d914f2402 100755 --- a/runtime/Cpp/runtime/src/InterpreterRuleContext.cpp +++ b/runtime/Cpp/runtime/src/InterpreterRuleContext.cpp @@ -31,7 +31,7 @@ #include "InterpreterRuleContext.h" -using namespace org::antlr::v4::runtime; +using namespace antlr4; InterpreterRuleContext::InterpreterRuleContext() { } diff --git a/runtime/Cpp/runtime/src/InterpreterRuleContext.h b/runtime/Cpp/runtime/src/InterpreterRuleContext.h index bdf2f6dc0..9759d1021 100755 --- a/runtime/Cpp/runtime/src/InterpreterRuleContext.h +++ b/runtime/Cpp/runtime/src/InterpreterRuleContext.h @@ -33,10 +33,7 @@ #include "ParserRuleContext.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { /** * This class extends {@link ParserRuleContext} by allowing the value of @@ -71,7 +68,4 @@ namespace runtime { const ssize_t _ruleIndex = -1; }; -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/Lexer.cpp b/runtime/Cpp/runtime/src/Lexer.cpp index f26c553f6..c06b544c2 100755 --- a/runtime/Cpp/runtime/src/Lexer.cpp +++ b/runtime/Cpp/runtime/src/Lexer.cpp @@ -42,7 +42,7 @@ #include "Lexer.h" using namespace antlrcpp; -using namespace org::antlr::v4::runtime; +using namespace antlr4; Lexer::Lexer() : Recognizer() { InitializeInstanceFields(); diff --git a/runtime/Cpp/runtime/src/Lexer.h b/runtime/Cpp/runtime/src/Lexer.h index 504d9af6a..16c898454 100755 --- a/runtime/Cpp/runtime/src/Lexer.h +++ b/runtime/Cpp/runtime/src/Lexer.h @@ -36,10 +36,7 @@ #include "CharStream.h" #include "Token.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { /// A lexer is recognizer that draws input symbols from a character stream. /// lexer grammars result in a subclass of this object. A Lexer object @@ -229,7 +226,4 @@ namespace runtime { void InitializeInstanceFields(); }; -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/LexerInterpreter.cpp b/runtime/Cpp/runtime/src/LexerInterpreter.cpp index ca0bc9448..03dfec7f7 100755 --- a/runtime/Cpp/runtime/src/LexerInterpreter.cpp +++ b/runtime/Cpp/runtime/src/LexerInterpreter.cpp @@ -38,7 +38,7 @@ #include "LexerInterpreter.h" -using namespace org::antlr::v4::runtime; +using namespace antlr4; LexerInterpreter::LexerInterpreter(const std::string &grammarFileName, const std::vector &tokenNames, const std::vector &ruleNames, const std::vector &modeNames, const atn::ATN &atn, diff --git a/runtime/Cpp/runtime/src/LexerInterpreter.h b/runtime/Cpp/runtime/src/LexerInterpreter.h index 524d1d221..089e46804 100755 --- a/runtime/Cpp/runtime/src/LexerInterpreter.h +++ b/runtime/Cpp/runtime/src/LexerInterpreter.h @@ -34,10 +34,7 @@ #include "Lexer.h" #include "atn/PredictionContext.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { class ANTLR4CPP_PUBLIC LexerInterpreter : public Lexer { public: @@ -75,7 +72,4 @@ namespace runtime { Ref _vocabulary; }; -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/LexerNoViableAltException.cpp b/runtime/Cpp/runtime/src/LexerNoViableAltException.cpp index 74b19176c..8ab0c476c 100755 --- a/runtime/Cpp/runtime/src/LexerNoViableAltException.cpp +++ b/runtime/Cpp/runtime/src/LexerNoViableAltException.cpp @@ -36,7 +36,7 @@ #include "LexerNoViableAltException.h" -using namespace org::antlr::v4::runtime; +using namespace antlr4; LexerNoViableAltException::LexerNoViableAltException(Lexer *lexer, CharStream *input, size_t startIndex, Ref deadEndConfigs) diff --git a/runtime/Cpp/runtime/src/LexerNoViableAltException.h b/runtime/Cpp/runtime/src/LexerNoViableAltException.h index f0d865955..f0d2eefa2 100755 --- a/runtime/Cpp/runtime/src/LexerNoViableAltException.h +++ b/runtime/Cpp/runtime/src/LexerNoViableAltException.h @@ -34,10 +34,7 @@ #include "RecognitionException.h" #include "atn/ATNConfigSet.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { class ANTLR4CPP_PUBLIC LexerNoViableAltException : public RecognitionException { public: @@ -57,7 +54,4 @@ namespace runtime { }; -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/ListTokenSource.cpp b/runtime/Cpp/runtime/src/ListTokenSource.cpp index e1daf07e3..070714d0e 100755 --- a/runtime/Cpp/runtime/src/ListTokenSource.cpp +++ b/runtime/Cpp/runtime/src/ListTokenSource.cpp @@ -35,7 +35,7 @@ #include "ListTokenSource.h" -using namespace org::antlr::v4::runtime; +using namespace antlr4; int ListTokenSource::getCharPositionInLine() { if (i < tokens.size()) { diff --git a/runtime/Cpp/runtime/src/ListTokenSource.h b/runtime/Cpp/runtime/src/ListTokenSource.h index ebeac79ba..085409e3e 100755 --- a/runtime/Cpp/runtime/src/ListTokenSource.h +++ b/runtime/Cpp/runtime/src/ListTokenSource.h @@ -34,10 +34,7 @@ #include "TokenSource.h" #include "CommonTokenFactory.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { /// /// Provides an implementation of as a wrapper around a list @@ -131,7 +128,4 @@ namespace runtime { void InitializeInstanceFields(); }; -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/NoViableAltException.cpp b/runtime/Cpp/runtime/src/NoViableAltException.cpp index 10ce02af2..003fdf890 100755 --- a/runtime/Cpp/runtime/src/NoViableAltException.cpp +++ b/runtime/Cpp/runtime/src/NoViableAltException.cpp @@ -33,7 +33,7 @@ #include "NoViableAltException.h" -using namespace org::antlr::v4::runtime; +using namespace antlr4; NoViableAltException::NoViableAltException(Parser *recognizer) : NoViableAltException(recognizer, recognizer->getTokenStream(), recognizer->getCurrentToken(), diff --git a/runtime/Cpp/runtime/src/NoViableAltException.h b/runtime/Cpp/runtime/src/NoViableAltException.h index e8037494c..306477ac1 100755 --- a/runtime/Cpp/runtime/src/NoViableAltException.h +++ b/runtime/Cpp/runtime/src/NoViableAltException.h @@ -35,10 +35,7 @@ #include "Token.h" #include "atn/ATNConfigSet.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { /// Indicates that the parser could not decide which of two or more paths /// to take based upon the remaining input. It tracks the starting token @@ -65,7 +62,4 @@ namespace runtime { }; -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/Parser.cpp b/runtime/Cpp/runtime/src/Parser.cpp index c31258e03..b3f933db1 100755 --- a/runtime/Cpp/runtime/src/Parser.cpp +++ b/runtime/Cpp/runtime/src/Parser.cpp @@ -51,7 +51,7 @@ #include "Parser.h" -using namespace org::antlr::v4::runtime; +using namespace antlr4; using namespace antlrcpp; std::map, atn::ATN> Parser::bypassAltsAtnCache; diff --git a/runtime/Cpp/runtime/src/Parser.h b/runtime/Cpp/runtime/src/Parser.h index 5c137c91c..7703fb95d 100755 --- a/runtime/Cpp/runtime/src/Parser.h +++ b/runtime/Cpp/runtime/src/Parser.h @@ -37,10 +37,7 @@ #include "TokenSource.h" #include "misc/Interval.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { /// This is all the parsing support code essentially; most of it is error recovery stuff. class ANTLR4CPP_PUBLIC Parser : public Recognizer { @@ -471,7 +468,4 @@ namespace runtime { void InitializeInstanceFields(); }; -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/ParserInterpreter.cpp b/runtime/Cpp/runtime/src/ParserInterpreter.cpp index a3628578c..3792e9dba 100755 --- a/runtime/Cpp/runtime/src/ParserInterpreter.cpp +++ b/runtime/Cpp/runtime/src/ParserInterpreter.cpp @@ -53,8 +53,8 @@ #include "ParserInterpreter.h" -using namespace org::antlr::v4::runtime; -using namespace org::antlr::v4::runtime::atn; +using namespace antlr4; +using namespace antlr4::atn; using namespace antlrcpp; ParserInterpreter::ParserInterpreter(const std::string &grammarFileName, const std::vector& tokenNames, diff --git a/runtime/Cpp/runtime/src/ParserInterpreter.h b/runtime/Cpp/runtime/src/ParserInterpreter.h index 6a0bf596a..f3a78aaba 100755 --- a/runtime/Cpp/runtime/src/ParserInterpreter.h +++ b/runtime/Cpp/runtime/src/ParserInterpreter.h @@ -36,10 +36,7 @@ #include "support/BitSet.h" #include "atn/PredictionContext.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { /// /// A parser simulator that mimics what ANTLR's generated @@ -204,7 +201,4 @@ namespace runtime { Ref _vocabulary; }; -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/ParserRuleContext.cpp b/runtime/Cpp/runtime/src/ParserRuleContext.cpp index 88f14c3b5..47fdcb71b 100755 --- a/runtime/Cpp/runtime/src/ParserRuleContext.cpp +++ b/runtime/Cpp/runtime/src/ParserRuleContext.cpp @@ -37,7 +37,7 @@ #include "ParserRuleContext.h" -using namespace org::antlr::v4::runtime; +using namespace antlr4; using namespace antlrcpp; ParserRuleContext::ParserRuleContext() { diff --git a/runtime/Cpp/runtime/src/ParserRuleContext.h b/runtime/Cpp/runtime/src/ParserRuleContext.h index 4268c102f..d2bf30eac 100755 --- a/runtime/Cpp/runtime/src/ParserRuleContext.h +++ b/runtime/Cpp/runtime/src/ParserRuleContext.h @@ -34,10 +34,7 @@ #include "RuleContext.h" #include "support/CPPUtils.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { /// /// A rule invocation record for parsing. @@ -186,7 +183,4 @@ namespace runtime { virtual Ref getChildReference(size_t i) override; }; -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/ProxyErrorListener.cpp b/runtime/Cpp/runtime/src/ProxyErrorListener.cpp index 2984bfa02..d9aa5dbc5 100755 --- a/runtime/Cpp/runtime/src/ProxyErrorListener.cpp +++ b/runtime/Cpp/runtime/src/ProxyErrorListener.cpp @@ -31,7 +31,7 @@ #include "ProxyErrorListener.h" -using namespace org::antlr::v4::runtime; +using namespace antlr4; void ProxyErrorListener::addErrorListener(ANTLRErrorListener *listener) { if (listener == nullptr) { diff --git a/runtime/Cpp/runtime/src/ProxyErrorListener.h b/runtime/Cpp/runtime/src/ProxyErrorListener.h index 45e51f891..32141ea61 100755 --- a/runtime/Cpp/runtime/src/ProxyErrorListener.h +++ b/runtime/Cpp/runtime/src/ProxyErrorListener.h @@ -34,10 +34,7 @@ #include "ANTLRErrorListener.h" #include "Exceptions.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { /// This implementation of ANTLRErrorListener dispatches all calls to a /// collection of delegate listeners. This reduces the effort required to support multiple @@ -64,7 +61,4 @@ namespace runtime { int prediction, Ref configs) override; }; -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/RecognitionException.cpp b/runtime/Cpp/runtime/src/RecognitionException.cpp index 8fdaf9eed..14dfde505 100755 --- a/runtime/Cpp/runtime/src/RecognitionException.cpp +++ b/runtime/Cpp/runtime/src/RecognitionException.cpp @@ -37,7 +37,7 @@ #include "RecognitionException.h" -using namespace org::antlr::v4::runtime; +using namespace antlr4; RecognitionException::RecognitionException(IRecognizer *recognizer, IntStream *input, Ref ctx, Ref offendingToken) diff --git a/runtime/Cpp/runtime/src/RecognitionException.h b/runtime/Cpp/runtime/src/RecognitionException.h index 698e7bc15..4d46d246a 100755 --- a/runtime/Cpp/runtime/src/RecognitionException.h +++ b/runtime/Cpp/runtime/src/RecognitionException.h @@ -33,10 +33,7 @@ #include "Exceptions.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { /// The root of the ANTLR exception hierarchy. In general, ANTLR tracks just /// 3 kinds of errors: prediction errors, failed predicate errors, and @@ -62,7 +59,8 @@ namespace runtime { Ref offendingToken = Ref()); RecognitionException(const std::string &message, IRecognizer *recognizer, IntStream *input, Ref ctx, Ref offendingToken = Ref()); - + ~RecognitionException() {} + /// Get the ATN state number the parser was in at the time the error /// occurred. For NoViableAltException and /// LexerNoViableAltException exceptions, this is the @@ -121,7 +119,4 @@ namespace runtime { void InitializeInstanceFields(); }; -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/Recognizer.cpp b/runtime/Cpp/runtime/src/Recognizer.cpp index 610ce2e29..1691c886e 100755 --- a/runtime/Cpp/runtime/src/Recognizer.cpp +++ b/runtime/Cpp/runtime/src/Recognizer.cpp @@ -43,7 +43,7 @@ #include "Recognizer.h" -using namespace org::antlr::v4::runtime; +using namespace antlr4; std::map, std::map> Recognizer::_tokenTypeMapCache; std::map, std::map> Recognizer::_ruleIndexMapCache; diff --git a/runtime/Cpp/runtime/src/Recognizer.h b/runtime/Cpp/runtime/src/Recognizer.h index 22997878b..8e9173983 100755 --- a/runtime/Cpp/runtime/src/Recognizer.h +++ b/runtime/Cpp/runtime/src/Recognizer.h @@ -34,10 +34,7 @@ #include "ProxyErrorListener.h" #include "IRecognizer.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { class ANTLR4CPP_PUBLIC Recognizer : public IRecognizer { public: @@ -192,7 +189,4 @@ namespace runtime { }; -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/RuleContext.cpp b/runtime/Cpp/runtime/src/RuleContext.cpp index ce0d05713..56e332338 100755 --- a/runtime/Cpp/runtime/src/RuleContext.cpp +++ b/runtime/Cpp/runtime/src/RuleContext.cpp @@ -36,7 +36,7 @@ #include "RuleContext.h" -using namespace org::antlr::v4::runtime; +using namespace antlr4; const Ref RuleContext::EMPTY = std::make_shared(); diff --git a/runtime/Cpp/runtime/src/RuleContext.h b/runtime/Cpp/runtime/src/RuleContext.h index 23da88209..7480e8db2 100755 --- a/runtime/Cpp/runtime/src/RuleContext.h +++ b/runtime/Cpp/runtime/src/RuleContext.h @@ -33,10 +33,7 @@ #include "tree/RuleNode.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { /** A rule context is a record of a single rule invocation. * @@ -179,7 +176,4 @@ namespace runtime { void InitializeInstanceFields(); }; -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/RuleContextWithAltNum.cpp b/runtime/Cpp/runtime/src/RuleContextWithAltNum.cpp index ad8cb63dd..c6f040de0 100755 --- a/runtime/Cpp/runtime/src/RuleContextWithAltNum.cpp +++ b/runtime/Cpp/runtime/src/RuleContextWithAltNum.cpp @@ -32,8 +32,8 @@ #include "RuleContextWithAltNum.h" -using namespace org::antlr::v4::runtime; -using namespace org::antlr::v4::runtime::atn; +using namespace antlr4; +using namespace antlr4::atn; RuleContextWithAltNum::RuleContextWithAltNum() : ParserRuleContext() { altNum = ATN::INVALID_ALT_NUMBER; diff --git a/runtime/Cpp/runtime/src/RuleContextWithAltNum.h b/runtime/Cpp/runtime/src/RuleContextWithAltNum.h index e92b8d0fd..9319307ff 100755 --- a/runtime/Cpp/runtime/src/RuleContextWithAltNum.h +++ b/runtime/Cpp/runtime/src/RuleContextWithAltNum.h @@ -32,10 +32,7 @@ #include "ParserRuleContext.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { /// A handy class for use with /// @@ -57,7 +54,4 @@ namespace runtime { virtual void setAltNumber(int altNum) override; }; -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/RuntimeMetaData.cpp b/runtime/Cpp/runtime/src/RuntimeMetaData.cpp index bd0080198..030a6ad9d 100755 --- a/runtime/Cpp/runtime/src/RuntimeMetaData.cpp +++ b/runtime/Cpp/runtime/src/RuntimeMetaData.cpp @@ -31,7 +31,7 @@ #include "RuntimeMetaData.h" -using namespace org::antlr::v4::runtime; +using namespace antlr4; const std::string RuntimeMetaData::VERSION = "4.5.3"; diff --git a/runtime/Cpp/runtime/src/RuntimeMetaData.h b/runtime/Cpp/runtime/src/RuntimeMetaData.h index 0178ea0b0..66c9828a3 100755 --- a/runtime/Cpp/runtime/src/RuntimeMetaData.h +++ b/runtime/Cpp/runtime/src/RuntimeMetaData.h @@ -33,10 +33,7 @@ #include "antlr4-common.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { /// /// This class provides access to the current version of the ANTLR 4 runtime @@ -181,7 +178,4 @@ namespace runtime { static std::string getMajorMinorVersion(const std::string &version); }; -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/Token.cpp b/runtime/Cpp/runtime/src/Token.cpp index a2bbdadbe..d9befe851 100755 --- a/runtime/Cpp/runtime/src/Token.cpp +++ b/runtime/Cpp/runtime/src/Token.cpp @@ -33,5 +33,5 @@ #include "Token.h" -using namespace org::antlr::v4::runtime; +using namespace antlr4; diff --git a/runtime/Cpp/runtime/src/Token.h b/runtime/Cpp/runtime/src/Token.h index 4723f67d7..3fd91e24d 100755 --- a/runtime/Cpp/runtime/src/Token.h +++ b/runtime/Cpp/runtime/src/Token.h @@ -33,10 +33,7 @@ #include "IntStream.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { /// A token has properties: text, type, line, character position in the line /// (so we can ignore tabs), token channel, index, and source from which @@ -138,7 +135,4 @@ namespace runtime { virtual std::string toString() const = 0; }; -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/TokenFactory.h b/runtime/Cpp/runtime/src/TokenFactory.h index 4501b6c49..196647ea0 100755 --- a/runtime/Cpp/runtime/src/TokenFactory.h +++ b/runtime/Cpp/runtime/src/TokenFactory.h @@ -31,10 +31,7 @@ #pragma once -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { /// The default mechanism for creating tokens. It's used by default in Lexer and /// the error handling strategy (to create missing tokens). Notifying the parser @@ -54,7 +51,4 @@ namespace runtime { virtual Ref create(int type, const std::string &text) = 0; }; -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/TokenSource.h b/runtime/Cpp/runtime/src/TokenSource.h index abcc9cf53..f820e6f35 100755 --- a/runtime/Cpp/runtime/src/TokenSource.h +++ b/runtime/Cpp/runtime/src/TokenSource.h @@ -33,10 +33,7 @@ #include "TokenFactory.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { /// /// A source of tokens must provide a sequence of tokens via @@ -111,7 +108,4 @@ namespace runtime { virtual Ref> getTokenFactory() = 0; }; -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/TokenStream.cpp b/runtime/Cpp/runtime/src/TokenStream.cpp index cbdd04ff3..abf841139 100755 --- a/runtime/Cpp/runtime/src/TokenStream.cpp +++ b/runtime/Cpp/runtime/src/TokenStream.cpp @@ -31,7 +31,7 @@ #include "TokenStream.h" -using namespace org::antlr::v4::runtime; +using namespace antlr4; TokenStream::~TokenStream() { } diff --git a/runtime/Cpp/runtime/src/TokenStream.h b/runtime/Cpp/runtime/src/TokenStream.h index 4ae0fccdd..c7f9bcecd 100755 --- a/runtime/Cpp/runtime/src/TokenStream.h +++ b/runtime/Cpp/runtime/src/TokenStream.h @@ -33,10 +33,7 @@ #include "IntStream.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { /// /// An whose symbols are instances. @@ -163,7 +160,4 @@ namespace runtime { virtual std::string getText(Ref start, Ref stop) = 0; }; -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/TokenStreamRewriter.cpp b/runtime/Cpp/runtime/src/TokenStreamRewriter.cpp index 6d466d1df..4a731dc94 100755 --- a/runtime/Cpp/runtime/src/TokenStreamRewriter.cpp +++ b/runtime/Cpp/runtime/src/TokenStreamRewriter.cpp @@ -37,10 +37,10 @@ #include "TokenStreamRewriter.h" -using namespace org::antlr::v4::runtime; +using namespace antlr4; using namespace antlrcpp; -using org::antlr::v4::runtime::misc::Interval; +using antlr4::misc::Interval; TokenStreamRewriter::RewriteOperation::RewriteOperation(TokenStreamRewriter *outerInstance, size_t index) : outerInstance(outerInstance) { diff --git a/runtime/Cpp/runtime/src/TokenStreamRewriter.h b/runtime/Cpp/runtime/src/TokenStreamRewriter.h index 42943eb3f..2799b0fe6 100755 --- a/runtime/Cpp/runtime/src/TokenStreamRewriter.h +++ b/runtime/Cpp/runtime/src/TokenStreamRewriter.h @@ -31,10 +31,7 @@ #pragma once -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { /** * Useful for rewriting out a buffered input token stream after doing some @@ -333,7 +330,4 @@ namespace runtime { }; -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/UnbufferedCharStream.cpp b/runtime/Cpp/runtime/src/UnbufferedCharStream.cpp index ff5fcd2a4..6dddf556d 100755 --- a/runtime/Cpp/runtime/src/UnbufferedCharStream.cpp +++ b/runtime/Cpp/runtime/src/UnbufferedCharStream.cpp @@ -36,7 +36,7 @@ #include "UnbufferedCharStream.h" using namespace antlrcpp; -using namespace org::antlr::v4::runtime; +using namespace antlr4; UnbufferedCharStream::UnbufferedCharStream(std::wistream &input) : _input(input) { InitializeInstanceFields(); diff --git a/runtime/Cpp/runtime/src/UnbufferedCharStream.h b/runtime/Cpp/runtime/src/UnbufferedCharStream.h index bad99754f..0f4280985 100755 --- a/runtime/Cpp/runtime/src/UnbufferedCharStream.h +++ b/runtime/Cpp/runtime/src/UnbufferedCharStream.h @@ -33,10 +33,7 @@ #include "CharStream.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { /// Do not buffer up the entire char stream. It does keep a small buffer /// for efficiency and also buffers while a mark exists (set by the @@ -142,7 +139,4 @@ namespace runtime { void InitializeInstanceFields(); }; -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/UnbufferedTokenStream.cpp b/runtime/Cpp/runtime/src/UnbufferedTokenStream.cpp index 59e35da8b..80eb689bc 100755 --- a/runtime/Cpp/runtime/src/UnbufferedTokenStream.cpp +++ b/runtime/Cpp/runtime/src/UnbufferedTokenStream.cpp @@ -40,7 +40,7 @@ #include "UnbufferedTokenStream.h" -using namespace org::antlr::v4::runtime; +using namespace antlr4; UnbufferedTokenStream::UnbufferedTokenStream(TokenSource *tokenSource) : UnbufferedTokenStream(tokenSource, 256) { } diff --git a/runtime/Cpp/runtime/src/UnbufferedTokenStream.h b/runtime/Cpp/runtime/src/UnbufferedTokenStream.h index f05916a88..2501ca6b7 100755 --- a/runtime/Cpp/runtime/src/UnbufferedTokenStream.h +++ b/runtime/Cpp/runtime/src/UnbufferedTokenStream.h @@ -33,10 +33,7 @@ #include "TokenStream.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { class ANTLR4CPP_PUBLIC UnbufferedTokenStream : public TokenStream { public: @@ -138,7 +135,4 @@ namespace runtime { void InitializeInstanceFields(); }; -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/Vocabulary.h b/runtime/Cpp/runtime/src/Vocabulary.h index fff0e6b95..0a0ed0cd2 100755 --- a/runtime/Cpp/runtime/src/Vocabulary.h +++ b/runtime/Cpp/runtime/src/Vocabulary.h @@ -33,10 +33,7 @@ #include "antlr4-common.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { namespace dfa { /// This interface provides information about the vocabulary used by a @@ -158,7 +155,4 @@ namespace dfa { }; } // namespace atn -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/VocabularyImpl.cpp b/runtime/Cpp/runtime/src/VocabularyImpl.cpp index e13b4b63c..c1dc5893c 100755 --- a/runtime/Cpp/runtime/src/VocabularyImpl.cpp +++ b/runtime/Cpp/runtime/src/VocabularyImpl.cpp @@ -33,7 +33,7 @@ #include "VocabularyImpl.h" -using namespace org::antlr::v4::runtime::dfa; +using namespace antlr4::dfa; const std::vector VocabularyImpl::EMPTY_NAMES; const Ref VocabularyImpl::EMPTY_VOCABULARY = std::make_shared(EMPTY_NAMES, EMPTY_NAMES, EMPTY_NAMES); diff --git a/runtime/Cpp/runtime/src/VocabularyImpl.h b/runtime/Cpp/runtime/src/VocabularyImpl.h index c6cf9c3b7..f93c66d90 100755 --- a/runtime/Cpp/runtime/src/VocabularyImpl.h +++ b/runtime/Cpp/runtime/src/VocabularyImpl.h @@ -33,10 +33,7 @@ #include "Vocabulary.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { namespace dfa { /// This class provides a default implementation of the @@ -115,7 +112,4 @@ namespace dfa { }; } // namespace atn -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/WritableToken.h b/runtime/Cpp/runtime/src/WritableToken.h index 2f92edd2e..3b74c4b7b 100755 --- a/runtime/Cpp/runtime/src/WritableToken.h +++ b/runtime/Cpp/runtime/src/WritableToken.h @@ -33,10 +33,7 @@ #include "Token.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { class ANTLR4CPP_PUBLIC WritableToken : public Token { public: @@ -48,7 +45,4 @@ namespace runtime { virtual void setTokenIndex(int index) = 0; }; -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/antlr4-runtime.h b/runtime/Cpp/runtime/src/antlr4-runtime.h index 55b648ad5..d3d5f57bd 100644 --- a/runtime/Cpp/runtime/src/antlr4-runtime.h +++ b/runtime/Cpp/runtime/src/antlr4-runtime.h @@ -153,7 +153,6 @@ #include "misc/IntervalSet.h" #include "misc/MurmurHash.h" #include "misc/Predicate.h" -#include "misc/TestRig.h" #include "support/Arrays.h" #include "support/BitSet.h" #include "support/CPPUtils.h" @@ -181,4 +180,15 @@ #include "tree/pattern/TagChunk.h" #include "tree/pattern/TextChunk.h" #include "tree/pattern/TokenTagToken.h" +#include "tree/xpath/XPath.h" +#include "tree/xpath/XPathElement.h" #include "tree/xpath/XPathLexer.h" +#include "tree/xpath/XPathLexerErrorListener.h" +#include "tree/xpath/XPathRuleAnywhereElement.h" +#include "tree/xpath/XPathRuleElement.h" +#include "tree/xpath/XPathTokenAnywhereElement.h" +#include "tree/xpath/XPathTokenElement.h" +#include "tree/xpath/XPathWildcardAnywhereElement.h" +#include "tree/xpath/XPathWildcardElement.h" + + diff --git a/runtime/Cpp/runtime/src/atn/ATN.cpp b/runtime/Cpp/runtime/src/atn/ATN.cpp index e914506f9..f50f4384a 100755 --- a/runtime/Cpp/runtime/src/atn/ATN.cpp +++ b/runtime/Cpp/runtime/src/atn/ATN.cpp @@ -42,8 +42,8 @@ #include "atn/ATN.h" -using namespace org::antlr::v4::runtime; -using namespace org::antlr::v4::runtime::atn; +using namespace antlr4; +using namespace antlr4::atn; using namespace antlrcpp; ATN::ATN() : ATN(ATNType::LEXER, 0) { diff --git a/runtime/Cpp/runtime/src/atn/ATN.h b/runtime/Cpp/runtime/src/atn/ATN.h index 98d5ea75c..40af5888c 100755 --- a/runtime/Cpp/runtime/src/atn/ATN.h +++ b/runtime/Cpp/runtime/src/atn/ATN.h @@ -33,10 +33,7 @@ #include "RuleContext.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { namespace atn { class ANTLR4CPP_PUBLIC ATN { @@ -135,7 +132,4 @@ namespace atn { }; } // namespace atn -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/atn/ATNConfig.cpp b/runtime/Cpp/runtime/src/atn/ATNConfig.cpp index 86b07c6b8..53aad54c8 100755 --- a/runtime/Cpp/runtime/src/atn/ATNConfig.cpp +++ b/runtime/Cpp/runtime/src/atn/ATNConfig.cpp @@ -35,7 +35,7 @@ #include "atn/ATNConfig.h" -using namespace org::antlr::v4::runtime::atn; +using namespace antlr4::atn; const size_t ATNConfig::SUPPRESS_PRECEDENCE_FILTER = 0x40000000; diff --git a/runtime/Cpp/runtime/src/atn/ATNConfig.h b/runtime/Cpp/runtime/src/atn/ATNConfig.h index 1775b670f..c1fab380a 100755 --- a/runtime/Cpp/runtime/src/atn/ATNConfig.h +++ b/runtime/Cpp/runtime/src/atn/ATNConfig.h @@ -31,10 +31,7 @@ #pragma once -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { namespace atn { /// @@ -146,16 +143,13 @@ namespace atn { }; } // namespace atn -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 // Hash function for ATNConfig. namespace std { - using org::antlr::v4::runtime::atn::ATNConfig; + using antlr4::atn::ATNConfig; template <> struct hash { diff --git a/runtime/Cpp/runtime/src/atn/ATNConfigSet.cpp b/runtime/Cpp/runtime/src/atn/ATNConfigSet.cpp index 669b0c2df..dce22787a 100755 --- a/runtime/Cpp/runtime/src/atn/ATNConfigSet.cpp +++ b/runtime/Cpp/runtime/src/atn/ATNConfigSet.cpp @@ -37,7 +37,7 @@ #include "atn/ATNConfigSet.h" -using namespace org::antlr::v4::runtime::atn; +using namespace antlr4::atn; using namespace antlrcpp; size_t SimpleATNConfigHasher::operator()(const Ref &k) const { diff --git a/runtime/Cpp/runtime/src/atn/ATNConfigSet.h b/runtime/Cpp/runtime/src/atn/ATNConfigSet.h index e177b13c8..125573b6b 100755 --- a/runtime/Cpp/runtime/src/atn/ATNConfigSet.h +++ b/runtime/Cpp/runtime/src/atn/ATNConfigSet.h @@ -35,10 +35,7 @@ #include "atn/ConfigLookup.h" #include "atn/PredictionContext.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { namespace atn { // Simpler hasher and comparer variants than those in ATNConfig (less fields, no murmur hash). @@ -154,7 +151,4 @@ namespace atn { }; } // namespace atn -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/atn/ATNDeserializationOptions.cpp b/runtime/Cpp/runtime/src/atn/ATNDeserializationOptions.cpp index 58ffb2cb0..9d53edbd7 100755 --- a/runtime/Cpp/runtime/src/atn/ATNDeserializationOptions.cpp +++ b/runtime/Cpp/runtime/src/atn/ATNDeserializationOptions.cpp @@ -31,7 +31,7 @@ #include "atn/ATNDeserializationOptions.h" -using namespace org::antlr::v4::runtime::atn; +using namespace antlr4::atn; ATNDeserializationOptions ATNDeserializationOptions::defaultOptions; diff --git a/runtime/Cpp/runtime/src/atn/ATNDeserializationOptions.h b/runtime/Cpp/runtime/src/atn/ATNDeserializationOptions.h index c873896ac..8a66cd4e5 100755 --- a/runtime/Cpp/runtime/src/atn/ATNDeserializationOptions.h +++ b/runtime/Cpp/runtime/src/atn/ATNDeserializationOptions.h @@ -33,10 +33,7 @@ #include "antlr4-common.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { namespace atn { class ANTLR4CPP_PUBLIC ATNDeserializationOptions { @@ -74,7 +71,4 @@ namespace atn { }; } // namespace atn -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/atn/ATNDeserializer.cpp b/runtime/Cpp/runtime/src/atn/ATNDeserializer.cpp index 5b3e98ba6..362fc5042 100755 --- a/runtime/Cpp/runtime/src/atn/ATNDeserializer.cpp +++ b/runtime/Cpp/runtime/src/atn/ATNDeserializer.cpp @@ -77,8 +77,8 @@ #include "atn/ATNDeserializer.h" -using namespace org::antlr::v4::runtime; -using namespace org::antlr::v4::runtime::atn; +using namespace antlr4; +using namespace antlr4::atn; using namespace antlrcpp; const size_t ATNDeserializer::SERIALIZED_VERSION = 3; diff --git a/runtime/Cpp/runtime/src/atn/ATNDeserializer.h b/runtime/Cpp/runtime/src/atn/ATNDeserializer.h index 8e5707e2e..e9c923684 100755 --- a/runtime/Cpp/runtime/src/atn/ATNDeserializer.h +++ b/runtime/Cpp/runtime/src/atn/ATNDeserializer.h @@ -34,10 +34,7 @@ #include "atn/LexerAction.h" #include "atn/ATNDeserializationOptions.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { namespace atn { class ANTLR4CPP_PUBLIC ATNDeserializer { @@ -104,7 +101,4 @@ namespace atn { }; } // namespace atn -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/atn/ATNSerializer.cpp b/runtime/Cpp/runtime/src/atn/ATNSerializer.cpp index 8e828bd3f..6a45bd26f 100755 --- a/runtime/Cpp/runtime/src/atn/ATNSerializer.cpp +++ b/runtime/Cpp/runtime/src/atn/ATNSerializer.cpp @@ -67,7 +67,7 @@ #include "atn/ATNSerializer.h" using namespace antlrcpp; -using namespace org::antlr::v4::runtime::atn; +using namespace antlr4::atn; ATNSerializer::ATNSerializer(ATN *atn) { this->atn = atn; } diff --git a/runtime/Cpp/runtime/src/atn/ATNSerializer.h b/runtime/Cpp/runtime/src/atn/ATNSerializer.h index f4ce09bf8..1eb2a85f5 100755 --- a/runtime/Cpp/runtime/src/atn/ATNSerializer.h +++ b/runtime/Cpp/runtime/src/atn/ATNSerializer.h @@ -31,10 +31,7 @@ #pragma once -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { namespace atn { class ANTLR4CPP_PUBLIC ATNSerializer { @@ -87,7 +84,4 @@ namespace atn { }; } // namespace atn -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/atn/ATNSimulator.cpp b/runtime/Cpp/runtime/src/atn/ATNSimulator.cpp index 314fc8944..640bc2abc 100755 --- a/runtime/Cpp/runtime/src/atn/ATNSimulator.cpp +++ b/runtime/Cpp/runtime/src/atn/ATNSimulator.cpp @@ -37,9 +37,9 @@ #include "atn/ATNSimulator.h" -using namespace org::antlr::v4::runtime; -using namespace org::antlr::v4::runtime::dfa; -using namespace org::antlr::v4::runtime::atn; +using namespace antlr4; +using namespace antlr4::dfa; +using namespace antlr4::atn; const Ref ATNSimulator::ERROR = std::make_shared(INT32_MAX); diff --git a/runtime/Cpp/runtime/src/atn/ATNSimulator.h b/runtime/Cpp/runtime/src/atn/ATNSimulator.h index 8537720cf..3838bf4c7 100755 --- a/runtime/Cpp/runtime/src/atn/ATNSimulator.h +++ b/runtime/Cpp/runtime/src/atn/ATNSimulator.h @@ -35,10 +35,7 @@ #include "misc/IntervalSet.h" #include "atn/PredictionContext.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { namespace atn { class ANTLR4CPP_PUBLIC ATNSimulator { @@ -113,7 +110,4 @@ namespace atn { }; } // namespace atn -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/atn/ATNState.cpp b/runtime/Cpp/runtime/src/atn/ATNState.cpp index b7301d365..f9ca37fe0 100755 --- a/runtime/Cpp/runtime/src/atn/ATNState.cpp +++ b/runtime/Cpp/runtime/src/atn/ATNState.cpp @@ -36,7 +36,7 @@ #include "atn/ATNState.h" -using namespace org::antlr::v4::runtime::atn; +using namespace antlr4::atn; using namespace antlrcpp; const int ATNState::INITIAL_NUM_TRANSITIONS = 4; diff --git a/runtime/Cpp/runtime/src/atn/ATNState.h b/runtime/Cpp/runtime/src/atn/ATNState.h index 3c1dff6eb..8aaa17457 100755 --- a/runtime/Cpp/runtime/src/atn/ATNState.h +++ b/runtime/Cpp/runtime/src/atn/ATNState.h @@ -33,10 +33,7 @@ #include "misc/IntervalSet.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { namespace atn { /// @@ -160,7 +157,4 @@ namespace atn { }; } // namespace atn -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/atn/ATNType.h b/runtime/Cpp/runtime/src/atn/ATNType.h index f5d3266a9..04a6e1a72 100755 --- a/runtime/Cpp/runtime/src/atn/ATNType.h +++ b/runtime/Cpp/runtime/src/atn/ATNType.h @@ -33,10 +33,7 @@ #include "antlr4-common.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { namespace atn { /// Represents the type of recognizer an ATN applies to. @@ -46,7 +43,4 @@ namespace atn { }; } // namespace atn -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/atn/AbstractPredicateTransition.cpp b/runtime/Cpp/runtime/src/atn/AbstractPredicateTransition.cpp index 971e026bc..4228b8ade 100755 --- a/runtime/Cpp/runtime/src/atn/AbstractPredicateTransition.cpp +++ b/runtime/Cpp/runtime/src/atn/AbstractPredicateTransition.cpp @@ -31,7 +31,7 @@ #include "atn/AbstractPredicateTransition.h" -using namespace org::antlr::v4::runtime::atn; +using namespace antlr4::atn; AbstractPredicateTransition::AbstractPredicateTransition(ATNState *target) : Transition(target) { } diff --git a/runtime/Cpp/runtime/src/atn/AbstractPredicateTransition.h b/runtime/Cpp/runtime/src/atn/AbstractPredicateTransition.h index 8454be6e2..117a4d9f4 100755 --- a/runtime/Cpp/runtime/src/atn/AbstractPredicateTransition.h +++ b/runtime/Cpp/runtime/src/atn/AbstractPredicateTransition.h @@ -33,10 +33,7 @@ #include "atn/Transition.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { namespace atn { class ANTState; @@ -49,7 +46,4 @@ namespace atn { }; } // namespace atn -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/atn/ActionTransition.cpp b/runtime/Cpp/runtime/src/atn/ActionTransition.cpp index c25c888cf..05c505736 100755 --- a/runtime/Cpp/runtime/src/atn/ActionTransition.cpp +++ b/runtime/Cpp/runtime/src/atn/ActionTransition.cpp @@ -31,7 +31,7 @@ #include "atn/ActionTransition.h" -using namespace org::antlr::v4::runtime::atn; +using namespace antlr4::atn; ActionTransition::ActionTransition(ATNState *target, int ruleIndex) : Transition(target), ruleIndex(ruleIndex), actionIndex(0), isCtxDependent(false) { diff --git a/runtime/Cpp/runtime/src/atn/ActionTransition.h b/runtime/Cpp/runtime/src/atn/ActionTransition.h index 3d2974227..c9dc2e666 100755 --- a/runtime/Cpp/runtime/src/atn/ActionTransition.h +++ b/runtime/Cpp/runtime/src/atn/ActionTransition.h @@ -33,10 +33,7 @@ #include "atn/Transition.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { namespace atn { class ANTLR4CPP_PUBLIC ActionTransition final : public Transition { @@ -59,8 +56,4 @@ namespace atn { }; } // namespace atn -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org - +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/atn/AmbiguityInfo.cpp b/runtime/Cpp/runtime/src/atn/AmbiguityInfo.cpp index 6ae6d3c4f..a3349c1a5 100755 --- a/runtime/Cpp/runtime/src/atn/AmbiguityInfo.cpp +++ b/runtime/Cpp/runtime/src/atn/AmbiguityInfo.cpp @@ -31,8 +31,8 @@ #include "atn/AmbiguityInfo.h" -using namespace org::antlr::v4::runtime; -using namespace org::antlr::v4::runtime::atn; +using namespace antlr4; +using namespace antlr4::atn; AmbiguityInfo::AmbiguityInfo(int decision, Ref configs, const antlrcpp::BitSet &ambigAlts, TokenStream *input, size_t startIndex, size_t stopIndex, bool fullCtx) diff --git a/runtime/Cpp/runtime/src/atn/AmbiguityInfo.h b/runtime/Cpp/runtime/src/atn/AmbiguityInfo.h index 09933c14f..9cda83921 100755 --- a/runtime/Cpp/runtime/src/atn/AmbiguityInfo.h +++ b/runtime/Cpp/runtime/src/atn/AmbiguityInfo.h @@ -34,10 +34,7 @@ #include "atn/DecisionEventInfo.h" #include "support/BitSet.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { namespace atn { /// @@ -94,7 +91,4 @@ namespace atn { }; } // namespace atn -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/atn/ArrayPredictionContext.cpp b/runtime/Cpp/runtime/src/atn/ArrayPredictionContext.cpp index 02b50bb1a..e7184f217 100755 --- a/runtime/Cpp/runtime/src/atn/ArrayPredictionContext.cpp +++ b/runtime/Cpp/runtime/src/atn/ArrayPredictionContext.cpp @@ -34,7 +34,7 @@ #include "atn/ArrayPredictionContext.h" -using namespace org::antlr::v4::runtime::atn; +using namespace antlr4::atn; ArrayPredictionContext::ArrayPredictionContext(Ref a) : ArrayPredictionContext({ a->parent }, { a->returnState }) { diff --git a/runtime/Cpp/runtime/src/atn/ArrayPredictionContext.h b/runtime/Cpp/runtime/src/atn/ArrayPredictionContext.h index 3d5c9c73f..2eb966e75 100755 --- a/runtime/Cpp/runtime/src/atn/ArrayPredictionContext.h +++ b/runtime/Cpp/runtime/src/atn/ArrayPredictionContext.h @@ -34,10 +34,7 @@ #include "atn/PredictionContext.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { namespace atn { class SingletonPredictionContext; @@ -71,8 +68,5 @@ namespace atn { }; } // namespace atn -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/atn/AtomTransition.cpp b/runtime/Cpp/runtime/src/atn/AtomTransition.cpp index 6e0d96b2d..67ad6450f 100755 --- a/runtime/Cpp/runtime/src/atn/AtomTransition.cpp +++ b/runtime/Cpp/runtime/src/atn/AtomTransition.cpp @@ -34,8 +34,8 @@ #include "atn/AtomTransition.h" -using namespace org::antlr::v4::runtime::misc; -using namespace org::antlr::v4::runtime::atn; +using namespace antlr4::misc; +using namespace antlr4::atn; AtomTransition::AtomTransition(ATNState *target, size_t label) : Transition(target), _label(label) { } diff --git a/runtime/Cpp/runtime/src/atn/AtomTransition.h b/runtime/Cpp/runtime/src/atn/AtomTransition.h index 4c17fc9f1..e634af919 100755 --- a/runtime/Cpp/runtime/src/atn/AtomTransition.h +++ b/runtime/Cpp/runtime/src/atn/AtomTransition.h @@ -33,10 +33,7 @@ #include "atn/Transition.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { namespace atn { /// TO_DO: make all transitions sets? no, should remove set edges. @@ -56,7 +53,4 @@ namespace atn { }; } // namespace atn -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/atn/BasicBlockStartState.cpp b/runtime/Cpp/runtime/src/atn/BasicBlockStartState.cpp index 4c6aa2b27..7ea889fa1 100755 --- a/runtime/Cpp/runtime/src/atn/BasicBlockStartState.cpp +++ b/runtime/Cpp/runtime/src/atn/BasicBlockStartState.cpp @@ -31,7 +31,7 @@ #include "atn/BasicBlockStartState.h" -using namespace org::antlr::v4::runtime::atn; +using namespace antlr4::atn; int BasicBlockStartState::getStateType() { return BLOCK_START; diff --git a/runtime/Cpp/runtime/src/atn/BasicBlockStartState.h b/runtime/Cpp/runtime/src/atn/BasicBlockStartState.h index cb221198f..d3ec91bb6 100755 --- a/runtime/Cpp/runtime/src/atn/BasicBlockStartState.h +++ b/runtime/Cpp/runtime/src/atn/BasicBlockStartState.h @@ -34,10 +34,7 @@ #include "antlr4-common.h" #include "atn/BlockStartState.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { namespace atn { class ANTLR4CPP_PUBLIC BasicBlockStartState final : public BlockStartState { @@ -48,7 +45,4 @@ namespace atn { }; } // namespace atn -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/atn/BasicState.cpp b/runtime/Cpp/runtime/src/atn/BasicState.cpp index 2979dac02..b387a42fe 100755 --- a/runtime/Cpp/runtime/src/atn/BasicState.cpp +++ b/runtime/Cpp/runtime/src/atn/BasicState.cpp @@ -31,7 +31,7 @@ #include "atn/BasicState.h" -using namespace org::antlr::v4::runtime::atn; +using namespace antlr4::atn; int BasicState::getStateType() { return BASIC; diff --git a/runtime/Cpp/runtime/src/atn/BasicState.h b/runtime/Cpp/runtime/src/atn/BasicState.h index c6e7a25c7..c85dacfa1 100755 --- a/runtime/Cpp/runtime/src/atn/BasicState.h +++ b/runtime/Cpp/runtime/src/atn/BasicState.h @@ -33,10 +33,7 @@ #include "atn/ATNState.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { namespace atn { class ANTLR4CPP_PUBLIC BasicState final : public ATNState { @@ -47,7 +44,4 @@ namespace atn { }; } // namespace atn -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/atn/BlockEndState.cpp b/runtime/Cpp/runtime/src/atn/BlockEndState.cpp index 7effacf5d..f4b8199b3 100755 --- a/runtime/Cpp/runtime/src/atn/BlockEndState.cpp +++ b/runtime/Cpp/runtime/src/atn/BlockEndState.cpp @@ -31,7 +31,7 @@ #include "atn/BlockEndState.h" -using namespace org::antlr::v4::runtime::atn; +using namespace antlr4::atn; BlockEndState::BlockEndState() : startState(nullptr) { } diff --git a/runtime/Cpp/runtime/src/atn/BlockEndState.h b/runtime/Cpp/runtime/src/atn/BlockEndState.h index b93e27118..0f2d30b4b 100755 --- a/runtime/Cpp/runtime/src/atn/BlockEndState.h +++ b/runtime/Cpp/runtime/src/atn/BlockEndState.h @@ -33,10 +33,7 @@ #include "atn/ATNState.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { namespace atn { /// @@ -51,7 +48,4 @@ namespace atn { }; } // namespace atn -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/atn/BlockStartState.h b/runtime/Cpp/runtime/src/atn/BlockStartState.h index f91f792ae..e53f6ea39 100755 --- a/runtime/Cpp/runtime/src/atn/BlockStartState.h +++ b/runtime/Cpp/runtime/src/atn/BlockStartState.h @@ -33,10 +33,7 @@ #include "atn/DecisionState.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { namespace atn { /// @@ -47,7 +44,4 @@ namespace atn { }; } // namespace atn -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/atn/ConfigLookup.h b/runtime/Cpp/runtime/src/atn/ConfigLookup.h index 5807c9eef..eee64843b 100644 --- a/runtime/Cpp/runtime/src/atn/ConfigLookup.h +++ b/runtime/Cpp/runtime/src/atn/ConfigLookup.h @@ -29,10 +29,7 @@ #pragma once -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { namespace atn { class ANTLR4CPP_PUBLIC ConfigLookup { @@ -154,7 +151,4 @@ namespace atn { }; } // namespace atn -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/atn/ContextSensitivityInfo.cpp b/runtime/Cpp/runtime/src/atn/ContextSensitivityInfo.cpp index 78a0a78a8..ed38190ac 100755 --- a/runtime/Cpp/runtime/src/atn/ContextSensitivityInfo.cpp +++ b/runtime/Cpp/runtime/src/atn/ContextSensitivityInfo.cpp @@ -31,8 +31,8 @@ #include "atn/ContextSensitivityInfo.h" -using namespace org::antlr::v4::runtime; -using namespace org::antlr::v4::runtime::atn; +using namespace antlr4; +using namespace antlr4::atn; ContextSensitivityInfo::ContextSensitivityInfo(int decision, Ref configs, TokenStream *input, size_t startIndex, size_t stopIndex) diff --git a/runtime/Cpp/runtime/src/atn/ContextSensitivityInfo.h b/runtime/Cpp/runtime/src/atn/ContextSensitivityInfo.h index adb2823d4..bf6b3ec62 100755 --- a/runtime/Cpp/runtime/src/atn/ContextSensitivityInfo.h +++ b/runtime/Cpp/runtime/src/atn/ContextSensitivityInfo.h @@ -33,10 +33,7 @@ #include "atn/DecisionEventInfo.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { namespace atn { /// @@ -73,7 +70,4 @@ namespace atn { }; } // namespace atn -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/atn/DecisionEventInfo.cpp b/runtime/Cpp/runtime/src/atn/DecisionEventInfo.cpp index 04f2a76b3..94ccd9f15 100755 --- a/runtime/Cpp/runtime/src/atn/DecisionEventInfo.cpp +++ b/runtime/Cpp/runtime/src/atn/DecisionEventInfo.cpp @@ -31,8 +31,8 @@ #include "atn/DecisionEventInfo.h" -using namespace org::antlr::v4::runtime; -using namespace org::antlr::v4::runtime::atn; +using namespace antlr4; +using namespace antlr4::atn; DecisionEventInfo::DecisionEventInfo(int decision, Ref configs, TokenStream *input, size_t startIndex, size_t stopIndex, bool fullCtx) diff --git a/runtime/Cpp/runtime/src/atn/DecisionEventInfo.h b/runtime/Cpp/runtime/src/atn/DecisionEventInfo.h index 588ea65d7..615c0c9d9 100755 --- a/runtime/Cpp/runtime/src/atn/DecisionEventInfo.h +++ b/runtime/Cpp/runtime/src/atn/DecisionEventInfo.h @@ -33,10 +33,7 @@ #include "antlr4-common.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { namespace atn { /// @@ -96,7 +93,4 @@ namespace atn { }; } // namespace atn -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/atn/DecisionInfo.cpp b/runtime/Cpp/runtime/src/atn/DecisionInfo.cpp index 20731449d..4775a0dfb 100755 --- a/runtime/Cpp/runtime/src/atn/DecisionInfo.cpp +++ b/runtime/Cpp/runtime/src/atn/DecisionInfo.cpp @@ -34,7 +34,7 @@ #include "atn/DecisionInfo.h" -using namespace org::antlr::v4::runtime::atn; +using namespace antlr4::atn; DecisionInfo::DecisionInfo(size_t decision) : decision(decision) { } diff --git a/runtime/Cpp/runtime/src/atn/DecisionInfo.h b/runtime/Cpp/runtime/src/atn/DecisionInfo.h index 6758f483e..93ba3b2d5 100755 --- a/runtime/Cpp/runtime/src/atn/DecisionInfo.h +++ b/runtime/Cpp/runtime/src/atn/DecisionInfo.h @@ -36,10 +36,7 @@ #include "atn/PredicateEvalInfo.h" #include "atn/ErrorInfo.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { namespace atn { class LookaheadEventInfo; @@ -253,7 +250,4 @@ namespace atn { }; } // namespace atn -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/atn/DecisionState.cpp b/runtime/Cpp/runtime/src/atn/DecisionState.cpp index 3644f6676..9c08a114c 100755 --- a/runtime/Cpp/runtime/src/atn/DecisionState.cpp +++ b/runtime/Cpp/runtime/src/atn/DecisionState.cpp @@ -31,7 +31,7 @@ #include "atn/DecisionState.h" -using namespace org::antlr::v4::runtime::atn; +using namespace antlr4::atn; void DecisionState::InitializeInstanceFields() { decision = -1; diff --git a/runtime/Cpp/runtime/src/atn/DecisionState.h b/runtime/Cpp/runtime/src/atn/DecisionState.h index c61236eeb..d3e1dee28 100755 --- a/runtime/Cpp/runtime/src/atn/DecisionState.h +++ b/runtime/Cpp/runtime/src/atn/DecisionState.h @@ -33,10 +33,7 @@ #include "atn/ATNState.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { namespace atn { class ANTLR4CPP_PUBLIC DecisionState : public ATNState { @@ -56,7 +53,4 @@ namespace atn { }; } // namespace atn -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/atn/EmptyPredictionContext.cpp b/runtime/Cpp/runtime/src/atn/EmptyPredictionContext.cpp index 5bf753a0d..5856ccdac 100755 --- a/runtime/Cpp/runtime/src/atn/EmptyPredictionContext.cpp +++ b/runtime/Cpp/runtime/src/atn/EmptyPredictionContext.cpp @@ -31,7 +31,7 @@ #include "atn/EmptyPredictionContext.h" -using namespace org::antlr::v4::runtime::atn; +using namespace antlr4::atn; EmptyPredictionContext::EmptyPredictionContext() : SingletonPredictionContext(std::weak_ptr(), EMPTY_RETURN_STATE) { } diff --git a/runtime/Cpp/runtime/src/atn/EmptyPredictionContext.h b/runtime/Cpp/runtime/src/atn/EmptyPredictionContext.h index f9d516916..852950ffc 100755 --- a/runtime/Cpp/runtime/src/atn/EmptyPredictionContext.h +++ b/runtime/Cpp/runtime/src/atn/EmptyPredictionContext.h @@ -33,10 +33,7 @@ #include "atn/SingletonPredictionContext.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { namespace atn { class ANTLR4CPP_PUBLIC EmptyPredictionContext : public SingletonPredictionContext { @@ -53,7 +50,4 @@ namespace atn { }; } // namespace atn -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/atn/EpsilonTransition.cpp b/runtime/Cpp/runtime/src/atn/EpsilonTransition.cpp index fd159efeb..3b00751f0 100755 --- a/runtime/Cpp/runtime/src/atn/EpsilonTransition.cpp +++ b/runtime/Cpp/runtime/src/atn/EpsilonTransition.cpp @@ -31,7 +31,7 @@ #include "atn/EpsilonTransition.h" -using namespace org::antlr::v4::runtime::atn; +using namespace antlr4::atn; EpsilonTransition::EpsilonTransition(ATNState *target) : EpsilonTransition(target, -1) { } diff --git a/runtime/Cpp/runtime/src/atn/EpsilonTransition.h b/runtime/Cpp/runtime/src/atn/EpsilonTransition.h index 0a5be150e..7c7b5dd48 100755 --- a/runtime/Cpp/runtime/src/atn/EpsilonTransition.h +++ b/runtime/Cpp/runtime/src/atn/EpsilonTransition.h @@ -33,10 +33,7 @@ #include "atn/Transition.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { namespace atn { class ANTLR4CPP_PUBLIC EpsilonTransition final : public Transition { @@ -65,7 +62,4 @@ namespace atn { }; } // namespace atn -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/atn/ErrorInfo.cpp b/runtime/Cpp/runtime/src/atn/ErrorInfo.cpp index 89f0f23e5..4632fcd8e 100755 --- a/runtime/Cpp/runtime/src/atn/ErrorInfo.cpp +++ b/runtime/Cpp/runtime/src/atn/ErrorInfo.cpp @@ -33,8 +33,8 @@ #include "atn/ErrorInfo.h" -using namespace org::antlr::v4::runtime; -using namespace org::antlr::v4::runtime::atn; +using namespace antlr4; +using namespace antlr4::atn; ErrorInfo::ErrorInfo(int decision, Ref configs, TokenStream *input, int startIndex, int stopIndex, bool fullCtx) : DecisionEventInfo(decision, configs, input, startIndex, stopIndex, fullCtx) { diff --git a/runtime/Cpp/runtime/src/atn/ErrorInfo.h b/runtime/Cpp/runtime/src/atn/ErrorInfo.h index 25672347f..f2d4c6b74 100755 --- a/runtime/Cpp/runtime/src/atn/ErrorInfo.h +++ b/runtime/Cpp/runtime/src/atn/ErrorInfo.h @@ -33,10 +33,7 @@ #include "atn/DecisionEventInfo.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { namespace atn { /// @@ -68,7 +65,4 @@ namespace atn { }; } // namespace atn -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/atn/LL1Analyzer.cpp b/runtime/Cpp/runtime/src/atn/LL1Analyzer.cpp index 45b767938..ceb85986a 100755 --- a/runtime/Cpp/runtime/src/atn/LL1Analyzer.cpp +++ b/runtime/Cpp/runtime/src/atn/LL1Analyzer.cpp @@ -44,8 +44,8 @@ #include "atn/LL1Analyzer.h" -using namespace org::antlr::v4::runtime; -using namespace org::antlr::v4::runtime::atn; +using namespace antlr4; +using namespace antlr4::atn; using namespace antlrcpp; LL1Analyzer::LL1Analyzer(const ATN &atn) : _atn(atn) { diff --git a/runtime/Cpp/runtime/src/atn/LL1Analyzer.h b/runtime/Cpp/runtime/src/atn/LL1Analyzer.h index b18d9cebf..e158a7f2e 100755 --- a/runtime/Cpp/runtime/src/atn/LL1Analyzer.h +++ b/runtime/Cpp/runtime/src/atn/LL1Analyzer.h @@ -36,10 +36,7 @@ #include "atn/PredictionContext.h" #include "atn/ATNConfig.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { namespace atn { class ANTLR4CPP_PUBLIC LL1Analyzer { @@ -135,7 +132,4 @@ namespace atn { }; } // namespace atn -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/atn/LexerATNConfig.cpp b/runtime/Cpp/runtime/src/atn/LexerATNConfig.cpp index bcd75b402..d51db57c6 100755 --- a/runtime/Cpp/runtime/src/atn/LexerATNConfig.cpp +++ b/runtime/Cpp/runtime/src/atn/LexerATNConfig.cpp @@ -39,7 +39,7 @@ #include "atn/LexerATNConfig.h" -using namespace org::antlr::v4::runtime::atn; +using namespace antlr4::atn; using namespace antlrcpp; LexerATNConfig::LexerATNConfig(ATNState *state, int alt, Ref context) diff --git a/runtime/Cpp/runtime/src/atn/LexerATNConfig.h b/runtime/Cpp/runtime/src/atn/LexerATNConfig.h index 530c25ac2..716f28ec5 100755 --- a/runtime/Cpp/runtime/src/atn/LexerATNConfig.h +++ b/runtime/Cpp/runtime/src/atn/LexerATNConfig.h @@ -33,10 +33,7 @@ #include "atn/ATNConfig.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { namespace atn { class ANTLR4CPP_PUBLIC LexerATNConfig : public ATNConfig { @@ -70,7 +67,4 @@ namespace atn { }; } // namespace atn -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/atn/LexerATNSimulator.cpp b/runtime/Cpp/runtime/src/atn/LexerATNSimulator.cpp index cb85105af..1beb62a91 100755 --- a/runtime/Cpp/runtime/src/atn/LexerATNSimulator.cpp +++ b/runtime/Cpp/runtime/src/atn/LexerATNSimulator.cpp @@ -49,8 +49,8 @@ #include "atn/LexerATNSimulator.h" -using namespace org::antlr::v4::runtime; -using namespace org::antlr::v4::runtime::atn; +using namespace antlr4; +using namespace antlr4::atn; using namespace antlrcpp; void LexerATNSimulator::SimState::reset() { @@ -661,5 +661,5 @@ void LexerATNSimulator::InitializeInstanceFields() { _startIndex = -1; _line = 1; _charPositionInLine = 0; - _mode = org::antlr::v4::runtime::Lexer::DEFAULT_MODE; + _mode = antlr4::Lexer::DEFAULT_MODE; } diff --git a/runtime/Cpp/runtime/src/atn/LexerATNSimulator.h b/runtime/Cpp/runtime/src/atn/LexerATNSimulator.h index f45e52693..a1c51df35 100755 --- a/runtime/Cpp/runtime/src/atn/LexerATNSimulator.h +++ b/runtime/Cpp/runtime/src/atn/LexerATNSimulator.h @@ -35,10 +35,7 @@ #include "atn/LexerATNConfig.h" #include "atn/ATNConfigSet.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { namespace atn { /// "dup" of ParserInterpreter @@ -243,7 +240,4 @@ namespace atn { }; } // namespace atn -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/atn/LexerAction.h b/runtime/Cpp/runtime/src/atn/LexerAction.h index f36f82666..10805a81c 100755 --- a/runtime/Cpp/runtime/src/atn/LexerAction.h +++ b/runtime/Cpp/runtime/src/atn/LexerAction.h @@ -33,10 +33,7 @@ #include "atn/LexerActionType.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { namespace atn { /// @@ -87,7 +84,4 @@ namespace atn { }; } // namespace atn -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/atn/LexerActionExecutor.cpp b/runtime/Cpp/runtime/src/atn/LexerActionExecutor.cpp index 7965883b4..7b6b6fad9 100755 --- a/runtime/Cpp/runtime/src/atn/LexerActionExecutor.cpp +++ b/runtime/Cpp/runtime/src/atn/LexerActionExecutor.cpp @@ -36,9 +36,9 @@ #include "atn/LexerActionExecutor.h" -using namespace org::antlr::v4::runtime; -using namespace org::antlr::v4::runtime::atn; -using namespace org::antlr::v4::runtime::misc; +using namespace antlr4; +using namespace antlr4::atn; +using namespace antlr4::misc; using namespace antlrcpp; LexerActionExecutor::LexerActionExecutor(const std::vector> &lexerActions) diff --git a/runtime/Cpp/runtime/src/atn/LexerActionExecutor.h b/runtime/Cpp/runtime/src/atn/LexerActionExecutor.h index 260f3c904..7a687152a 100755 --- a/runtime/Cpp/runtime/src/atn/LexerActionExecutor.h +++ b/runtime/Cpp/runtime/src/atn/LexerActionExecutor.h @@ -34,10 +34,7 @@ #include "CharStream.h" #include "atn/LexerAction.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { namespace atn { /// Represents an executor for a sequence of lexer actions which traversed during @@ -139,7 +136,4 @@ namespace atn { }; } // namespace atn -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/atn/LexerActionType.h b/runtime/Cpp/runtime/src/atn/LexerActionType.h index dd96bb0fc..a74e8aa02 100755 --- a/runtime/Cpp/runtime/src/atn/LexerActionType.h +++ b/runtime/Cpp/runtime/src/atn/LexerActionType.h @@ -31,10 +31,7 @@ #pragma once -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { namespace atn { /// @@ -79,7 +76,4 @@ namespace atn { }; } // namespace atn -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/atn/LexerChannelAction.cpp b/runtime/Cpp/runtime/src/atn/LexerChannelAction.cpp index c4ee03a14..c2101b103 100755 --- a/runtime/Cpp/runtime/src/atn/LexerChannelAction.cpp +++ b/runtime/Cpp/runtime/src/atn/LexerChannelAction.cpp @@ -34,8 +34,8 @@ #include "atn/LexerChannelAction.h" -using namespace org::antlr::v4::runtime::atn; -using namespace org::antlr::v4::runtime::misc; +using namespace antlr4::atn; +using namespace antlr4::misc; LexerChannelAction::LexerChannelAction(int channel) : _channel(channel) { } diff --git a/runtime/Cpp/runtime/src/atn/LexerChannelAction.h b/runtime/Cpp/runtime/src/atn/LexerChannelAction.h index be0bad6d4..773ea227a 100755 --- a/runtime/Cpp/runtime/src/atn/LexerChannelAction.h +++ b/runtime/Cpp/runtime/src/atn/LexerChannelAction.h @@ -34,13 +34,10 @@ #include "atn/LexerAction.h" #include "atn/LexerActionType.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { namespace atn { - using org::antlr::v4::runtime::Lexer; + using antlr4::Lexer; /// /// Implements the {@code channel} lexer action by calling @@ -89,7 +86,4 @@ namespace atn { }; } // namespace atn -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/atn/LexerCustomAction.cpp b/runtime/Cpp/runtime/src/atn/LexerCustomAction.cpp index 8d09f5d35..3a78258d2 100755 --- a/runtime/Cpp/runtime/src/atn/LexerCustomAction.cpp +++ b/runtime/Cpp/runtime/src/atn/LexerCustomAction.cpp @@ -35,9 +35,9 @@ #include "atn/LexerCustomAction.h" -using namespace org::antlr::v4::runtime; -using namespace org::antlr::v4::runtime::atn; -using namespace org::antlr::v4::runtime::misc; +using namespace antlr4; +using namespace antlr4::atn; +using namespace antlr4::misc; LexerCustomAction::LexerCustomAction(int ruleIndex, int actionIndex) : _ruleIndex(ruleIndex), _actionIndex(actionIndex) { } diff --git a/runtime/Cpp/runtime/src/atn/LexerCustomAction.h b/runtime/Cpp/runtime/src/atn/LexerCustomAction.h index 12543a86f..318a406e9 100755 --- a/runtime/Cpp/runtime/src/atn/LexerCustomAction.h +++ b/runtime/Cpp/runtime/src/atn/LexerCustomAction.h @@ -34,10 +34,7 @@ #include "atn/LexerAction.h" #include "atn/LexerActionType.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { namespace atn { /// @@ -113,7 +110,4 @@ namespace atn { }; } // namespace atn -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/atn/LexerIndexedCustomAction.cpp b/runtime/Cpp/runtime/src/atn/LexerIndexedCustomAction.cpp index ad29b5524..2201aaecc 100755 --- a/runtime/Cpp/runtime/src/atn/LexerIndexedCustomAction.cpp +++ b/runtime/Cpp/runtime/src/atn/LexerIndexedCustomAction.cpp @@ -35,9 +35,9 @@ #include "atn/LexerIndexedCustomAction.h" -using namespace org::antlr::v4::runtime; -using namespace org::antlr::v4::runtime::atn; -using namespace org::antlr::v4::runtime::misc; +using namespace antlr4; +using namespace antlr4::atn; +using namespace antlr4::misc; LexerIndexedCustomAction::LexerIndexedCustomAction(int offset, Ref action) : _offset(offset), _action(action) { } diff --git a/runtime/Cpp/runtime/src/atn/LexerIndexedCustomAction.h b/runtime/Cpp/runtime/src/atn/LexerIndexedCustomAction.h index 1ca11a478..8848ac3fa 100755 --- a/runtime/Cpp/runtime/src/atn/LexerIndexedCustomAction.h +++ b/runtime/Cpp/runtime/src/atn/LexerIndexedCustomAction.h @@ -34,10 +34,7 @@ #include "RuleContext.h" #include "atn/LexerAction.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { namespace atn { /// @@ -107,8 +104,5 @@ namespace atn { }; } // namespace atn -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/atn/LexerModeAction.cpp b/runtime/Cpp/runtime/src/atn/LexerModeAction.cpp index a77ab72d1..83773318d 100755 --- a/runtime/Cpp/runtime/src/atn/LexerModeAction.cpp +++ b/runtime/Cpp/runtime/src/atn/LexerModeAction.cpp @@ -34,9 +34,9 @@ #include "atn/LexerModeAction.h" -using namespace org::antlr::v4::runtime; -using namespace org::antlr::v4::runtime::atn; -using namespace org::antlr::v4::runtime::misc; +using namespace antlr4; +using namespace antlr4::atn; +using namespace antlr4::misc; LexerModeAction::LexerModeAction(int mode) : _mode(mode) { } diff --git a/runtime/Cpp/runtime/src/atn/LexerModeAction.h b/runtime/Cpp/runtime/src/atn/LexerModeAction.h index 6e5ea2303..7b37eb9e5 100755 --- a/runtime/Cpp/runtime/src/atn/LexerModeAction.h +++ b/runtime/Cpp/runtime/src/atn/LexerModeAction.h @@ -34,10 +34,7 @@ #include "atn/LexerAction.h" #include "atn/LexerActionType.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { namespace atn { /// @@ -87,7 +84,4 @@ namespace atn { }; } // namespace atn -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/atn/LexerMoreAction.cpp b/runtime/Cpp/runtime/src/atn/LexerMoreAction.cpp index 7832de340..4163061d2 100755 --- a/runtime/Cpp/runtime/src/atn/LexerMoreAction.cpp +++ b/runtime/Cpp/runtime/src/atn/LexerMoreAction.cpp @@ -34,9 +34,9 @@ #include "atn/LexerMoreAction.h" -using namespace org::antlr::v4::runtime; -using namespace org::antlr::v4::runtime::atn; -using namespace org::antlr::v4::runtime::misc; +using namespace antlr4; +using namespace antlr4::atn; +using namespace antlr4::misc; const Ref LexerMoreAction::INSTANCE { new LexerMoreAction() }; diff --git a/runtime/Cpp/runtime/src/atn/LexerMoreAction.h b/runtime/Cpp/runtime/src/atn/LexerMoreAction.h index e1d3daade..44661d4e1 100755 --- a/runtime/Cpp/runtime/src/atn/LexerMoreAction.h +++ b/runtime/Cpp/runtime/src/atn/LexerMoreAction.h @@ -34,10 +34,7 @@ #include "atn/LexerAction.h" #include "atn/LexerActionType.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { namespace atn { /// @@ -83,7 +80,4 @@ namespace atn { }; } // namespace atn -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/atn/LexerPopModeAction.cpp b/runtime/Cpp/runtime/src/atn/LexerPopModeAction.cpp index a103e5fe2..1c98ddf05 100755 --- a/runtime/Cpp/runtime/src/atn/LexerPopModeAction.cpp +++ b/runtime/Cpp/runtime/src/atn/LexerPopModeAction.cpp @@ -34,9 +34,9 @@ #include "atn/LexerPopModeAction.h" -using namespace org::antlr::v4::runtime; -using namespace org::antlr::v4::runtime::atn; -using namespace org::antlr::v4::runtime::misc; +using namespace antlr4; +using namespace antlr4::atn; +using namespace antlr4::misc; const Ref LexerPopModeAction::INSTANCE { new LexerPopModeAction() }; diff --git a/runtime/Cpp/runtime/src/atn/LexerPopModeAction.h b/runtime/Cpp/runtime/src/atn/LexerPopModeAction.h index e64c21f44..31979da15 100755 --- a/runtime/Cpp/runtime/src/atn/LexerPopModeAction.h +++ b/runtime/Cpp/runtime/src/atn/LexerPopModeAction.h @@ -34,10 +34,7 @@ #include "atn/LexerAction.h" #include "atn/LexerActionType.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { namespace atn { /// @@ -83,7 +80,4 @@ namespace atn { }; } // namespace atn -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/atn/LexerPushModeAction.cpp b/runtime/Cpp/runtime/src/atn/LexerPushModeAction.cpp index 3770e1d03..57c2bb034 100755 --- a/runtime/Cpp/runtime/src/atn/LexerPushModeAction.cpp +++ b/runtime/Cpp/runtime/src/atn/LexerPushModeAction.cpp @@ -34,9 +34,9 @@ #include "atn/LexerPushModeAction.h" -using namespace org::antlr::v4::runtime; -using namespace org::antlr::v4::runtime::atn; -using namespace org::antlr::v4::runtime::misc; +using namespace antlr4; +using namespace antlr4::atn; +using namespace antlr4::misc; LexerPushModeAction::LexerPushModeAction(int mode) : _mode(mode) { } diff --git a/runtime/Cpp/runtime/src/atn/LexerPushModeAction.h b/runtime/Cpp/runtime/src/atn/LexerPushModeAction.h index b69e19191..4f89f0cdf 100755 --- a/runtime/Cpp/runtime/src/atn/LexerPushModeAction.h +++ b/runtime/Cpp/runtime/src/atn/LexerPushModeAction.h @@ -34,10 +34,7 @@ #include "atn/LexerAction.h" #include "atn/LexerActionType.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { namespace atn { /// @@ -87,7 +84,4 @@ namespace atn { }; } // namespace atn -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/atn/LexerSkipAction.cpp b/runtime/Cpp/runtime/src/atn/LexerSkipAction.cpp index 630a80bf6..efcd56892 100755 --- a/runtime/Cpp/runtime/src/atn/LexerSkipAction.cpp +++ b/runtime/Cpp/runtime/src/atn/LexerSkipAction.cpp @@ -34,9 +34,9 @@ #include "atn/LexerSkipAction.h" -using namespace org::antlr::v4::runtime; -using namespace org::antlr::v4::runtime::atn; -using namespace org::antlr::v4::runtime::misc; +using namespace antlr4; +using namespace antlr4::atn; +using namespace antlr4::misc; const Ref LexerSkipAction::INSTANCE { new LexerSkipAction() }; diff --git a/runtime/Cpp/runtime/src/atn/LexerSkipAction.h b/runtime/Cpp/runtime/src/atn/LexerSkipAction.h index 5d7cb8dac..b7fc297ab 100755 --- a/runtime/Cpp/runtime/src/atn/LexerSkipAction.h +++ b/runtime/Cpp/runtime/src/atn/LexerSkipAction.h @@ -34,10 +34,7 @@ #include "atn/LexerAction.h" #include "atn/LexerActionType.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { namespace atn { /// @@ -81,7 +78,4 @@ namespace atn { }; } // namespace atn -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/atn/LexerTypeAction.cpp b/runtime/Cpp/runtime/src/atn/LexerTypeAction.cpp index ca57ea5dc..464ff9b7b 100755 --- a/runtime/Cpp/runtime/src/atn/LexerTypeAction.cpp +++ b/runtime/Cpp/runtime/src/atn/LexerTypeAction.cpp @@ -34,9 +34,9 @@ #include "atn/LexerTypeAction.h" -using namespace org::antlr::v4::runtime; -using namespace org::antlr::v4::runtime::atn; -using namespace org::antlr::v4::runtime::misc; +using namespace antlr4; +using namespace antlr4::atn; +using namespace antlr4::misc; LexerTypeAction::LexerTypeAction(int type) : _type(type) { } diff --git a/runtime/Cpp/runtime/src/atn/LexerTypeAction.h b/runtime/Cpp/runtime/src/atn/LexerTypeAction.h index 89554e4f2..536216067 100755 --- a/runtime/Cpp/runtime/src/atn/LexerTypeAction.h +++ b/runtime/Cpp/runtime/src/atn/LexerTypeAction.h @@ -34,10 +34,7 @@ #include "atn/LexerActionType.h" #include "atn/LexerAction.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { namespace atn { /// Implements the {@code type} lexer action by calling @@ -81,7 +78,4 @@ namespace atn { }; } // namespace atn -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/atn/LookaheadEventInfo.cpp b/runtime/Cpp/runtime/src/atn/LookaheadEventInfo.cpp index e4ecee68e..5c1be347e 100755 --- a/runtime/Cpp/runtime/src/atn/LookaheadEventInfo.cpp +++ b/runtime/Cpp/runtime/src/atn/LookaheadEventInfo.cpp @@ -31,8 +31,8 @@ #include "atn/LookaheadEventInfo.h" -using namespace org::antlr::v4::runtime; -using namespace org::antlr::v4::runtime::atn; +using namespace antlr4; +using namespace antlr4::atn; LookaheadEventInfo::LookaheadEventInfo(int decision, Ref configs, int predictedAlt, TokenStream *input, int startIndex, int stopIndex, bool fullCtx) diff --git a/runtime/Cpp/runtime/src/atn/LookaheadEventInfo.h b/runtime/Cpp/runtime/src/atn/LookaheadEventInfo.h index 43a9e47f7..3ed20fb08 100755 --- a/runtime/Cpp/runtime/src/atn/LookaheadEventInfo.h +++ b/runtime/Cpp/runtime/src/atn/LookaheadEventInfo.h @@ -33,10 +33,7 @@ #include "atn/DecisionEventInfo.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { namespace atn { /// This class represents profiling event information for tracking the lookahead @@ -68,7 +65,4 @@ namespace atn { }; } // namespace atn -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/atn/LoopEndState.cpp b/runtime/Cpp/runtime/src/atn/LoopEndState.cpp index 54a55416c..76c84c7b1 100755 --- a/runtime/Cpp/runtime/src/atn/LoopEndState.cpp +++ b/runtime/Cpp/runtime/src/atn/LoopEndState.cpp @@ -31,7 +31,7 @@ #include "atn/LoopEndState.h" -using namespace org::antlr::v4::runtime::atn; +using namespace antlr4::atn; int LoopEndState::getStateType() { return LOOP_END; diff --git a/runtime/Cpp/runtime/src/atn/LoopEndState.h b/runtime/Cpp/runtime/src/atn/LoopEndState.h index d691dc840..3de98af06 100755 --- a/runtime/Cpp/runtime/src/atn/LoopEndState.h +++ b/runtime/Cpp/runtime/src/atn/LoopEndState.h @@ -33,10 +33,7 @@ #include "atn/ATNState.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { namespace atn { /// @@ -49,7 +46,4 @@ namespace atn { }; } // namespace atn -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/atn/NotSetTransition.cpp b/runtime/Cpp/runtime/src/atn/NotSetTransition.cpp index 0f2bc999c..3f0543f34 100755 --- a/runtime/Cpp/runtime/src/atn/NotSetTransition.cpp +++ b/runtime/Cpp/runtime/src/atn/NotSetTransition.cpp @@ -33,8 +33,8 @@ #include "atn/ATNState.h" #include "misc/IntervalSet.h" -using namespace org::antlr::v4::runtime; -using namespace org::antlr::v4::runtime::atn; +using namespace antlr4; +using namespace antlr4::atn; NotSetTransition::NotSetTransition(ATNState *target, const misc::IntervalSet &set) : SetTransition(target, set) { } diff --git a/runtime/Cpp/runtime/src/atn/NotSetTransition.h b/runtime/Cpp/runtime/src/atn/NotSetTransition.h index 6c57db69f..fa44a9ccb 100755 --- a/runtime/Cpp/runtime/src/atn/NotSetTransition.h +++ b/runtime/Cpp/runtime/src/atn/NotSetTransition.h @@ -33,10 +33,7 @@ #include "atn/SetTransition.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { namespace atn { class ANTLR4CPP_PUBLIC NotSetTransition final : public SetTransition { @@ -51,7 +48,4 @@ namespace atn { }; } // namespace atn -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/atn/OrderedATNConfigSet.cpp b/runtime/Cpp/runtime/src/atn/OrderedATNConfigSet.cpp index da35fa7e3..52eb35812 100755 --- a/runtime/Cpp/runtime/src/atn/OrderedATNConfigSet.cpp +++ b/runtime/Cpp/runtime/src/atn/OrderedATNConfigSet.cpp @@ -31,7 +31,7 @@ #include "atn/OrderedATNConfigSet.h" -using namespace org::antlr::v4::runtime::atn; +using namespace antlr4::atn; OrderedATNConfigSet::OrderedATNConfigSet() : ATNConfigSet() { configLookup = Ref( diff --git a/runtime/Cpp/runtime/src/atn/OrderedATNConfigSet.h b/runtime/Cpp/runtime/src/atn/OrderedATNConfigSet.h index 4f24495a4..7d49cc985 100755 --- a/runtime/Cpp/runtime/src/atn/OrderedATNConfigSet.h +++ b/runtime/Cpp/runtime/src/atn/OrderedATNConfigSet.h @@ -34,10 +34,7 @@ #include "atn/ATNConfigSet.h" #include "atn/ATNConfig.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { namespace atn { struct OrderedATNConfigHasher @@ -60,7 +57,4 @@ namespace atn { }; } // namespace atn -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/atn/ParseInfo.cpp b/runtime/Cpp/runtime/src/atn/ParseInfo.cpp index fcfef39fb..e41d99761 100755 --- a/runtime/Cpp/runtime/src/atn/ParseInfo.cpp +++ b/runtime/Cpp/runtime/src/atn/ParseInfo.cpp @@ -34,7 +34,7 @@ #include "atn/ParseInfo.h" -using namespace org::antlr::v4::runtime::atn; +using namespace antlr4::atn; ParseInfo::ParseInfo(ProfilingATNSimulator *atnSimulator) : _atnSimulator(atnSimulator) { } diff --git a/runtime/Cpp/runtime/src/atn/ParseInfo.h b/runtime/Cpp/runtime/src/atn/ParseInfo.h index 2fd96bb3e..0c47e195a 100755 --- a/runtime/Cpp/runtime/src/atn/ParseInfo.h +++ b/runtime/Cpp/runtime/src/atn/ParseInfo.h @@ -33,10 +33,7 @@ #include "atn/DecisionInfo.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { namespace atn { class ProfilingATNSimulator; @@ -125,7 +122,4 @@ namespace atn { }; } // namespace atn -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/atn/ParserATNSimulator.cpp b/runtime/Cpp/runtime/src/atn/ParserATNSimulator.cpp index fed04c78e..38fb32671 100755 --- a/runtime/Cpp/runtime/src/atn/ParserATNSimulator.cpp +++ b/runtime/Cpp/runtime/src/atn/ParserATNSimulator.cpp @@ -57,8 +57,8 @@ #include "atn/ParserATNSimulator.h" -using namespace org::antlr::v4::runtime; -using namespace org::antlr::v4::runtime::atn; +using namespace antlr4; +using namespace antlr4::atn; using namespace antlrcpp; diff --git a/runtime/Cpp/runtime/src/atn/ParserATNSimulator.h b/runtime/Cpp/runtime/src/atn/ParserATNSimulator.h index e1a5a9208..be6f9a147 100755 --- a/runtime/Cpp/runtime/src/atn/ParserATNSimulator.h +++ b/runtime/Cpp/runtime/src/atn/ParserATNSimulator.h @@ -38,10 +38,7 @@ #include "SemanticContext.h" #include "atn/ATNConfig.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { namespace atn { /** @@ -859,7 +856,4 @@ namespace atn { }; } // namespace atn -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/atn/PlusBlockStartState.cpp b/runtime/Cpp/runtime/src/atn/PlusBlockStartState.cpp index ff5e8b12f..be586f563 100755 --- a/runtime/Cpp/runtime/src/atn/PlusBlockStartState.cpp +++ b/runtime/Cpp/runtime/src/atn/PlusBlockStartState.cpp @@ -31,7 +31,7 @@ #include "atn/PlusBlockStartState.h" -using namespace org::antlr::v4::runtime::atn; +using namespace antlr4::atn; int PlusBlockStartState::getStateType() { return PLUS_BLOCK_START; diff --git a/runtime/Cpp/runtime/src/atn/PlusBlockStartState.h b/runtime/Cpp/runtime/src/atn/PlusBlockStartState.h index b9bd56fc8..397dd542c 100755 --- a/runtime/Cpp/runtime/src/atn/PlusBlockStartState.h +++ b/runtime/Cpp/runtime/src/atn/PlusBlockStartState.h @@ -33,10 +33,7 @@ #include "atn/BlockStartState.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { namespace atn { /// @@ -53,7 +50,4 @@ namespace atn { }; } // namespace atn -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/atn/PlusLoopbackState.cpp b/runtime/Cpp/runtime/src/atn/PlusLoopbackState.cpp index fac637775..b9472b7bb 100755 --- a/runtime/Cpp/runtime/src/atn/PlusLoopbackState.cpp +++ b/runtime/Cpp/runtime/src/atn/PlusLoopbackState.cpp @@ -31,7 +31,7 @@ #include "atn/PlusLoopbackState.h" -using namespace org::antlr::v4::runtime::atn; +using namespace antlr4::atn; int PlusLoopbackState::getStateType() { return PLUS_LOOP_BACK; diff --git a/runtime/Cpp/runtime/src/atn/PlusLoopbackState.h b/runtime/Cpp/runtime/src/atn/PlusLoopbackState.h index 3f2f8f2ae..b5ea2c37b 100755 --- a/runtime/Cpp/runtime/src/atn/PlusLoopbackState.h +++ b/runtime/Cpp/runtime/src/atn/PlusLoopbackState.h @@ -33,10 +33,7 @@ #include "atn/DecisionState.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { namespace atn { /// @@ -50,7 +47,4 @@ namespace atn { }; } // namespace atn -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/atn/PrecedencePredicateTransition.cpp b/runtime/Cpp/runtime/src/atn/PrecedencePredicateTransition.cpp index 907102645..7c69cfa0b 100755 --- a/runtime/Cpp/runtime/src/atn/PrecedencePredicateTransition.cpp +++ b/runtime/Cpp/runtime/src/atn/PrecedencePredicateTransition.cpp @@ -31,7 +31,7 @@ #include "atn/PrecedencePredicateTransition.h" -using namespace org::antlr::v4::runtime::atn; +using namespace antlr4::atn; PrecedencePredicateTransition::PrecedencePredicateTransition(ATNState *target, int precedence) : AbstractPredicateTransition(target), precedence(precedence) { diff --git a/runtime/Cpp/runtime/src/atn/PrecedencePredicateTransition.h b/runtime/Cpp/runtime/src/atn/PrecedencePredicateTransition.h index f6f913649..e2fb5c672 100755 --- a/runtime/Cpp/runtime/src/atn/PrecedencePredicateTransition.h +++ b/runtime/Cpp/runtime/src/atn/PrecedencePredicateTransition.h @@ -34,10 +34,7 @@ #include "atn/AbstractPredicateTransition.h" #include "SemanticContext.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { namespace atn { class ANTLR4CPP_PUBLIC PrecedencePredicateTransition final : public AbstractPredicateTransition { @@ -55,7 +52,4 @@ namespace atn { }; } // namespace atn -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/atn/PredicateEvalInfo.cpp b/runtime/Cpp/runtime/src/atn/PredicateEvalInfo.cpp index 5063e75f9..6392ac0e0 100755 --- a/runtime/Cpp/runtime/src/atn/PredicateEvalInfo.cpp +++ b/runtime/Cpp/runtime/src/atn/PredicateEvalInfo.cpp @@ -33,8 +33,8 @@ #include "atn/PredicateEvalInfo.h" -using namespace org::antlr::v4::runtime; -using namespace org::antlr::v4::runtime::atn; +using namespace antlr4; +using namespace antlr4::atn; PredicateEvalInfo::PredicateEvalInfo(int decision, TokenStream *input, int startIndex, int stopIndex, Ref semctx, bool evalResult, int predictedAlt, bool fullCtx) diff --git a/runtime/Cpp/runtime/src/atn/PredicateEvalInfo.h b/runtime/Cpp/runtime/src/atn/PredicateEvalInfo.h index eb8350af5..1e8874653 100755 --- a/runtime/Cpp/runtime/src/atn/PredicateEvalInfo.h +++ b/runtime/Cpp/runtime/src/atn/PredicateEvalInfo.h @@ -33,10 +33,7 @@ #include "atn/DecisionEventInfo.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { namespace atn { /// @@ -88,7 +85,4 @@ namespace atn { }; } // namespace atn -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/atn/PredicateTransition.cpp b/runtime/Cpp/runtime/src/atn/PredicateTransition.cpp index 4810da31a..c8c7dddc1 100755 --- a/runtime/Cpp/runtime/src/atn/PredicateTransition.cpp +++ b/runtime/Cpp/runtime/src/atn/PredicateTransition.cpp @@ -31,7 +31,7 @@ #include "atn/PredicateTransition.h" -using namespace org::antlr::v4::runtime::atn; +using namespace antlr4::atn; PredicateTransition::PredicateTransition(ATNState *target, int ruleIndex, int predIndex, bool isCtxDependent) : AbstractPredicateTransition(target), ruleIndex(ruleIndex), predIndex(predIndex), isCtxDependent(isCtxDependent) { } diff --git a/runtime/Cpp/runtime/src/atn/PredicateTransition.h b/runtime/Cpp/runtime/src/atn/PredicateTransition.h index 4c7c8b144..c60bd5a63 100755 --- a/runtime/Cpp/runtime/src/atn/PredicateTransition.h +++ b/runtime/Cpp/runtime/src/atn/PredicateTransition.h @@ -34,10 +34,7 @@ #include "atn/AbstractPredicateTransition.h" #include "SemanticContext.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { namespace atn { /// TO_DO: this is old comment: @@ -65,7 +62,4 @@ namespace atn { }; } // namespace atn -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/atn/PredictionContext.cpp b/runtime/Cpp/runtime/src/atn/PredictionContext.cpp index a7ff4e6e7..3d0812ac2 100755 --- a/runtime/Cpp/runtime/src/atn/PredictionContext.cpp +++ b/runtime/Cpp/runtime/src/atn/PredictionContext.cpp @@ -40,9 +40,9 @@ #include "atn/PredictionContext.h" -using namespace org::antlr::v4::runtime; -using namespace org::antlr::v4::runtime::misc; -using namespace org::antlr::v4::runtime::atn; +using namespace antlr4; +using namespace antlr4::misc; +using namespace antlr4::atn; using namespace antlrcpp; diff --git a/runtime/Cpp/runtime/src/atn/PredictionContext.h b/runtime/Cpp/runtime/src/atn/PredictionContext.h index 276001144..5763949d1 100755 --- a/runtime/Cpp/runtime/src/atn/PredictionContext.h +++ b/runtime/Cpp/runtime/src/atn/PredictionContext.h @@ -35,10 +35,7 @@ #include "atn/ATN.h" #include "atn/ATNState.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { namespace atn { struct PredictionContextHasher; @@ -259,8 +256,5 @@ namespace atn { }; } // namespace atn -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/atn/PredictionMode.cpp b/runtime/Cpp/runtime/src/atn/PredictionMode.cpp index 2e2c8972d..ae34e942a 100755 --- a/runtime/Cpp/runtime/src/atn/PredictionMode.cpp +++ b/runtime/Cpp/runtime/src/atn/PredictionMode.cpp @@ -37,8 +37,8 @@ #include "PredictionMode.h" -using namespace org::antlr::v4::runtime; -using namespace org::antlr::v4::runtime::atn; +using namespace antlr4; +using namespace antlr4::atn; using namespace antlrcpp; struct AltAndContextConfigHasher diff --git a/runtime/Cpp/runtime/src/atn/PredictionMode.h b/runtime/Cpp/runtime/src/atn/PredictionMode.h index 58be194f1..eca5c4757 100755 --- a/runtime/Cpp/runtime/src/atn/PredictionMode.h +++ b/runtime/Cpp/runtime/src/atn/PredictionMode.h @@ -33,10 +33,7 @@ #include "support/BitSet.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { namespace atn { /** @@ -462,7 +459,4 @@ namespace atn { }; } // namespace atn -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/atn/ProfilingATNSimulator.cpp b/runtime/Cpp/runtime/src/atn/ProfilingATNSimulator.cpp index 26f5878d6..78bda30e5 100755 --- a/runtime/Cpp/runtime/src/atn/ProfilingATNSimulator.cpp +++ b/runtime/Cpp/runtime/src/atn/ProfilingATNSimulator.cpp @@ -37,9 +37,9 @@ #include "atn/ProfilingATNSimulator.h" -using namespace org::antlr::v4::runtime; -using namespace org::antlr::v4::runtime::atn; -using namespace org::antlr::v4::runtime::dfa; +using namespace antlr4; +using namespace antlr4::atn; +using namespace antlr4::dfa; using namespace antlrcpp; using namespace std::chrono; diff --git a/runtime/Cpp/runtime/src/atn/ProfilingATNSimulator.h b/runtime/Cpp/runtime/src/atn/ProfilingATNSimulator.h index 51df4028a..1ca427f5e 100755 --- a/runtime/Cpp/runtime/src/atn/ProfilingATNSimulator.h +++ b/runtime/Cpp/runtime/src/atn/ProfilingATNSimulator.h @@ -34,10 +34,7 @@ #include "atn/ParserATNSimulator.h" #include "atn/DecisionInfo.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { namespace atn { class ANTLR4CPP_PUBLIC ProfilingATNSimulator : public ParserATNSimulator { @@ -87,7 +84,4 @@ namespace atn { }; } // namespace atn -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/atn/RangeTransition.cpp b/runtime/Cpp/runtime/src/atn/RangeTransition.cpp index 6afbcb713..270941767 100755 --- a/runtime/Cpp/runtime/src/atn/RangeTransition.cpp +++ b/runtime/Cpp/runtime/src/atn/RangeTransition.cpp @@ -33,8 +33,8 @@ #include "atn/RangeTransition.h" -using namespace org::antlr::v4::runtime; -using namespace org::antlr::v4::runtime::atn; +using namespace antlr4; +using namespace antlr4::atn; RangeTransition::RangeTransition(ATNState *target, size_t from, size_t to) : Transition(target), from(from), to(to) { } diff --git a/runtime/Cpp/runtime/src/atn/RangeTransition.h b/runtime/Cpp/runtime/src/atn/RangeTransition.h index c302a7e17..7fa7b1ef1 100755 --- a/runtime/Cpp/runtime/src/atn/RangeTransition.h +++ b/runtime/Cpp/runtime/src/atn/RangeTransition.h @@ -33,10 +33,7 @@ #include "atn/Transition.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { namespace atn { class ANTLR4CPP_PUBLIC RangeTransition final : public Transition { @@ -55,7 +52,4 @@ namespace atn { }; } // namespace atn -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/atn/RuleStartState.cpp b/runtime/Cpp/runtime/src/atn/RuleStartState.cpp index 3c2410d1f..8545a95c6 100755 --- a/runtime/Cpp/runtime/src/atn/RuleStartState.cpp +++ b/runtime/Cpp/runtime/src/atn/RuleStartState.cpp @@ -31,7 +31,7 @@ #include "atn/RuleStartState.h" -using namespace org::antlr::v4::runtime::atn; +using namespace antlr4::atn; RuleStartState::RuleStartState() { isLeftRecursiveRule = false; diff --git a/runtime/Cpp/runtime/src/atn/RuleStartState.h b/runtime/Cpp/runtime/src/atn/RuleStartState.h index 27cf23b14..690492f41 100755 --- a/runtime/Cpp/runtime/src/atn/RuleStartState.h +++ b/runtime/Cpp/runtime/src/atn/RuleStartState.h @@ -33,10 +33,7 @@ #include "atn/ATNState.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { namespace atn { class ANTLR4CPP_PUBLIC RuleStartState final : public ATNState { @@ -51,7 +48,4 @@ namespace atn { }; } // namespace atn -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/atn/RuleStopState.cpp b/runtime/Cpp/runtime/src/atn/RuleStopState.cpp index cfc51b34b..1b9a19521 100755 --- a/runtime/Cpp/runtime/src/atn/RuleStopState.cpp +++ b/runtime/Cpp/runtime/src/atn/RuleStopState.cpp @@ -31,7 +31,7 @@ #include "atn/RuleStopState.h" -using namespace org::antlr::v4::runtime::atn; +using namespace antlr4::atn; int RuleStopState::getStateType() { return RULE_STOP; diff --git a/runtime/Cpp/runtime/src/atn/RuleStopState.h b/runtime/Cpp/runtime/src/atn/RuleStopState.h index 7571205e3..56b2a2dfc 100755 --- a/runtime/Cpp/runtime/src/atn/RuleStopState.h +++ b/runtime/Cpp/runtime/src/atn/RuleStopState.h @@ -33,10 +33,7 @@ #include "atn/ATNState.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { namespace atn { /// @@ -53,7 +50,4 @@ namespace atn { }; } // namespace atn -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/atn/RuleTransition.cpp b/runtime/Cpp/runtime/src/atn/RuleTransition.cpp index 9187e52e0..bdd35ef4e 100755 --- a/runtime/Cpp/runtime/src/atn/RuleTransition.cpp +++ b/runtime/Cpp/runtime/src/atn/RuleTransition.cpp @@ -32,7 +32,7 @@ #include "atn/RuleStartState.h" #include "atn/RuleTransition.h" -using namespace org::antlr::v4::runtime::atn; +using namespace antlr4::atn; RuleTransition::RuleTransition(RuleStartState *ruleStart, int ruleIndex, ATNState *followState) : RuleTransition(ruleStart, ruleIndex, 0, followState) { diff --git a/runtime/Cpp/runtime/src/atn/RuleTransition.h b/runtime/Cpp/runtime/src/atn/RuleTransition.h index be41e8195..d498d9e4e 100755 --- a/runtime/Cpp/runtime/src/atn/RuleTransition.h +++ b/runtime/Cpp/runtime/src/atn/RuleTransition.h @@ -33,10 +33,7 @@ #include "atn/Transition.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { namespace atn { class ANTLR4CPP_PUBLIC RuleTransition : public Transition { @@ -66,7 +63,4 @@ namespace atn { }; } // namespace atn -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/atn/SemanticContext.cpp b/runtime/Cpp/runtime/src/atn/SemanticContext.cpp index bebb645bd..628e2d32a 100755 --- a/runtime/Cpp/runtime/src/atn/SemanticContext.cpp +++ b/runtime/Cpp/runtime/src/atn/SemanticContext.cpp @@ -34,8 +34,8 @@ #include "SemanticContext.h" -using namespace org::antlr::v4::runtime; -using namespace org::antlr::v4::runtime::atn; +using namespace antlr4; +using namespace antlr4::atn; using namespace antlrcpp; //------------------ Predicate ----------------------------------------------------------------------------------------- diff --git a/runtime/Cpp/runtime/src/atn/SemanticContext.h b/runtime/Cpp/runtime/src/atn/SemanticContext.h index ce0beb4d5..52bae8e5d 100755 --- a/runtime/Cpp/runtime/src/atn/SemanticContext.h +++ b/runtime/Cpp/runtime/src/atn/SemanticContext.h @@ -34,10 +34,7 @@ #include "Recognizer.h" #include "support/CPPUtils.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { namespace atn { /// A tree structure used to record the semantic context in which @@ -229,15 +226,12 @@ namespace atn { }; } // namespace atn -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 // Hash function for SemanticContext, used in the MurmurHash::update function namespace std { - using org::antlr::v4::runtime::atn::SemanticContext; + using antlr4::atn::SemanticContext; template <> struct hash { diff --git a/runtime/Cpp/runtime/src/atn/SetTransition.cpp b/runtime/Cpp/runtime/src/atn/SetTransition.cpp index 82c2ca009..71e9321f7 100755 --- a/runtime/Cpp/runtime/src/atn/SetTransition.cpp +++ b/runtime/Cpp/runtime/src/atn/SetTransition.cpp @@ -34,8 +34,8 @@ #include "atn/SetTransition.h" -using namespace org::antlr::v4::runtime; -using namespace org::antlr::v4::runtime::atn; +using namespace antlr4; +using namespace antlr4::atn; SetTransition::SetTransition(ATNState *target, const misc::IntervalSet &aSet) : Transition(target), set(aSet.isEmpty() ? misc::IntervalSet::of(Token::INVALID_TYPE) : aSet) { diff --git a/runtime/Cpp/runtime/src/atn/SetTransition.h b/runtime/Cpp/runtime/src/atn/SetTransition.h index 6ac68f72e..62f5dbfa8 100755 --- a/runtime/Cpp/runtime/src/atn/SetTransition.h +++ b/runtime/Cpp/runtime/src/atn/SetTransition.h @@ -33,10 +33,7 @@ #include "atn/Transition.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { namespace atn { /// @@ -56,7 +53,4 @@ namespace atn { }; } // namespace atn -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/atn/SingletonPredictionContext.cpp b/runtime/Cpp/runtime/src/atn/SingletonPredictionContext.cpp index f88dd0e44..1d742c68a 100755 --- a/runtime/Cpp/runtime/src/atn/SingletonPredictionContext.cpp +++ b/runtime/Cpp/runtime/src/atn/SingletonPredictionContext.cpp @@ -33,7 +33,7 @@ #include "atn/SingletonPredictionContext.h" -using namespace org::antlr::v4::runtime::atn; +using namespace antlr4::atn; SingletonPredictionContext::SingletonPredictionContext(std::weak_ptr parent, int returnState) : PredictionContext(!parent.expired() ? calculateHashCode(parent, returnState) : calculateEmptyHashCode()), diff --git a/runtime/Cpp/runtime/src/atn/SingletonPredictionContext.h b/runtime/Cpp/runtime/src/atn/SingletonPredictionContext.h index a163b446a..9ee93ca89 100755 --- a/runtime/Cpp/runtime/src/atn/SingletonPredictionContext.h +++ b/runtime/Cpp/runtime/src/atn/SingletonPredictionContext.h @@ -33,10 +33,7 @@ #include "atn/PredictionContext.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { namespace atn { class ANTLR4CPP_PUBLIC SingletonPredictionContext : public PredictionContext { @@ -62,7 +59,4 @@ namespace atn { }; } // namespace atn -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/atn/StarBlockStartState.cpp b/runtime/Cpp/runtime/src/atn/StarBlockStartState.cpp index db4a82341..9c74fc6cc 100755 --- a/runtime/Cpp/runtime/src/atn/StarBlockStartState.cpp +++ b/runtime/Cpp/runtime/src/atn/StarBlockStartState.cpp @@ -31,7 +31,7 @@ #include "atn/StarBlockStartState.h" -using namespace org::antlr::v4::runtime::atn; +using namespace antlr4::atn; int StarBlockStartState::getStateType() { return STAR_BLOCK_START; diff --git a/runtime/Cpp/runtime/src/atn/StarBlockStartState.h b/runtime/Cpp/runtime/src/atn/StarBlockStartState.h index f31f6ba29..972cddf7b 100755 --- a/runtime/Cpp/runtime/src/atn/StarBlockStartState.h +++ b/runtime/Cpp/runtime/src/atn/StarBlockStartState.h @@ -33,10 +33,7 @@ #include "atn/BlockStartState.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { namespace atn { /// @@ -48,7 +45,4 @@ namespace atn { }; } // namespace atn -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/atn/StarLoopEntryState.cpp b/runtime/Cpp/runtime/src/atn/StarLoopEntryState.cpp index aa3438024..60604ef8c 100755 --- a/runtime/Cpp/runtime/src/atn/StarLoopEntryState.cpp +++ b/runtime/Cpp/runtime/src/atn/StarLoopEntryState.cpp @@ -31,7 +31,7 @@ #include "atn/StarLoopEntryState.h" -using namespace org::antlr::v4::runtime::atn; +using namespace antlr4::atn; StarLoopEntryState::StarLoopEntryState() : DecisionState(), isPrecedenceDecision(false) { } diff --git a/runtime/Cpp/runtime/src/atn/StarLoopEntryState.h b/runtime/Cpp/runtime/src/atn/StarLoopEntryState.h index 6b856f21e..9248ea3f7 100755 --- a/runtime/Cpp/runtime/src/atn/StarLoopEntryState.h +++ b/runtime/Cpp/runtime/src/atn/StarLoopEntryState.h @@ -33,10 +33,7 @@ #include "atn/DecisionState.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { namespace atn { class ANTLR4CPP_PUBLIC StarLoopEntryState final : public DecisionState { @@ -61,7 +58,4 @@ namespace atn { }; } // namespace atn -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/atn/StarLoopbackState.cpp b/runtime/Cpp/runtime/src/atn/StarLoopbackState.cpp index 93945a48c..ae454d7fc 100755 --- a/runtime/Cpp/runtime/src/atn/StarLoopbackState.cpp +++ b/runtime/Cpp/runtime/src/atn/StarLoopbackState.cpp @@ -34,7 +34,7 @@ #include "atn/StarLoopbackState.h" -using namespace org::antlr::v4::runtime::atn; +using namespace antlr4::atn; StarLoopEntryState *StarLoopbackState::getLoopEntryState() { return static_cast(transition(0)->target); diff --git a/runtime/Cpp/runtime/src/atn/StarLoopbackState.h b/runtime/Cpp/runtime/src/atn/StarLoopbackState.h index ac356b2ba..614331f71 100755 --- a/runtime/Cpp/runtime/src/atn/StarLoopbackState.h +++ b/runtime/Cpp/runtime/src/atn/StarLoopbackState.h @@ -33,10 +33,7 @@ #include "atn/ATNState.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { namespace atn { class ANTLR4CPP_PUBLIC StarLoopbackState final : public ATNState { @@ -47,7 +44,4 @@ namespace atn { }; } // namespace atn -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/atn/TokensStartState.cpp b/runtime/Cpp/runtime/src/atn/TokensStartState.cpp index b05092e88..ec753fa4b 100755 --- a/runtime/Cpp/runtime/src/atn/TokensStartState.cpp +++ b/runtime/Cpp/runtime/src/atn/TokensStartState.cpp @@ -31,7 +31,7 @@ #include "atn/TokensStartState.h" -using namespace org::antlr::v4::runtime::atn; +using namespace antlr4::atn; int TokensStartState::getStateType() { return TOKEN_START; diff --git a/runtime/Cpp/runtime/src/atn/TokensStartState.h b/runtime/Cpp/runtime/src/atn/TokensStartState.h index 4d7857777..7975d21ad 100755 --- a/runtime/Cpp/runtime/src/atn/TokensStartState.h +++ b/runtime/Cpp/runtime/src/atn/TokensStartState.h @@ -33,10 +33,7 @@ #include "atn/DecisionState.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { namespace atn { /// @@ -48,7 +45,4 @@ namespace atn { }; } // namespace atn -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/atn/Transition.cpp b/runtime/Cpp/runtime/src/atn/Transition.cpp index 3479f7937..ae68b7268 100755 --- a/runtime/Cpp/runtime/src/atn/Transition.cpp +++ b/runtime/Cpp/runtime/src/atn/Transition.cpp @@ -34,8 +34,8 @@ #include "atn/Transition.h" -using namespace org::antlr::v4::runtime; -using namespace org::antlr::v4::runtime::atn; +using namespace antlr4; +using namespace antlr4::atn; using namespace antlrcpp; diff --git a/runtime/Cpp/runtime/src/atn/Transition.h b/runtime/Cpp/runtime/src/atn/Transition.h index 90bdc99a4..7ff7dda5d 100755 --- a/runtime/Cpp/runtime/src/atn/Transition.h +++ b/runtime/Cpp/runtime/src/atn/Transition.h @@ -33,10 +33,7 @@ #include "misc/IntervalSet.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { namespace atn { /// @@ -98,7 +95,4 @@ namespace atn { }; } // namespace atn -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/atn/WildcardTransition.cpp b/runtime/Cpp/runtime/src/atn/WildcardTransition.cpp index c9203dd2b..712925a8c 100755 --- a/runtime/Cpp/runtime/src/atn/WildcardTransition.cpp +++ b/runtime/Cpp/runtime/src/atn/WildcardTransition.cpp @@ -33,7 +33,7 @@ #include "atn/WildcardTransition.h" -using namespace org::antlr::v4::runtime::atn; +using namespace antlr4::atn; WildcardTransition::WildcardTransition(ATNState *target) : Transition(target) { } diff --git a/runtime/Cpp/runtime/src/atn/WildcardTransition.h b/runtime/Cpp/runtime/src/atn/WildcardTransition.h index 07b0360dc..e81d337f4 100755 --- a/runtime/Cpp/runtime/src/atn/WildcardTransition.h +++ b/runtime/Cpp/runtime/src/atn/WildcardTransition.h @@ -33,10 +33,7 @@ #include "atn/Transition.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { namespace atn { class ANTLR4CPP_PUBLIC WildcardTransition final : public Transition { @@ -51,7 +48,4 @@ namespace atn { }; } // namespace atn -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/dfa/DFA.cpp b/runtime/Cpp/runtime/src/dfa/DFA.cpp index 0ef527692..67b56d65f 100755 --- a/runtime/Cpp/runtime/src/dfa/DFA.cpp +++ b/runtime/Cpp/runtime/src/dfa/DFA.cpp @@ -37,8 +37,8 @@ #include "dfa/DFA.h" -using namespace org::antlr::v4::runtime; -using namespace org::antlr::v4::runtime::dfa; +using namespace antlr4; +using namespace antlr4::dfa; using namespace antlrcpp; DFA::DFA(atn::DecisionState *atnStartState) : DFA(atnStartState, 0) { diff --git a/runtime/Cpp/runtime/src/dfa/DFA.h b/runtime/Cpp/runtime/src/dfa/DFA.h index 11cea9066..ef5399d64 100755 --- a/runtime/Cpp/runtime/src/dfa/DFA.h +++ b/runtime/Cpp/runtime/src/dfa/DFA.h @@ -33,10 +33,7 @@ #include "dfa/DFAState.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { namespace dfa { class ANTLR4CPP_PUBLIC DFA { @@ -115,7 +112,4 @@ namespace dfa { }; } // namespace atn -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/dfa/DFASerializer.cpp b/runtime/Cpp/runtime/src/dfa/DFASerializer.cpp index 51681c467..712759212 100755 --- a/runtime/Cpp/runtime/src/dfa/DFASerializer.cpp +++ b/runtime/Cpp/runtime/src/dfa/DFASerializer.cpp @@ -35,7 +35,7 @@ #include "dfa/DFASerializer.h" -using namespace org::antlr::v4::runtime::dfa; +using namespace antlr4::dfa; DFASerializer::DFASerializer(const DFA *dfa, const std::vector& tokenNames) : DFASerializer(dfa, VocabularyImpl::fromTokenNames(tokenNames)) { diff --git a/runtime/Cpp/runtime/src/dfa/DFASerializer.h b/runtime/Cpp/runtime/src/dfa/DFASerializer.h index bf48dba78..45ba1a4d3 100755 --- a/runtime/Cpp/runtime/src/dfa/DFASerializer.h +++ b/runtime/Cpp/runtime/src/dfa/DFASerializer.h @@ -34,10 +34,7 @@ #include "Vocabulary.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { namespace dfa { /// A DFA walker that knows how to dump them to serialized strings. @@ -59,7 +56,4 @@ namespace dfa { }; } // namespace atn -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/dfa/DFAState.cpp b/runtime/Cpp/runtime/src/dfa/DFAState.cpp index d5c368a20..ea268862d 100755 --- a/runtime/Cpp/runtime/src/dfa/DFAState.cpp +++ b/runtime/Cpp/runtime/src/dfa/DFAState.cpp @@ -36,8 +36,8 @@ #include "dfa/DFAState.h" -using namespace org::antlr::v4::runtime::dfa; -using namespace org::antlr::v4::runtime::atn; +using namespace antlr4::dfa; +using namespace antlr4::atn; DFAState::PredPrediction::PredPrediction(Ref pred, int alt) : pred(pred) { InitializeInstanceFields(); diff --git a/runtime/Cpp/runtime/src/dfa/DFAState.h b/runtime/Cpp/runtime/src/dfa/DFAState.h index dd5c8ace7..f799c3c71 100755 --- a/runtime/Cpp/runtime/src/dfa/DFAState.h +++ b/runtime/Cpp/runtime/src/dfa/DFAState.h @@ -33,10 +33,7 @@ #include "antlr4-common.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { namespace dfa { /// @@ -172,7 +169,4 @@ namespace dfa { }; } // namespace atn -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/dfa/LexerDFASerializer.cpp b/runtime/Cpp/runtime/src/dfa/LexerDFASerializer.cpp index 61e64ab69..1d43a08fe 100755 --- a/runtime/Cpp/runtime/src/dfa/LexerDFASerializer.cpp +++ b/runtime/Cpp/runtime/src/dfa/LexerDFASerializer.cpp @@ -33,7 +33,7 @@ #include "dfa/LexerDFASerializer.h" -using namespace org::antlr::v4::runtime::dfa; +using namespace antlr4::dfa; LexerDFASerializer::LexerDFASerializer(DFA *dfa) : DFASerializer(dfa, VocabularyImpl::EMPTY_VOCABULARY) { } diff --git a/runtime/Cpp/runtime/src/dfa/LexerDFASerializer.h b/runtime/Cpp/runtime/src/dfa/LexerDFASerializer.h index b9591f1d0..117263d94 100755 --- a/runtime/Cpp/runtime/src/dfa/LexerDFASerializer.h +++ b/runtime/Cpp/runtime/src/dfa/LexerDFASerializer.h @@ -33,10 +33,7 @@ #include "dfa/DFASerializer.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { namespace dfa { class ANTLR4CPP_PUBLIC LexerDFASerializer : public DFASerializer { @@ -49,7 +46,4 @@ namespace dfa { }; } // namespace atn -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/misc/Interval.cpp b/runtime/Cpp/runtime/src/misc/Interval.cpp index c6af880c9..db09271fc 100755 --- a/runtime/Cpp/runtime/src/misc/Interval.cpp +++ b/runtime/Cpp/runtime/src/misc/Interval.cpp @@ -31,7 +31,7 @@ #include "misc/Interval.h" -using namespace org::antlr::v4::runtime::misc; +using namespace antlr4::misc; Interval const Interval::INVALID; diff --git a/runtime/Cpp/runtime/src/misc/Interval.h b/runtime/Cpp/runtime/src/misc/Interval.h index 55377ab9e..b46e1a053 100755 --- a/runtime/Cpp/runtime/src/misc/Interval.h +++ b/runtime/Cpp/runtime/src/misc/Interval.h @@ -33,10 +33,7 @@ #include "antlr4-common.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { namespace misc { /// An immutable inclusive interval a..b @@ -110,7 +107,4 @@ namespace misc { }; } // namespace atn -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/misc/IntervalSet.cpp b/runtime/Cpp/runtime/src/misc/IntervalSet.cpp index 27c1445e5..4faf51cc4 100755 --- a/runtime/Cpp/runtime/src/misc/IntervalSet.cpp +++ b/runtime/Cpp/runtime/src/misc/IntervalSet.cpp @@ -36,8 +36,8 @@ #include "misc/IntervalSet.h" -using namespace org::antlr::v4::runtime; -using namespace org::antlr::v4::runtime::misc; +using namespace antlr4; +using namespace antlr4::misc; IntervalSet const IntervalSet::COMPLETE_CHAR_SET = []() { IntervalSet complete = IntervalSet::of(Lexer::MIN_CHAR_VALUE, Lexer::MAX_CHAR_VALUE); @@ -60,7 +60,7 @@ IntervalSet::IntervalSet(const std::vector &intervals) : IntervalSet() } IntervalSet::IntervalSet(const IntervalSet &set) : IntervalSet() { - _intervals = set._intervals; + addAll(set); } IntervalSet::IntervalSet(int n, ...) : IntervalSet() { diff --git a/runtime/Cpp/runtime/src/misc/IntervalSet.h b/runtime/Cpp/runtime/src/misc/IntervalSet.h index 9a23eecf9..8901bb709 100755 --- a/runtime/Cpp/runtime/src/misc/IntervalSet.h +++ b/runtime/Cpp/runtime/src/misc/IntervalSet.h @@ -33,10 +33,7 @@ #include "misc/Interval.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { namespace misc { /** @@ -208,15 +205,12 @@ namespace misc { }; } // namespace atn -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 // Hash function for IntervalSet. namespace std { - using org::antlr::v4::runtime::misc::IntervalSet; + using antlr4::misc::IntervalSet; template <> struct hash { diff --git a/runtime/Cpp/runtime/src/misc/MurmurHash.cpp b/runtime/Cpp/runtime/src/misc/MurmurHash.cpp index a50184e94..1486f2f28 100755 --- a/runtime/Cpp/runtime/src/misc/MurmurHash.cpp +++ b/runtime/Cpp/runtime/src/misc/MurmurHash.cpp @@ -31,7 +31,7 @@ #include "misc/MurmurHash.h" -using namespace org::antlr::v4::runtime::misc; +using namespace antlr4::misc; // A variation of the MurmurHash3 implementation (https://github.com/aappleby/smhasher/blob/master/src/MurmurHash3.cpp) // Here we unrolled the loop used there into individual calls to update(), as we usually hash object fields diff --git a/runtime/Cpp/runtime/src/misc/MurmurHash.h b/runtime/Cpp/runtime/src/misc/MurmurHash.h index bb9333d72..2fbf82a2a 100755 --- a/runtime/Cpp/runtime/src/misc/MurmurHash.h +++ b/runtime/Cpp/runtime/src/misc/MurmurHash.h @@ -33,10 +33,7 @@ #include "antlr4-common.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { namespace misc { class ANTLR4CPP_PUBLIC MurmurHash { @@ -97,7 +94,4 @@ namespace misc { }; } // namespace atn -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/misc/Predicate.h b/runtime/Cpp/runtime/src/misc/Predicate.h index cc8ad94bb..c4f29a225 100755 --- a/runtime/Cpp/runtime/src/misc/Predicate.h +++ b/runtime/Cpp/runtime/src/misc/Predicate.h @@ -31,10 +31,7 @@ #pragma once -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { namespace misc { template @@ -46,7 +43,4 @@ namespace misc { }; } // namespace tree -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/misc/TestRig.cpp b/runtime/Cpp/runtime/src/misc/TestRig.cpp deleted file mode 100755 index 470d09478..000000000 --- a/runtime/Cpp/runtime/src/misc/TestRig.cpp +++ /dev/null @@ -1,236 +0,0 @@ -/* - * [The "BSD license"] - * Copyright (c) 2016 Mike Lischke - * Copyright (c) 2013 Terence Parr - * Copyright (c) 2013 Dan McLaughlin - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "misc/TestRig.h" - -using namespace org::antlr::v4::runtime::misc; - -#ifdef TODO -const std::string TestRig::LEXER_START_RULE_NAME = "tokens"; - -TestRig::TestRig(std::string args[]) throw(std::exception) : inputFiles(new java::util::ArrayList()) { - InitializeInstanceFields(); - if (sizeof(args) / sizeof(args[0]) < 2) { - System::err::println(std::string("java org.antlr.v4.runtime.misc.TestRig GrammarName startRuleName\n") + std::string(" [-tokens] [-tree] [-gui] [-ps file.ps] [-encoding encodingname]\n") + std::string(" [-trace] [-diagnostics] [-SLL]\n") + std::string(" [input-filename(s)]")); - System::err::println("Use startRuleName='tokens' if GrammarName is a lexer grammar."); - System::err::println("Omitting input-filename makes rig read from stdin."); - return; - } - int i = 0; - grammarName = args[i]; - i++; - startRuleName = args[i]; - i++; - while (i < sizeof(args) / sizeof(args[0])) { - std::string arg = args[i]; - i++; - if (arg[0] != '-') { // input file name - inputFiles.push_back(arg); - continue; - } - if (arg == "-tree") { - printTree = true; - } - if (arg == "-gui") { - gui = true; - } - if (arg == "-tokens") { - showTokens = true; - } else if (arg == "-trace") { - trace = true; - } else if (arg == "-SL") { - SLL = true; - } else if (arg == "-diagnostics") { - diagnostics = true; - } else if (arg == "-encoding") { - if (i >= sizeof(args) / sizeof(args[0])) { - System::err::println("missing encoding on -encoding"); - return; - } - encoding = args[i]; - i++; - } else if (arg == "-ps") { - if (i >= sizeof(args) / sizeof(args[0])) { - System::err::println("missing filename on -ps"); - return; - } - psFile = args[i]; - i++; - } - } -} - -void TestRig::main(std::string args[]) throw(std::exception) { - TestRig *testRig = new TestRig(args); - if (sizeof(args) / sizeof(args[0]) >= 2) { - testRig->process(); - } -} - -void TestRig::process() throw(std::exception) { - // System.out.println("exec "+grammarName+"."+startRuleName); - std::string lexerName = grammarName + std::string("Lexer"); - ClassLoader *cl = Thread::currentThread()->getContextClassLoader(); - Class *lexerClass = nullptr; - try { - lexerClass = cl->loadClass(lexerName)->asSubclass(Lexer::typeid); - } catch (java::lang::ClassNotFoundException cnfe) { - // might be pure lexer grammar; no Lexer suffix then - lexerName = grammarName; - try { - lexerClass = cl->loadClass(lexerName)->asSubclass(Lexer::typeid); - } catch (ClassNotFoundException cnfe2) { - System::err::println(std::string("Can't load ") + lexerName + std::string(" as lexer or parser")); - return; - } - } - - //JAVA TO C++ CONVERTER TODO TASK: Java wildcard generics are not converted to C++: - //ORIGINAL LINE: Constructor lexerCtor = lexerClass.getConstructor(org.antlr.v4.runtime.CharStream.class); - Constructor *lexerCtor = lexerClass->getConstructor(CharStream::typeid); - Lexer *lexer = lexerCtor->newInstance(static_cast(nullptr)); - - Class *parserClass = nullptr; - Parser *parser = nullptr; - if (startRuleName != LEXER_START_RULE_NAME) { - std::string parserName = grammarName + std::string("Parser"); - parserClass = cl->loadClass(parserName)->asSubclass(Parser::typeid); - if (parserClass == nullptr) { - System::err::println(std::string("Can't load ") + parserName); - } - //JAVA TO C++ CONVERTER TODO TASK: Java wildcard generics are not converted to C++: - //ORIGINAL LINE: Constructor parserCtor = parserClass.getConstructor(org.antlr.v4.runtime.TokenStream.class); - Constructor *parserCtor = parserClass->getConstructor(TokenStream::typeid); - parser = parserCtor->newInstance(static_cast(nullptr)); - } - - if (inputFiles.empty()) { - InputStream *is = System::in; - Reader *r; - if (encoding != "") { - r = new InputStreamReader(is, encoding); - } else { - r = new InputStreamReader(is); - } - - process(lexer, parserClass, parser, is, r); - return; - } - for (auto inputFile : inputFiles) { - InputStream *is = System::in; - if (inputFile != nullptr) { - is = new FileInputStream(inputFile); - } - Reader *r; - if (encoding != "") { - r = new InputStreamReader(is, encoding); - } else { - r = new InputStreamReader(is); - } - - if (inputFiles.size() > 1) { - System::err::println(inputFile); - } - process(lexer, parserClass, parser, is, r); - } -} - -void TestRig::process(Lexer *lexer, Class *parserClass, Parser *parser, InputStream *is, Reader *r) throw(IOException, IllegalAccessException, InvocationTargetException, PrintException) { - try { - ANTLRInputStream *input = new ANTLRInputStream(r); - lexer->setInputStream(input); - CommonTokenStream *tokens = new CommonTokenStream(lexer); - - tokens->fill(); - - if (showTokens) { - for (auto tok : tokens->getTokens()) { - std::cout << tok << std::endl; - } - } - - if (startRuleName == LEXER_START_RULE_NAME) { - return; - } - - if (diagnostics) { - parser->addErrorListener(new DiagnosticErrorListener()); - parser->getInterpreter()->setPredictionMode(PredictionMode::LL_EXACT_AMBIG_DETECTION); - } - - if (printTree || gui || psFile != "") { - parser->setBuildParseTree(true); - } - - if (SLL) { // overrides diagnostics - parser->getInterpreter()->setPredictionMode(PredictionMode::SLL); - } - - parser->setTokenStream(tokens); - parser->setTrace(trace); - - try { - Method *startRule = parserClass->getMethod(startRuleName); - ParserRuleContext *tree = static_cast(startRule->invoke(parser, static_cast(nullptr))); - - if (printTree) { - std::cout << tree->toStringTree(parser) << std::endl; - } - if (gui) { - tree->inspect(parser); - } - if (psFile != "") { - tree->save(parser, psFile); // Generate postscript - } - } catch (NoSuchMethodException nsme) { - System::err::println(std::string("No method for rule ") + startRuleName + std::string(" or it has arguments")); - } - } finally { - if (r != nullptr) { - r->close(); - } - if (is != nullptr) { - is->close(); - } - } -} - -void TestRig::InitializeInstanceFields() { - printTree = false; - gui = false; - psFile = ""; - showTokens = false; - trace = false; - diagnostics = false; - encoding = ""; - SLL = false; -} -#endif diff --git a/runtime/Cpp/runtime/src/support/Arrays.cpp b/runtime/Cpp/runtime/src/support/Arrays.cpp index 2cd49e737..536a7e295 100644 --- a/runtime/Cpp/runtime/src/support/Arrays.cpp +++ b/runtime/Cpp/runtime/src/support/Arrays.cpp @@ -52,7 +52,7 @@ std::string Arrays::listToString(const std::vector &list, const std } template <> -std::string Arrays::toString(const std::vector &source) { +std::string Arrays::toString(const std::vector &source) { std::string result = "["; bool firstEntry = true; for (auto value : source) { diff --git a/runtime/Cpp/runtime/src/support/Arrays.h b/runtime/Cpp/runtime/src/support/Arrays.h index 31b4eaae5..f705e45aa 100644 --- a/runtime/Cpp/runtime/src/support/Arrays.h +++ b/runtime/Cpp/runtime/src/support/Arrays.h @@ -128,5 +128,5 @@ namespace antlrcpp { }; template <> - std::string Arrays::toString(const std::vector &source); + std::string Arrays::toString(const std::vector &source); } diff --git a/runtime/Cpp/runtime/src/support/Declarations.h b/runtime/Cpp/runtime/src/support/Declarations.h index ce2aa00dc..1ddad6bd3 100644 --- a/runtime/Cpp/runtime/src/support/Declarations.h +++ b/runtime/Cpp/runtime/src/support/Declarations.h @@ -30,169 +30,167 @@ #pragma once -// This can be regenerated from the command line by using -// ls *.h | sed "s/\.h\*/;/" | sed 's/^/class /' +namespace antlr4 { + class IllegalStateException; + class IllegalArgumentException; + class NoSuchElementException; + class NullPointerException; + class InputMismatchException; + class ParseCancellationException; + class InputMismatchException; + class EmptyStackException; + class LexerNoViableAltException; -// Autogenerated -class XPathLexer; -class XPathParser; + class ANTLRErrorListener; + class ANTLRErrorStrategy; + class ANTLRFileStream; + class ANTLRInputStream; + class BailErrorStrategy; + class BaseErrorListener; + class BufferedTokenStream; + class CharStream; + class CommonToken; + class CommonTokenFactory; + class CommonTokenStream; + class ConsoleErrorListener; + class DefaultErrorStrategy; + class DiagnosticErrorListener; + class FailedPredicateException; + class InputMismatchException; + class IntStream; + class InterpreterRuleContext; + class IRecognizer; + class Lexer; + class LexerInterpreter; + class LexerNoViableAltException; + class ListTokenSource; + class NoViableAltException; + class Parser; + class ParserInterpreter; + class ParserRuleContext; + class ProxyErrorListener; + class RecognitionException; + class Recognizer; + class RuleContext; + class Token; + template class TokenFactory; + class TokenSource; + class TokenStream; + class TokenStreamRewriter; + class UnbufferedCharStream; + class UnbufferedTokenStream; + class WritableToken; -namespace org { - namespace antlr { - namespace v4 { - namespace runtime { - class IllegalStateException; - class IllegalArgumentException; - class NoSuchElementException; - class NullPointerException; - class InputMismatchException; - class ParseCancellationException; - class InputMismatchException; - class EmptyStackException; - class LexerNoViableAltException; + namespace misc { + class Interval; + class IntervalSet; + class MurmurHash; + class ParseCancellationException; + class Utils; + template class Predicate; + } + namespace atn { + class ATN; + class ATNConfig; + template class BaseATNConfigSet; + class ATNConfigSet; + class ATNDeserializationOptions; + class ATNDeserializer; + class ATNSerializer; + class ATNSimulator; + class ATNState; + enum class ATNType; + class AbstractPredicateTransition; + class ActionTransition; + class ArrayPredictionContext; + class AtomTransition; + class BasicBlockStartState; + class BasicState; + class BlockEndState; + class BlockStartState; + class ConfigLookup; + class DecisionState; + class EmptyPredictionContext; + class EpsilonTransition; + class LL1Analyzer; + class LexerAction; + class LexerActionExecutor; + class LexerATNConfig; + class LexerATNSimulator; + class LexerMoreAction; + class LexerPopModeAction; + class LexerSkipAction; + class LookaheadEventInfo; + class LoopEndState; + class NotSetTransition; + class OrderedATNConfigSet; + class ParseInfo; + class ParserATNSimulator; + class PlusBlockStartState; + class PlusLoopbackState; + class PrecedencePredicateTransition; + class PredicateTransition; + class PredictionContext; + enum class PredictionMode; + class PredictionModeClass; + class RangeTransition; + class RuleStartState; + class RuleStopState; + class RuleTransition; + class SemanticContext; + class SetTransition; + class SingletonPredictionContext; + class StarBlockStartState; + class StarLoopEntryState; + class StarLoopbackState; + class TokensStartState; + class Transition; + class WildcardTransition; + } + namespace dfa { + class DFA; + class DFASerializer; + class DFAState; + class LexerDFASerializer; + class Vocabulary; + } + namespace tree { + template class AbstractParseTreeVisitor; + class ErrorNode; + class ErrorNodeImpl; + class ParseTree; + class ParseTreeListener; + template class ParseTreeProperty; + template class ParseTreeVisitor; + class ParseTreeWalker; + class RuleNode; + class SyntaxTree; + class TerminalNode; + class TerminalNodeImpl; + class Tree; + class Trees; - class ANTLRErrorListener; - class ANTLRErrorStrategy; - class ANTLRFileStream; - class ANTLRInputStream; - class BailErrorStrategy; - class BaseErrorListener; - class BufferedTokenStream; - class CharStream; - class CommonToken; - class CommonTokenFactory; - class CommonTokenStream; - class ConsoleErrorListener; - class DefaultErrorStrategy; - class DiagnosticErrorListener; - class FailedPredicateException; - class InputMismatchException; - class IntStream; - class InterpreterRuleContext; - class IRecognizer; - class Lexer; - class LexerInterpreter; - class LexerNoViableAltException; - class ListTokenSource; - class NoViableAltException; - class Parser; - class ParserInterpreter; - class ParserRuleContext; - class ProxyErrorListener; - class RecognitionException; - class Recognizer; - class RuleContext; - class Token; - template class TokenFactory; - class TokenSource; - class TokenStream; - class TokenStreamRewriter; - class UnbufferedCharStream; - class UnbufferedTokenStream; - class WritableToken; + namespace pattern { + class Chunk; + class ParseTreeMatch; + class ParseTreePattern; + class ParseTreePatternMatcher; + class RuleTagToken; + class TagChunk; + class TextChunk; + class TokenTagToken; + } - namespace misc { - class Interval; - class IntervalSet; - class MurmurHash; - class ParseCancellationException; - class Utils; - template class Predicate; - } - namespace atn { - class ATN; - class ATNConfig; - template class BaseATNConfigSet; - class ATNConfigSet; - class ATNDeserializationOptions; - class ATNDeserializer; - class ATNSerializer; - class ATNSimulator; - class ATNState; - enum class ATNType; - class AbstractPredicateTransition; - class ActionTransition; - class ArrayPredictionContext; - class AtomTransition; - class BasicBlockStartState; - class BasicState; - class BlockEndState; - class BlockStartState; - class ConfigLookup; - class DecisionState; - class EmptyPredictionContext; - class EpsilonTransition; - class LL1Analyzer; - class LexerAction; - class LexerActionExecutor; - class LexerATNConfig; - class LexerATNSimulator; - class LexerMoreAction; - class LexerPopModeAction; - class LexerSkipAction; - class LookaheadEventInfo; - class LoopEndState; - class NotSetTransition; - class OrderedATNConfigSet; - class ParseInfo; - class ParserATNSimulator; - class PlusBlockStartState; - class PlusLoopbackState; - class PrecedencePredicateTransition; - class PredicateTransition; - class PredictionContext; - enum class PredictionMode; - class PredictionModeClass; - class RangeTransition; - class RuleStartState; - class RuleStopState; - class RuleTransition; - class SemanticContext; - class SetTransition; - class SingletonPredictionContext; - class StarBlockStartState; - class StarLoopEntryState; - class StarLoopbackState; - class TokensStartState; - class Transition; - class WildcardTransition; - } - namespace dfa { - class DFA; - class DFASerializer; - class DFAState; - class LexerDFASerializer; - class Vocabulary; - } - namespace tree { - template class AbstractParseTreeVisitor; - class ErrorNode; - class ErrorNodeImpl; - class ParseTree; - class ParseTreeListener; - template class ParseTreeProperty; - template class ParseTreeVisitor; - class ParseTreeWalker; - class RuleNode; - class SyntaxTree; - class TerminalNode; - class TerminalNodeImpl; - class Tree; - class Trees; - - namespace pattern { - class Chunk; - class ParseTreeMatch; - class ParseTreePattern; - class ParseTreePatternMatcher; - class RuleTagToken; - class TagChunk; - class TextChunk; - class TokenTagToken; - } - - } - } + namespace xpath { + class XPath; + class XPathElement; + class XPathLexerErrorListener; + class XPathRuleAnywhereElement; + class XPathRuleElement; + class XPathTokenAnywhereElement; + class XPathTokenElement; + class XPathWildcardAnywhereElement; + class XPathWildcardElement; } } } diff --git a/runtime/Cpp/runtime/src/tree/AbstractParseTreeVisitor.h b/runtime/Cpp/runtime/src/tree/AbstractParseTreeVisitor.h index 058eb724b..0f4df21b3 100755 --- a/runtime/Cpp/runtime/src/tree/AbstractParseTreeVisitor.h +++ b/runtime/Cpp/runtime/src/tree/AbstractParseTreeVisitor.h @@ -34,10 +34,7 @@ #include "tree/ParseTreeVisitor.h" #include "tree/RuleNode.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { namespace tree { template @@ -169,7 +166,4 @@ namespace tree { }; } // namespace tree -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/tree/ErrorNode.h b/runtime/Cpp/runtime/src/tree/ErrorNode.h index e3bec6c1c..41bbd1c5d 100755 --- a/runtime/Cpp/runtime/src/tree/ErrorNode.h +++ b/runtime/Cpp/runtime/src/tree/ErrorNode.h @@ -33,17 +33,11 @@ #include "tree/TerminalNode.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { namespace tree { class ANTLR4CPP_PUBLIC ErrorNode : public virtual TerminalNode { }; } // namespace tree -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/tree/ErrorNodeImpl.cpp b/runtime/Cpp/runtime/src/tree/ErrorNodeImpl.cpp index 44e691fe1..e32d1524a 100755 --- a/runtime/Cpp/runtime/src/tree/ErrorNodeImpl.cpp +++ b/runtime/Cpp/runtime/src/tree/ErrorNodeImpl.cpp @@ -33,9 +33,9 @@ #include "tree/ErrorNodeImpl.h" -using namespace org::antlr::v4::runtime; -using namespace org::antlr::v4::runtime::misc; -using namespace org::antlr::v4::runtime::tree; +using namespace antlr4; +using namespace antlr4::misc; +using namespace antlr4::tree; ErrorNodeImpl::ErrorNodeImpl(Ref token) : TerminalNodeImpl(token) { } diff --git a/runtime/Cpp/runtime/src/tree/ErrorNodeImpl.h b/runtime/Cpp/runtime/src/tree/ErrorNodeImpl.h index f2cfe55b4..c45166bae 100755 --- a/runtime/Cpp/runtime/src/tree/ErrorNodeImpl.h +++ b/runtime/Cpp/runtime/src/tree/ErrorNodeImpl.h @@ -35,10 +35,7 @@ #include "tree/TerminalNodeImpl.h" #include "misc/Interval.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { namespace tree { /// @@ -59,7 +56,4 @@ namespace tree { }; } // namespace tree -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/tree/ParseTree.h b/runtime/Cpp/runtime/src/tree/ParseTree.h index ed9e88624..4ca67a8bf 100755 --- a/runtime/Cpp/runtime/src/tree/ParseTree.h +++ b/runtime/Cpp/runtime/src/tree/ParseTree.h @@ -33,10 +33,7 @@ #include "tree/SyntaxTree.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { namespace tree { /// @@ -73,7 +70,4 @@ namespace tree { }; } // namespace tree -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/tree/ParseTreeListener.h b/runtime/Cpp/runtime/src/tree/ParseTreeListener.h index 9314c4756..719ab613c 100755 --- a/runtime/Cpp/runtime/src/tree/ParseTreeListener.h +++ b/runtime/Cpp/runtime/src/tree/ParseTreeListener.h @@ -33,10 +33,7 @@ #include "antlr4-common.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { namespace tree { /** This interface describes the minimal core of methods triggered @@ -65,7 +62,4 @@ namespace tree { }; } // namespace tree -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/tree/ParseTreeProperty.h b/runtime/Cpp/runtime/src/tree/ParseTreeProperty.h index d7ee14bcb..c6d2aa155 100755 --- a/runtime/Cpp/runtime/src/tree/ParseTreeProperty.h +++ b/runtime/Cpp/runtime/src/tree/ParseTreeProperty.h @@ -31,10 +31,7 @@ #pragma once -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { namespace tree { /// @@ -80,7 +77,4 @@ namespace tree { }; } // namespace tree -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/tree/ParseTreeVisitor.h b/runtime/Cpp/runtime/src/tree/ParseTreeVisitor.h index c393ab30d..72fc3bbed 100755 --- a/runtime/Cpp/runtime/src/tree/ParseTreeVisitor.h +++ b/runtime/Cpp/runtime/src/tree/ParseTreeVisitor.h @@ -33,10 +33,7 @@ #include "antlr4-common.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { namespace tree { /// @@ -82,7 +79,4 @@ namespace tree { }; } // namespace tree -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/tree/ParseTreeWalker.cpp b/runtime/Cpp/runtime/src/tree/ParseTreeWalker.cpp index fd25ce843..c93bab701 100755 --- a/runtime/Cpp/runtime/src/tree/ParseTreeWalker.cpp +++ b/runtime/Cpp/runtime/src/tree/ParseTreeWalker.cpp @@ -36,7 +36,7 @@ #include "tree/ParseTreeWalker.h" -using namespace org::antlr::v4::runtime::tree; +using namespace antlr4::tree; using namespace antlrcpp; const Ref ParseTreeWalker::DEFAULT = std::make_shared(); diff --git a/runtime/Cpp/runtime/src/tree/ParseTreeWalker.h b/runtime/Cpp/runtime/src/tree/ParseTreeWalker.h index 0a4f7b821..dd84eb216 100755 --- a/runtime/Cpp/runtime/src/tree/ParseTreeWalker.h +++ b/runtime/Cpp/runtime/src/tree/ParseTreeWalker.h @@ -31,10 +31,7 @@ #pragma once -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { namespace tree { class ANTLR4CPP_PUBLIC ParseTreeWalker { @@ -58,7 +55,4 @@ namespace tree { }; } // namespace tree -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/tree/RuleNode.h b/runtime/Cpp/runtime/src/tree/RuleNode.h index 8c26ebcfb..35745c302 100755 --- a/runtime/Cpp/runtime/src/tree/RuleNode.h +++ b/runtime/Cpp/runtime/src/tree/RuleNode.h @@ -33,20 +33,13 @@ #include "tree/ParseTree.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { namespace tree { class ANTLR4CPP_PUBLIC RuleNode : public ParseTree { public: - // Because of cross references (RuleNode <-> RuleContext) we cannot use RuleContext> here. - virtual Ref getRuleContext() = 0; + virtual Ref getRuleContext() = 0; }; } // namespace tree -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/tree/SyntaxTree.h b/runtime/Cpp/runtime/src/tree/SyntaxTree.h index 3719e2915..f2f805a9e 100755 --- a/runtime/Cpp/runtime/src/tree/SyntaxTree.h +++ b/runtime/Cpp/runtime/src/tree/SyntaxTree.h @@ -33,10 +33,7 @@ #include "tree/Tree.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { namespace tree { /// @@ -66,7 +63,4 @@ namespace tree { }; } // namespace tree -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/tree/TerminalNode.h b/runtime/Cpp/runtime/src/tree/TerminalNode.h index 48fc8b382..49f1c2552 100755 --- a/runtime/Cpp/runtime/src/tree/TerminalNode.h +++ b/runtime/Cpp/runtime/src/tree/TerminalNode.h @@ -33,10 +33,7 @@ #include "tree/ParseTree.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { namespace tree { class ANTLR4CPP_PUBLIC TerminalNode : public ParseTree { @@ -45,7 +42,4 @@ namespace tree { }; } // namespace tree -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/tree/TerminalNodeImpl.cpp b/runtime/Cpp/runtime/src/tree/TerminalNodeImpl.cpp index 595c65558..706adf164 100755 --- a/runtime/Cpp/runtime/src/tree/TerminalNodeImpl.cpp +++ b/runtime/Cpp/runtime/src/tree/TerminalNodeImpl.cpp @@ -34,8 +34,8 @@ #include "tree/TerminalNodeImpl.h" -using namespace org::antlr::v4::runtime; -using namespace org::antlr::v4::runtime::tree; +using namespace antlr4; +using namespace antlr4::tree; TerminalNodeImpl::TerminalNodeImpl(Ref symbol) { this->symbol = symbol; diff --git a/runtime/Cpp/runtime/src/tree/TerminalNodeImpl.h b/runtime/Cpp/runtime/src/tree/TerminalNodeImpl.h index 82e566dca..50f7d0fb8 100755 --- a/runtime/Cpp/runtime/src/tree/TerminalNodeImpl.h +++ b/runtime/Cpp/runtime/src/tree/TerminalNodeImpl.h @@ -33,10 +33,7 @@ #include "tree/TerminalNode.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { namespace tree { class ANTLR4CPP_PUBLIC TerminalNodeImpl : public virtual TerminalNode { @@ -67,7 +64,4 @@ namespace tree { }; } // namespace tree -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/tree/Tree.cpp b/runtime/Cpp/runtime/src/tree/Tree.cpp index 2f2a6fe9b..12f63c575 100755 --- a/runtime/Cpp/runtime/src/tree/Tree.cpp +++ b/runtime/Cpp/runtime/src/tree/Tree.cpp @@ -31,7 +31,7 @@ #include "tree/Tree.h" -using namespace org::antlr::v4::runtime::tree; +using namespace antlr4::tree; bool Tree::operator == (const Tree &other) const { return &other == this; diff --git a/runtime/Cpp/runtime/src/tree/Tree.h b/runtime/Cpp/runtime/src/tree/Tree.h index 3a0e6ae6d..5a1057c4e 100755 --- a/runtime/Cpp/runtime/src/tree/Tree.h +++ b/runtime/Cpp/runtime/src/tree/Tree.h @@ -33,10 +33,7 @@ #include "antlr4-common.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { namespace tree { /// @@ -88,7 +85,4 @@ namespace tree { }; } // namespace tree -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/tree/Trees.cpp b/runtime/Cpp/runtime/src/tree/Trees.cpp index 8e2ad503e..3445494ee 100755 --- a/runtime/Cpp/runtime/src/tree/Trees.cpp +++ b/runtime/Cpp/runtime/src/tree/Trees.cpp @@ -42,9 +42,9 @@ #include "tree/Trees.h" -using namespace org::antlr::v4::runtime; -using namespace org::antlr::v4::runtime::misc; -using namespace org::antlr::v4::runtime::tree; +using namespace antlr4; +using namespace antlr4::misc; +using namespace antlr4::tree; using namespace antlrcpp; diff --git a/runtime/Cpp/runtime/src/tree/Trees.h b/runtime/Cpp/runtime/src/tree/Trees.h index 4598b2977..ab238d365 100755 --- a/runtime/Cpp/runtime/src/tree/Trees.h +++ b/runtime/Cpp/runtime/src/tree/Trees.h @@ -35,10 +35,7 @@ #include "ParserRuleContext.h" #include "Recognizer.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { namespace tree { /// A set of utility routines useful for all kinds of ANTLR trees. @@ -118,7 +115,4 @@ namespace tree { }; } // namespace tree -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/tree/pattern/Chunk.h b/runtime/Cpp/runtime/src/tree/pattern/Chunk.h index a0af8b368..10265cb47 100755 --- a/runtime/Cpp/runtime/src/tree/pattern/Chunk.h +++ b/runtime/Cpp/runtime/src/tree/pattern/Chunk.h @@ -31,10 +31,7 @@ #pragma once -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { namespace tree { namespace pattern { @@ -64,7 +61,4 @@ namespace pattern { } // namespace pattern } // namespace tree -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/tree/pattern/ParseTreeMatch.cpp b/runtime/Cpp/runtime/src/tree/pattern/ParseTreeMatch.cpp index 02c55286e..4ab3625a2 100755 --- a/runtime/Cpp/runtime/src/tree/pattern/ParseTreeMatch.cpp +++ b/runtime/Cpp/runtime/src/tree/pattern/ParseTreeMatch.cpp @@ -33,8 +33,8 @@ #include "tree/pattern/ParseTreeMatch.h" -using namespace org::antlr::v4::runtime::tree; -using namespace org::antlr::v4::runtime::tree::pattern; +using namespace antlr4::tree; +using namespace antlr4::tree::pattern; ParseTreeMatch::ParseTreeMatch(Ref tree, const ParseTreePattern &pattern, const std::map>> &labels, diff --git a/runtime/Cpp/runtime/src/tree/pattern/ParseTreeMatch.h b/runtime/Cpp/runtime/src/tree/pattern/ParseTreeMatch.h index a7cba72cc..884bddb63 100755 --- a/runtime/Cpp/runtime/src/tree/pattern/ParseTreeMatch.h +++ b/runtime/Cpp/runtime/src/tree/pattern/ParseTreeMatch.h @@ -33,10 +33,7 @@ #include "antlr4-common.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { namespace tree { namespace pattern { @@ -161,7 +158,4 @@ namespace pattern { } // namespace pattern } // namespace tree -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/tree/pattern/ParseTreePattern.cpp b/runtime/Cpp/runtime/src/tree/pattern/ParseTreePattern.cpp index d03335276..60319a709 100755 --- a/runtime/Cpp/runtime/src/tree/pattern/ParseTreePattern.cpp +++ b/runtime/Cpp/runtime/src/tree/pattern/ParseTreePattern.cpp @@ -31,46 +31,47 @@ #include "tree/pattern/ParseTreePatternMatcher.h" #include "tree/pattern/ParseTreeMatch.h" -//#include "XPath.h" + +#include "tree/xpath/XPath.h" +#include "tree/xpath/XPathElement.h" #include "tree/pattern/ParseTreePattern.h" -using namespace org::antlr::v4::runtime::tree; -using namespace org::antlr::v4::runtime::tree::pattern; +using namespace antlr4::tree; +using namespace antlr4::tree::pattern; ParseTreePattern::ParseTreePattern(ParseTreePatternMatcher *matcher, const std::string &pattern, int patternRuleIndex, Ref patternTree) - : patternRuleIndex(patternRuleIndex), pattern(pattern), patternTree(patternTree), matcher(matcher) { + : patternRuleIndex(patternRuleIndex), _pattern(pattern), _patternTree(patternTree), _matcher(matcher) { } ParseTreeMatch ParseTreePattern::match(Ref tree) { - return matcher->match(tree, *this); + return _matcher->match(tree, *this); } bool ParseTreePattern::matches(Ref tree) { - return matcher->match(tree, *this).succeeded(); + return _matcher->match(tree, *this).succeeded(); } -/* -std::vector ParseTreePattern::findAll(ParseTree *tree, const std::string &xpath) { - std::vector subtrees = xpath::XPath::findAll(tree, xpath, matcher->getParser()); - std::vector matches = std::vector(); +std::vector ParseTreePattern::findAll(Ref tree, const std::string &xpath) { + std::vector> subtrees = xpath::XPath::findAll(tree, xpath, _matcher->getParser()); + std::vector matches; for (auto t : subtrees) { - ParseTreeMatch *aMatch = match(t); - if (aMatch->succeeded()) { + ParseTreeMatch aMatch = match(t); + if (aMatch.succeeded()) { matches.push_back(aMatch); } } return matches; } -*/ + ParseTreePatternMatcher *ParseTreePattern::getMatcher() const { - return matcher; + return _matcher; } std::string ParseTreePattern::getPattern() const { - return pattern; + return _pattern; } int ParseTreePattern::getPatternRuleIndex() const { @@ -78,5 +79,5 @@ int ParseTreePattern::getPatternRuleIndex() const { } Ref ParseTreePattern::getPatternTree() const { - return patternTree; + return _patternTree; } diff --git a/runtime/Cpp/runtime/src/tree/pattern/ParseTreePattern.h b/runtime/Cpp/runtime/src/tree/pattern/ParseTreePattern.h index c8d271099..de5874ff6 100755 --- a/runtime/Cpp/runtime/src/tree/pattern/ParseTreePattern.h +++ b/runtime/Cpp/runtime/src/tree/pattern/ParseTreePattern.h @@ -33,10 +33,7 @@ #include "antlr4-common.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { namespace tree { namespace pattern { @@ -87,7 +84,7 @@ namespace pattern { // A full blown XPath implementation just for this single function which is nowhere used? // Readd the XPath stuff from ANTLR if you really need that. - //virtual std::vector findAll(ParseTree *tree, const std::string &xpath); + virtual std::vector findAll(Ref tree, const std::string &xpath); /// /// Get the which created this tree pattern. @@ -121,23 +118,18 @@ namespace pattern { private: const int patternRuleIndex; - /// /// This is the backing field for . - /// - const std::string pattern; + const std::string _pattern; /// This is the backing field for . - Ref patternTree; + Ref _patternTree; /// /// This is the backing field for . /// - ParseTreePatternMatcher *const matcher; + ParseTreePatternMatcher *const _matcher; }; } // namespace pattern } // namespace tree -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/tree/pattern/ParseTreePatternMatcher.cpp b/runtime/Cpp/runtime/src/tree/pattern/ParseTreePatternMatcher.cpp index b1754ea81..6be009d06 100755 --- a/runtime/Cpp/runtime/src/tree/pattern/ParseTreePatternMatcher.cpp +++ b/runtime/Cpp/runtime/src/tree/pattern/ParseTreePatternMatcher.cpp @@ -52,9 +52,9 @@ #include "tree/pattern/ParseTreePatternMatcher.h" -using namespace org::antlr::v4::runtime; -using namespace org::antlr::v4::runtime::tree; -using namespace org::antlr::v4::runtime::tree::pattern; +using namespace antlr4; +using namespace antlr4::tree; +using namespace antlr4::tree::pattern; using namespace antlrcpp; ParseTreePatternMatcher::CannotInvokeStartRule::CannotInvokeStartRule(const RuntimeException &e) : RuntimeException(e.what()) { diff --git a/runtime/Cpp/runtime/src/tree/pattern/ParseTreePatternMatcher.h b/runtime/Cpp/runtime/src/tree/pattern/ParseTreePatternMatcher.h index d7c278edc..f67d2396e 100755 --- a/runtime/Cpp/runtime/src/tree/pattern/ParseTreePatternMatcher.h +++ b/runtime/Cpp/runtime/src/tree/pattern/ParseTreePatternMatcher.h @@ -33,10 +33,7 @@ #include "Exceptions.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { namespace tree { namespace pattern { @@ -205,7 +202,4 @@ namespace pattern { } // namespace pattern } // namespace tree -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/tree/pattern/RuleTagToken.cpp b/runtime/Cpp/runtime/src/tree/pattern/RuleTagToken.cpp index ef344cd2d..629d75453 100755 --- a/runtime/Cpp/runtime/src/tree/pattern/RuleTagToken.cpp +++ b/runtime/Cpp/runtime/src/tree/pattern/RuleTagToken.cpp @@ -33,7 +33,7 @@ #include "tree/pattern/RuleTagToken.h" -using namespace org::antlr::v4::runtime::tree::pattern; +using namespace antlr4::tree::pattern; RuleTagToken::RuleTagToken(const std::string &/*ruleName*/, int _bypassTokenType) : bypassTokenType(_bypassTokenType) { } @@ -90,11 +90,11 @@ int RuleTagToken::getStopIndex() const { return -1; } -org::antlr::v4::runtime::TokenSource *RuleTagToken::getTokenSource() const { +antlr4::TokenSource *RuleTagToken::getTokenSource() const { return nullptr; } -org::antlr::v4::runtime::CharStream *RuleTagToken::getInputStream() const { +antlr4::CharStream *RuleTagToken::getInputStream() const { return nullptr; } diff --git a/runtime/Cpp/runtime/src/tree/pattern/RuleTagToken.h b/runtime/Cpp/runtime/src/tree/pattern/RuleTagToken.h index 407d3ab77..d22b21429 100755 --- a/runtime/Cpp/runtime/src/tree/pattern/RuleTagToken.h +++ b/runtime/Cpp/runtime/src/tree/pattern/RuleTagToken.h @@ -33,10 +33,7 @@ #include "Token.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { namespace tree { namespace pattern { @@ -183,7 +180,4 @@ namespace pattern { } // namespace pattern } // namespace tree -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/tree/pattern/TagChunk.cpp b/runtime/Cpp/runtime/src/tree/pattern/TagChunk.cpp index 1714ba2e3..8d4c5930b 100755 --- a/runtime/Cpp/runtime/src/tree/pattern/TagChunk.cpp +++ b/runtime/Cpp/runtime/src/tree/pattern/TagChunk.cpp @@ -33,7 +33,7 @@ #include "tree/pattern/TagChunk.h" -using namespace org::antlr::v4::runtime::tree::pattern; +using namespace antlr4::tree::pattern; TagChunk::TagChunk(const std::string &tag) : TagChunk("", tag) { } diff --git a/runtime/Cpp/runtime/src/tree/pattern/TagChunk.h b/runtime/Cpp/runtime/src/tree/pattern/TagChunk.h index 30289bf36..350f481d6 100755 --- a/runtime/Cpp/runtime/src/tree/pattern/TagChunk.h +++ b/runtime/Cpp/runtime/src/tree/pattern/TagChunk.h @@ -33,10 +33,7 @@ #include "Chunk.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { namespace tree { namespace pattern { @@ -112,7 +109,4 @@ namespace pattern { } // namespace pattern } // namespace tree -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/tree/pattern/TextChunk.cpp b/runtime/Cpp/runtime/src/tree/pattern/TextChunk.cpp index 117bfcce4..a709f0db1 100755 --- a/runtime/Cpp/runtime/src/tree/pattern/TextChunk.cpp +++ b/runtime/Cpp/runtime/src/tree/pattern/TextChunk.cpp @@ -33,7 +33,7 @@ #include "tree/pattern/TextChunk.h" -using namespace org::antlr::v4::runtime::tree::pattern; +using namespace antlr4::tree::pattern; TextChunk::TextChunk(const std::string &text) : text(text) { if (text == "") { diff --git a/runtime/Cpp/runtime/src/tree/pattern/TextChunk.h b/runtime/Cpp/runtime/src/tree/pattern/TextChunk.h index 7bc0dc68b..b354900b0 100755 --- a/runtime/Cpp/runtime/src/tree/pattern/TextChunk.h +++ b/runtime/Cpp/runtime/src/tree/pattern/TextChunk.h @@ -33,10 +33,7 @@ #include "Chunk.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { namespace tree { namespace pattern { @@ -77,7 +74,4 @@ namespace pattern { } // namespace pattern } // namespace tree -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/tree/pattern/TokenTagToken.cpp b/runtime/Cpp/runtime/src/tree/pattern/TokenTagToken.cpp index 34ec61225..c7b7e1a62 100755 --- a/runtime/Cpp/runtime/src/tree/pattern/TokenTagToken.cpp +++ b/runtime/Cpp/runtime/src/tree/pattern/TokenTagToken.cpp @@ -31,7 +31,7 @@ #include "tree/pattern/TokenTagToken.h" -using namespace org::antlr::v4::runtime::tree::pattern; +using namespace antlr4::tree::pattern; TokenTagToken::TokenTagToken(const std::string &/*tokenName*/, int type) : CommonToken(type), tokenName(""), label("") { diff --git a/runtime/Cpp/runtime/src/tree/pattern/TokenTagToken.h b/runtime/Cpp/runtime/src/tree/pattern/TokenTagToken.h index 85fa5e5d6..45a4cb89b 100755 --- a/runtime/Cpp/runtime/src/tree/pattern/TokenTagToken.h +++ b/runtime/Cpp/runtime/src/tree/pattern/TokenTagToken.h @@ -33,10 +33,7 @@ #include "CommonToken.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { +namespace antlr4 { namespace tree { namespace pattern { @@ -106,7 +103,4 @@ namespace pattern { } // namespace pattern } // namespace tree -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/tree/xpath/XPath.cpp b/runtime/Cpp/runtime/src/tree/xpath/XPath.cpp new file mode 100755 index 000000000..753fe4bd2 --- /dev/null +++ b/runtime/Cpp/runtime/src/tree/xpath/XPath.cpp @@ -0,0 +1,179 @@ +/* + * [The "BSD license"] + * Copyright (c) 2016 Mike Lischke + * Copyright (c) 2014 Sam Harwell + * Copyright (c) 2013 Terence Parr + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "XPathLexer.h" +#include "XPathLexerErrorListener.h" +#include "XPathElement.h" +#include "XPathWildcardAnywhereElement.h" +#include "XPathWildcardElement.h" +#include "XPathTokenAnywhereElement.h" +#include "XPathTokenElement.h" +#include "XPathRuleAnywhereElement.h" +#include "XPathRuleElement.h" + +#include "ParseTree.h" + +#include "XPath.h" + +using namespace antlr4; +using namespace antlr4::tree; +using namespace antlr4::tree::xpath; + +const std::string XPath::WILDCARD = "*"; +const std::string XPath::NOT = "!"; + +XPath::XPath(Parser *parser, const std::string &path) { + _parser = parser; + _path = path; + _elements = split(path); +} + +std::vector XPath::split(const std::string &path) { + ANTLRFileStream in(path); + XPathLexer lexer(&in); + lexer.removeErrorListeners(); + XPathLexerErrorListener listener; + lexer.addErrorListener(&listener); + CommonTokenStream tokenStream(&lexer); + try { + tokenStream.fill(); + } catch (LexerNoViableAltException &e) { + int pos = lexer.getCharPositionInLine(); + std::string msg = "Invalid tokens or characters at index " + std::to_string(pos) + " in path '" + path + "'"; + throw IllegalArgumentException(msg); + } + + std::vector> tokens = tokenStream.getTokens(); + std::vector elements; + size_t n = tokens.size(); + size_t i = 0; + bool done = false; + while (!done && i < n) { + Ref el = tokens[i]; + Ref next = nullptr; + switch (el->getType()) { + case XPathLexer::ROOT: + case XPathLexer::ANYWHERE: { + bool anywhere = el->getType() == XPathLexer::ANYWHERE; + i++; + next = tokens[i]; + bool invert = next->getType() == XPathLexer::BANG; + if (invert) { + i++; + next = tokens[i]; + } + XPathElement pathElement = getXPathElement(next, anywhere); + pathElement.setInvert(invert); + elements.push_back(pathElement); + i++; + break; + + } + case XPathLexer::TOKEN_REF: + case XPathLexer::RULE_REF: + case XPathLexer::WILDCARD: + elements.push_back(getXPathElement(el, false)); + i++; + break; + + case Token::EOF: + done = true; + break; + + default : + throw IllegalArgumentException("Unknow path element " + el->toString()); + } + } + + return elements; +} + +XPathElement XPath::getXPathElement(const Ref &wordToken, bool anywhere) { + if (wordToken->getType() == Token::EOF) { + throw IllegalArgumentException("Missing path element at end of path"); + } + std::string word = wordToken->getText(); + size_t ttype = _parser->getTokenType(word); + ssize_t ruleIndex = _parser->getRuleIndex(word); + switch (wordToken->getType()) { + case XPathLexer::WILDCARD : + if (anywhere) + return XPathWildcardAnywhereElement(); + return XPathWildcardElement(); + + case XPathLexer::TOKEN_REF: + case XPathLexer::STRING : + if (ttype == Token::INVALID_TYPE) { + throw IllegalArgumentException(word + " at index " + std::to_string(wordToken->getStartIndex()) + " isn't a valid token name"); + } + if (anywhere) + return XPathTokenAnywhereElement(word, (int)ttype); + return XPathTokenElement(word, (int)ttype); + + default : + if (ruleIndex == -1) { + throw IllegalArgumentException(word + " at index " + std::to_string(wordToken->getStartIndex()) + " isn't a valid rule name"); + } + if (anywhere) + return XPathRuleAnywhereElement(word, (int)ruleIndex); + return XPathRuleElement(word, (int)ruleIndex); + } +} + +std::vector> XPath::findAll(const Ref &tree, const std::string &xpath, Parser *parser) { + Ref p = std::make_shared(parser, xpath); + return p->evaluate(tree); +} + +std::vector> XPath::evaluate(const Ref &t) { + std::shared_ptr dummyRoot = std::make_shared(); + dummyRoot->children = { t }; // don't set t's parent. + + std::vector> work = { dummyRoot }; + + size_t i = 0; + while (i < _elements.size()) { + std::vector> next; + for (auto node : work) { + if (node->getChildCount() > 0) { + // only try to match next element if it has children + // e.g., //func/*/stat might have a token node for which + // we can't go looking for stat nodes. + auto matching = _elements[i].evaluate(node); + next.insert(next.end(), matching.begin(), matching.end()); + } + } + i++; + work = next; + } + + return work; +} diff --git a/runtime/Cpp/runtime/src/tree/xpath/XPath.h b/runtime/Cpp/runtime/src/tree/xpath/XPath.h new file mode 100755 index 000000000..09f64f533 --- /dev/null +++ b/runtime/Cpp/runtime/src/tree/xpath/XPath.h @@ -0,0 +1,113 @@ +/* + * [The "BSD license"] + * Copyright (c) 2016 Mike Lischke + * Copyright (c) 2014 Sam Harwell + * Copyright (c) 2013 Terence Parr + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#pragma once + +#include "antlr4-common.h" + +namespace antlr4 { +namespace tree { +namespace xpath { + + /// Represent a subset of XPath XML path syntax for use in identifying nodes in + /// parse trees. + /// + /// + /// Split path into words and separators {@code /} and {@code //} via ANTLR + /// itself then walk path elements from left to right. At each separator-word + /// pair, find set of nodes. Next stage uses those as work list. + /// + /// + /// The basic interface is + /// {@code (tree, pathString, parser)}. + /// But that is just shorthand for: + /// + ///
+  ///  p = new (parser, pathString);
+  /// return p.(tree);
+  /// 
+ /// + /// + /// See {@code org.antlr.v4.test.TestXPath} for descriptions. In short, this + /// allows operators: + /// + ///
+ ///
/
root
+ ///
//
anywhere
+ ///
!
invert; this must appear directly after root or anywhere + /// operator
+ ///
+ /// + /// + /// and path elements: + /// + ///
+ ///
ID
token name
+ ///
'string'
any string literal token from the grammar
+ ///
expr
rule name
+ ///
*
wildcard matching any node
+ ///
+ /// + /// + /// Whitespace is not allowed. + + class ANTLR4CPP_PUBLIC XPath { + public: + static const std::string WILDCARD; // word not operator/separator + static const std::string NOT; // word for invert operator + + XPath(Parser *parser, const std::string &path); + virtual ~XPath() {} + + // TO_DO: check for invalid token/rule names, bad syntax + virtual std::vector split(const std::string &path); + + static std::vector> findAll(const Ref &tree, const std::string &xpath, Parser *parser); + + /// Return a list of all nodes starting at {@code t} as root that satisfy the + /// path. The root {@code /} is relative to the node passed to + /// . + virtual std::vector> evaluate(const Ref &t); + + protected: + std::string _path; + std::vector _elements; + Parser *_parser; + + /// Convert word like {@code *} or {@code ID} or {@code expr} to a path + /// element. {@code anywhere} is {@code true} if {@code //} precedes the + /// word. + virtual XPathElement getXPathElement(const std::shared_ptr &wordToken, bool anywhere); + }; + +} // namespace xpath +} // namespace tree +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/tree/xpath/XPathElement.cpp b/runtime/Cpp/runtime/src/tree/xpath/XPathElement.cpp new file mode 100755 index 000000000..9c8946e8e --- /dev/null +++ b/runtime/Cpp/runtime/src/tree/xpath/XPathElement.cpp @@ -0,0 +1,54 @@ +/* + * [The "BSD license"] + * Copyright (c) 2016 Mike Lischke + * Copyright (c) 2014 Sam Harwell + * Copyright (c) 2013 Terence Parr + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "CPPUtils.h" + +#include "XPathElement.h" + +using namespace antlr4::tree; +using namespace antlr4::tree::xpath; + +XPathElement::XPathElement(const std::string &nodeName) { + _nodeName = nodeName; +} + +std::vector> XPathElement::evaluate(const Ref &/*t*/) { + return {}; +} + +std::string XPathElement::toString() const { + std::string inv = _invert ? "!" : ""; + return antlrcpp::toString(*this) + "[" + inv + _nodeName + "]"; +} + +void XPathElement::setInvert(bool value) { + _invert = value; +} diff --git a/runtime/Cpp/runtime/src/misc/TestRig.h b/runtime/Cpp/runtime/src/tree/xpath/XPathElement.h similarity index 53% rename from runtime/Cpp/runtime/src/misc/TestRig.h rename to runtime/Cpp/runtime/src/tree/xpath/XPathElement.h index fd818c703..b3e90016a 100755 --- a/runtime/Cpp/runtime/src/misc/TestRig.h +++ b/runtime/Cpp/runtime/src/tree/xpath/XPathElement.h @@ -1,8 +1,8 @@ -/* +/* * [The "BSD license"] * Copyright (c) 2016 Mike Lischke + * Copyright (c) 2014 Sam Harwell * Copyright (c) 2013 Terence Parr - * Copyright (c) 2013 Dan McLaughlin * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -33,60 +33,31 @@ #include "antlr4-common.h" -namespace org { -namespace antlr { -namespace v4 { -namespace runtime { -namespace misc { +namespace antlr4 { +namespace tree { + class ParseTree; - /// - /// Run a lexer/parser combo, optionally printing tree string or generating - /// postscript file. Optionally taking input file. - /// - /// $ java org.antlr.v4.runtime.misc.TestRig GrammarName startRuleName - /// [-tree] - /// [-tokens] [-gui] [-ps file.ps] - /// [-trace] - /// [-diagnostics] - /// [-SLL] - /// [input-filename(s)] - /// - class ANTLR4CPP_PUBLIC TestRig { +namespace xpath { + + class ANTLR4CPP_PUBLIC XPathElement { public: - static const std::string LEXER_START_RULE_NAME; + /// Construct element like {@code /ID} or {@code ID} or {@code /*} etc... + /// op is null if just node + XPathElement(const std::string &nodeName); + virtual ~XPathElement() {} - virtual ~TestRig() {}; + /// Given tree rooted at {@code t} return all nodes matched by this path + /// element. + virtual std::vector> evaluate(const Ref &t); + virtual std::string toString() const; + + void setInvert(bool value); protected: - std::string grammarName; - std::string startRuleName; - const std::vector inputFiles; - bool printTree; - bool gui; - std::string psFile; - bool showTokens; - bool trace; - bool diagnostics; - std::string encoding; - bool SLL; - - public: - TestRig(std::string args[]); - - static void main(std::string args[]); - - virtual void process(); - - protected: -#ifdef TODO - virtual void process(Lexer *lexer, Class *parserClass, Parser *parser, InputStream *is, Reader *r) throw(IOException, IllegalAccessException, InvocationTargetException, PrintException); -#endif - private: - void InitializeInstanceFields(); + std::string _nodeName; + bool _invert = false; }; -} // namespace atn -} // namespace runtime -} // namespace v4 -} // namespace antlr -} // namespace org +} // namespace xpath +} // namespace tree +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/tree/xpath/XPathLexer.cpp b/runtime/Cpp/runtime/src/tree/xpath/XPathLexer.cpp old mode 100755 new mode 100644 index 2885036e3..f494ca1a3 --- a/runtime/Cpp/runtime/src/tree/xpath/XPathLexer.cpp +++ b/runtime/Cpp/runtime/src/tree/xpath/XPathLexer.cpp @@ -1,90 +1,166 @@ -// Generated from java-escape by ANTLR 4.x -#include "Lexer.h" -#include "CharStream.h" -#include "Token.h" -#include "TokenStream.h" -#include "PredictionContextCache.h" -#include "DFA.h" -#include "ATN.h" -class XPathLexer : public org::antlr::v4::runtime::Lexer { - static org::antlr::v4::runtime::dfa::DFA _decisionToDFA[]; - org::antlr::v4::runtime::atn::PredictionContextCache *_sharedContextCache = - new org::antlr::v4::runtime::atn::PredictionContextCache(); - int - TOKEN_REF=1, RULE_REF=2, ANYWHERE=3, ROOT=4, WILDCARD=5, BANG=6, ID=7, - STRING=8; - - static std::vector ruleNames = { - "ANYWHERE", "ROOT", "WILDCARD", "BANG", "ID", "NameChar", "NameStartChar", - "STRING" - }; +// Generated from XPathLexer.g4 by ANTLR 4.5.3 - XPathLexer(CharStream input) { - super(input); - _interp = new LexerATNSimulator(this,_ATN,_decisionToDFA,_sharedContextCache); - _modeNames.insert(_modeNames.end(),L"DEFAULT_MODE"); - _tokenNames.insert(_tokenNames.end(),L"",L"TOKEN_REF",L"RULE_REF", - L"'//'",L"'/'",L"'*'", - L"'!'",L"ID",L"STRING"); - } +#include "XPathLexer.h" - const std::wstring& getGrammarFileName() { return "XPathLexer.g4"; } - const std::vector& getTokenNames() { return tokenNames; } +using namespace antlr4; - const std::vector& getRuleNames() { return ruleNames; } +XPathLexer::XPathLexer(CharStream *input) : Lexer(input) { + _interpreter = new atn::LexerATNSimulator(this, _atn, _decisionToDFA, _sharedContextCache); +} - const std::wstring& getSerializedATN() { return _serializedATN; } +XPathLexer::~XPathLexer() { + delete _interpreter; +} - const std::vector& getModeNames() { return modeNames; } +std::string XPathLexer::getGrammarFileName() const { + return "XPathLexer.g4"; +} - @Override - const ATN& getATN() { return _ATN; } +const std::vector& XPathLexer::getRuleNames() const { + return _ruleNames; +} - @Override - void action(RuleContext _localctx, int ruleIndex, int actionIndex) { - switch (ruleIndex) { - case 4: ID_action((RuleContext)_localctx, actionIndex); break; - } - } - private: - void ID_action(RuleContext _localctx, int actionIndex) { - switch (actionIndex) { - case 0: - String text = getText(); - if ( Character.isUpperCase(text.charAt(0)) ) setType(TOKEN_REF); - else setType(RULE_REF); - break; - } - } - public: +const std::vector& XPathLexer::getModeNames() const { + return _modeNames; +} - static std::wstring _serializedATN = - "\3\u0f63\ub3d0\u10be\u9b29\u438c\u6c08\uc57f\u1da2\2\n\64\b\1\4\2\t\2"+ - "\4\3\t\3\4\4\t\4\4\5\t\5\4\6\t\6\4\7\t\7\4\b\t\b\4\t\t\t\3\2\3\2\3\2\3"+ - "\3\3\3\3\4\3\4\3\5\3\5\3\6\3\6\7\6\37\n\6\f\6\16\6\"\13\6\3\6\3\6\3\7"+ - "\3\7\5\7(\n\7\3\b\3\b\3\t\3\t\7\t.\n\t\f\t\16\t\61\13\t\3\t\3\t\3/\2\n"+ - "\3\5\1\5\6\1\7\7\1\t\b\1\13\t\2\r\2\1\17\2\1\21\n\1\3\2\4\7\2\62;aa\u00b9"+ - "\u00b9\u0302\u0371\u2041\u2042\17\2C\\c|\u00c2\u00d8\u00da\u00f8\u00fa"+ - "\u0301\u0372\u037f\u0381\u2001\u200e\u200f\u2072\u2191\u2c02\u2ff1\u3003"+ - "\ud801\uf902\ufdd1\ufdf2\uffff\64\2\3\3\2\2\2\2\5\3\2\2\2\2\7\3\2\2\2"+ - "\2\t\3\2\2\2\2\13\3\2\2\2\2\21\3\2\2\2\3\23\3\2\2\2\5\26\3\2\2\2\7\30"+ - "\3\2\2\2\t\32\3\2\2\2\13\34\3\2\2\2\r\'\3\2\2\2\17)\3\2\2\2\21+\3\2\2"+ - "\2\23\24\7\61\2\2\24\25\7\61\2\2\25\4\3\2\2\2\26\27\7\61\2\2\27\6\3\2"+ - "\2\2\30\31\7,\2\2\31\b\3\2\2\2\32\33\7#\2\2\33\n\3\2\2\2\34 \5\17\b\2"+ - "\35\37\5\r\7\2\36\35\3\2\2\2\37\"\3\2\2\2 \36\3\2\2\2 !\3\2\2\2!#\3\2"+ - "\2\2\" \3\2\2\2#$\b\6\2\2$\f\3\2\2\2%(\5\17\b\2&(\t\2\2\2\'%\3\2\2\2\'"+ - "&\3\2\2\2(\16\3\2\2\2)*\t\3\2\2*\20\3\2\2\2+/\7)\2\2,.\13\2\2\2-,\3\2"+ - "\2\2.\61\3\2\2\2/\60\3\2\2\2/-\3\2\2\2\60\62\3\2\2\2\61/\3\2\2\2\62\63"+ - "\7)\2\2\63\22\3\2\2\2\6\2 \'/"; - static ATN _ATN = - new ATNDeserializer().deserialize(_serializedATN.toCharArray()); - static { - _decisionToDFA = new DFA[_ATN.getNumberOfDecisions()]; - for (int i = 0; i < _ATN.getNumberOfDecisions(); i++) { - _decisionToDFA[i] = new DFA(_ATN.getDecisionState(i), i); - } - } +const std::vector& XPathLexer::getTokenNames() const { + return _tokenNames; +} + +Ref XPathLexer::getVocabulary() const { + return _vocabulary; +} + +const std::vector XPathLexer::getSerializedATN() const { + return _serializedATN; +} + +const atn::ATN& XPathLexer::getATN() const { + return _atn; +} + + +void XPathLexer::action(Ref context, int ruleIndex, int actionIndex) { + switch (ruleIndex) { + case 4: IDAction(std::dynamic_pointer_cast(context), actionIndex); break; + + default: + break; + } +} + +void XPathLexer::IDAction(Ref /*context*/, int actionIndex) { + switch (actionIndex) { + case 0: + if (std::isupper(getText()[0])) + setType(TOKEN_REF); + else + setType(RULE_REF); + break; + + default: + break; + } +} + + + +// Static vars and initialization. +std::vector XPathLexer::_decisionToDFA; +Ref XPathLexer::_sharedContextCache = std::make_shared(); + +// We own the ATN which in turn owns the ATN states. +atn::ATN XPathLexer::_atn; +std::vector XPathLexer::_serializedATN; + +std::vector XPathLexer::_ruleNames = { + "ANYWHERE", "ROOT", "WILDCARD", "BANG", "ID", "NameChar", "NameStartChar", + "STRING" }; + +std::vector XPathLexer::_modeNames = { + "DEFAULT_MODE" +}; + +std::vector XPathLexer::_literalNames = { + "", "", "", "'//'", "'/'", "'*'", "'!'" +}; + +std::vector XPathLexer::_symbolicNames = { + "", "TOKEN_REF", "RULE_REF", "ANYWHERE", "ROOT", "WILDCARD", "BANG", "ID", + "STRING" +}; + +Ref XPathLexer::_vocabulary = std::make_shared(_literalNames, _symbolicNames); + +std::vector XPathLexer::_tokenNames; + +XPathLexer::Initializer::Initializer() { + // This code could be in a static initializer lambda, but VS doesn't allow access to private class members from there. + for (size_t i = 0; i < _symbolicNames.size(); ++i) { + std::string name = _vocabulary->getLiteralName(i); + if (name.empty()) { + name = _vocabulary->getSymbolicName(i); + } + + if (name.empty()) { + _tokenNames.push_back(""); + } else { + _tokenNames.push_back(name); + } + } + + _serializedATN = { + 0x3, 0x430, 0xd6d1, 0x8206, 0xad2d, 0x4417, 0xaef1, 0x8d80, 0xaadd, + 0x2, 0xa, 0x34, 0x8, 0x1, 0x4, 0x2, 0x9, 0x2, 0x4, 0x3, 0x9, 0x3, 0x4, + 0x4, 0x9, 0x4, 0x4, 0x5, 0x9, 0x5, 0x4, 0x6, 0x9, 0x6, 0x4, 0x7, 0x9, + 0x7, 0x4, 0x8, 0x9, 0x8, 0x4, 0x9, 0x9, 0x9, 0x3, 0x2, 0x3, 0x2, 0x3, + 0x2, 0x3, 0x3, 0x3, 0x3, 0x3, 0x4, 0x3, 0x4, 0x3, 0x5, 0x3, 0x5, 0x3, + 0x6, 0x3, 0x6, 0x7, 0x6, 0x1f, 0xa, 0x6, 0xc, 0x6, 0xe, 0x6, 0x22, 0xb, + 0x6, 0x3, 0x6, 0x3, 0x6, 0x3, 0x7, 0x3, 0x7, 0x5, 0x7, 0x28, 0xa, 0x7, + 0x3, 0x8, 0x3, 0x8, 0x3, 0x9, 0x3, 0x9, 0x7, 0x9, 0x2e, 0xa, 0x9, 0xc, + 0x9, 0xe, 0x9, 0x31, 0xb, 0x9, 0x3, 0x9, 0x3, 0x9, 0x3, 0x2f, 0x2, 0xa, + 0x3, 0x5, 0x5, 0x6, 0x7, 0x7, 0x9, 0x8, 0xb, 0x9, 0xd, 0x2, 0xf, 0x2, + 0x11, 0xa, 0x3, 0x2, 0x4, 0x7, 0x2, 0x32, 0x3b, 0x61, 0x61, 0xb9, 0xb9, + 0x302, 0x371, 0x2041, 0x2042, 0xf, 0x2, 0x43, 0x5c, 0x63, 0x7c, 0xc2, + 0xd8, 0xda, 0xf8, 0xfa, 0x301, 0x372, 0x37f, 0x381, 0x2001, 0x200e, + 0x200f, 0x2072, 0x2191, 0x2c02, 0x2ff1, 0x3003, 0xd801, 0xf902, 0xfdd1, + 0xfdf2, 0x1, 0x34, 0x2, 0x3, 0x3, 0x2, 0x2, 0x2, 0x2, 0x5, 0x3, 0x2, + 0x2, 0x2, 0x2, 0x7, 0x3, 0x2, 0x2, 0x2, 0x2, 0x9, 0x3, 0x2, 0x2, 0x2, + 0x2, 0xb, 0x3, 0x2, 0x2, 0x2, 0x2, 0x11, 0x3, 0x2, 0x2, 0x2, 0x3, 0x13, + 0x3, 0x2, 0x2, 0x2, 0x5, 0x16, 0x3, 0x2, 0x2, 0x2, 0x7, 0x18, 0x3, 0x2, + 0x2, 0x2, 0x9, 0x1a, 0x3, 0x2, 0x2, 0x2, 0xb, 0x1c, 0x3, 0x2, 0x2, 0x2, + 0xd, 0x27, 0x3, 0x2, 0x2, 0x2, 0xf, 0x29, 0x3, 0x2, 0x2, 0x2, 0x11, + 0x2b, 0x3, 0x2, 0x2, 0x2, 0x13, 0x14, 0x7, 0x31, 0x2, 0x2, 0x14, 0x15, + 0x7, 0x31, 0x2, 0x2, 0x15, 0x4, 0x3, 0x2, 0x2, 0x2, 0x16, 0x17, 0x7, + 0x31, 0x2, 0x2, 0x17, 0x6, 0x3, 0x2, 0x2, 0x2, 0x18, 0x19, 0x7, 0x2c, + 0x2, 0x2, 0x19, 0x8, 0x3, 0x2, 0x2, 0x2, 0x1a, 0x1b, 0x7, 0x23, 0x2, + 0x2, 0x1b, 0xa, 0x3, 0x2, 0x2, 0x2, 0x1c, 0x20, 0x5, 0xf, 0x8, 0x2, + 0x1d, 0x1f, 0x5, 0xd, 0x7, 0x2, 0x1e, 0x1d, 0x3, 0x2, 0x2, 0x2, 0x1f, + 0x22, 0x3, 0x2, 0x2, 0x2, 0x20, 0x1e, 0x3, 0x2, 0x2, 0x2, 0x20, 0x21, + 0x3, 0x2, 0x2, 0x2, 0x21, 0x23, 0x3, 0x2, 0x2, 0x2, 0x22, 0x20, 0x3, + 0x2, 0x2, 0x2, 0x23, 0x24, 0x8, 0x6, 0x2, 0x2, 0x24, 0xc, 0x3, 0x2, + 0x2, 0x2, 0x25, 0x28, 0x5, 0xf, 0x8, 0x2, 0x26, 0x28, 0x9, 0x2, 0x2, + 0x2, 0x27, 0x25, 0x3, 0x2, 0x2, 0x2, 0x27, 0x26, 0x3, 0x2, 0x2, 0x2, + 0x28, 0xe, 0x3, 0x2, 0x2, 0x2, 0x29, 0x2a, 0x9, 0x3, 0x2, 0x2, 0x2a, + 0x10, 0x3, 0x2, 0x2, 0x2, 0x2b, 0x2f, 0x7, 0x29, 0x2, 0x2, 0x2c, 0x2e, + 0xb, 0x2, 0x2, 0x2, 0x2d, 0x2c, 0x3, 0x2, 0x2, 0x2, 0x2e, 0x31, 0x3, + 0x2, 0x2, 0x2, 0x2f, 0x30, 0x3, 0x2, 0x2, 0x2, 0x2f, 0x2d, 0x3, 0x2, + 0x2, 0x2, 0x30, 0x32, 0x3, 0x2, 0x2, 0x2, 0x31, 0x2f, 0x3, 0x2, 0x2, + 0x2, 0x32, 0x33, 0x7, 0x29, 0x2, 0x2, 0x33, 0x12, 0x3, 0x2, 0x2, 0x2, + 0x6, 0x2, 0x20, 0x27, 0x2f, 0x3, 0x3, 0x6, 0x2, + }; + + atn::ATNDeserializer deserializer; + _atn = deserializer.deserialize(_serializedATN); + + for (int i = 0; i < _atn.getNumberOfDecisions(); i++) { + _decisionToDFA.push_back(dfa::DFA(_atn.getDecisionState(i), i)); + } +} + +XPathLexer::Initializer XPathLexer::_init; diff --git a/runtime/Cpp/runtime/src/tree/xpath/XPathLexer.g4 b/runtime/Cpp/runtime/src/tree/xpath/XPathLexer.g4 new file mode 100644 index 000000000..d6f6031d8 --- /dev/null +++ b/runtime/Cpp/runtime/src/tree/xpath/XPathLexer.g4 @@ -0,0 +1,64 @@ +lexer grammar XPathLexer; + +tokens { TOKEN_REF, RULE_REF } + +/* +path : separator? word (separator word)* EOF ; + +separator + : '/' '!' + | '//' '!' + | '/' + | '//' + ; + +word: TOKEN_REF + | RULE_REF + | STRING + | '*' + ; +*/ + +ANYWHERE : '//' ; +ROOT : '/' ; +WILDCARD : '*' ; +BANG : '!' ; + +ID : NameStartChar NameChar* + { + if (std::isupper(getText()[0])) + setType(TOKEN_REF); + else + setType(RULE_REF); + } + ; + +fragment +NameChar : NameStartChar + | '0'..'9' + | '_' + | '\u00B7' + | '\u0300'..'\u036F' + | '\u203F'..'\u2040' + ; + +fragment +NameStartChar + : 'A'..'Z' | 'a'..'z' + | '\u00C0'..'\u00D6' + | '\u00D8'..'\u00F6' + | '\u00F8'..'\u02FF' + | '\u0370'..'\u037D' + | '\u037F'..'\u1FFF' + | '\u200C'..'\u200D' + | '\u2070'..'\u218F' + | '\u2C00'..'\u2FEF' + | '\u3001'..'\uD7FF' + | '\uF900'..'\uFDCF' + | '\uFDF0'..'\uFFFF' // implicitly includes ['\u10000-'\uEFFFF] + ; + +STRING : '\'' .*? '\''; + +//WS : [ \t\r\n]+ -> skip ; + diff --git a/runtime/Cpp/runtime/src/tree/xpath/XPathLexer.h b/runtime/Cpp/runtime/src/tree/xpath/XPathLexer.h old mode 100755 new mode 100644 index e39b79d93..a02d975a1 --- a/runtime/Cpp/runtime/src/tree/xpath/XPathLexer.h +++ b/runtime/Cpp/runtime/src/tree/xpath/XPathLexer.h @@ -1,68 +1,59 @@ -#pragma once -#include -#include -#include "Lexer.h" +// Generated from XPathLexer.g4 by ANTLR 4.5.3 -// Generated from XPathLexer.g4 by ANTLR 4.1 -/* - * [The "BSD license"] - * Copyright (c) 2016 Mike Lischke - * Copyright (c) 2013 Terence Parr - * Copyright (c) 2013 Dan McLaughlin - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ +#pragma once -class XPathLexer : public org::antlr::v4::runtime::Lexer { -protected: - //ORIGINAL LINE: protected static final org.antlr.v4.runtime.dfa.DFA[] _decisionToDFA; - static const org::antlr::v4::runtime::dfa::DFA *_decisionToDFA; - static org::antlr::v4::runtime::atn::PredictionContextCache *const _sharedContextCache; +#include "antlr4-runtime.h" + + +namespace antlr4 { + +class XPathLexer : public Lexer { public: - static const int TOKEN_REF = 1, RULE_REF = 2, ANYWHERE = 3, ROOT = 4, WILDCARD = 5, BANG = 6, ID = 7, STRING = 8; - static std::vector _modeNames; + enum { + TOKEN_REF = 1, RULE_REF = 2, ANYWHERE = 3, ROOT = 4, WILDCARD = 5, BANG = 6, + ID = 7, STRING = 8 + }; - static const std::vector _tokenNames; - static const std::vector _ruleNames; + XPathLexer(CharStream *input); + ~XPathLexer(); - XPathLexer(org::antlr::v4::runtime::CharStream *input); + virtual std::string getGrammarFileName() const override; + virtual const std::vector& getRuleNames() const override; + + virtual const std::vector& getModeNames() const override; + virtual const std::vector& getTokenNames() const override; // deprecated, use vocabulary instead + virtual Ref getVocabulary() const override; + + virtual const std::vector getSerializedATN() const; + virtual const atn::ATN& getATN() const override; + + virtual void action(Ref context, int ruleIndex, int actionIndex) override; - virtual std::string getGrammarFileName() const override; - virtual const std::vector& getTokenNames() const override; - virtual const std::vector& getRuleNames() const override; - virtual const std::vector& getModeNames() const override; - virtual const org::antlr::v4::runtime::atn::ATN& getATN() const override; - virtual void action(Ref _localctx, int ruleIndex, int actionIndex) override; private: - void ID_action(org::antlr::v4::runtime::RuleContext *_localctx, int actionIndex); + static std::vector _decisionToDFA; + static Ref _sharedContextCache; + static std::vector _ruleNames; + static std::vector _tokenNames; + static std::vector _modeNames; -public: - static const std::wstring _serializedATN; - static org::antlr::v4::runtime::atn::ATN _ATN; + static std::vector _literalNames; + static std::vector _symbolicNames; + static Ref _vocabulary; + static atn::ATN _atn; + static std::vector _serializedATN; - XPathLexer(); + + // Individual action functions triggered by action() above. + void IDAction(Ref context, int actionIndex); + + // Individual semantic predicate functions triggered by sempred() above. + + struct Initializer { + Initializer(); + }; + static Initializer _init; }; + +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/tree/xpath/XPathLexer.tokens b/runtime/Cpp/runtime/src/tree/xpath/XPathLexer.tokens new file mode 100644 index 000000000..5bf699ec9 --- /dev/null +++ b/runtime/Cpp/runtime/src/tree/xpath/XPathLexer.tokens @@ -0,0 +1,12 @@ +TOKEN_REF=1 +RULE_REF=2 +ANYWHERE=3 +ROOT=4 +WILDCARD=5 +BANG=6 +ID=7 +STRING=8 +'//'=3 +'/'=4 +'*'=5 +'!'=6 diff --git a/runtime/Cpp/runtime/src/tree/xpath/XPathLexerErrorListener.cpp b/runtime/Cpp/runtime/src/tree/xpath/XPathLexerErrorListener.cpp new file mode 100755 index 000000000..31facc3e7 --- /dev/null +++ b/runtime/Cpp/runtime/src/tree/xpath/XPathLexerErrorListener.cpp @@ -0,0 +1,38 @@ +/* + * [The "BSD license"] + * Copyright (c) 2016 Mike Lischke + * Copyright (c) 2014 Sam Harwell + * Copyright (c) 2013 Terence Parr + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "XPathLexerErrorListener.h" + +using namespace antlr4::tree::xpath; + +void XPathLexerErrorListener::syntaxError(IRecognizer * /*recognizer*/, Ref /*offendingSymbol*/, size_t /*line*/, + int /*charPositionInLine*/, const std::string &/*msg*/, std::exception_ptr /*e*/) { +} diff --git a/runtime/Cpp/runtime/src/tree/xpath/XPathLexerErrorListener.h b/runtime/Cpp/runtime/src/tree/xpath/XPathLexerErrorListener.h new file mode 100755 index 000000000..67c0bc3a1 --- /dev/null +++ b/runtime/Cpp/runtime/src/tree/xpath/XPathLexerErrorListener.h @@ -0,0 +1,48 @@ +/* + * [The "BSD license"] + * Copyright (c) 2016 Mike Lischke + * Copyright (c) 2014 Sam Harwell + * Copyright (c) 2013 Terence Parr + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#pragma once + +#include "BaseErrorListener.h" + +namespace antlr4 { +namespace tree { +namespace xpath { + + class ANTLR4CPP_PUBLIC XPathLexerErrorListener : public BaseErrorListener { + public: + virtual void syntaxError(IRecognizer *recognizer, Ref offendingSymbol, size_t line, int charPositionInLine, + const std::string &msg, std::exception_ptr e) override; + }; + +} // namespace xpath +} // namespace tree +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/tree/xpath/XPathRuleAnywhereElement.cpp b/runtime/Cpp/runtime/src/tree/xpath/XPathRuleAnywhereElement.cpp new file mode 100755 index 000000000..1d8024b05 --- /dev/null +++ b/runtime/Cpp/runtime/src/tree/xpath/XPathRuleAnywhereElement.cpp @@ -0,0 +1,46 @@ +/* + * [The "BSD license"] + * Copyright (c) 2016 Mike Lischke + * Copyright (c) 2014 Sam Harwell + * Copyright (c) 2013 Terence Parr + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "ParseTree.h" +#include "Trees.h" + +#include "XPathRuleAnywhereElement.h" + +using namespace antlr4::tree; +using namespace antlr4::tree::xpath; + +XPathRuleAnywhereElement::XPathRuleAnywhereElement(const std::string &ruleName, int ruleIndex) : XPathElement(ruleName) { + _ruleIndex = ruleIndex; +} + +std::vector> XPathRuleAnywhereElement::evaluate(const Ref &t) { + return Trees::findAllRuleNodes(t, _ruleIndex); +} diff --git a/runtime/Cpp/runtime/src/tree/xpath/XPathRuleAnywhereElement.h b/runtime/Cpp/runtime/src/tree/xpath/XPathRuleAnywhereElement.h new file mode 100755 index 000000000..43a48bc11 --- /dev/null +++ b/runtime/Cpp/runtime/src/tree/xpath/XPathRuleAnywhereElement.h @@ -0,0 +1,53 @@ +/* + * [The "BSD license"] + * Copyright (c) 2016 Mike Lischke + * Copyright (c) 2014 Sam Harwell + * Copyright (c) 2013 Terence Parr + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#pragma once + +#include "XPathElement.h" + +namespace antlr4 { +namespace tree { +namespace xpath { + + /// Either {@code ID} at start of path or {@code ...//ID} in middle of path. + class ANTLR4CPP_PUBLIC XPathRuleAnywhereElement : public XPathElement { + public: + XPathRuleAnywhereElement(const std::string &ruleName, int ruleIndex); + + virtual std::vector> evaluate(const Ref &t) override; + + protected: + int _ruleIndex = 0; + }; + +} // namespace xpath +} // namespace tree +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/tree/xpath/XPathRuleElement.cpp b/runtime/Cpp/runtime/src/tree/xpath/XPathRuleElement.cpp new file mode 100755 index 000000000..474157277 --- /dev/null +++ b/runtime/Cpp/runtime/src/tree/xpath/XPathRuleElement.cpp @@ -0,0 +1,56 @@ +/* + * [The "BSD license"] + * Copyright (c) 2016 Mike Lischke + * Copyright (c) 2014 Sam Harwell + * Copyright (c) 2013 Terence Parr + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "ParseTree.h" +#include "Trees.h" + +#include "XPathRuleElement.h" + +using namespace antlr4::tree; +using namespace antlr4::tree::xpath; + +XPathRuleElement::XPathRuleElement(const std::string &ruleName, int ruleIndex) : XPathElement(ruleName) { + _ruleIndex = ruleIndex; +} + +std::vector> XPathRuleElement::evaluate(const Ref &t) { + // return all children of t that match nodeName + std::vector> nodes; + for (auto c : Trees::getChildren(t)) { + if (antlrcpp::is(c)) { + Ref ctx = std::static_pointer_cast(c); + if ((ctx->getRuleIndex() == _ruleIndex && !_invert) || (ctx->getRuleIndex() != _ruleIndex && _invert)) { + nodes.push_back(ctx); + } + } + } + return nodes; +} diff --git a/runtime/Cpp/runtime/src/tree/xpath/XPathRuleElement.h b/runtime/Cpp/runtime/src/tree/xpath/XPathRuleElement.h new file mode 100755 index 000000000..f234b9dab --- /dev/null +++ b/runtime/Cpp/runtime/src/tree/xpath/XPathRuleElement.h @@ -0,0 +1,52 @@ +/* + * [The "BSD license"] + * Copyright (c) 2016 Mike Lischke + * Copyright (c) 2014 Sam Harwell + * Copyright (c) 2013 Terence Parr + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#pragma once + +#include "XPathElement.h" + +namespace antlr4 { +namespace tree { +namespace xpath { + + class ANTLR4CPP_PUBLIC XPathRuleElement : public XPathElement { + public: + XPathRuleElement(const std::string &ruleName, int ruleIndex); + + virtual std::vector> evaluate(const Ref &t) override; + + protected: + int _ruleIndex = 0; + }; + +} // namespace xpath +} // namespace tree +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/tree/xpath/XPathTokenAnywhereElement.cpp b/runtime/Cpp/runtime/src/tree/xpath/XPathTokenAnywhereElement.cpp new file mode 100755 index 000000000..b963cf856 --- /dev/null +++ b/runtime/Cpp/runtime/src/tree/xpath/XPathTokenAnywhereElement.cpp @@ -0,0 +1,46 @@ +/* + * [The "BSD license"] + * Copyright (c) 2016 Mike Lischke + * Copyright (c) 2014 Sam Harwell + * Copyright (c) 2013 Terence Parr + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "ParseTree.h" +#include "Trees.h" + +#include "XPathTokenAnywhereElement.h" + +using namespace antlr4::tree; +using namespace antlr4::tree::xpath; + +XPathTokenAnywhereElement::XPathTokenAnywhereElement(const std::string &tokenName, int tokenType) : XPathElement(tokenName) { + this->tokenType = tokenType; +} + +std::vector> XPathTokenAnywhereElement::evaluate(const std::shared_ptr &t) { + return Trees::findAllTokenNodes(t, tokenType); +} diff --git a/runtime/Cpp/runtime/src/tree/xpath/XPathTokenAnywhereElement.h b/runtime/Cpp/runtime/src/tree/xpath/XPathTokenAnywhereElement.h new file mode 100755 index 000000000..564a0090a --- /dev/null +++ b/runtime/Cpp/runtime/src/tree/xpath/XPathTokenAnywhereElement.h @@ -0,0 +1,51 @@ +/* + * [The "BSD license"] + * Copyright (c) 2016 Mike Lischke + * Copyright (c) 2014 Sam Harwell + * Copyright (c) 2013 Terence Parr + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#pragma once + +#include "XPathElement.h" + +namespace antlr4 { +namespace tree { +namespace xpath { + + class ANTLR4CPP_PUBLIC XPathTokenAnywhereElement : public XPathElement { + protected: + int tokenType = 0; + public: + XPathTokenAnywhereElement(const std::string &tokenName, int tokenType); + + virtual std::vector> evaluate(const std::shared_ptr &t) override; + }; + +} // namespace xpath +} // namespace tree +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/tree/xpath/XPathTokenElement.cpp b/runtime/Cpp/runtime/src/tree/xpath/XPathTokenElement.cpp new file mode 100755 index 000000000..2bd9d9934 --- /dev/null +++ b/runtime/Cpp/runtime/src/tree/xpath/XPathTokenElement.cpp @@ -0,0 +1,59 @@ +/* + * [The "BSD license"] + * Copyright (c) 2016 Mike Lischke + * Copyright (c) 2014 Sam Harwell + * Copyright (c) 2013 Terence Parr + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "ParseTree.h" +#include "Trees.h" +#include "CPPUtils.h" +#include "Token.h" + +#include "XPathTokenElement.h" + +using namespace antlr4; +using namespace antlr4::tree; +using namespace antlr4::tree::xpath; + +XPathTokenElement::XPathTokenElement(const std::string &tokenName, int tokenType) : XPathElement(tokenName) { + _tokenType = tokenType; +} + +std::vector> XPathTokenElement::evaluate(const std::shared_ptr &t) { + // return all children of t that match nodeName + std::vector> nodes; + for (auto c : Trees::getChildren(t)) { + if (antlrcpp::is(c)) { + Ref tnode = std::static_pointer_cast(c); + if ((tnode->getSymbol()->getType() == _tokenType && !_invert) || (tnode->getSymbol()->getType() != _tokenType && _invert)) { + nodes.push_back(tnode); + } + } + } + return nodes; +} diff --git a/runtime/Cpp/runtime/src/tree/xpath/XPathTokenElement.h b/runtime/Cpp/runtime/src/tree/xpath/XPathTokenElement.h new file mode 100755 index 000000000..88e37dc42 --- /dev/null +++ b/runtime/Cpp/runtime/src/tree/xpath/XPathTokenElement.h @@ -0,0 +1,52 @@ +/* + * [The "BSD license"] + * Copyright (c) 2016 Mike Lischke + * Copyright (c) 2014 Sam Harwell + * Copyright (c) 2013 Terence Parr + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#pragma once + +#include "XPathElement.h" + +namespace antlr4 { +namespace tree { +namespace xpath { + + class ANTLR4CPP_PUBLIC XPathTokenElement : public XPathElement { + public: + XPathTokenElement(const std::string &tokenName, int tokenType); + + virtual std::vector> evaluate(const std::shared_ptr &t) override; + + protected: + int _tokenType = 0; + }; + +} // namespace xpath +} // namespace tree +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/tree/xpath/XPathWildcardAnywhereElement.cpp b/runtime/Cpp/runtime/src/tree/xpath/XPathWildcardAnywhereElement.cpp new file mode 100755 index 000000000..0ad3495e1 --- /dev/null +++ b/runtime/Cpp/runtime/src/tree/xpath/XPathWildcardAnywhereElement.cpp @@ -0,0 +1,49 @@ +/* + * [The "BSD license"] + * Copyright (c) 2016 Mike Lischke + * Copyright (c) 2014 Sam Harwell + * Copyright (c) 2013 Terence Parr + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "XPath.h" +#include "ParseTree.h" +#include "Trees.h" + +#include "XPathWildcardAnywhereElement.h" + +using namespace antlr4::tree; +using namespace antlr4::tree::xpath; + +XPathWildcardAnywhereElement::XPathWildcardAnywhereElement() : XPathElement(XPath::WILDCARD) { +} + +std::vector> XPathWildcardAnywhereElement::evaluate(const Ref &t) { + if (_invert) { + return {}; // !* is weird but valid (empty) + } + return Trees::getDescendants(t); +} diff --git a/runtime/Cpp/runtime/src/tree/xpath/XPathWildcardAnywhereElement.h b/runtime/Cpp/runtime/src/tree/xpath/XPathWildcardAnywhereElement.h new file mode 100755 index 000000000..4b9cef704 --- /dev/null +++ b/runtime/Cpp/runtime/src/tree/xpath/XPathWildcardAnywhereElement.h @@ -0,0 +1,49 @@ +/* + * [The "BSD license"] + * Copyright (c) 2016 Mike Lischke + * Copyright (c) 2014 Sam Harwell + * Copyright (c) 2013 Terence Parr + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#pragma once + +#include "XPathElement.h" + +namespace antlr4 { +namespace tree { +namespace xpath { + + class ANTLR4CPP_PUBLIC XPathWildcardAnywhereElement : public XPathElement { + public: + XPathWildcardAnywhereElement(); + + virtual std::vector> evaluate(const std::shared_ptr &t) override; + }; + +} // namespace xpath +} // namespace tree +} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/tree/xpath/XPathWildcardElement.cpp b/runtime/Cpp/runtime/src/tree/xpath/XPathWildcardElement.cpp new file mode 100755 index 000000000..110fafc4d --- /dev/null +++ b/runtime/Cpp/runtime/src/tree/xpath/XPathWildcardElement.cpp @@ -0,0 +1,53 @@ +/* + * [The "BSD license"] + * Copyright (c) 2016 Mike Lischke + * Copyright (c) 2014 Sam Harwell + * Copyright (c) 2013 Terence Parr + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "XPath.h" +#include "ParseTree.h" +#include "Trees.h" + +#include "XPathWildcardElement.h" + +using namespace antlr4::tree; +using namespace antlr4::tree::xpath; + +XPathWildcardElement::XPathWildcardElement() : XPathElement(XPath::WILDCARD) { +} + +std::vector> XPathWildcardElement::evaluate(const Ref &t) { + if (_invert) { + return {}; // !* is weird but valid (empty) + } + std::vector> kids; + for (auto c : Trees::getChildren(t)) { + kids.push_back(std::static_pointer_cast(c)); + } + return kids; +} diff --git a/runtime/Cpp/runtime/src/tree/xpath/XPathWildcardElement.h b/runtime/Cpp/runtime/src/tree/xpath/XPathWildcardElement.h new file mode 100755 index 000000000..5a189a7b4 --- /dev/null +++ b/runtime/Cpp/runtime/src/tree/xpath/XPathWildcardElement.h @@ -0,0 +1,49 @@ +/* + * [The "BSD license"] + * Copyright (c) 2016 Mike Lischke + * Copyright (c) 2014 Sam Harwell + * Copyright (c) 2013 Terence Parr + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#pragma once + +#include "XPathElement.h" + +namespace antlr4 { +namespace tree { +namespace xpath { + + class ANTLR4CPP_PUBLIC XPathWildcardElement : public XPathElement { + public: + XPathWildcardElement(); + + virtual std::vector> evaluate(const Ref &t) override; + }; + +} // namespace xpath +} // namespace tree +} // namespace antlr4 diff --git a/tool/resources/org/antlr/v4/tool/templates/codegen/Cpp/Cpp.stg b/tool/resources/org/antlr/v4/tool/templates/codegen/Cpp/Cpp.stg index c8a34384b..5bfad055e 100644 --- a/tool/resources/org/antlr/v4/tool/templates/codegen/Cpp/Cpp.stg +++ b/tool/resources/org/antlr/v4/tool/templates/codegen/Cpp/Cpp.stg @@ -315,7 +315,7 @@ private: >> Parser(parser, funcs, atn, sempredFuncs, superClass = {Parser}) ::= << -using namespace org::antlr::v4::runtime; +using namespace antlr4; ::(TokenStream *input) : (input) { _interpreter = new atn::ParserATNSimulator(this, _atn, _decisionToDFA, _sharedContextCache); diff --git a/tool/resources/org/antlr/v4/tool/templates/codegen/Cpp/Files.stg b/tool/resources/org/antlr/v4/tool/templates/codegen/Cpp/Files.stg index defa8a980..b5be40512 100644 --- a/tool/resources/org/antlr/v4/tool/templates/codegen/Cpp/Files.stg +++ b/tool/resources/org/antlr/v4/tool/templates/codegen/Cpp/Files.stg @@ -47,7 +47,7 @@ LexerFileHeader(file, lexer, namedActions) ::= << -using namespace org::antlr::v4::runtime; +using namespace antlr4; namespace { @@ -67,7 +67,7 @@ LexerFile(file, lexer, namedActions) ::= << -using namespace org::antlr::v4::runtime; +using namespace antlr4; using namespace ; @@ -86,7 +86,7 @@ ParserFileHeader(file, parser, namedActions, contextSuperClass) ::= << -using namespace org::antlr::v4::runtime; +using namespace antlr4; namespace { @@ -197,7 +197,7 @@ namespace { /** * This interface defines an abstract listener for a parse tree produced by . */ -class Listener : public org::antlr::v4::runtime::tree::ParseTreeListener { +class Listener : public antlr4::tree::ParseTreeListener { public: @@ -316,7 +316,7 @@ VisitorFileHeader(file, header, namedActions) ::= << * operations with no return type. */ template \ -class Visitor : public org::antlr::v4::runtime::tree::ParseTreeVisitor\ { +class Visitor : public antlr4::tree::ParseTreeVisitor\ { public: