expressir 0.2.4 → 0.2.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/release.yml +4 -3
- data/Rakefile +0 -9
- data/expressir.gemspec +3 -1
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/CMakeLists.txt +118 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlr4cpp-vs2013.vcxproj +637 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlr4cpp-vs2013.vcxproj.filters +984 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlr4cpp-vs2015.vcxproj +652 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlr4cpp-vs2015.vcxproj.filters +990 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlr4cpp-vs2017.vcxproj +652 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlr4cpp-vs2017.vcxproj.filters +990 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlr4cpp-vs2019.vcxproj +652 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlr4cpp-vs2019.vcxproj.filters +990 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlrcpp-ios/Info.plist +26 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlrcpp-ios/antlrcpp_ios.h +17 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlrcpp.xcodeproj/project.pbxproj +3024 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlrcpp.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlrcpp.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlrcpp.xcodeproj/xcshareddata/xcschemes/antlr4.xcscheme +76 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlrcpp.xcodeproj/xcshareddata/xcschemes/antlr4_ios.xcscheme +80 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlrcpp.xcodeproj/xcshareddata/xcschemes/antlr4_static.xcscheme +80 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ANTLRErrorListener.cpp +10 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ANTLRErrorListener.h +167 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ANTLRErrorStrategy.cpp +10 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ANTLRErrorStrategy.h +121 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ANTLRFileStream.cpp +34 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ANTLRFileStream.h +27 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ANTLRInputStream.cpp +155 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ANTLRInputStream.h +69 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/BailErrorStrategy.cpp +61 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/BailErrorStrategy.h +59 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/BaseErrorListener.cpp +25 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/BaseErrorListener.h +36 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/BufferedTokenStream.cpp +414 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/BufferedTokenStream.h +200 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/CharStream.cpp +11 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/CharStream.h +37 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/CommonToken.cpp +195 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/CommonToken.h +158 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/CommonTokenFactory.cpp +39 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/CommonTokenFactory.h +74 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/CommonTokenStream.cpp +78 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/CommonTokenStream.h +79 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ConsoleErrorListener.cpp +15 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ConsoleErrorListener.h +35 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/DefaultErrorStrategy.cpp +333 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/DefaultErrorStrategy.h +466 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/DiagnosticErrorListener.cpp +84 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/DiagnosticErrorListener.h +80 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/Exceptions.cpp +64 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/Exceptions.h +99 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/FailedPredicateException.cpp +51 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/FailedPredicateException.h +32 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/InputMismatchException.cpp +18 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/InputMismatchException.h +24 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/IntStream.cpp +12 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/IntStream.h +218 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/InterpreterRuleContext.cpp +19 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/InterpreterRuleContext.h +45 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/Lexer.cpp +295 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/Lexer.h +196 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/LexerInterpreter.cpp +75 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/LexerInterpreter.h +52 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/LexerNoViableAltException.cpp +36 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/LexerNoViableAltException.h +31 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ListTokenSource.cpp +92 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ListTokenSource.h +88 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/NoViableAltException.cpp +46 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/NoViableAltException.h +42 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/Parser.cpp +648 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/Parser.h +467 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ParserInterpreter.cpp +306 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ParserInterpreter.h +179 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ParserRuleContext.cpp +141 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ParserRuleContext.h +147 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ProxyErrorListener.cpp +53 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ProxyErrorListener.h +38 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/RecognitionException.cpp +66 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/RecognitionException.h +98 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/Recognizer.cpp +167 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/Recognizer.h +164 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/RuleContext.cpp +143 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/RuleContext.h +137 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/RuleContextWithAltNum.cpp +27 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/RuleContextWithAltNum.h +32 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/RuntimeMetaData.cpp +53 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/RuntimeMetaData.h +155 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/Token.cpp +9 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/Token.h +92 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/TokenFactory.h +30 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/TokenSource.cpp +9 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/TokenSource.h +85 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/TokenStream.cpp +11 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/TokenStream.h +137 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/TokenStreamRewriter.cpp +425 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/TokenStreamRewriter.h +293 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/UnbufferedCharStream.cpp +211 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/UnbufferedCharStream.h +123 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/UnbufferedTokenStream.cpp +270 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/UnbufferedTokenStream.h +115 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/Vocabulary.cpp +104 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/Vocabulary.h +193 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/WritableToken.cpp +9 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/WritableToken.h +23 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/antlr4-common.h +137 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/antlr4-runtime.h +167 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATN.cpp +209 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATN.h +112 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNConfig.cpp +113 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNConfig.h +148 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNConfigSet.cpp +228 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNConfigSet.h +110 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNDeserializationOptions.cpp +64 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNDeserializationOptions.h +50 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNDeserializer.cpp +758 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNDeserializer.h +85 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNSerializer.cpp +621 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNSerializer.h +61 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNSimulator.cpp +63 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNSimulator.h +87 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNState.cpp +72 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNState.h +133 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNType.h +20 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/AbstractPredicateTransition.cpp +14 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/AbstractPredicateTransition.h +24 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ActionTransition.cpp +33 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ActionTransition.h +33 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/AmbiguityInfo.cpp +16 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/AmbiguityInfo.h +68 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ArrayPredictionContext.cpp +82 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ArrayPredictionContext.h +43 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/AtomTransition.cpp +31 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/AtomTransition.h +30 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/BasicBlockStartState.cpp +12 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/BasicBlockStartState.h +22 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/BasicState.cpp +12 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/BasicState.h +21 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/BlockEndState.cpp +15 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/BlockEndState.h +24 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/BlockStartState.cpp +9 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/BlockStartState.h +21 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ContextSensitivityInfo.cpp +14 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ContextSensitivityInfo.h +47 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/DecisionEventInfo.cpp +14 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/DecisionEventInfo.h +70 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/DecisionInfo.cpp +25 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/DecisionInfo.h +227 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/DecisionState.cpp +17 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/DecisionState.h +30 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/EmptyPredictionContext.cpp +35 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/EmptyPredictionContext.h +27 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/EpsilonTransition.cpp +35 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/EpsilonTransition.h +39 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ErrorInfo.cpp +15 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ErrorInfo.h +43 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LL1Analyzer.cpp +158 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LL1Analyzer.h +109 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerATNConfig.cpp +84 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerATNConfig.h +44 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerATNSimulator.cpp +628 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerATNSimulator.h +210 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerAction.cpp +9 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerAction.h +66 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerActionExecutor.cpp +107 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerActionExecutor.h +115 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerActionType.h +55 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerChannelAction.cpp +55 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerChannelAction.h +63 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerCustomAction.cpp +62 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerCustomAction.h +87 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerIndexedCustomAction.cpp +63 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerIndexedCustomAction.h +82 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerModeAction.cpp +56 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerModeAction.h +61 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerMoreAction.cpp +47 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerMoreAction.h +57 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerPopModeAction.cpp +47 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerPopModeAction.h +57 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerPushModeAction.cpp +56 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerPushModeAction.h +61 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerSkipAction.cpp +47 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerSkipAction.h +55 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerTypeAction.cpp +56 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerTypeAction.h +55 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LookaheadEventInfo.cpp +16 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LookaheadEventInfo.h +42 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LoopEndState.cpp +12 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LoopEndState.h +22 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/Makefile +67 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/NotSetTransition.cpp +27 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/NotSetTransition.h +25 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/OrderedATNConfigSet.cpp +12 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/OrderedATNConfigSet.h +20 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ParseInfo.cpp +102 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ParseInfo.h +102 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ParserATNSimulator.cpp +1366 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ParserATNSimulator.h +904 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PlusBlockStartState.cpp +12 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PlusBlockStartState.h +25 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PlusLoopbackState.cpp +12 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PlusLoopbackState.h +22 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PrecedencePredicateTransition.cpp +32 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PrecedencePredicateTransition.h +29 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredicateEvalInfo.cpp +17 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredicateEvalInfo.h +62 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredicateTransition.cpp +34 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredicateTransition.h +39 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredictionContext.cpp +662 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredictionContext.h +254 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredictionMode.cpp +201 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredictionMode.h +436 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ProfilingATNSimulator.cpp +179 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ProfilingATNSimulator.h +60 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/RangeTransition.cpp +30 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/RangeTransition.h +29 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/RuleStartState.cpp +16 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/RuleStartState.h +25 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/RuleStopState.cpp +12 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/RuleStopState.h +25 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/RuleTransition.cpp +37 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/RuleTransition.h +40 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/SemanticContext.cpp +377 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/SemanticContext.h +222 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/SetTransition.cpp +32 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/SetTransition.h +30 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/SingletonPredictionContext.cpp +81 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/SingletonPredictionContext.h +36 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/StarBlockStartState.cpp +12 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/StarBlockStartState.h +21 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/StarLoopEntryState.cpp +15 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/StarLoopEntryState.h +35 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/StarLoopbackState.cpp +19 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/StarLoopbackState.h +21 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/TokensStartState.cpp +12 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/TokensStartState.h +21 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/Transition.cpp +44 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/Transition.h +76 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/WildcardTransition.cpp +25 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/WildcardTransition.h +25 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/dfa/DFA.cpp +127 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/dfa/DFA.h +91 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/dfa/DFASerializer.cpp +67 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/dfa/DFASerializer.h +32 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/dfa/DFAState.cpp +100 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/dfa/DFAState.h +144 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/dfa/LexerDFASerializer.cpp +20 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/dfa/LexerDFASerializer.h +23 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/misc/InterpreterDataReader.cpp +124 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/misc/InterpreterDataReader.h +31 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/misc/Interval.cpp +89 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/misc/Interval.h +84 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/misc/IntervalSet.cpp +521 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/misc/IntervalSet.h +198 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/misc/MurmurHash.cpp +134 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/misc/MurmurHash.h +76 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/misc/Predicate.cpp +4 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/misc/Predicate.h +21 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/Any.cpp +13 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/Any.h +170 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/Arrays.cpp +43 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/Arrays.h +110 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/BitSet.h +76 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/CPPUtils.cpp +248 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/CPPUtils.h +78 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/Declarations.h +163 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/StringUtils.cpp +36 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/StringUtils.h +54 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/guid.cpp +303 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/guid.h +112 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/AbstractParseTreeVisitor.h +128 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ErrorNode.cpp +9 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ErrorNode.h +19 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ErrorNodeImpl.cpp +23 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ErrorNodeImpl.h +33 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/IterativeParseTreeWalker.cpp +71 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/IterativeParseTreeWalker.h +53 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ParseTree.cpp +15 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ParseTree.h +102 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ParseTreeListener.cpp +9 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ParseTreeListener.h +39 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ParseTreeProperty.h +50 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ParseTreeVisitor.cpp +9 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ParseTreeVisitor.h +57 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ParseTreeWalker.cpp +49 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ParseTreeWalker.h +31 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/TerminalNode.cpp +9 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/TerminalNode.h +32 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/TerminalNodeImpl.cpp +57 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/TerminalNodeImpl.h +33 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/Trees.cpp +241 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/Trees.h +78 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/pattern/Chunk.cpp +9 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/pattern/Chunk.h +44 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/pattern/ParseTreeMatch.cpp +69 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/pattern/ParseTreeMatch.h +132 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/pattern/ParseTreePattern.cpp +64 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/pattern/ParseTreePattern.h +105 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/pattern/ParseTreePatternMatcher.cpp +371 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/pattern/ParseTreePatternMatcher.h +185 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/pattern/RuleTagToken.cpp +77 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/pattern/RuleTagToken.h +117 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/pattern/TagChunk.cpp +39 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/pattern/TagChunk.h +86 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/pattern/TextChunk.cpp +28 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/pattern/TextChunk.h +51 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/pattern/TokenTagToken.cpp +36 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/pattern/TokenTagToken.h +80 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPath.cpp +154 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPath.h +86 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathElement.cpp +31 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathElement.h +40 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathLexer.cpp +173 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathLexer.g4 +64 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathLexer.h +56 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathLexer.tokens +12 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathLexerErrorListener.cpp +13 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathLexerErrorListener.h +22 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathRuleAnywhereElement.cpp +20 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathRuleAnywhereElement.h +27 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathRuleElement.cpp +30 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathRuleElement.h +26 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathTokenAnywhereElement.cpp +20 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathTokenAnywhereElement.h +25 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathTokenElement.cpp +33 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathTokenElement.h +26 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathWildcardAnywhereElement.cpp +23 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathWildcardAnywhereElement.h +23 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathWildcardElement.cpp +24 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathWildcardElement.h +23 -0
- data/lib/expressir/version.rb +1 -1
- metadata +329 -4
@@ -0,0 +1,254 @@
|
|
1
|
+
/* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
|
2
|
+
* Use of this file is governed by the BSD 3-clause license that
|
3
|
+
* can be found in the LICENSE.txt file in the project root.
|
4
|
+
*/
|
5
|
+
|
6
|
+
#pragma once
|
7
|
+
|
8
|
+
#include "Recognizer.h"
|
9
|
+
#include "atn/ATN.h"
|
10
|
+
#include "atn/ATNState.h"
|
11
|
+
|
12
|
+
namespace antlr4 {
|
13
|
+
namespace atn {
|
14
|
+
|
15
|
+
struct PredictionContextHasher;
|
16
|
+
struct PredictionContextComparer;
|
17
|
+
class PredictionContextMergeCache;
|
18
|
+
|
19
|
+
typedef std::unordered_set<Ref<PredictionContext>, PredictionContextHasher, PredictionContextComparer> PredictionContextCache;
|
20
|
+
|
21
|
+
class ANTLR4CPP_PUBLIC PredictionContext {
|
22
|
+
public:
|
23
|
+
/// Represents $ in local context prediction, which means wildcard.
|
24
|
+
/// *+x = *.
|
25
|
+
static const Ref<PredictionContext> EMPTY;
|
26
|
+
|
27
|
+
/// Represents $ in an array in full context mode, when $
|
28
|
+
/// doesn't mean wildcard: $ + x = [$,x]. Here,
|
29
|
+
/// $ = EMPTY_RETURN_STATE.
|
30
|
+
// ml: originally Integer.MAX_VALUE, which would be -1 for us, but this is already used in places where
|
31
|
+
// -1 is converted to unsigned, so we use a different value here. Any value does the job provided it doesn't
|
32
|
+
// conflict with real return states.
|
33
|
+
static const size_t EMPTY_RETURN_STATE = static_cast<size_t>(-10); // std::numeric_limits<size_t>::max() - 9;
|
34
|
+
|
35
|
+
private:
|
36
|
+
static const size_t INITIAL_HASH = 1;
|
37
|
+
|
38
|
+
public:
|
39
|
+
static size_t globalNodeCount;
|
40
|
+
const size_t id;
|
41
|
+
|
42
|
+
/// <summary>
|
43
|
+
/// Stores the computed hash code of this <seealso cref="PredictionContext"/>. The hash
|
44
|
+
/// code is computed in parts to match the following reference algorithm.
|
45
|
+
///
|
46
|
+
/// <pre>
|
47
|
+
/// private int referenceHashCode() {
|
48
|
+
/// int hash = <seealso cref="MurmurHash#initialize"/>(<seealso cref="#INITIAL_HASH"/>);
|
49
|
+
///
|
50
|
+
/// for (int i = 0; i < <seealso cref="#size()"/>; i++) {
|
51
|
+
/// hash = <seealso cref="MurmurHash#update"/>(hash, <seealso cref="#getParent"/>(i));
|
52
|
+
/// }
|
53
|
+
///
|
54
|
+
/// for (int i = 0; i < <seealso cref="#size()"/>; i++) {
|
55
|
+
/// hash = <seealso cref="MurmurHash#update"/>(hash, <seealso cref="#getReturnState"/>(i));
|
56
|
+
/// }
|
57
|
+
///
|
58
|
+
/// hash = <seealso cref="MurmurHash#finish"/>(hash, 2 * <seealso cref="#size()"/>);
|
59
|
+
/// return hash;
|
60
|
+
/// }
|
61
|
+
/// </pre>
|
62
|
+
/// </summary>
|
63
|
+
const size_t cachedHashCode;
|
64
|
+
|
65
|
+
protected:
|
66
|
+
PredictionContext(size_t cachedHashCode);
|
67
|
+
~PredictionContext();
|
68
|
+
|
69
|
+
public:
|
70
|
+
/// Convert a RuleContext tree to a PredictionContext graph.
|
71
|
+
/// Return EMPTY if outerContext is empty.
|
72
|
+
static Ref<PredictionContext> fromRuleContext(const ATN &atn, RuleContext *outerContext);
|
73
|
+
|
74
|
+
virtual size_t size() const = 0;
|
75
|
+
virtual Ref<PredictionContext> getParent(size_t index) const = 0;
|
76
|
+
virtual size_t getReturnState(size_t index) const = 0;
|
77
|
+
|
78
|
+
virtual bool operator == (const PredictionContext &o) const = 0;
|
79
|
+
|
80
|
+
/// This means only the EMPTY (wildcard? not sure) context is in set.
|
81
|
+
virtual bool isEmpty() const;
|
82
|
+
virtual bool hasEmptyPath() const;
|
83
|
+
virtual size_t hashCode() const;
|
84
|
+
|
85
|
+
protected:
|
86
|
+
static size_t calculateEmptyHashCode();
|
87
|
+
static size_t calculateHashCode(Ref<PredictionContext> parent, size_t returnState);
|
88
|
+
static size_t calculateHashCode(const std::vector<Ref<PredictionContext>> &parents,
|
89
|
+
const std::vector<size_t> &returnStates);
|
90
|
+
|
91
|
+
public:
|
92
|
+
// dispatch
|
93
|
+
static Ref<PredictionContext> merge(const Ref<PredictionContext> &a, const Ref<PredictionContext> &b,
|
94
|
+
bool rootIsWildcard, PredictionContextMergeCache *mergeCache);
|
95
|
+
|
96
|
+
/// <summary>
|
97
|
+
/// Merge two <seealso cref="SingletonPredictionContext"/> instances.
|
98
|
+
///
|
99
|
+
/// <p/>
|
100
|
+
///
|
101
|
+
/// Stack tops equal, parents merge is same; return left graph.<br/>
|
102
|
+
/// <embed src="images/SingletonMerge_SameRootSamePar.svg" type="image/svg+xml"/>
|
103
|
+
///
|
104
|
+
/// <p/>
|
105
|
+
///
|
106
|
+
/// Same stack top, parents differ; merge parents giving array node, then
|
107
|
+
/// remainders of those graphs. A new root node is created to point to the
|
108
|
+
/// merged parents.<br/>
|
109
|
+
/// <embed src="images/SingletonMerge_SameRootDiffPar.svg" type="image/svg+xml"/>
|
110
|
+
///
|
111
|
+
/// <p/>
|
112
|
+
///
|
113
|
+
/// Different stack tops pointing to same parent. Make array node for the
|
114
|
+
/// root where both element in the root point to the same (original)
|
115
|
+
/// parent.<br/>
|
116
|
+
/// <embed src="images/SingletonMerge_DiffRootSamePar.svg" type="image/svg+xml"/>
|
117
|
+
///
|
118
|
+
/// <p/>
|
119
|
+
///
|
120
|
+
/// Different stack tops pointing to different parents. Make array node for
|
121
|
+
/// the root where each element points to the corresponding original
|
122
|
+
/// parent.<br/>
|
123
|
+
/// <embed src="images/SingletonMerge_DiffRootDiffPar.svg" type="image/svg+xml"/>
|
124
|
+
/// </summary>
|
125
|
+
/// <param name="a"> the first <seealso cref="SingletonPredictionContext"/> </param>
|
126
|
+
/// <param name="b"> the second <seealso cref="SingletonPredictionContext"/> </param>
|
127
|
+
/// <param name="rootIsWildcard"> {@code true} if this is a local-context merge,
|
128
|
+
/// otherwise false to indicate a full-context merge </param>
|
129
|
+
/// <param name="mergeCache"> </param>
|
130
|
+
static Ref<PredictionContext> mergeSingletons(const Ref<SingletonPredictionContext> &a,
|
131
|
+
const Ref<SingletonPredictionContext> &b, bool rootIsWildcard, PredictionContextMergeCache *mergeCache);
|
132
|
+
|
133
|
+
/**
|
134
|
+
* Handle case where at least one of {@code a} or {@code b} is
|
135
|
+
* {@link #EMPTY}. In the following diagrams, the symbol {@code $} is used
|
136
|
+
* to represent {@link #EMPTY}.
|
137
|
+
*
|
138
|
+
* <h2>Local-Context Merges</h2>
|
139
|
+
*
|
140
|
+
* <p>These local-context merge operations are used when {@code rootIsWildcard}
|
141
|
+
* is true.</p>
|
142
|
+
*
|
143
|
+
* <p>{@link #EMPTY} is superset of any graph; return {@link #EMPTY}.<br>
|
144
|
+
* <embed src="images/LocalMerge_EmptyRoot.svg" type="image/svg+xml"/></p>
|
145
|
+
*
|
146
|
+
* <p>{@link #EMPTY} and anything is {@code #EMPTY}, so merged parent is
|
147
|
+
* {@code #EMPTY}; return left graph.<br>
|
148
|
+
* <embed src="images/LocalMerge_EmptyParent.svg" type="image/svg+xml"/></p>
|
149
|
+
*
|
150
|
+
* <p>Special case of last merge if local context.<br>
|
151
|
+
* <embed src="images/LocalMerge_DiffRoots.svg" type="image/svg+xml"/></p>
|
152
|
+
*
|
153
|
+
* <h2>Full-Context Merges</h2>
|
154
|
+
*
|
155
|
+
* <p>These full-context merge operations are used when {@code rootIsWildcard}
|
156
|
+
* is false.</p>
|
157
|
+
*
|
158
|
+
* <p><embed src="images/FullMerge_EmptyRoots.svg" type="image/svg+xml"/></p>
|
159
|
+
*
|
160
|
+
* <p>Must keep all contexts; {@link #EMPTY} in array is a special value (and
|
161
|
+
* null parent).<br>
|
162
|
+
* <embed src="images/FullMerge_EmptyRoot.svg" type="image/svg+xml"/></p>
|
163
|
+
*
|
164
|
+
* <p><embed src="images/FullMerge_SameRoot.svg" type="image/svg+xml"/></p>
|
165
|
+
*
|
166
|
+
* @param a the first {@link SingletonPredictionContext}
|
167
|
+
* @param b the second {@link SingletonPredictionContext}
|
168
|
+
* @param rootIsWildcard {@code true} if this is a local-context merge,
|
169
|
+
* otherwise false to indicate a full-context merge
|
170
|
+
*/
|
171
|
+
static Ref<PredictionContext> mergeRoot(const Ref<SingletonPredictionContext> &a,
|
172
|
+
const Ref<SingletonPredictionContext> &b, bool rootIsWildcard);
|
173
|
+
|
174
|
+
/**
|
175
|
+
* Merge two {@link ArrayPredictionContext} instances.
|
176
|
+
*
|
177
|
+
* <p>Different tops, different parents.<br>
|
178
|
+
* <embed src="images/ArrayMerge_DiffTopDiffPar.svg" type="image/svg+xml"/></p>
|
179
|
+
*
|
180
|
+
* <p>Shared top, same parents.<br>
|
181
|
+
* <embed src="images/ArrayMerge_ShareTopSamePar.svg" type="image/svg+xml"/></p>
|
182
|
+
*
|
183
|
+
* <p>Shared top, different parents.<br>
|
184
|
+
* <embed src="images/ArrayMerge_ShareTopDiffPar.svg" type="image/svg+xml"/></p>
|
185
|
+
*
|
186
|
+
* <p>Shared top, all shared parents.<br>
|
187
|
+
* <embed src="images/ArrayMerge_ShareTopSharePar.svg" type="image/svg+xml"/></p>
|
188
|
+
*
|
189
|
+
* <p>Equal tops, merge parents and reduce top to
|
190
|
+
* {@link SingletonPredictionContext}.<br>
|
191
|
+
* <embed src="images/ArrayMerge_EqualTop.svg" type="image/svg+xml"/></p>
|
192
|
+
*/
|
193
|
+
static Ref<PredictionContext> mergeArrays(const Ref<ArrayPredictionContext> &a,
|
194
|
+
const Ref<ArrayPredictionContext> &b, bool rootIsWildcard, PredictionContextMergeCache *mergeCache);
|
195
|
+
|
196
|
+
protected:
|
197
|
+
/// Make pass over all M parents; merge any equal() ones.
|
198
|
+
/// @returns true if the list has been changed (i.e. duplicates where found).
|
199
|
+
static bool combineCommonParents(std::vector<Ref<PredictionContext>> &parents);
|
200
|
+
|
201
|
+
public:
|
202
|
+
static std::string toDOTString(const Ref<PredictionContext> &context);
|
203
|
+
|
204
|
+
static Ref<PredictionContext> getCachedContext(const Ref<PredictionContext> &context,
|
205
|
+
PredictionContextCache &contextCache,
|
206
|
+
std::map<Ref<PredictionContext>, Ref<PredictionContext>> &visited);
|
207
|
+
|
208
|
+
// ter's recursive version of Sam's getAllNodes()
|
209
|
+
static std::vector<Ref<PredictionContext>> getAllContextNodes(const Ref<PredictionContext> &context);
|
210
|
+
static void getAllContextNodes_(const Ref<PredictionContext> &context,
|
211
|
+
std::vector<Ref<PredictionContext>> &nodes, std::set<PredictionContext *> &visited);
|
212
|
+
|
213
|
+
virtual std::string toString() const;
|
214
|
+
virtual std::string toString(Recognizer *recog) const;
|
215
|
+
|
216
|
+
std::vector<std::string> toStrings(Recognizer *recognizer, int currentState);
|
217
|
+
std::vector<std::string> toStrings(Recognizer *recognizer, const Ref<PredictionContext> &stop, int currentState);
|
218
|
+
};
|
219
|
+
|
220
|
+
struct PredictionContextHasher {
|
221
|
+
size_t operator () (const Ref<PredictionContext> &k) const {
|
222
|
+
return k->hashCode();
|
223
|
+
}
|
224
|
+
};
|
225
|
+
|
226
|
+
struct PredictionContextComparer {
|
227
|
+
bool operator () (const Ref<PredictionContext> &lhs, const Ref<PredictionContext> &rhs) const
|
228
|
+
{
|
229
|
+
if (lhs == rhs) // Object identity.
|
230
|
+
return true;
|
231
|
+
return (lhs->hashCode() == rhs->hashCode()) && (*lhs == *rhs);
|
232
|
+
}
|
233
|
+
};
|
234
|
+
|
235
|
+
class PredictionContextMergeCache {
|
236
|
+
public:
|
237
|
+
Ref<PredictionContext> put(Ref<PredictionContext> const& key1, Ref<PredictionContext> const& key2,
|
238
|
+
Ref<PredictionContext> const& value);
|
239
|
+
Ref<PredictionContext> get(Ref<PredictionContext> const& key1, Ref<PredictionContext> const& key2);
|
240
|
+
|
241
|
+
void clear();
|
242
|
+
std::string toString() const;
|
243
|
+
size_t count() const;
|
244
|
+
|
245
|
+
private:
|
246
|
+
std::unordered_map<Ref<PredictionContext>,
|
247
|
+
std::unordered_map<Ref<PredictionContext>, Ref<PredictionContext>, PredictionContextHasher, PredictionContextComparer>,
|
248
|
+
PredictionContextHasher, PredictionContextComparer> _data;
|
249
|
+
|
250
|
+
};
|
251
|
+
|
252
|
+
} // namespace atn
|
253
|
+
} // namespace antlr4
|
254
|
+
|
@@ -0,0 +1,201 @@
|
|
1
|
+
/* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
|
2
|
+
* Use of this file is governed by the BSD 3-clause license that
|
3
|
+
* can be found in the LICENSE.txt file in the project root.
|
4
|
+
*/
|
5
|
+
|
6
|
+
#include "atn/RuleStopState.h"
|
7
|
+
#include "atn/ATNConfigSet.h"
|
8
|
+
#include "atn/ATNConfig.h"
|
9
|
+
#include "misc/MurmurHash.h"
|
10
|
+
#include "SemanticContext.h"
|
11
|
+
|
12
|
+
#include "PredictionMode.h"
|
13
|
+
|
14
|
+
using namespace antlr4;
|
15
|
+
using namespace antlr4::atn;
|
16
|
+
using namespace antlrcpp;
|
17
|
+
|
18
|
+
struct AltAndContextConfigHasher
|
19
|
+
{
|
20
|
+
/**
|
21
|
+
* The hash code is only a function of the {@link ATNState#stateNumber}
|
22
|
+
* and {@link ATNConfig#context}.
|
23
|
+
*/
|
24
|
+
size_t operator () (ATNConfig *o) const {
|
25
|
+
size_t hashCode = misc::MurmurHash::initialize(7);
|
26
|
+
hashCode = misc::MurmurHash::update(hashCode, o->state->stateNumber);
|
27
|
+
hashCode = misc::MurmurHash::update(hashCode, o->context);
|
28
|
+
return misc::MurmurHash::finish(hashCode, 2);
|
29
|
+
}
|
30
|
+
};
|
31
|
+
|
32
|
+
struct AltAndContextConfigComparer {
|
33
|
+
bool operator()(ATNConfig *a, ATNConfig *b) const
|
34
|
+
{
|
35
|
+
if (a == b) {
|
36
|
+
return true;
|
37
|
+
}
|
38
|
+
return a->state->stateNumber == b->state->stateNumber && *a->context == *b->context;
|
39
|
+
}
|
40
|
+
};
|
41
|
+
|
42
|
+
bool PredictionModeClass::hasSLLConflictTerminatingPrediction(PredictionMode mode, ATNConfigSet *configs) {
|
43
|
+
/* Configs in rule stop states indicate reaching the end of the decision
|
44
|
+
* rule (local context) or end of start rule (full context). If all
|
45
|
+
* configs meet this condition, then none of the configurations is able
|
46
|
+
* to match additional input so we terminate prediction.
|
47
|
+
*/
|
48
|
+
if (allConfigsInRuleStopStates(configs)) {
|
49
|
+
return true;
|
50
|
+
}
|
51
|
+
|
52
|
+
bool heuristic;
|
53
|
+
|
54
|
+
// Pure SLL mode parsing or SLL+LL if:
|
55
|
+
// Don't bother with combining configs from different semantic
|
56
|
+
// contexts if we can fail over to full LL; costs more time
|
57
|
+
// since we'll often fail over anyway.
|
58
|
+
if (mode == PredictionMode::SLL || !configs->hasSemanticContext) {
|
59
|
+
std::vector<antlrcpp::BitSet> altsets = getConflictingAltSubsets(configs);
|
60
|
+
heuristic = hasConflictingAltSet(altsets) && !hasStateAssociatedWithOneAlt(configs);
|
61
|
+
} else {
|
62
|
+
// dup configs, tossing out semantic predicates
|
63
|
+
ATNConfigSet dup(true);
|
64
|
+
for (auto &config : configs->configs) {
|
65
|
+
Ref<ATNConfig> c = std::make_shared<ATNConfig>(config, SemanticContext::NONE);
|
66
|
+
dup.add(c);
|
67
|
+
}
|
68
|
+
std::vector<antlrcpp::BitSet> altsets = getConflictingAltSubsets(&dup);
|
69
|
+
heuristic = hasConflictingAltSet(altsets) && !hasStateAssociatedWithOneAlt(&dup);
|
70
|
+
}
|
71
|
+
|
72
|
+
return heuristic;
|
73
|
+
}
|
74
|
+
|
75
|
+
bool PredictionModeClass::hasConfigInRuleStopState(ATNConfigSet *configs) {
|
76
|
+
for (auto &c : configs->configs) {
|
77
|
+
if (is<RuleStopState *>(c->state)) {
|
78
|
+
return true;
|
79
|
+
}
|
80
|
+
}
|
81
|
+
|
82
|
+
return false;
|
83
|
+
}
|
84
|
+
|
85
|
+
bool PredictionModeClass::allConfigsInRuleStopStates(ATNConfigSet *configs) {
|
86
|
+
for (auto &config : configs->configs) {
|
87
|
+
if (!is<RuleStopState*>(config->state)) {
|
88
|
+
return false;
|
89
|
+
}
|
90
|
+
}
|
91
|
+
|
92
|
+
return true;
|
93
|
+
}
|
94
|
+
|
95
|
+
size_t PredictionModeClass::resolvesToJustOneViableAlt(const std::vector<antlrcpp::BitSet>& altsets) {
|
96
|
+
return getSingleViableAlt(altsets);
|
97
|
+
}
|
98
|
+
|
99
|
+
bool PredictionModeClass::allSubsetsConflict(const std::vector<antlrcpp::BitSet>& altsets) {
|
100
|
+
return !hasNonConflictingAltSet(altsets);
|
101
|
+
}
|
102
|
+
|
103
|
+
bool PredictionModeClass::hasNonConflictingAltSet(const std::vector<antlrcpp::BitSet>& altsets) {
|
104
|
+
for (antlrcpp::BitSet alts : altsets) {
|
105
|
+
if (alts.count() == 1) {
|
106
|
+
return true;
|
107
|
+
}
|
108
|
+
}
|
109
|
+
return false;
|
110
|
+
}
|
111
|
+
|
112
|
+
bool PredictionModeClass::hasConflictingAltSet(const std::vector<antlrcpp::BitSet>& altsets) {
|
113
|
+
for (antlrcpp::BitSet alts : altsets) {
|
114
|
+
if (alts.count() > 1) {
|
115
|
+
return true;
|
116
|
+
}
|
117
|
+
}
|
118
|
+
return false;
|
119
|
+
}
|
120
|
+
|
121
|
+
bool PredictionModeClass::allSubsetsEqual(const std::vector<antlrcpp::BitSet>& altsets) {
|
122
|
+
if (altsets.empty()) {
|
123
|
+
return true;
|
124
|
+
}
|
125
|
+
|
126
|
+
const antlrcpp::BitSet& first = *altsets.begin();
|
127
|
+
for (const antlrcpp::BitSet& alts : altsets) {
|
128
|
+
if (alts != first) {
|
129
|
+
return false;
|
130
|
+
}
|
131
|
+
}
|
132
|
+
return true;
|
133
|
+
}
|
134
|
+
|
135
|
+
size_t PredictionModeClass::getUniqueAlt(const std::vector<antlrcpp::BitSet>& altsets) {
|
136
|
+
antlrcpp::BitSet all = getAlts(altsets);
|
137
|
+
if (all.count() == 1) {
|
138
|
+
return all.nextSetBit(0);
|
139
|
+
}
|
140
|
+
return ATN::INVALID_ALT_NUMBER;
|
141
|
+
}
|
142
|
+
|
143
|
+
antlrcpp::BitSet PredictionModeClass::getAlts(const std::vector<antlrcpp::BitSet>& altsets) {
|
144
|
+
antlrcpp::BitSet all;
|
145
|
+
for (antlrcpp::BitSet alts : altsets) {
|
146
|
+
all |= alts;
|
147
|
+
}
|
148
|
+
|
149
|
+
return all;
|
150
|
+
}
|
151
|
+
|
152
|
+
antlrcpp::BitSet PredictionModeClass::getAlts(ATNConfigSet *configs) {
|
153
|
+
antlrcpp::BitSet alts;
|
154
|
+
for (auto &config : configs->configs) {
|
155
|
+
alts.set(config->alt);
|
156
|
+
}
|
157
|
+
return alts;
|
158
|
+
}
|
159
|
+
|
160
|
+
std::vector<antlrcpp::BitSet> PredictionModeClass::getConflictingAltSubsets(ATNConfigSet *configs) {
|
161
|
+
std::unordered_map<ATNConfig *, antlrcpp::BitSet, AltAndContextConfigHasher, AltAndContextConfigComparer> configToAlts;
|
162
|
+
for (auto &config : configs->configs) {
|
163
|
+
configToAlts[config.get()].set(config->alt);
|
164
|
+
}
|
165
|
+
std::vector<antlrcpp::BitSet> values;
|
166
|
+
for (auto it : configToAlts) {
|
167
|
+
values.push_back(it.second);
|
168
|
+
}
|
169
|
+
return values;
|
170
|
+
}
|
171
|
+
|
172
|
+
std::map<ATNState*, antlrcpp::BitSet> PredictionModeClass::getStateToAltMap(ATNConfigSet *configs) {
|
173
|
+
std::map<ATNState*, antlrcpp::BitSet> m;
|
174
|
+
for (auto &c : configs->configs) {
|
175
|
+
m[c->state].set(c->alt);
|
176
|
+
}
|
177
|
+
return m;
|
178
|
+
}
|
179
|
+
|
180
|
+
bool PredictionModeClass::hasStateAssociatedWithOneAlt(ATNConfigSet *configs) {
|
181
|
+
std::map<ATNState*, antlrcpp::BitSet> x = getStateToAltMap(configs);
|
182
|
+
for (std::map<ATNState*, antlrcpp::BitSet>::iterator it = x.begin(); it != x.end(); it++){
|
183
|
+
if (it->second.count() == 1) return true;
|
184
|
+
}
|
185
|
+
return false;
|
186
|
+
}
|
187
|
+
|
188
|
+
size_t PredictionModeClass::getSingleViableAlt(const std::vector<antlrcpp::BitSet>& altsets) {
|
189
|
+
antlrcpp::BitSet viableAlts;
|
190
|
+
for (antlrcpp::BitSet alts : altsets) {
|
191
|
+
size_t minAlt = alts.nextSetBit(0);
|
192
|
+
|
193
|
+
viableAlts.set(minAlt);
|
194
|
+
if (viableAlts.count() > 1) // more than 1 viable alt
|
195
|
+
{
|
196
|
+
return ATN::INVALID_ALT_NUMBER;
|
197
|
+
}
|
198
|
+
}
|
199
|
+
|
200
|
+
return viableAlts.nextSetBit(0);
|
201
|
+
}
|