expressir 0.2.4 → 0.2.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.cross_rubies +30 -0
- data/.github/workflows/rake.yml +14 -15
- data/.github/workflows/release.yml +26 -17
- data/.gitignore +3 -1
- data/Gemfile +0 -2
- data/Rakefile +2 -17
- data/expressir.gemspec +10 -5
- 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/ext/express-parser/express_parser.cpp +12 -10
- data/ext/express-parser/extconf.rb +48 -25
- data/lib/expressir/express_exp/formatter.rb +3 -7
- data/lib/expressir/express_exp/parser.rb +20 -2
- data/lib/expressir/express_exp/visitor.rb +106 -55
- data/lib/expressir/model.rb +1 -0
- data/lib/expressir/model/entity.rb +3 -0
- data/lib/expressir/model/expressions/query_expression.rb +2 -2
- data/lib/expressir/model/identifier.rb +2 -0
- data/lib/expressir/model/informal_proposition.rb +11 -0
- data/lib/expressir/model/rule.rb +3 -0
- data/lib/expressir/model/schema.rb +2 -0
- data/lib/expressir/model/scope.rb +52 -3
- data/lib/expressir/model/type.rb +8 -0
- data/lib/expressir/version.rb +1 -1
- data/original/examples/syntax/remark.exp +64 -20
- data/original/examples/syntax/remark_formatted.exp +63 -19
- data/original/examples/syntax/source.exp +16 -0
- data/original/examples/syntax/syntax.exp +6 -1
- data/original/examples/syntax/syntax_formatted.exp +13 -0
- data/rakelib/cross-ruby.rake +308 -0
- data/spec/expressir/express_exp/head_source_spec.rb +41 -0
- data/spec/expressir/express_exp/parse_multiple_spec.rb +32 -0
- data/spec/expressir/express_exp/parse_remark_spec.rb +119 -53
- data/spec/expressir/express_exp/parse_syntax_spec.rb +47 -2
- data/spec/expressir/express_exp/source_spec.rb +32 -0
- data/spec/expressir/model/find_spec.rb +19 -6
- metadata +369 -23
@@ -0,0 +1,121 @@
|
|
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 "Token.h"
|
9
|
+
|
10
|
+
namespace antlr4 {
|
11
|
+
|
12
|
+
/// <summary>
|
13
|
+
/// The interface for defining strategies to deal with syntax errors encountered
|
14
|
+
/// during a parse by ANTLR-generated parsers. We distinguish between three
|
15
|
+
/// different kinds of errors:
|
16
|
+
///
|
17
|
+
/// <ul>
|
18
|
+
/// <li>The parser could not figure out which path to take in the ATN (none of
|
19
|
+
/// the available alternatives could possibly match)</li>
|
20
|
+
/// <li>The current input does not match what we were looking for</li>
|
21
|
+
/// <li>A predicate evaluated to false</li>
|
22
|
+
/// </ul>
|
23
|
+
///
|
24
|
+
/// Implementations of this interface report syntax errors by calling
|
25
|
+
/// <seealso cref="Parser#notifyErrorListeners"/>.
|
26
|
+
/// <p/>
|
27
|
+
/// TODO: what to do about lexers
|
28
|
+
/// </summary>
|
29
|
+
class ANTLR4CPP_PUBLIC ANTLRErrorStrategy {
|
30
|
+
public:
|
31
|
+
|
32
|
+
/// <summary>
|
33
|
+
/// Reset the error handler state for the specified {@code recognizer}. </summary>
|
34
|
+
/// <param name="recognizer"> the parser instance </param>
|
35
|
+
virtual ~ANTLRErrorStrategy();
|
36
|
+
|
37
|
+
virtual void reset(Parser *recognizer) = 0;
|
38
|
+
|
39
|
+
/**
|
40
|
+
* This method is called when an unexpected symbol is encountered during an
|
41
|
+
* inline match operation, such as {@link Parser#match}. If the error
|
42
|
+
* strategy successfully recovers from the match failure, this method
|
43
|
+
* returns the {@link Token} instance which should be treated as the
|
44
|
+
* successful result of the match.
|
45
|
+
*
|
46
|
+
* <p>This method handles the consumption of any tokens - the caller should
|
47
|
+
* <b>not</b> call {@link Parser#consume} after a successful recovery.</p>
|
48
|
+
*
|
49
|
+
* <p>Note that the calling code will not report an error if this method
|
50
|
+
* returns successfully. The error strategy implementation is responsible
|
51
|
+
* for calling {@link Parser#notifyErrorListeners} as appropriate.</p>
|
52
|
+
*
|
53
|
+
* @param recognizer the parser instance
|
54
|
+
* @throws RecognitionException if the error strategy was not able to
|
55
|
+
* recover from the unexpected input symbol
|
56
|
+
*/
|
57
|
+
virtual Token* recoverInline(Parser *recognizer) = 0;
|
58
|
+
|
59
|
+
/// <summary>
|
60
|
+
/// This method is called to recover from exception {@code e}. This method is
|
61
|
+
/// called after <seealso cref="#reportError"/> by the default exception handler
|
62
|
+
/// generated for a rule method.
|
63
|
+
/// </summary>
|
64
|
+
/// <seealso cref= #reportError
|
65
|
+
/// </seealso>
|
66
|
+
/// <param name="recognizer"> the parser instance </param>
|
67
|
+
/// <param name="e"> the recognition exception to recover from </param>
|
68
|
+
/// <exception cref="RecognitionException"> if the error strategy could not recover from
|
69
|
+
/// the recognition exception </exception>
|
70
|
+
virtual void recover(Parser *recognizer, std::exception_ptr e) = 0;
|
71
|
+
|
72
|
+
/// <summary>
|
73
|
+
/// This method provides the error handler with an opportunity to handle
|
74
|
+
/// syntactic or semantic errors in the input stream before they result in a
|
75
|
+
/// <seealso cref="RecognitionException"/>.
|
76
|
+
/// <p/>
|
77
|
+
/// The generated code currently contains calls to <seealso cref="#sync"/> after
|
78
|
+
/// entering the decision state of a closure block ({@code (...)*} or
|
79
|
+
/// {@code (...)+}).
|
80
|
+
/// <p/>
|
81
|
+
/// For an implementation based on Jim Idle's "magic sync" mechanism, see
|
82
|
+
/// <seealso cref="DefaultErrorStrategy#sync"/>.
|
83
|
+
/// </summary>
|
84
|
+
/// <seealso cref= DefaultErrorStrategy#sync
|
85
|
+
/// </seealso>
|
86
|
+
/// <param name="recognizer"> the parser instance </param>
|
87
|
+
/// <exception cref="RecognitionException"> if an error is detected by the error
|
88
|
+
/// strategy but cannot be automatically recovered at the current state in
|
89
|
+
/// the parsing process </exception>
|
90
|
+
virtual void sync(Parser *recognizer) = 0;
|
91
|
+
|
92
|
+
/// <summary>
|
93
|
+
/// Tests whether or not {@code recognizer} is in the process of recovering
|
94
|
+
/// from an error. In error recovery mode, <seealso cref="Parser#consume"/> adds
|
95
|
+
/// symbols to the parse tree by calling
|
96
|
+
/// {@link Parser#createErrorNode(ParserRuleContext, Token)} then
|
97
|
+
/// {@link ParserRuleContext#addErrorNode(ErrorNode)} instead of
|
98
|
+
/// {@link Parser#createTerminalNode(ParserRuleContext, Token)}.
|
99
|
+
/// </summary>
|
100
|
+
/// <param name="recognizer"> the parser instance </param>
|
101
|
+
/// <returns> {@code true} if the parser is currently recovering from a parse
|
102
|
+
/// error, otherwise {@code false} </returns>
|
103
|
+
virtual bool inErrorRecoveryMode(Parser *recognizer) = 0;
|
104
|
+
|
105
|
+
/// <summary>
|
106
|
+
/// This method is called by when the parser successfully matches an input
|
107
|
+
/// symbol.
|
108
|
+
/// </summary>
|
109
|
+
/// <param name="recognizer"> the parser instance </param>
|
110
|
+
virtual void reportMatch(Parser *recognizer) = 0;
|
111
|
+
|
112
|
+
/// <summary>
|
113
|
+
/// Report any kind of <seealso cref="RecognitionException"/>. This method is called by
|
114
|
+
/// the default exception handler generated for a rule method.
|
115
|
+
/// </summary>
|
116
|
+
/// <param name="recognizer"> the parser instance </param>
|
117
|
+
/// <param name="e"> the recognition exception to report </param>
|
118
|
+
virtual void reportError(Parser *recognizer, const RecognitionException &e) = 0;
|
119
|
+
};
|
120
|
+
|
121
|
+
} // namespace antlr4
|
@@ -0,0 +1,34 @@
|
|
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 "support/StringUtils.h"
|
7
|
+
|
8
|
+
#include "ANTLRFileStream.h"
|
9
|
+
|
10
|
+
using namespace antlr4;
|
11
|
+
|
12
|
+
ANTLRFileStream::ANTLRFileStream(const std::string &fileName) {
|
13
|
+
_fileName = fileName;
|
14
|
+
loadFromFile(fileName);
|
15
|
+
}
|
16
|
+
|
17
|
+
void ANTLRFileStream::loadFromFile(const std::string &fileName) {
|
18
|
+
_fileName = fileName;
|
19
|
+
if (_fileName.empty()) {
|
20
|
+
return;
|
21
|
+
}
|
22
|
+
|
23
|
+
#ifdef _MSC_VER
|
24
|
+
std::ifstream stream(antlrcpp::s2ws(fileName), std::ios::binary);
|
25
|
+
#else
|
26
|
+
std::ifstream stream(fileName, std::ios::binary);
|
27
|
+
#endif
|
28
|
+
|
29
|
+
ANTLRInputStream::load(stream);
|
30
|
+
}
|
31
|
+
|
32
|
+
std::string ANTLRFileStream::getSourceName() const {
|
33
|
+
return _fileName;
|
34
|
+
}
|
@@ -0,0 +1,27 @@
|
|
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 "ANTLRInputStream.h"
|
9
|
+
|
10
|
+
namespace antlr4 {
|
11
|
+
|
12
|
+
/// This is an ANTLRInputStream that is loaded from a file all at once
|
13
|
+
/// when you construct the object (or call load()).
|
14
|
+
// TODO: this class needs testing.
|
15
|
+
class ANTLR4CPP_PUBLIC ANTLRFileStream : public ANTLRInputStream {
|
16
|
+
protected:
|
17
|
+
std::string _fileName; // UTF-8 encoded file name.
|
18
|
+
|
19
|
+
public:
|
20
|
+
// Assumes a file name encoded in UTF-8 and file content in the same encoding (with or w/o BOM).
|
21
|
+
ANTLRFileStream(const std::string &fileName);
|
22
|
+
|
23
|
+
virtual void loadFromFile(const std::string &fileName);
|
24
|
+
virtual std::string getSourceName() const override;
|
25
|
+
};
|
26
|
+
|
27
|
+
} // namespace antlr4
|
@@ -0,0 +1,155 @@
|
|
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 "Exceptions.h"
|
7
|
+
#include "misc/Interval.h"
|
8
|
+
#include "IntStream.h"
|
9
|
+
|
10
|
+
#include "support/StringUtils.h"
|
11
|
+
#include "support/CPPUtils.h"
|
12
|
+
|
13
|
+
#include "ANTLRInputStream.h"
|
14
|
+
|
15
|
+
using namespace antlr4;
|
16
|
+
using namespace antlrcpp;
|
17
|
+
|
18
|
+
using misc::Interval;
|
19
|
+
|
20
|
+
ANTLRInputStream::ANTLRInputStream(const std::string &input) {
|
21
|
+
InitializeInstanceFields();
|
22
|
+
load(input);
|
23
|
+
}
|
24
|
+
|
25
|
+
ANTLRInputStream::ANTLRInputStream(const char data_[], size_t numberOfActualCharsInArray)
|
26
|
+
: ANTLRInputStream(std::string(data_, numberOfActualCharsInArray)) {
|
27
|
+
}
|
28
|
+
|
29
|
+
ANTLRInputStream::ANTLRInputStream(std::istream &stream) {
|
30
|
+
InitializeInstanceFields();
|
31
|
+
load(stream);
|
32
|
+
}
|
33
|
+
|
34
|
+
void ANTLRInputStream::load(const std::string &input) {
|
35
|
+
// Remove the UTF-8 BOM if present.
|
36
|
+
const char bom[4] = "\xef\xbb\xbf";
|
37
|
+
if (input.compare(0, 3, bom, 3) == 0)
|
38
|
+
_data = antlrcpp::utf8_to_utf32(input.data() + 3, input.data() + input.size());
|
39
|
+
else
|
40
|
+
_data = antlrcpp::utf8_to_utf32(input.data(), input.data() + input.size());
|
41
|
+
p = 0;
|
42
|
+
}
|
43
|
+
|
44
|
+
void ANTLRInputStream::load(std::istream &stream) {
|
45
|
+
if (!stream.good() || stream.eof()) // No fail, bad or EOF.
|
46
|
+
return;
|
47
|
+
|
48
|
+
_data.clear();
|
49
|
+
|
50
|
+
std::string s((std::istreambuf_iterator<char>(stream)), std::istreambuf_iterator<char>());
|
51
|
+
load(s);
|
52
|
+
}
|
53
|
+
|
54
|
+
void ANTLRInputStream::reset() {
|
55
|
+
p = 0;
|
56
|
+
}
|
57
|
+
|
58
|
+
void ANTLRInputStream::consume() {
|
59
|
+
if (p >= _data.size()) {
|
60
|
+
assert(LA(1) == IntStream::EOF);
|
61
|
+
throw IllegalStateException("cannot consume EOF");
|
62
|
+
}
|
63
|
+
|
64
|
+
if (p < _data.size()) {
|
65
|
+
p++;
|
66
|
+
}
|
67
|
+
}
|
68
|
+
|
69
|
+
size_t ANTLRInputStream::LA(ssize_t i) {
|
70
|
+
if (i == 0) {
|
71
|
+
return 0; // undefined
|
72
|
+
}
|
73
|
+
|
74
|
+
ssize_t position = static_cast<ssize_t>(p);
|
75
|
+
if (i < 0) {
|
76
|
+
i++; // e.g., translate LA(-1) to use offset i=0; then _data[p+0-1]
|
77
|
+
if ((position + i - 1) < 0) {
|
78
|
+
return IntStream::EOF; // invalid; no char before first char
|
79
|
+
}
|
80
|
+
}
|
81
|
+
|
82
|
+
if ((position + i - 1) >= static_cast<ssize_t>(_data.size())) {
|
83
|
+
return IntStream::EOF;
|
84
|
+
}
|
85
|
+
|
86
|
+
return _data[static_cast<size_t>((position + i - 1))];
|
87
|
+
}
|
88
|
+
|
89
|
+
size_t ANTLRInputStream::LT(ssize_t i) {
|
90
|
+
return LA(i);
|
91
|
+
}
|
92
|
+
|
93
|
+
size_t ANTLRInputStream::index() {
|
94
|
+
return p;
|
95
|
+
}
|
96
|
+
|
97
|
+
size_t ANTLRInputStream::size() {
|
98
|
+
return _data.size();
|
99
|
+
}
|
100
|
+
|
101
|
+
// Mark/release do nothing. We have entire buffer.
|
102
|
+
ssize_t ANTLRInputStream::mark() {
|
103
|
+
return -1;
|
104
|
+
}
|
105
|
+
|
106
|
+
void ANTLRInputStream::release(ssize_t /* marker */) {
|
107
|
+
}
|
108
|
+
|
109
|
+
void ANTLRInputStream::seek(size_t index) {
|
110
|
+
if (index <= p) {
|
111
|
+
p = index; // just jump; don't update stream state (line, ...)
|
112
|
+
return;
|
113
|
+
}
|
114
|
+
// seek forward, consume until p hits index or n (whichever comes first)
|
115
|
+
index = std::min(index, _data.size());
|
116
|
+
while (p < index) {
|
117
|
+
consume();
|
118
|
+
}
|
119
|
+
}
|
120
|
+
|
121
|
+
std::string ANTLRInputStream::getText(const Interval &interval) {
|
122
|
+
if (interval.a < 0 || interval.b < 0) {
|
123
|
+
return "";
|
124
|
+
}
|
125
|
+
|
126
|
+
size_t start = static_cast<size_t>(interval.a);
|
127
|
+
size_t stop = static_cast<size_t>(interval.b);
|
128
|
+
|
129
|
+
|
130
|
+
if (stop >= _data.size()) {
|
131
|
+
stop = _data.size() - 1;
|
132
|
+
}
|
133
|
+
|
134
|
+
size_t count = stop - start + 1;
|
135
|
+
if (start >= _data.size()) {
|
136
|
+
return "";
|
137
|
+
}
|
138
|
+
|
139
|
+
return antlrcpp::utf32_to_utf8(_data.substr(start, count));
|
140
|
+
}
|
141
|
+
|
142
|
+
std::string ANTLRInputStream::getSourceName() const {
|
143
|
+
if (name.empty()) {
|
144
|
+
return IntStream::UNKNOWN_SOURCE_NAME;
|
145
|
+
}
|
146
|
+
return name;
|
147
|
+
}
|
148
|
+
|
149
|
+
std::string ANTLRInputStream::toString() const {
|
150
|
+
return antlrcpp::utf32_to_utf8(_data);
|
151
|
+
}
|
152
|
+
|
153
|
+
void ANTLRInputStream::InitializeInstanceFields() {
|
154
|
+
p = 0;
|
155
|
+
}
|
@@ -0,0 +1,69 @@
|
|
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 "CharStream.h"
|
9
|
+
|
10
|
+
namespace antlr4 {
|
11
|
+
|
12
|
+
// Vacuum all input from a stream and then treat it
|
13
|
+
// like a string. Can also pass in a string or char[] to use.
|
14
|
+
// Input is expected to be encoded in UTF-8 and converted to UTF-32 internally.
|
15
|
+
class ANTLR4CPP_PUBLIC ANTLRInputStream : public CharStream {
|
16
|
+
protected:
|
17
|
+
/// The data being scanned.
|
18
|
+
// UTF-32
|
19
|
+
UTF32String _data;
|
20
|
+
|
21
|
+
/// 0..n-1 index into string of next char </summary>
|
22
|
+
size_t p;
|
23
|
+
|
24
|
+
public:
|
25
|
+
/// What is name or source of this char stream?
|
26
|
+
std::string name;
|
27
|
+
|
28
|
+
ANTLRInputStream(const std::string &input = "");
|
29
|
+
ANTLRInputStream(const char data_[], size_t numberOfActualCharsInArray);
|
30
|
+
ANTLRInputStream(std::istream &stream);
|
31
|
+
|
32
|
+
virtual void load(const std::string &input);
|
33
|
+
virtual void load(std::istream &stream);
|
34
|
+
|
35
|
+
/// Reset the stream so that it's in the same state it was
|
36
|
+
/// when the object was created *except* the data array is not
|
37
|
+
/// touched.
|
38
|
+
virtual void reset();
|
39
|
+
virtual void consume() override;
|
40
|
+
virtual size_t LA(ssize_t i) override;
|
41
|
+
virtual size_t LT(ssize_t i);
|
42
|
+
|
43
|
+
/// <summary>
|
44
|
+
/// Return the current input symbol index 0..n where n indicates the
|
45
|
+
/// last symbol has been read. The index is the index of char to
|
46
|
+
/// be returned from LA(1).
|
47
|
+
/// </summary>
|
48
|
+
virtual size_t index() override;
|
49
|
+
virtual size_t size() override;
|
50
|
+
|
51
|
+
/// <summary>
|
52
|
+
/// mark/release do nothing; we have entire buffer </summary>
|
53
|
+
virtual ssize_t mark() override;
|
54
|
+
virtual void release(ssize_t marker) override;
|
55
|
+
|
56
|
+
/// <summary>
|
57
|
+
/// consume() ahead until p==index; can't just set p=index as we must
|
58
|
+
/// update line and charPositionInLine. If we seek backwards, just set p
|
59
|
+
/// </summary>
|
60
|
+
virtual void seek(size_t index) override;
|
61
|
+
virtual std::string getText(const misc::Interval &interval) override;
|
62
|
+
virtual std::string getSourceName() const override;
|
63
|
+
virtual std::string toString() const override;
|
64
|
+
|
65
|
+
private:
|
66
|
+
void InitializeInstanceFields();
|
67
|
+
};
|
68
|
+
|
69
|
+
} // namespace antlr4
|
@@ -0,0 +1,61 @@
|
|
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 "Exceptions.h"
|
7
|
+
#include "ParserRuleContext.h"
|
8
|
+
#include "InputMismatchException.h"
|
9
|
+
#include "Parser.h"
|
10
|
+
|
11
|
+
#include "BailErrorStrategy.h"
|
12
|
+
|
13
|
+
using namespace antlr4;
|
14
|
+
|
15
|
+
void BailErrorStrategy::recover(Parser *recognizer, std::exception_ptr e) {
|
16
|
+
ParserRuleContext *context = recognizer->getContext();
|
17
|
+
do {
|
18
|
+
context->exception = e;
|
19
|
+
if (context->parent == nullptr)
|
20
|
+
break;
|
21
|
+
context = static_cast<ParserRuleContext *>(context->parent);
|
22
|
+
} while (true);
|
23
|
+
|
24
|
+
try {
|
25
|
+
std::rethrow_exception(e); // Throw the exception to be able to catch and rethrow nested.
|
26
|
+
#if defined(_MSC_FULL_VER) && _MSC_FULL_VER < 190023026
|
27
|
+
} catch (RecognitionException &inner) {
|
28
|
+
throw ParseCancellationException(inner.what());
|
29
|
+
#else
|
30
|
+
} catch (RecognitionException & /*inner*/) {
|
31
|
+
std::throw_with_nested(ParseCancellationException());
|
32
|
+
#endif
|
33
|
+
}
|
34
|
+
}
|
35
|
+
|
36
|
+
Token* BailErrorStrategy::recoverInline(Parser *recognizer) {
|
37
|
+
InputMismatchException e(recognizer);
|
38
|
+
std::exception_ptr exception = std::make_exception_ptr(e);
|
39
|
+
|
40
|
+
ParserRuleContext *context = recognizer->getContext();
|
41
|
+
do {
|
42
|
+
context->exception = exception;
|
43
|
+
if (context->parent == nullptr)
|
44
|
+
break;
|
45
|
+
context = static_cast<ParserRuleContext *>(context->parent);
|
46
|
+
} while (true);
|
47
|
+
|
48
|
+
try {
|
49
|
+
throw e;
|
50
|
+
#if defined(_MSC_FULL_VER) && _MSC_FULL_VER < 190023026
|
51
|
+
} catch (InputMismatchException &inner) {
|
52
|
+
throw ParseCancellationException(inner.what());
|
53
|
+
#else
|
54
|
+
} catch (InputMismatchException & /*inner*/) {
|
55
|
+
std::throw_with_nested(ParseCancellationException());
|
56
|
+
#endif
|
57
|
+
}
|
58
|
+
}
|
59
|
+
|
60
|
+
void BailErrorStrategy::sync(Parser * /*recognizer*/) {
|
61
|
+
}
|