expressir 0.2.4-x64-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.github/workflows/rake.yml +46 -0
- data/.github/workflows/release.yml +75 -0
- data/.gitignore +15 -0
- data/.gitmodules +3 -0
- data/.rspec +2 -0
- data/.rubocop.yml +508 -0
- data/Gemfile +6 -0
- data/README.adoc +147 -0
- data/Rakefile +17 -0
- data/bin/console +12 -0
- data/bin/rspec +29 -0
- data/bin/setup +8 -0
- data/demo.rb +18 -0
- data/docs/development.md +90 -0
- data/exe/expressir +20 -0
- data/exe/generate-parser +48 -0
- data/expressir.gemspec +40 -0
- 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/antlrgen/Express.interp +532 -0
- data/ext/express-parser/antlrgen/Express.tokens +190 -0
- data/ext/express-parser/antlrgen/ExpressBaseListener.cpp +7 -0
- data/ext/express-parser/antlrgen/ExpressBaseListener.h +623 -0
- data/ext/express-parser/antlrgen/ExpressBaseVisitor.cpp +7 -0
- data/ext/express-parser/antlrgen/ExpressBaseVisitor.h +816 -0
- data/ext/express-parser/antlrgen/ExpressLexer.cpp +1169 -0
- data/ext/express-parser/antlrgen/ExpressLexer.h +85 -0
- data/ext/express-parser/antlrgen/ExpressLexer.interp +534 -0
- data/ext/express-parser/antlrgen/ExpressLexer.tokens +190 -0
- data/ext/express-parser/antlrgen/ExpressListener.cpp +7 -0
- data/ext/express-parser/antlrgen/ExpressListener.h +616 -0
- data/ext/express-parser/antlrgen/ExpressParser.cpp +17284 -0
- data/ext/express-parser/antlrgen/ExpressParser.h +3696 -0
- data/ext/express-parser/antlrgen/ExpressVisitor.cpp +7 -0
- data/ext/express-parser/antlrgen/ExpressVisitor.h +422 -0
- data/ext/express-parser/express_parser.cpp +17931 -0
- data/ext/express-parser/extconf.rb +34 -0
- data/lib/express_parser.so +0 -0
- data/lib/expressir.rb +21 -0
- data/lib/expressir/cli.rb +27 -0
- data/lib/expressir/cli/ui.rb +36 -0
- data/lib/expressir/config.rb +23 -0
- data/lib/expressir/express.rb +11 -0
- data/lib/expressir/express/aggregate_dimension.rb +38 -0
- data/lib/expressir/express/attribute.rb +15 -0
- data/lib/expressir/express/comment.rb +7 -0
- data/lib/expressir/express/defined_type.rb +36 -0
- data/lib/expressir/express/derived.rb +65 -0
- data/lib/expressir/express/derived_aggregate.rb +43 -0
- data/lib/expressir/express/entity.rb +137 -0
- data/lib/expressir/express/explicit.rb +70 -0
- data/lib/expressir/express/explicit_aggregate.rb +46 -0
- data/lib/expressir/express/explicit_or_derived.rb +16 -0
- data/lib/expressir/express/global_rule.rb +44 -0
- data/lib/expressir/express/interface_specification.rb +51 -0
- data/lib/expressir/express/interfaced_item.rb +38 -0
- data/lib/expressir/express/inverse.rb +46 -0
- data/lib/expressir/express/inverse_aggregate.rb +37 -0
- data/lib/expressir/express/model_element.rb +7 -0
- data/lib/expressir/express/named_type.rb +19 -0
- data/lib/expressir/express/remark.rb +8 -0
- data/lib/expressir/express/repository.rb +306 -0
- data/lib/expressir/express/schema_definition.rb +96 -0
- data/lib/expressir/express/subtype_constraint.rb +14 -0
- data/lib/expressir/express/type.rb +26 -0
- data/lib/expressir/express/type_aggregate.rb +42 -0
- data/lib/expressir/express/type_enum.rb +29 -0
- data/lib/expressir/express/type_parser.rb +45 -0
- data/lib/expressir/express/type_select.rb +82 -0
- data/lib/expressir/express/unique_rule.rb +35 -0
- data/lib/expressir/express/where_rule.rb +32 -0
- data/lib/expressir/express_exp/formatter.rb +1450 -0
- data/lib/expressir/express_exp/parser.rb +36 -0
- data/lib/expressir/express_exp/visitor.rb +2451 -0
- data/lib/expressir/express_parser.rb +30 -0
- data/lib/expressir/model.rb +65 -0
- data/lib/expressir/model/attribute.rb +27 -0
- data/lib/expressir/model/constant.rb +17 -0
- data/lib/expressir/model/entity.rb +46 -0
- data/lib/expressir/model/enumeration_item.rb +11 -0
- data/lib/expressir/model/expressions/aggregate_initializer.rb +13 -0
- data/lib/expressir/model/expressions/aggregate_item.rb +15 -0
- data/lib/expressir/model/expressions/attribute_reference.rb +15 -0
- data/lib/expressir/model/expressions/binary_expression.rb +40 -0
- data/lib/expressir/model/expressions/call.rb +15 -0
- data/lib/expressir/model/expressions/entity_constructor.rb +15 -0
- data/lib/expressir/model/expressions/group_reference.rb +15 -0
- data/lib/expressir/model/expressions/index_reference.rb +17 -0
- data/lib/expressir/model/expressions/interval.rb +21 -0
- data/lib/expressir/model/expressions/query_expression.rb +26 -0
- data/lib/expressir/model/expressions/simple_reference.rb +13 -0
- data/lib/expressir/model/expressions/unary_expression.rb +19 -0
- data/lib/expressir/model/function.rb +62 -0
- data/lib/expressir/model/identifier.rb +9 -0
- data/lib/expressir/model/interface.rb +18 -0
- data/lib/expressir/model/literals/binary.rb +13 -0
- data/lib/expressir/model/literals/integer.rb +13 -0
- data/lib/expressir/model/literals/logical.rb +17 -0
- data/lib/expressir/model/literals/real.rb +13 -0
- data/lib/expressir/model/literals/string.rb +15 -0
- data/lib/expressir/model/parameter.rb +17 -0
- data/lib/expressir/model/procedure.rb +60 -0
- data/lib/expressir/model/renamed_ref.rb +13 -0
- data/lib/expressir/model/repository.rb +19 -0
- data/lib/expressir/model/rule.rb +62 -0
- data/lib/expressir/model/schema.rb +67 -0
- data/lib/expressir/model/scope.rb +17 -0
- data/lib/expressir/model/statements/alias.rb +26 -0
- data/lib/expressir/model/statements/assignment.rb +15 -0
- data/lib/expressir/model/statements/call.rb +15 -0
- data/lib/expressir/model/statements/case.rb +17 -0
- data/lib/expressir/model/statements/case_action.rb +15 -0
- data/lib/expressir/model/statements/compound.rb +13 -0
- data/lib/expressir/model/statements/escape.rb +8 -0
- data/lib/expressir/model/statements/if.rb +17 -0
- data/lib/expressir/model/statements/null.rb +8 -0
- data/lib/expressir/model/statements/repeat.rb +34 -0
- data/lib/expressir/model/statements/return.rb +13 -0
- data/lib/expressir/model/statements/skip.rb +8 -0
- data/lib/expressir/model/subtype_constraint.rb +27 -0
- data/lib/expressir/model/type.rb +24 -0
- data/lib/expressir/model/types/aggregate.rb +17 -0
- data/lib/expressir/model/types/array.rb +21 -0
- data/lib/expressir/model/types/bag.rb +17 -0
- data/lib/expressir/model/types/binary.rb +15 -0
- data/lib/expressir/model/types/boolean.rb +8 -0
- data/lib/expressir/model/types/enumeration.rb +19 -0
- data/lib/expressir/model/types/generic.rb +13 -0
- data/lib/expressir/model/types/generic_entity.rb +13 -0
- data/lib/expressir/model/types/integer.rb +8 -0
- data/lib/expressir/model/types/list.rb +19 -0
- data/lib/expressir/model/types/logical.rb +8 -0
- data/lib/expressir/model/types/number.rb +8 -0
- data/lib/expressir/model/types/real.rb +13 -0
- data/lib/expressir/model/types/select.rb +21 -0
- data/lib/expressir/model/types/set.rb +17 -0
- data/lib/expressir/model/types/string.rb +15 -0
- data/lib/expressir/model/unique.rb +15 -0
- data/lib/expressir/model/variable.rb +17 -0
- data/lib/expressir/model/where.rb +15 -0
- data/lib/expressir/parser.rb +6 -0
- data/lib/expressir/parser/owl_parser.rb +8 -0
- data/lib/expressir/version.rb +3 -0
- data/original/examples/ap233/ap233e1_arm_lf_stepmod-2010-11-12.exp +9589 -0
- data/original/examples/ap233/ap233e1_arm_lf_stepmod-2010-11-12.owl +36619 -0
- data/original/examples/ap233/ap233e1_arm_lf_stepmod-2010-11-12.xml +13294 -0
- data/original/examples/employment/eclipse/.project +17 -0
- data/original/examples/employment/eclipse/Export/Employment.png +0 -0
- data/original/examples/employment/eclipse/Express/employment_schema.exp +33 -0
- data/original/examples/employment/eclipse/Express/employment_schema.xmi +77 -0
- data/original/examples/employment/eclipse/Express/employment_schema.xml +93 -0
- data/original/examples/employment/eclipse/Models/Employment.uml +4 -0
- data/original/examples/employment/eclipse/Models/Employment.umldi +240 -0
- data/original/examples/employment/eclipse/readme.txt +7 -0
- data/original/examples/employment/employment_schema.exp +33 -0
- data/original/examples/employment/employment_schema.rb +232 -0
- data/original/examples/employment/employment_schema.xml +93 -0
- data/original/examples/employment/employment_schema___module.rb +46 -0
- data/original/examples/employment/employment_schema___p28attr.rb +126 -0
- data/original/examples/employment/employment_schema___p28inst.rb +26 -0
- data/original/examples/employment/example_employment_data.xml +1 -0
- data/original/examples/employment/example_employment_data_copy.xml +1 -0
- data/original/examples/employment/example_employment_reader.rb +30 -0
- data/original/examples/employment/example_employment_writer.rb +51 -0
- data/original/examples/plcs/ap239e1_arm_lf_dexlib_2010-01-06.exp +3710 -0
- data/original/examples/plcs/ap239e1_arm_lf_dexlib_2010-01-06.owl +35880 -0
- data/original/examples/plcs/ap239e1_arm_lf_dexlib_2010-01-06.xmi +15357 -0
- data/original/examples/plcs/ap239e1_arm_lf_dexlib_2010-01-06.xml +9468 -0
- data/original/examples/plcs/ap239e2_arm_lf_stepmod-2010-01-25.exp +8404 -0
- data/original/examples/plcs/ap239e2_arm_lf_stepmod-2010-01-25.owl +43147 -0
- data/original/examples/plcs/ap239e2_arm_lf_stepmod-2010-01-25.xmi +18341 -0
- data/original/examples/plcs/ap239e2_arm_lf_stepmod-2010-01-25.xml +11632 -0
- data/original/examples/syntax/remark.exp +145 -0
- data/original/examples/syntax/remark_formatted.exp +174 -0
- data/original/examples/syntax/syntax.exp +310 -0
- data/original/examples/syntax/syntax_formatted.exp +1187 -0
- data/original/exp2ruby.rb +525 -0
- data/original/expsm.rb +34 -0
- data/original/mapping_owl.rb +1018 -0
- data/original/mapping_sysml.rb +2281 -0
- data/original/mapping_uml2.rb +599 -0
- data/original/mapping_uml2_eclipse.rb +433 -0
- data/original/reeper.rb +134 -0
- data/spec/acceptance/express_to_owl_spec.rb +18 -0
- data/spec/acceptance/version_spec.rb +12 -0
- data/spec/expressir/express/repository_spec.rb +25 -0
- data/spec/expressir/express_exp/ap233_spec.rb +22 -0
- data/spec/expressir/express_exp/format_remark_spec.rb +28 -0
- data/spec/expressir/express_exp/format_syntax_spec.rb +28 -0
- data/spec/expressir/express_exp/parse_remark_spec.rb +345 -0
- data/spec/expressir/express_exp/parse_syntax_spec.rb +2998 -0
- data/spec/expressir/model/find_spec.rb +110 -0
- data/spec/expressr_spec.rb +5 -0
- data/spec/spec_helper.rb +17 -0
- data/spec/support/console_helper.rb +29 -0
- metadata +695 -0
@@ -0,0 +1,110 @@
|
|
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 "support/BitSet.h"
|
9
|
+
#include "atn/PredictionContext.h"
|
10
|
+
|
11
|
+
namespace antlr4 {
|
12
|
+
namespace atn {
|
13
|
+
|
14
|
+
/// Specialized set that can track info about the set, with support for combining similar configurations using a
|
15
|
+
/// graph-structured stack.
|
16
|
+
class ANTLR4CPP_PUBLIC ATNConfigSet {
|
17
|
+
public:
|
18
|
+
/// Track the elements as they are added to the set; supports get(i)
|
19
|
+
std::vector<Ref<ATNConfig>> configs;
|
20
|
+
|
21
|
+
// TODO: these fields make me pretty uncomfortable but nice to pack up info together, saves recomputation
|
22
|
+
// TODO: can we track conflicts as they are added to save scanning configs later?
|
23
|
+
size_t uniqueAlt;
|
24
|
+
|
25
|
+
/** Currently this is only used when we detect SLL conflict; this does
|
26
|
+
* not necessarily represent the ambiguous alternatives. In fact,
|
27
|
+
* I should also point out that this seems to include predicated alternatives
|
28
|
+
* that have predicates that evaluate to false. Computed in computeTargetState().
|
29
|
+
*/
|
30
|
+
antlrcpp::BitSet conflictingAlts;
|
31
|
+
|
32
|
+
// Used in parser and lexer. In lexer, it indicates we hit a pred
|
33
|
+
// while computing a closure operation. Don't make a DFA state from this.
|
34
|
+
bool hasSemanticContext;
|
35
|
+
bool dipsIntoOuterContext;
|
36
|
+
|
37
|
+
/// Indicates that this configuration set is part of a full context
|
38
|
+
/// LL prediction. It will be used to determine how to merge $. With SLL
|
39
|
+
/// it's a wildcard whereas it is not for LL context merge.
|
40
|
+
const bool fullCtx;
|
41
|
+
|
42
|
+
ATNConfigSet(bool fullCtx = true);
|
43
|
+
ATNConfigSet(const Ref<ATNConfigSet> &old);
|
44
|
+
|
45
|
+
virtual ~ATNConfigSet();
|
46
|
+
|
47
|
+
virtual bool add(const Ref<ATNConfig> &config);
|
48
|
+
|
49
|
+
/// <summary>
|
50
|
+
/// Adding a new config means merging contexts with existing configs for
|
51
|
+
/// {@code (s, i, pi, _)}, where {@code s} is the
|
52
|
+
/// <seealso cref="ATNConfig#state"/>, {@code i} is the <seealso cref="ATNConfig#alt"/>, and
|
53
|
+
/// {@code pi} is the <seealso cref="ATNConfig#semanticContext"/>. We use
|
54
|
+
/// {@code (s,i,pi)} as key.
|
55
|
+
/// <p/>
|
56
|
+
/// This method updates <seealso cref="#dipsIntoOuterContext"/> and
|
57
|
+
/// <seealso cref="#hasSemanticContext"/> when necessary.
|
58
|
+
/// </summary>
|
59
|
+
virtual bool add(const Ref<ATNConfig> &config, PredictionContextMergeCache *mergeCache);
|
60
|
+
|
61
|
+
virtual std::vector<ATNState *> getStates();
|
62
|
+
|
63
|
+
/**
|
64
|
+
* Gets the complete set of represented alternatives for the configuration
|
65
|
+
* set.
|
66
|
+
*
|
67
|
+
* @return the set of represented alternatives in this configuration set
|
68
|
+
*
|
69
|
+
* @since 4.3
|
70
|
+
*/
|
71
|
+
antlrcpp::BitSet getAlts();
|
72
|
+
virtual std::vector<Ref<SemanticContext>> getPredicates();
|
73
|
+
|
74
|
+
virtual Ref<ATNConfig> get(size_t i) const;
|
75
|
+
|
76
|
+
virtual void optimizeConfigs(ATNSimulator *interpreter);
|
77
|
+
|
78
|
+
bool addAll(const Ref<ATNConfigSet> &other);
|
79
|
+
|
80
|
+
bool operator == (const ATNConfigSet &other);
|
81
|
+
virtual size_t hashCode();
|
82
|
+
virtual size_t size();
|
83
|
+
virtual bool isEmpty();
|
84
|
+
virtual void clear();
|
85
|
+
virtual bool isReadonly();
|
86
|
+
virtual void setReadonly(bool readonly);
|
87
|
+
virtual std::string toString();
|
88
|
+
|
89
|
+
protected:
|
90
|
+
/// Indicates that the set of configurations is read-only. Do not
|
91
|
+
/// allow any code to manipulate the set; DFA states will point at
|
92
|
+
/// the sets and they must not change. This does not protect the other
|
93
|
+
/// fields; in particular, conflictingAlts is set after
|
94
|
+
/// we've made this readonly.
|
95
|
+
bool _readonly;
|
96
|
+
|
97
|
+
virtual size_t getHash(ATNConfig *c); // Hash differs depending on set type.
|
98
|
+
|
99
|
+
private:
|
100
|
+
size_t _cachedHashCode;
|
101
|
+
|
102
|
+
/// All configs but hashed by (s, i, _, pi) not including context. Wiped out
|
103
|
+
/// when we go readonly as this set becomes a DFA state.
|
104
|
+
std::unordered_map<size_t, ATNConfig *> _configLookup;
|
105
|
+
|
106
|
+
void InitializeInstanceFields();
|
107
|
+
};
|
108
|
+
|
109
|
+
} // namespace atn
|
110
|
+
} // namespace antlr4
|
data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNDeserializationOptions.cpp
ADDED
@@ -0,0 +1,64 @@
|
|
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/ATNDeserializationOptions.h"
|
7
|
+
|
8
|
+
using namespace antlr4::atn;
|
9
|
+
|
10
|
+
ATNDeserializationOptions ATNDeserializationOptions::defaultOptions;
|
11
|
+
|
12
|
+
ATNDeserializationOptions::ATNDeserializationOptions() {
|
13
|
+
InitializeInstanceFields();
|
14
|
+
}
|
15
|
+
|
16
|
+
ATNDeserializationOptions::ATNDeserializationOptions(ATNDeserializationOptions *options) : ATNDeserializationOptions() {
|
17
|
+
this->verifyATN = options->verifyATN;
|
18
|
+
this->generateRuleBypassTransitions = options->generateRuleBypassTransitions;
|
19
|
+
}
|
20
|
+
|
21
|
+
ATNDeserializationOptions::~ATNDeserializationOptions() {
|
22
|
+
}
|
23
|
+
|
24
|
+
const ATNDeserializationOptions& ATNDeserializationOptions::getDefaultOptions() {
|
25
|
+
return defaultOptions;
|
26
|
+
}
|
27
|
+
|
28
|
+
bool ATNDeserializationOptions::isReadOnly() {
|
29
|
+
return readOnly;
|
30
|
+
}
|
31
|
+
|
32
|
+
void ATNDeserializationOptions::makeReadOnly() {
|
33
|
+
readOnly = true;
|
34
|
+
}
|
35
|
+
|
36
|
+
bool ATNDeserializationOptions::isVerifyATN() {
|
37
|
+
return verifyATN;
|
38
|
+
}
|
39
|
+
|
40
|
+
void ATNDeserializationOptions::setVerifyATN(bool verify) {
|
41
|
+
throwIfReadOnly();
|
42
|
+
verifyATN = verify;
|
43
|
+
}
|
44
|
+
|
45
|
+
bool ATNDeserializationOptions::isGenerateRuleBypassTransitions() {
|
46
|
+
return generateRuleBypassTransitions;
|
47
|
+
}
|
48
|
+
|
49
|
+
void ATNDeserializationOptions::setGenerateRuleBypassTransitions(bool generate) {
|
50
|
+
throwIfReadOnly();
|
51
|
+
generateRuleBypassTransitions = generate;
|
52
|
+
}
|
53
|
+
|
54
|
+
void ATNDeserializationOptions::throwIfReadOnly() {
|
55
|
+
if (isReadOnly()) {
|
56
|
+
throw "The object is read only.";
|
57
|
+
}
|
58
|
+
}
|
59
|
+
|
60
|
+
void ATNDeserializationOptions::InitializeInstanceFields() {
|
61
|
+
readOnly = false;
|
62
|
+
verifyATN = true;
|
63
|
+
generateRuleBypassTransitions = false;
|
64
|
+
}
|
data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNDeserializationOptions.h
ADDED
@@ -0,0 +1,50 @@
|
|
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 "antlr4-common.h"
|
9
|
+
|
10
|
+
namespace antlr4 {
|
11
|
+
namespace atn {
|
12
|
+
|
13
|
+
class ANTLR4CPP_PUBLIC ATNDeserializationOptions {
|
14
|
+
private:
|
15
|
+
static ATNDeserializationOptions defaultOptions;
|
16
|
+
|
17
|
+
bool readOnly;
|
18
|
+
bool verifyATN;
|
19
|
+
bool generateRuleBypassTransitions;
|
20
|
+
|
21
|
+
public:
|
22
|
+
ATNDeserializationOptions();
|
23
|
+
ATNDeserializationOptions(ATNDeserializationOptions *options);
|
24
|
+
ATNDeserializationOptions(ATNDeserializationOptions const&) = default;
|
25
|
+
virtual ~ATNDeserializationOptions();
|
26
|
+
ATNDeserializationOptions& operator=(ATNDeserializationOptions const&) = default;
|
27
|
+
|
28
|
+
static const ATNDeserializationOptions& getDefaultOptions();
|
29
|
+
|
30
|
+
bool isReadOnly();
|
31
|
+
|
32
|
+
void makeReadOnly();
|
33
|
+
|
34
|
+
bool isVerifyATN();
|
35
|
+
|
36
|
+
void setVerifyATN(bool verify);
|
37
|
+
|
38
|
+
bool isGenerateRuleBypassTransitions();
|
39
|
+
|
40
|
+
void setGenerateRuleBypassTransitions(bool generate);
|
41
|
+
|
42
|
+
protected:
|
43
|
+
virtual void throwIfReadOnly();
|
44
|
+
|
45
|
+
private:
|
46
|
+
void InitializeInstanceFields();
|
47
|
+
};
|
48
|
+
|
49
|
+
} // namespace atn
|
50
|
+
} // namespace antlr4
|
@@ -0,0 +1,758 @@
|
|
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/ATNDeserializationOptions.h"
|
7
|
+
|
8
|
+
#include "atn/ATNType.h"
|
9
|
+
#include "atn/ATNState.h"
|
10
|
+
#include "atn/ATN.h"
|
11
|
+
|
12
|
+
#include "atn/LoopEndState.h"
|
13
|
+
#include "atn/DecisionState.h"
|
14
|
+
#include "atn/RuleStartState.h"
|
15
|
+
#include "atn/RuleStopState.h"
|
16
|
+
#include "atn/TokensStartState.h"
|
17
|
+
#include "atn/RuleTransition.h"
|
18
|
+
#include "atn/EpsilonTransition.h"
|
19
|
+
#include "atn/PlusLoopbackState.h"
|
20
|
+
#include "atn/PlusBlockStartState.h"
|
21
|
+
#include "atn/StarLoopbackState.h"
|
22
|
+
#include "atn/BasicBlockStartState.h"
|
23
|
+
#include "atn/BasicState.h"
|
24
|
+
#include "atn/BlockEndState.h"
|
25
|
+
#include "atn/StarLoopEntryState.h"
|
26
|
+
|
27
|
+
#include "atn/AtomTransition.h"
|
28
|
+
#include "atn/StarBlockStartState.h"
|
29
|
+
#include "atn/RangeTransition.h"
|
30
|
+
#include "atn/PredicateTransition.h"
|
31
|
+
#include "atn/PrecedencePredicateTransition.h"
|
32
|
+
#include "atn/ActionTransition.h"
|
33
|
+
#include "atn/SetTransition.h"
|
34
|
+
#include "atn/NotSetTransition.h"
|
35
|
+
#include "atn/WildcardTransition.h"
|
36
|
+
#include "Token.h"
|
37
|
+
|
38
|
+
#include "misc/IntervalSet.h"
|
39
|
+
#include "Exceptions.h"
|
40
|
+
#include "support/CPPUtils.h"
|
41
|
+
#include "support/StringUtils.h"
|
42
|
+
|
43
|
+
#include "atn/LexerCustomAction.h"
|
44
|
+
#include "atn/LexerChannelAction.h"
|
45
|
+
#include "atn/LexerModeAction.h"
|
46
|
+
#include "atn/LexerMoreAction.h"
|
47
|
+
#include "atn/LexerPopModeAction.h"
|
48
|
+
#include "atn/LexerPushModeAction.h"
|
49
|
+
#include "atn/LexerSkipAction.h"
|
50
|
+
#include "atn/LexerTypeAction.h"
|
51
|
+
|
52
|
+
#include "atn/ATNDeserializer.h"
|
53
|
+
|
54
|
+
#include <string>
|
55
|
+
|
56
|
+
using namespace antlr4;
|
57
|
+
using namespace antlr4::atn;
|
58
|
+
using namespace antlrcpp;
|
59
|
+
|
60
|
+
const size_t ATNDeserializer::SERIALIZED_VERSION = 3;
|
61
|
+
|
62
|
+
namespace {
|
63
|
+
|
64
|
+
uint32_t deserializeInt32(const std::vector<uint16_t>& data, size_t offset) {
|
65
|
+
return (uint32_t)data[offset] | ((uint32_t)data[offset + 1] << 16);
|
66
|
+
}
|
67
|
+
|
68
|
+
ssize_t readUnicodeInt(const std::vector<uint16_t>& data, int& p) {
|
69
|
+
return static_cast<ssize_t>(data[p++]);
|
70
|
+
}
|
71
|
+
|
72
|
+
ssize_t readUnicodeInt32(const std::vector<uint16_t>& data, int& p) {
|
73
|
+
auto result = deserializeInt32(data, p);
|
74
|
+
p += 2;
|
75
|
+
return static_cast<ssize_t>(result);
|
76
|
+
}
|
77
|
+
|
78
|
+
// We templatize this on the function type so the optimizer can inline
|
79
|
+
// the 16- or 32-bit readUnicodeInt/readUnicodeInt32 as needed.
|
80
|
+
template <typename F>
|
81
|
+
void deserializeSets(
|
82
|
+
const std::vector<uint16_t>& data,
|
83
|
+
int& p,
|
84
|
+
std::vector<misc::IntervalSet>& sets,
|
85
|
+
F readUnicode) {
|
86
|
+
int nsets = data[p++];
|
87
|
+
for (int i = 0; i < nsets; i++) {
|
88
|
+
int nintervals = data[p++];
|
89
|
+
misc::IntervalSet set;
|
90
|
+
|
91
|
+
bool containsEof = data[p++] != 0;
|
92
|
+
if (containsEof) {
|
93
|
+
set.add(-1);
|
94
|
+
}
|
95
|
+
|
96
|
+
for (int j = 0; j < nintervals; j++) {
|
97
|
+
auto a = readUnicode(data, p);
|
98
|
+
auto b = readUnicode(data, p);
|
99
|
+
set.add(a, b);
|
100
|
+
}
|
101
|
+
sets.push_back(set);
|
102
|
+
}
|
103
|
+
}
|
104
|
+
|
105
|
+
}
|
106
|
+
|
107
|
+
ATNDeserializer::ATNDeserializer(): ATNDeserializer(ATNDeserializationOptions::getDefaultOptions()) {
|
108
|
+
}
|
109
|
+
|
110
|
+
ATNDeserializer::ATNDeserializer(const ATNDeserializationOptions& dso): deserializationOptions(dso) {
|
111
|
+
}
|
112
|
+
|
113
|
+
ATNDeserializer::~ATNDeserializer() {
|
114
|
+
}
|
115
|
+
|
116
|
+
/**
|
117
|
+
* This value should never change. Updates following this version are
|
118
|
+
* reflected as change in the unique ID SERIALIZED_UUID.
|
119
|
+
*/
|
120
|
+
Guid ATNDeserializer::ADDED_PRECEDENCE_TRANSITIONS() {
|
121
|
+
return Guid("1DA0C57D-6C06-438A-9B27-10BCB3CE0F61");
|
122
|
+
}
|
123
|
+
|
124
|
+
Guid ATNDeserializer::ADDED_LEXER_ACTIONS() {
|
125
|
+
return Guid("AADB8D7E-AEEF-4415-AD2B-8204D6CF042E");
|
126
|
+
}
|
127
|
+
|
128
|
+
Guid ATNDeserializer::ADDED_UNICODE_SMP() {
|
129
|
+
return Guid("59627784-3BE5-417A-B9EB-8131A7286089");
|
130
|
+
}
|
131
|
+
|
132
|
+
Guid ATNDeserializer::SERIALIZED_UUID() {
|
133
|
+
return ADDED_UNICODE_SMP();
|
134
|
+
}
|
135
|
+
|
136
|
+
Guid ATNDeserializer::BASE_SERIALIZED_UUID() {
|
137
|
+
return Guid("33761B2D-78BB-4A43-8B0B-4F5BEE8AACF3");
|
138
|
+
}
|
139
|
+
|
140
|
+
std::vector<Guid>& ATNDeserializer::SUPPORTED_UUIDS() {
|
141
|
+
static std::vector<Guid> singleton = { BASE_SERIALIZED_UUID(), ADDED_PRECEDENCE_TRANSITIONS(), ADDED_LEXER_ACTIONS(), ADDED_UNICODE_SMP() };
|
142
|
+
return singleton;
|
143
|
+
}
|
144
|
+
|
145
|
+
bool ATNDeserializer::isFeatureSupported(const Guid &feature, const Guid &actualUuid) {
|
146
|
+
auto featureIterator = std::find(SUPPORTED_UUIDS().begin(), SUPPORTED_UUIDS().end(), feature);
|
147
|
+
if (featureIterator == SUPPORTED_UUIDS().end()) {
|
148
|
+
return false;
|
149
|
+
}
|
150
|
+
auto actualIterator = std::find(SUPPORTED_UUIDS().begin(), SUPPORTED_UUIDS().end(), actualUuid);
|
151
|
+
if (actualIterator == SUPPORTED_UUIDS().end()) {
|
152
|
+
return false;
|
153
|
+
}
|
154
|
+
|
155
|
+
return std::distance(featureIterator, actualIterator) >= 0;
|
156
|
+
}
|
157
|
+
|
158
|
+
ATN ATNDeserializer::deserialize(const std::vector<uint16_t>& input) {
|
159
|
+
// Don't adjust the first value since that's the version number.
|
160
|
+
std::vector<uint16_t> data(input.size());
|
161
|
+
data[0] = input[0];
|
162
|
+
for (size_t i = 1; i < input.size(); ++i) {
|
163
|
+
data[i] = input[i] - 2;
|
164
|
+
}
|
165
|
+
|
166
|
+
int p = 0;
|
167
|
+
int version = data[p++];
|
168
|
+
if (version != SERIALIZED_VERSION) {
|
169
|
+
std::string reason = "Could not deserialize ATN with version" + std::to_string(version) + "(expected " + std::to_string(SERIALIZED_VERSION) + ").";
|
170
|
+
|
171
|
+
throw UnsupportedOperationException(reason);
|
172
|
+
}
|
173
|
+
|
174
|
+
Guid uuid = toUUID(data.data(), p);
|
175
|
+
p += 8;
|
176
|
+
auto uuidIterator = std::find(SUPPORTED_UUIDS().begin(), SUPPORTED_UUIDS().end(), uuid);
|
177
|
+
if (uuidIterator == SUPPORTED_UUIDS().end()) {
|
178
|
+
std::string reason = "Could not deserialize ATN with UUID " + uuid.toString() + " (expected " +
|
179
|
+
SERIALIZED_UUID().toString() + " or a legacy UUID).";
|
180
|
+
|
181
|
+
throw UnsupportedOperationException(reason);
|
182
|
+
}
|
183
|
+
|
184
|
+
bool supportsPrecedencePredicates = isFeatureSupported(ADDED_PRECEDENCE_TRANSITIONS(), uuid);
|
185
|
+
bool supportsLexerActions = isFeatureSupported(ADDED_LEXER_ACTIONS(), uuid);
|
186
|
+
|
187
|
+
ATNType grammarType = (ATNType)data[p++];
|
188
|
+
size_t maxTokenType = data[p++];
|
189
|
+
ATN atn(grammarType, maxTokenType);
|
190
|
+
|
191
|
+
//
|
192
|
+
// STATES
|
193
|
+
//
|
194
|
+
std::vector<std::pair<LoopEndState*, size_t>> loopBackStateNumbers;
|
195
|
+
std::vector<std::pair<BlockStartState*, size_t>> endStateNumbers;
|
196
|
+
size_t nstates = data[p++];
|
197
|
+
for (size_t i = 0; i < nstates; i++) {
|
198
|
+
size_t stype = data[p++];
|
199
|
+
// ignore bad type of states
|
200
|
+
if (stype == ATNState::ATN_INVALID_TYPE) {
|
201
|
+
atn.addState(nullptr);
|
202
|
+
continue;
|
203
|
+
}
|
204
|
+
|
205
|
+
size_t ruleIndex = data[p++];
|
206
|
+
if (ruleIndex == 0xFFFF) {
|
207
|
+
ruleIndex = INVALID_INDEX;
|
208
|
+
}
|
209
|
+
|
210
|
+
ATNState *s = stateFactory(stype, ruleIndex);
|
211
|
+
if (stype == ATNState::LOOP_END) { // special case
|
212
|
+
int loopBackStateNumber = data[p++];
|
213
|
+
loopBackStateNumbers.push_back({ (LoopEndState*)s, loopBackStateNumber });
|
214
|
+
} else if (is<BlockStartState*>(s)) {
|
215
|
+
int endStateNumber = data[p++];
|
216
|
+
endStateNumbers.push_back({ (BlockStartState*)s, endStateNumber });
|
217
|
+
}
|
218
|
+
atn.addState(s);
|
219
|
+
}
|
220
|
+
|
221
|
+
// delay the assignment of loop back and end states until we know all the state instances have been initialized
|
222
|
+
for (auto &pair : loopBackStateNumbers) {
|
223
|
+
pair.first->loopBackState = atn.states[pair.second];
|
224
|
+
}
|
225
|
+
|
226
|
+
for (auto &pair : endStateNumbers) {
|
227
|
+
pair.first->endState = (BlockEndState*)atn.states[pair.second];
|
228
|
+
}
|
229
|
+
|
230
|
+
size_t numNonGreedyStates = data[p++];
|
231
|
+
for (size_t i = 0; i < numNonGreedyStates; i++) {
|
232
|
+
size_t stateNumber = data[p++];
|
233
|
+
// The serialized ATN must be specifying the right states, so that the
|
234
|
+
// cast below is correct.
|
235
|
+
((DecisionState *)atn.states[stateNumber])->nonGreedy = true;
|
236
|
+
}
|
237
|
+
|
238
|
+
if (supportsPrecedencePredicates) {
|
239
|
+
size_t numPrecedenceStates = data[p++];
|
240
|
+
for (size_t i = 0; i < numPrecedenceStates; i++) {
|
241
|
+
size_t stateNumber = data[p++];
|
242
|
+
((RuleStartState *)atn.states[stateNumber])->isLeftRecursiveRule = true;
|
243
|
+
}
|
244
|
+
}
|
245
|
+
|
246
|
+
//
|
247
|
+
// RULES
|
248
|
+
//
|
249
|
+
size_t nrules = data[p++];
|
250
|
+
for (size_t i = 0; i < nrules; i++) {
|
251
|
+
size_t s = data[p++];
|
252
|
+
// Also here, the serialized atn must ensure to point to the correct class type.
|
253
|
+
RuleStartState *startState = (RuleStartState*)atn.states[s];
|
254
|
+
atn.ruleToStartState.push_back(startState);
|
255
|
+
if (atn.grammarType == ATNType::LEXER) {
|
256
|
+
size_t tokenType = data[p++];
|
257
|
+
if (tokenType == 0xFFFF) {
|
258
|
+
tokenType = Token::EOF;
|
259
|
+
}
|
260
|
+
|
261
|
+
atn.ruleToTokenType.push_back(tokenType);
|
262
|
+
|
263
|
+
if (!isFeatureSupported(ADDED_LEXER_ACTIONS(), uuid)) {
|
264
|
+
// this piece of unused metadata was serialized prior to the
|
265
|
+
// addition of LexerAction
|
266
|
+
//int actionIndexIgnored = data[p++];
|
267
|
+
p++;
|
268
|
+
}
|
269
|
+
}
|
270
|
+
}
|
271
|
+
|
272
|
+
atn.ruleToStopState.resize(nrules);
|
273
|
+
for (ATNState *state : atn.states) {
|
274
|
+
if (!is<RuleStopState*>(state)) {
|
275
|
+
continue;
|
276
|
+
}
|
277
|
+
|
278
|
+
RuleStopState *stopState = static_cast<RuleStopState*>(state);
|
279
|
+
atn.ruleToStopState[state->ruleIndex] = stopState;
|
280
|
+
atn.ruleToStartState[state->ruleIndex]->stopState = stopState;
|
281
|
+
}
|
282
|
+
|
283
|
+
//
|
284
|
+
// MODES
|
285
|
+
//
|
286
|
+
size_t nmodes = data[p++];
|
287
|
+
for (size_t i = 0; i < nmodes; i++) {
|
288
|
+
size_t s = data[p++];
|
289
|
+
atn.modeToStartState.push_back(static_cast<TokensStartState*>(atn.states[s]));
|
290
|
+
}
|
291
|
+
|
292
|
+
//
|
293
|
+
// SETS
|
294
|
+
//
|
295
|
+
std::vector<misc::IntervalSet> sets;
|
296
|
+
|
297
|
+
// First, deserialize sets with 16-bit arguments <= U+FFFF.
|
298
|
+
deserializeSets(data, p, sets, readUnicodeInt);
|
299
|
+
|
300
|
+
// Next, if the ATN was serialized with the Unicode SMP feature,
|
301
|
+
// deserialize sets with 32-bit arguments <= U+10FFFF.
|
302
|
+
if (isFeatureSupported(ADDED_UNICODE_SMP(), uuid)) {
|
303
|
+
deserializeSets(data, p, sets, readUnicodeInt32);
|
304
|
+
}
|
305
|
+
|
306
|
+
//
|
307
|
+
// EDGES
|
308
|
+
//
|
309
|
+
int nedges = data[p++];
|
310
|
+
for (int i = 0; i < nedges; i++) {
|
311
|
+
size_t src = data[p];
|
312
|
+
size_t trg = data[p + 1];
|
313
|
+
size_t ttype = data[p + 2];
|
314
|
+
size_t arg1 = data[p + 3];
|
315
|
+
size_t arg2 = data[p + 4];
|
316
|
+
size_t arg3 = data[p + 5];
|
317
|
+
Transition *trans = edgeFactory(atn, ttype, src, trg, arg1, arg2, arg3, sets);
|
318
|
+
ATNState *srcState = atn.states[src];
|
319
|
+
srcState->addTransition(trans);
|
320
|
+
p += 6;
|
321
|
+
}
|
322
|
+
|
323
|
+
// edges for rule stop states can be derived, so they aren't serialized
|
324
|
+
for (ATNState *state : atn.states) {
|
325
|
+
for (size_t i = 0; i < state->transitions.size(); i++) {
|
326
|
+
Transition *t = state->transitions[i];
|
327
|
+
if (!is<RuleTransition*>(t)) {
|
328
|
+
continue;
|
329
|
+
}
|
330
|
+
|
331
|
+
RuleTransition *ruleTransition = static_cast<RuleTransition*>(t);
|
332
|
+
size_t outermostPrecedenceReturn = INVALID_INDEX;
|
333
|
+
if (atn.ruleToStartState[ruleTransition->target->ruleIndex]->isLeftRecursiveRule) {
|
334
|
+
if (ruleTransition->precedence == 0) {
|
335
|
+
outermostPrecedenceReturn = ruleTransition->target->ruleIndex;
|
336
|
+
}
|
337
|
+
}
|
338
|
+
|
339
|
+
EpsilonTransition *returnTransition = new EpsilonTransition(ruleTransition->followState, outermostPrecedenceReturn); /* mem check: freed in ANTState d-tor */
|
340
|
+
atn.ruleToStopState[ruleTransition->target->ruleIndex]->addTransition(returnTransition);
|
341
|
+
}
|
342
|
+
}
|
343
|
+
|
344
|
+
for (ATNState *state : atn.states) {
|
345
|
+
if (is<BlockStartState *>(state)) {
|
346
|
+
BlockStartState *startState = static_cast<BlockStartState *>(state);
|
347
|
+
|
348
|
+
// we need to know the end state to set its start state
|
349
|
+
if (startState->endState == nullptr) {
|
350
|
+
throw IllegalStateException();
|
351
|
+
}
|
352
|
+
|
353
|
+
// block end states can only be associated to a single block start state
|
354
|
+
if (startState->endState->startState != nullptr) {
|
355
|
+
throw IllegalStateException();
|
356
|
+
}
|
357
|
+
|
358
|
+
startState->endState->startState = static_cast<BlockStartState*>(state);
|
359
|
+
}
|
360
|
+
|
361
|
+
if (is<PlusLoopbackState*>(state)) {
|
362
|
+
PlusLoopbackState *loopbackState = static_cast<PlusLoopbackState *>(state);
|
363
|
+
for (size_t i = 0; i < loopbackState->transitions.size(); i++) {
|
364
|
+
ATNState *target = loopbackState->transitions[i]->target;
|
365
|
+
if (is<PlusBlockStartState *>(target)) {
|
366
|
+
(static_cast<PlusBlockStartState *>(target))->loopBackState = loopbackState;
|
367
|
+
}
|
368
|
+
}
|
369
|
+
} else if (is<StarLoopbackState *>(state)) {
|
370
|
+
StarLoopbackState *loopbackState = static_cast<StarLoopbackState *>(state);
|
371
|
+
for (size_t i = 0; i < loopbackState->transitions.size(); i++) {
|
372
|
+
ATNState *target = loopbackState->transitions[i]->target;
|
373
|
+
if (is<StarLoopEntryState *>(target)) {
|
374
|
+
(static_cast<StarLoopEntryState*>(target))->loopBackState = loopbackState;
|
375
|
+
}
|
376
|
+
}
|
377
|
+
}
|
378
|
+
}
|
379
|
+
|
380
|
+
//
|
381
|
+
// DECISIONS
|
382
|
+
//
|
383
|
+
size_t ndecisions = data[p++];
|
384
|
+
for (size_t i = 1; i <= ndecisions; i++) {
|
385
|
+
size_t s = data[p++];
|
386
|
+
DecisionState *decState = dynamic_cast<DecisionState*>(atn.states[s]);
|
387
|
+
if (decState == nullptr)
|
388
|
+
throw IllegalStateException();
|
389
|
+
|
390
|
+
atn.decisionToState.push_back(decState);
|
391
|
+
decState->decision = (int)i - 1;
|
392
|
+
}
|
393
|
+
|
394
|
+
//
|
395
|
+
// LEXER ACTIONS
|
396
|
+
//
|
397
|
+
if (atn.grammarType == ATNType::LEXER) {
|
398
|
+
if (supportsLexerActions) {
|
399
|
+
atn.lexerActions.resize(data[p++]);
|
400
|
+
for (size_t i = 0; i < atn.lexerActions.size(); i++) {
|
401
|
+
LexerActionType actionType = (LexerActionType)data[p++];
|
402
|
+
int data1 = data[p++];
|
403
|
+
if (data1 == 0xFFFF) {
|
404
|
+
data1 = -1;
|
405
|
+
}
|
406
|
+
|
407
|
+
int data2 = data[p++];
|
408
|
+
if (data2 == 0xFFFF) {
|
409
|
+
data2 = -1;
|
410
|
+
}
|
411
|
+
|
412
|
+
atn.lexerActions[i] = lexerActionFactory(actionType, data1, data2);
|
413
|
+
}
|
414
|
+
} else {
|
415
|
+
// for compatibility with older serialized ATNs, convert the old
|
416
|
+
// serialized action index for action transitions to the new
|
417
|
+
// form, which is the index of a LexerCustomAction
|
418
|
+
for (ATNState *state : atn.states) {
|
419
|
+
for (size_t i = 0; i < state->transitions.size(); i++) {
|
420
|
+
Transition *transition = state->transitions[i];
|
421
|
+
if (!is<ActionTransition *>(transition)) {
|
422
|
+
continue;
|
423
|
+
}
|
424
|
+
|
425
|
+
size_t ruleIndex = static_cast<ActionTransition *>(transition)->ruleIndex;
|
426
|
+
size_t actionIndex = static_cast<ActionTransition *>(transition)->actionIndex;
|
427
|
+
Ref<LexerCustomAction> lexerAction = std::make_shared<LexerCustomAction>(ruleIndex, actionIndex);
|
428
|
+
state->transitions[i] = new ActionTransition(transition->target, ruleIndex, atn.lexerActions.size(), false); /* mem-check freed in ATNState d-tor */
|
429
|
+
delete transition; // ml: no longer needed since we just replaced it.
|
430
|
+
atn.lexerActions.push_back(lexerAction);
|
431
|
+
}
|
432
|
+
}
|
433
|
+
}
|
434
|
+
}
|
435
|
+
|
436
|
+
markPrecedenceDecisions(atn);
|
437
|
+
|
438
|
+
if (deserializationOptions.isVerifyATN()) {
|
439
|
+
verifyATN(atn);
|
440
|
+
}
|
441
|
+
|
442
|
+
if (deserializationOptions.isGenerateRuleBypassTransitions() && atn.grammarType == ATNType::PARSER) {
|
443
|
+
atn.ruleToTokenType.resize(atn.ruleToStartState.size());
|
444
|
+
for (size_t i = 0; i < atn.ruleToStartState.size(); i++) {
|
445
|
+
atn.ruleToTokenType[i] = int(atn.maxTokenType + i + 1);
|
446
|
+
}
|
447
|
+
|
448
|
+
for (std::vector<RuleStartState*>::size_type i = 0; i < atn.ruleToStartState.size(); i++) {
|
449
|
+
BasicBlockStartState *bypassStart = new BasicBlockStartState(); /* mem check: freed in ATN d-tor */
|
450
|
+
bypassStart->ruleIndex = (int)i;
|
451
|
+
atn.addState(bypassStart);
|
452
|
+
|
453
|
+
BlockEndState *bypassStop = new BlockEndState(); /* mem check: freed in ATN d-tor */
|
454
|
+
bypassStop->ruleIndex = (int)i;
|
455
|
+
atn.addState(bypassStop);
|
456
|
+
|
457
|
+
bypassStart->endState = bypassStop;
|
458
|
+
atn.defineDecisionState(bypassStart);
|
459
|
+
|
460
|
+
bypassStop->startState = bypassStart;
|
461
|
+
|
462
|
+
ATNState *endState;
|
463
|
+
Transition *excludeTransition = nullptr;
|
464
|
+
if (atn.ruleToStartState[i]->isLeftRecursiveRule) {
|
465
|
+
// wrap from the beginning of the rule to the StarLoopEntryState
|
466
|
+
endState = nullptr;
|
467
|
+
for (ATNState *state : atn.states) {
|
468
|
+
if (state->ruleIndex != i) {
|
469
|
+
continue;
|
470
|
+
}
|
471
|
+
|
472
|
+
if (!is<StarLoopEntryState*>(state)) {
|
473
|
+
continue;
|
474
|
+
}
|
475
|
+
|
476
|
+
ATNState *maybeLoopEndState = state->transitions[state->transitions.size() - 1]->target;
|
477
|
+
if (!is<LoopEndState*>(maybeLoopEndState)) {
|
478
|
+
continue;
|
479
|
+
}
|
480
|
+
|
481
|
+
if (maybeLoopEndState->epsilonOnlyTransitions && is<RuleStopState*>(maybeLoopEndState->transitions[0]->target)) {
|
482
|
+
endState = state;
|
483
|
+
break;
|
484
|
+
}
|
485
|
+
}
|
486
|
+
|
487
|
+
if (endState == nullptr) {
|
488
|
+
throw UnsupportedOperationException("Couldn't identify final state of the precedence rule prefix section.");
|
489
|
+
|
490
|
+
}
|
491
|
+
|
492
|
+
excludeTransition = (static_cast<StarLoopEntryState*>(endState))->loopBackState->transitions[0];
|
493
|
+
} else {
|
494
|
+
endState = atn.ruleToStopState[i];
|
495
|
+
}
|
496
|
+
|
497
|
+
// all non-excluded transitions that currently target end state need to target blockEnd instead
|
498
|
+
for (ATNState *state : atn.states) {
|
499
|
+
for (Transition *transition : state->transitions) {
|
500
|
+
if (transition == excludeTransition) {
|
501
|
+
continue;
|
502
|
+
}
|
503
|
+
|
504
|
+
if (transition->target == endState) {
|
505
|
+
transition->target = bypassStop;
|
506
|
+
}
|
507
|
+
}
|
508
|
+
}
|
509
|
+
|
510
|
+
// all transitions leaving the rule start state need to leave blockStart instead
|
511
|
+
while (atn.ruleToStartState[i]->transitions.size() > 0) {
|
512
|
+
Transition *transition = atn.ruleToStartState[i]->removeTransition(atn.ruleToStartState[i]->transitions.size() - 1);
|
513
|
+
bypassStart->addTransition(transition);
|
514
|
+
}
|
515
|
+
|
516
|
+
// link the new states
|
517
|
+
atn.ruleToStartState[i]->addTransition(new EpsilonTransition(bypassStart)); /* mem check: freed in ATNState d-tor */
|
518
|
+
bypassStop->addTransition(new EpsilonTransition(endState)); /* mem check: freed in ATNState d-tor */
|
519
|
+
|
520
|
+
ATNState *matchState = new BasicState(); /* mem check: freed in ATN d-tor */
|
521
|
+
atn.addState(matchState);
|
522
|
+
matchState->addTransition(new AtomTransition(bypassStop, atn.ruleToTokenType[i])); /* mem check: freed in ATNState d-tor */
|
523
|
+
bypassStart->addTransition(new EpsilonTransition(matchState)); /* mem check: freed in ATNState d-tor */
|
524
|
+
}
|
525
|
+
|
526
|
+
if (deserializationOptions.isVerifyATN()) {
|
527
|
+
// reverify after modification
|
528
|
+
verifyATN(atn);
|
529
|
+
}
|
530
|
+
}
|
531
|
+
|
532
|
+
return atn;
|
533
|
+
}
|
534
|
+
|
535
|
+
/**
|
536
|
+
* Analyze the {@link StarLoopEntryState} states in the specified ATN to set
|
537
|
+
* the {@link StarLoopEntryState#isPrecedenceDecision} field to the
|
538
|
+
* correct value.
|
539
|
+
*
|
540
|
+
* @param atn The ATN.
|
541
|
+
*/
|
542
|
+
void ATNDeserializer::markPrecedenceDecisions(const ATN &atn) {
|
543
|
+
for (ATNState *state : atn.states) {
|
544
|
+
if (!is<StarLoopEntryState *>(state)) {
|
545
|
+
continue;
|
546
|
+
}
|
547
|
+
|
548
|
+
/* We analyze the ATN to determine if this ATN decision state is the
|
549
|
+
* decision for the closure block that determines whether a
|
550
|
+
* precedence rule should continue or complete.
|
551
|
+
*/
|
552
|
+
if (atn.ruleToStartState[state->ruleIndex]->isLeftRecursiveRule) {
|
553
|
+
ATNState *maybeLoopEndState = state->transitions[state->transitions.size() - 1]->target;
|
554
|
+
if (is<LoopEndState *>(maybeLoopEndState)) {
|
555
|
+
if (maybeLoopEndState->epsilonOnlyTransitions && is<RuleStopState *>(maybeLoopEndState->transitions[0]->target)) {
|
556
|
+
static_cast<StarLoopEntryState *>(state)->isPrecedenceDecision = true;
|
557
|
+
}
|
558
|
+
}
|
559
|
+
}
|
560
|
+
}
|
561
|
+
}
|
562
|
+
|
563
|
+
void ATNDeserializer::verifyATN(const ATN &atn) {
|
564
|
+
// verify assumptions
|
565
|
+
for (ATNState *state : atn.states) {
|
566
|
+
if (state == nullptr) {
|
567
|
+
continue;
|
568
|
+
}
|
569
|
+
|
570
|
+
checkCondition(state->epsilonOnlyTransitions || state->transitions.size() <= 1);
|
571
|
+
|
572
|
+
if (is<PlusBlockStartState *>(state)) {
|
573
|
+
checkCondition((static_cast<PlusBlockStartState *>(state))->loopBackState != nullptr);
|
574
|
+
}
|
575
|
+
|
576
|
+
if (is<StarLoopEntryState *>(state)) {
|
577
|
+
StarLoopEntryState *starLoopEntryState = static_cast<StarLoopEntryState*>(state);
|
578
|
+
checkCondition(starLoopEntryState->loopBackState != nullptr);
|
579
|
+
checkCondition(starLoopEntryState->transitions.size() == 2);
|
580
|
+
|
581
|
+
if (is<StarBlockStartState *>(starLoopEntryState->transitions[0]->target)) {
|
582
|
+
checkCondition(static_cast<LoopEndState *>(starLoopEntryState->transitions[1]->target) != nullptr);
|
583
|
+
checkCondition(!starLoopEntryState->nonGreedy);
|
584
|
+
} else if (is<LoopEndState *>(starLoopEntryState->transitions[0]->target)) {
|
585
|
+
checkCondition(is<StarBlockStartState *>(starLoopEntryState->transitions[1]->target));
|
586
|
+
checkCondition(starLoopEntryState->nonGreedy);
|
587
|
+
} else {
|
588
|
+
throw IllegalStateException();
|
589
|
+
|
590
|
+
}
|
591
|
+
}
|
592
|
+
|
593
|
+
if (is<StarLoopbackState *>(state)) {
|
594
|
+
checkCondition(state->transitions.size() == 1);
|
595
|
+
checkCondition(is<StarLoopEntryState *>(state->transitions[0]->target));
|
596
|
+
}
|
597
|
+
|
598
|
+
if (is<LoopEndState *>(state)) {
|
599
|
+
checkCondition((static_cast<LoopEndState *>(state))->loopBackState != nullptr);
|
600
|
+
}
|
601
|
+
|
602
|
+
if (is<RuleStartState *>(state)) {
|
603
|
+
checkCondition((static_cast<RuleStartState *>(state))->stopState != nullptr);
|
604
|
+
}
|
605
|
+
|
606
|
+
if (is<BlockStartState *>(state)) {
|
607
|
+
checkCondition((static_cast<BlockStartState *>(state))->endState != nullptr);
|
608
|
+
}
|
609
|
+
|
610
|
+
if (is<BlockEndState *>(state)) {
|
611
|
+
checkCondition((static_cast<BlockEndState *>(state))->startState != nullptr);
|
612
|
+
}
|
613
|
+
|
614
|
+
if (is<DecisionState *>(state)) {
|
615
|
+
DecisionState *decisionState = static_cast<DecisionState *>(state);
|
616
|
+
checkCondition(decisionState->transitions.size() <= 1 || decisionState->decision >= 0);
|
617
|
+
} else {
|
618
|
+
checkCondition(state->transitions.size() <= 1 || is<RuleStopState *>(state));
|
619
|
+
}
|
620
|
+
}
|
621
|
+
}
|
622
|
+
|
623
|
+
void ATNDeserializer::checkCondition(bool condition) {
|
624
|
+
checkCondition(condition, "");
|
625
|
+
}
|
626
|
+
|
627
|
+
void ATNDeserializer::checkCondition(bool condition, const std::string &message) {
|
628
|
+
if (!condition) {
|
629
|
+
throw IllegalStateException(message);
|
630
|
+
}
|
631
|
+
}
|
632
|
+
|
633
|
+
Guid ATNDeserializer::toUUID(const unsigned short *data, size_t offset) {
|
634
|
+
return Guid((uint16_t *)data + offset, true);
|
635
|
+
}
|
636
|
+
|
637
|
+
/* mem check: all created instances are freed in the d-tor of the ATNState they are added to. */
|
638
|
+
Transition *ATNDeserializer::edgeFactory(const ATN &atn, size_t type, size_t /*src*/, size_t trg, size_t arg1,
|
639
|
+
size_t arg2, size_t arg3,
|
640
|
+
const std::vector<misc::IntervalSet> &sets) {
|
641
|
+
|
642
|
+
ATNState *target = atn.states[trg];
|
643
|
+
switch (type) {
|
644
|
+
case Transition::EPSILON:
|
645
|
+
return new EpsilonTransition(target);
|
646
|
+
case Transition::RANGE:
|
647
|
+
if (arg3 != 0) {
|
648
|
+
return new RangeTransition(target, Token::EOF, arg2);
|
649
|
+
} else {
|
650
|
+
return new RangeTransition(target, arg1, arg2);
|
651
|
+
}
|
652
|
+
case Transition::RULE:
|
653
|
+
return new RuleTransition(static_cast<RuleStartState*>(atn.states[arg1]), arg2, (int)arg3, target);
|
654
|
+
case Transition::PREDICATE:
|
655
|
+
return new PredicateTransition(target, arg1, arg2, arg3 != 0);
|
656
|
+
case Transition::PRECEDENCE:
|
657
|
+
return new PrecedencePredicateTransition(target, (int)arg1);
|
658
|
+
case Transition::ATOM:
|
659
|
+
if (arg3 != 0) {
|
660
|
+
return new AtomTransition(target, Token::EOF);
|
661
|
+
} else {
|
662
|
+
return new AtomTransition(target, arg1);
|
663
|
+
}
|
664
|
+
case Transition::ACTION:
|
665
|
+
return new ActionTransition(target, arg1, arg2, arg3 != 0);
|
666
|
+
case Transition::SET:
|
667
|
+
return new SetTransition(target, sets[arg1]);
|
668
|
+
case Transition::NOT_SET:
|
669
|
+
return new NotSetTransition(target, sets[arg1]);
|
670
|
+
case Transition::WILDCARD:
|
671
|
+
return new WildcardTransition(target);
|
672
|
+
}
|
673
|
+
|
674
|
+
throw IllegalArgumentException("The specified transition type is not valid.");
|
675
|
+
}
|
676
|
+
|
677
|
+
/* mem check: all created instances are freed in the d-tor of the ATN. */
|
678
|
+
ATNState* ATNDeserializer::stateFactory(size_t type, size_t ruleIndex) {
|
679
|
+
ATNState *s;
|
680
|
+
switch (type) {
|
681
|
+
case ATNState::ATN_INVALID_TYPE:
|
682
|
+
return nullptr;
|
683
|
+
case ATNState::BASIC :
|
684
|
+
s = new BasicState();
|
685
|
+
break;
|
686
|
+
case ATNState::RULE_START :
|
687
|
+
s = new RuleStartState();
|
688
|
+
break;
|
689
|
+
case ATNState::BLOCK_START :
|
690
|
+
s = new BasicBlockStartState();
|
691
|
+
break;
|
692
|
+
case ATNState::PLUS_BLOCK_START :
|
693
|
+
s = new PlusBlockStartState();
|
694
|
+
break;
|
695
|
+
case ATNState::STAR_BLOCK_START :
|
696
|
+
s = new StarBlockStartState();
|
697
|
+
break;
|
698
|
+
case ATNState::TOKEN_START :
|
699
|
+
s = new TokensStartState();
|
700
|
+
break;
|
701
|
+
case ATNState::RULE_STOP :
|
702
|
+
s = new RuleStopState();
|
703
|
+
break;
|
704
|
+
case ATNState::BLOCK_END :
|
705
|
+
s = new BlockEndState();
|
706
|
+
break;
|
707
|
+
case ATNState::STAR_LOOP_BACK :
|
708
|
+
s = new StarLoopbackState();
|
709
|
+
break;
|
710
|
+
case ATNState::STAR_LOOP_ENTRY :
|
711
|
+
s = new StarLoopEntryState();
|
712
|
+
break;
|
713
|
+
case ATNState::PLUS_LOOP_BACK :
|
714
|
+
s = new PlusLoopbackState();
|
715
|
+
break;
|
716
|
+
case ATNState::LOOP_END :
|
717
|
+
s = new LoopEndState();
|
718
|
+
break;
|
719
|
+
default :
|
720
|
+
std::string message = "The specified state type " + std::to_string(type) + " is not valid.";
|
721
|
+
throw IllegalArgumentException(message);
|
722
|
+
}
|
723
|
+
|
724
|
+
s->ruleIndex = ruleIndex;
|
725
|
+
return s;
|
726
|
+
}
|
727
|
+
|
728
|
+
Ref<LexerAction> ATNDeserializer::lexerActionFactory(LexerActionType type, int data1, int data2) {
|
729
|
+
switch (type) {
|
730
|
+
case LexerActionType::CHANNEL:
|
731
|
+
return std::make_shared<LexerChannelAction>(data1);
|
732
|
+
|
733
|
+
case LexerActionType::CUSTOM:
|
734
|
+
return std::make_shared<LexerCustomAction>(data1, data2);
|
735
|
+
|
736
|
+
case LexerActionType::MODE:
|
737
|
+
return std::make_shared< LexerModeAction>(data1);
|
738
|
+
|
739
|
+
case LexerActionType::MORE:
|
740
|
+
return LexerMoreAction::getInstance();
|
741
|
+
|
742
|
+
case LexerActionType::POP_MODE:
|
743
|
+
return LexerPopModeAction::getInstance();
|
744
|
+
|
745
|
+
case LexerActionType::PUSH_MODE:
|
746
|
+
return std::make_shared<LexerPushModeAction>(data1);
|
747
|
+
|
748
|
+
case LexerActionType::SKIP:
|
749
|
+
return LexerSkipAction::getInstance();
|
750
|
+
|
751
|
+
case LexerActionType::TYPE:
|
752
|
+
return std::make_shared<LexerTypeAction>(data1);
|
753
|
+
|
754
|
+
default:
|
755
|
+
throw IllegalArgumentException("The specified lexer action type " + std::to_string(static_cast<size_t>(type)) +
|
756
|
+
" is not valid.");
|
757
|
+
}
|
758
|
+
}
|