expressir 0.2.3 → 0.2.8
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 +45 -0
- data/.github/workflows/release.yml +89 -0
- data/.gitignore +3 -2
- data/.gitmodules +3 -0
- data/Rakefile +5 -0
- data/exe/generate-parser +48 -0
- data/expressir.gemspec +12 -4
- 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 +17933 -0
- data/ext/express-parser/extconf.rb +57 -0
- data/lib/expressir/express_exp/formatter.rb +51 -45
- data/lib/expressir/express_exp/parser.rb +17 -6
- data/lib/expressir/express_exp/visitor.rb +1402 -1078
- data/lib/expressir/model.rb +3 -0
- data/lib/expressir/model/attribute.rb +4 -5
- data/lib/expressir/model/constant.rb +3 -4
- data/lib/expressir/model/entity.rb +4 -4
- data/lib/expressir/model/enumeration_item.rb +1 -4
- data/lib/expressir/model/expressions/query_expression.rb +6 -6
- data/lib/expressir/model/function.rb +4 -4
- data/lib/expressir/model/identifier.rb +11 -0
- data/lib/expressir/model/parameter.rb +4 -5
- data/lib/expressir/model/procedure.rb +4 -4
- data/lib/expressir/model/repository.rb +2 -0
- data/lib/expressir/model/rule.rb +4 -4
- data/lib/expressir/model/schema.rb +3 -3
- data/lib/expressir/model/scope.rb +32 -0
- data/lib/expressir/model/statements/alias.rb +4 -4
- data/lib/expressir/model/statements/repeat.rb +4 -4
- data/lib/expressir/model/subtype_constraint.rb +9 -4
- data/lib/expressir/model/type.rb +4 -4
- data/lib/expressir/model/types/aggregate.rb +4 -5
- data/lib/expressir/model/types/generic.rb +2 -5
- data/lib/expressir/model/types/generic_entity.rb +2 -5
- data/lib/expressir/model/unique.rb +3 -4
- data/lib/expressir/model/variable.rb +3 -4
- data/lib/expressir/model/where.rb +3 -4
- data/lib/expressir/version.rb +1 -1
- data/original/examples/syntax/remark.exp +1 -0
- data/original/examples/syntax/remark_formatted.exp +74 -71
- data/original/examples/syntax/syntax.exp +2 -0
- data/original/examples/syntax/syntax_formatted.exp +113 -98
- data/rakelib/cross-ruby.rake +308 -0
- data/spec/expressir/express_exp/ap233_spec.rb +1 -1
- data/spec/expressir/express_exp/find_spec.rb +28 -0
- data/spec/expressir/express_exp/parse_remark_spec.rb +4 -3
- data/spec/expressir/express_exp/parse_syntax_spec.rb +37 -32
- data/spec/expressir/express_exp/source_spec.rb +32 -0
- data/spec/expressir/model/find_spec.rb +110 -0
- metadata +411 -22
- data/.github/workflows/macos.yml +0 -38
- data/.github/workflows/ubuntu.yml +0 -56
- data/.github/workflows/windows.yml +0 -40
- data/generate-parser.sh +0 -29
- data/lib/expressir/express_exp/generated/ExpressBaseVisitor.rb +0 -779
- data/lib/expressir/express_exp/generated/ExpressLexer.rb +0 -844
- data/lib/expressir/express_exp/generated/ExpressParser.rb +0 -12162
- data/lib/expressir/express_exp/generated/ExpressVisitor.rb +0 -394
@@ -0,0 +1,57 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'mkmf'
|
3
|
+
|
4
|
+
extension_name = 'express_parser'
|
5
|
+
cross_build = enable_config("cross-build")
|
6
|
+
|
7
|
+
antlr4_src = 'antlr4-upstream/runtime/Cpp/runtime/src'
|
8
|
+
src_paths = [
|
9
|
+
".",
|
10
|
+
"antlrgen",
|
11
|
+
"#{antlr4_src}",
|
12
|
+
"#{antlr4_src}/atn",
|
13
|
+
"#{antlr4_src}/dfa",
|
14
|
+
"#{antlr4_src}/misc",
|
15
|
+
"#{antlr4_src}/support",
|
16
|
+
"#{antlr4_src}/tree",
|
17
|
+
"#{antlr4_src}/tree/pattern",
|
18
|
+
"#{antlr4_src}/tree/xpath",
|
19
|
+
]
|
20
|
+
|
21
|
+
if cross_build
|
22
|
+
rice_subdir = "rice-embed"
|
23
|
+
rice_root = Gem.loaded_specs["rice"].full_gem_path
|
24
|
+
rice_src = File.join(rice_root, "rice")
|
25
|
+
rice_embed = File.join(__dir__, rice_subdir)
|
26
|
+
unless File.exists?(rice_embed)
|
27
|
+
FileUtils.mkdir_p(rice_embed)
|
28
|
+
FileUtils.cp_r(Dir.glob(rice_src), rice_embed)
|
29
|
+
File.delete(*Dir.glob("#{rice_embed}/**/*.o"))
|
30
|
+
File.delete(*Dir.glob("#{rice_embed}/**/Makefile"))
|
31
|
+
end
|
32
|
+
|
33
|
+
src_paths.push("#{rice_subdir}/rice", "#{rice_subdir}/rice/detail")
|
34
|
+
|
35
|
+
$INCFLAGS << " -I#{__dir__}/#{rice_subdir}"
|
36
|
+
|
37
|
+
if RbConfig::CONFIG['target_os'] =~ /mingw32|mswin/
|
38
|
+
# workaround for 'w64-mingw32-as: express_parser.o: too many sections'
|
39
|
+
$CXXFLAGS << " -O3 -Wa,-mbig-obj"
|
40
|
+
end
|
41
|
+
else
|
42
|
+
require 'mkmf-rice'
|
43
|
+
|
44
|
+
dir_config(extension_name)
|
45
|
+
end
|
46
|
+
|
47
|
+
$CPPFLAGS << " -std=c++14 -DANTLR4CPP_STATIC -DHAVE_CXX11"
|
48
|
+
$INCFLAGS << " -I#{__dir__}/#{antlr4_src}"
|
49
|
+
$srcs = []
|
50
|
+
|
51
|
+
src_paths.each do |src_path|
|
52
|
+
abs_src_path = File.join(__dir__, src_path)
|
53
|
+
$VPATH << abs_src_path
|
54
|
+
$srcs.push(*Dir["#{abs_src_path}/*.cpp"])
|
55
|
+
end
|
56
|
+
|
57
|
+
create_makefile "expressir/express_exp/#{extension_name}"
|
@@ -171,17 +171,6 @@ module Expressir
|
|
171
171
|
|
172
172
|
def format_attribute(node)
|
173
173
|
[
|
174
|
-
*if node.kind == Model::Attribute::DERIVED
|
175
|
-
[
|
176
|
-
'DERIVE',
|
177
|
-
' '
|
178
|
-
].join('')
|
179
|
-
elsif node.kind == Model::Attribute::INVERSE
|
180
|
-
[
|
181
|
-
'INVERSE',
|
182
|
-
' '
|
183
|
-
].join('')
|
184
|
-
end,
|
185
174
|
*if node.supertype_attribute
|
186
175
|
[
|
187
176
|
format(node.supertype_attribute),
|
@@ -252,7 +241,7 @@ module Expressir
|
|
252
241
|
*if node.abstract and !node.supertype_expression
|
253
242
|
[
|
254
243
|
"\n",
|
255
|
-
|
244
|
+
INDENT,
|
256
245
|
'ABSTRACT',
|
257
246
|
' ',
|
258
247
|
'SUPERTYPE'
|
@@ -261,7 +250,7 @@ module Expressir
|
|
261
250
|
*if node.abstract and node.supertype_expression
|
262
251
|
[
|
263
252
|
"\n",
|
264
|
-
|
253
|
+
INDENT,
|
265
254
|
'ABSTRACT',
|
266
255
|
' ',
|
267
256
|
'SUPERTYPE',
|
@@ -276,7 +265,7 @@ module Expressir
|
|
276
265
|
*if !node.abstract and node.supertype_expression
|
277
266
|
[
|
278
267
|
"\n",
|
279
|
-
|
268
|
+
INDENT,
|
280
269
|
'SUPERTYPE',
|
281
270
|
' ',
|
282
271
|
'OF',
|
@@ -289,7 +278,7 @@ module Expressir
|
|
289
278
|
*if node.subtype_of and node.subtype_of.length > 0
|
290
279
|
[
|
291
280
|
"\n",
|
292
|
-
|
281
|
+
INDENT,
|
293
282
|
'SUBTYPE',
|
294
283
|
' ',
|
295
284
|
'OF',
|
@@ -301,8 +290,20 @@ module Expressir
|
|
301
290
|
end,
|
302
291
|
';'
|
303
292
|
].join(''),
|
304
|
-
*if node.
|
305
|
-
indent(node.
|
293
|
+
*if node.explicit_attributes and node.explicit_attributes.length > 0
|
294
|
+
indent(node.explicit_attributes.map{|x| format(x)}.join("\n"))
|
295
|
+
end,
|
296
|
+
*if node.derived_attributes and node.derived_attributes.length > 0
|
297
|
+
indent([
|
298
|
+
'DERIVE',
|
299
|
+
indent(node.derived_attributes.map{|x| format(x)}.join("\n")),
|
300
|
+
].join("\n"))
|
301
|
+
end,
|
302
|
+
*if node.inverse_attributes and node.inverse_attributes.length > 0
|
303
|
+
indent([
|
304
|
+
'INVERSE',
|
305
|
+
indent(node.inverse_attributes.map{|x| format(x)}.join("\n")),
|
306
|
+
].join("\n"))
|
306
307
|
end,
|
307
308
|
*if node.unique and node.unique.length > 0
|
308
309
|
indent([
|
@@ -316,7 +317,6 @@ module Expressir
|
|
316
317
|
indent(node.where.map{|x| format(x)}.join("\n")),
|
317
318
|
].join("\n"))
|
318
319
|
end,
|
319
|
-
*format_scope_remarks(node),
|
320
320
|
[
|
321
321
|
'END_ENTITY',
|
322
322
|
';'
|
@@ -373,7 +373,6 @@ module Expressir
|
|
373
373
|
*if node.statements and node.statements.length > 0
|
374
374
|
indent(node.statements.map{|x| format(x)}.join("\n"))
|
375
375
|
end,
|
376
|
-
*format_scope_remarks(node),
|
377
376
|
[
|
378
377
|
'END_FUNCTION',
|
379
378
|
';'
|
@@ -394,7 +393,7 @@ module Expressir
|
|
394
393
|
*if node.items and node.items.length > 0
|
395
394
|
[
|
396
395
|
"\n",
|
397
|
-
|
396
|
+
INDENT,
|
398
397
|
'(',
|
399
398
|
node.items.map{|x| format(x)},
|
400
399
|
')'
|
@@ -461,7 +460,6 @@ module Expressir
|
|
461
460
|
*if node.statements and node.statements.length > 0
|
462
461
|
indent(node.statements.map{|x| format(x)}.join("\n"))
|
463
462
|
end,
|
464
|
-
*format_scope_remarks(node),
|
465
463
|
[
|
466
464
|
'END_PROCEDURE',
|
467
465
|
';'
|
@@ -534,7 +532,6 @@ module Expressir
|
|
534
532
|
indent(node.where.map{|x| format(x)}.join("\n"))
|
535
533
|
].join("\n"))
|
536
534
|
end,
|
537
|
-
*format_scope_remarks(node),
|
538
535
|
[
|
539
536
|
'END_RULE',
|
540
537
|
';'
|
@@ -572,7 +569,6 @@ module Expressir
|
|
572
569
|
*if node.declarations and node.declarations.length > 0
|
573
570
|
node.declarations.map{|x| format(x)}.join("\n\n")
|
574
571
|
end,
|
575
|
-
*format_scope_remarks(node),
|
576
572
|
[
|
577
573
|
'END_SCHEMA',
|
578
574
|
';'
|
@@ -640,7 +636,6 @@ module Expressir
|
|
640
636
|
indent(node.where.map{|x| format(x)}.join("\n"))
|
641
637
|
].join("\n"))
|
642
638
|
end,
|
643
|
-
*format_scope_remarks(node),
|
644
639
|
[
|
645
640
|
'END_TYPE',
|
646
641
|
';'
|
@@ -837,12 +832,12 @@ module Expressir
|
|
837
832
|
' ',
|
838
833
|
'<*',
|
839
834
|
' ',
|
840
|
-
format(node.
|
835
|
+
format(node.aggregate_source),
|
841
836
|
' ',
|
842
837
|
'|',
|
843
838
|
' ',
|
844
839
|
format(node.expression),
|
845
|
-
*
|
840
|
+
*format_remarks(node).instance_eval{|x| x.length > 0 ? ["\n", *x, "\n"] : x},
|
846
841
|
')'
|
847
842
|
].join('')
|
848
843
|
end
|
@@ -925,7 +920,7 @@ module Expressir
|
|
925
920
|
*if node.statements and node.statements.length > 0
|
926
921
|
indent(node.statements.map{|x| format(x)}.join("\n"))
|
927
922
|
end,
|
928
|
-
*
|
923
|
+
*format_remarks(node),
|
929
924
|
[
|
930
925
|
'END_ALIAS',
|
931
926
|
';'
|
@@ -1094,7 +1089,7 @@ module Expressir
|
|
1094
1089
|
*if node.statements and node.statements.length > 0
|
1095
1090
|
indent(node.statements.map{|x| format(x)}.join("\n"))
|
1096
1091
|
end,
|
1097
|
-
*
|
1092
|
+
*format_remarks(node),
|
1098
1093
|
[
|
1099
1094
|
'END_REPEAT',
|
1100
1095
|
';'
|
@@ -1392,6 +1387,18 @@ module Expressir
|
|
1392
1387
|
str.split("\n").map{|x| "#{INDENT}#{x}"}.join("\n")
|
1393
1388
|
end
|
1394
1389
|
|
1390
|
+
def format_remark_ref(node)
|
1391
|
+
[
|
1392
|
+
*if node.class.method_defined? :parent and node.parent.class.method_defined? :id and node.parent != node
|
1393
|
+
[
|
1394
|
+
format_remark_ref(node.parent),
|
1395
|
+
'.'
|
1396
|
+
].join('')
|
1397
|
+
end,
|
1398
|
+
node.id,
|
1399
|
+
].join('')
|
1400
|
+
end
|
1401
|
+
|
1395
1402
|
def format_remark(node, remark)
|
1396
1403
|
if remark.include?("\n")
|
1397
1404
|
[
|
@@ -1416,28 +1423,27 @@ module Expressir
|
|
1416
1423
|
end
|
1417
1424
|
end
|
1418
1425
|
|
1419
|
-
def
|
1420
|
-
|
1421
|
-
|
1422
|
-
|
1423
|
-
|
1424
|
-
|
1425
|
-
|
1426
|
-
|
1427
|
-
node.id,
|
1428
|
-
].join('')
|
1426
|
+
def format_remarks(node)
|
1427
|
+
if node.class.method_defined? :remarks and node.remarks and node.remarks.length > 0
|
1428
|
+
node.remarks.map do |remark|
|
1429
|
+
format_remark(node, remark)
|
1430
|
+
end
|
1431
|
+
else
|
1432
|
+
[]
|
1433
|
+
end
|
1429
1434
|
end
|
1430
1435
|
|
1431
1436
|
def format_scope_remarks(node)
|
1432
|
-
|
1433
|
-
|
1434
|
-
|
1435
|
-
|
1437
|
+
[
|
1438
|
+
*format_remarks(node),
|
1439
|
+
*if node.class.method_defined? :children
|
1440
|
+
node.children.flat_map do |x|
|
1441
|
+
if x != node
|
1442
|
+
format_scope_remarks(x)
|
1443
|
+
end
|
1436
1444
|
end
|
1437
|
-
else
|
1438
|
-
[]
|
1439
1445
|
end
|
1440
|
-
|
1446
|
+
]
|
1441
1447
|
end
|
1442
1448
|
end
|
1443
1449
|
end
|
@@ -1,7 +1,9 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
begin
|
2
|
+
RUBY_VERSION =~ /(\d+\.\d+)/
|
3
|
+
require_relative "#{$1}/express_parser"
|
4
|
+
rescue LoadError
|
5
|
+
require_relative "express_parser"
|
6
|
+
end
|
5
7
|
require 'expressir/express_exp/visitor'
|
6
8
|
|
7
9
|
module Expressir
|
@@ -10,10 +12,11 @@ module Expressir
|
|
10
12
|
def self.from_exp(file)
|
11
13
|
input = File.read(file)
|
12
14
|
|
15
|
+
=begin
|
13
16
|
char_stream = Antlr4::Runtime::CharStreams.from_string(input, 'String')
|
14
|
-
lexer =
|
17
|
+
lexer = ::ExpressParser::Lexer.new(char_stream)
|
15
18
|
token_stream = Antlr4::Runtime::CommonTokenStream.new(lexer)
|
16
|
-
parser =
|
19
|
+
parser = ::ExpressParser::Parser.new(token_stream)
|
17
20
|
|
18
21
|
# don't attempt to recover from any parsing error
|
19
22
|
parser.instance_variable_set(:@_err_handler, Antlr4::Runtime::BailErrorStrategy.new)
|
@@ -22,6 +25,14 @@ module Expressir
|
|
22
25
|
|
23
26
|
visitor = Visitor.new(token_stream)
|
24
27
|
repo = visitor.visit(parse_tree)
|
28
|
+
=end
|
29
|
+
|
30
|
+
parser = ::ExpressParser::Parser.parse(input)
|
31
|
+
|
32
|
+
parse_tree = parser.syntax()
|
33
|
+
|
34
|
+
visitor = Visitor.new(parser.tokens)
|
35
|
+
repo = visitor.visit(parse_tree)
|
25
36
|
|
26
37
|
repo
|
27
38
|
end
|
@@ -1,5 +1,10 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
begin
|
2
|
+
RUBY_VERSION =~ /(\d+\.\d+)/
|
3
|
+
require_relative "#{$1}/express_parser"
|
4
|
+
rescue LoadError
|
5
|
+
require_relative "express_parser"
|
6
|
+
end
|
7
|
+
require "expressir/model"
|
3
8
|
|
4
9
|
# static shorthands are unwrapped
|
5
10
|
# - entity attributes, function/procedure parameters, local variables
|
@@ -23,21 +28,53 @@ require 'expressir/model'
|
|
23
28
|
|
24
29
|
module Expressir
|
25
30
|
module ExpressExp
|
26
|
-
class Visitor <
|
31
|
+
class Visitor < ::ExpressParser::Visitor
|
27
32
|
REMARK_CHANNEL = 2
|
28
33
|
|
29
34
|
def initialize(tokens)
|
30
35
|
@tokens = tokens
|
31
36
|
@attached_remarks = Set.new
|
37
|
+
|
38
|
+
super()
|
32
39
|
end
|
33
40
|
|
34
41
|
def visit(ctx)
|
35
42
|
result = super(ctx)
|
43
|
+
attach_source(ctx, result)
|
36
44
|
attach_parent(ctx, result)
|
37
45
|
attach_remarks(ctx, result)
|
38
46
|
result
|
39
47
|
end
|
40
48
|
|
49
|
+
def visit_if(ctx)
|
50
|
+
visit(ctx) if ctx
|
51
|
+
end
|
52
|
+
|
53
|
+
def visit_if_map(ctx)
|
54
|
+
ctx.map{|ctx2| visit(ctx2)} if ctx
|
55
|
+
end
|
56
|
+
|
57
|
+
def visit_if_map_flatten(ctx)
|
58
|
+
ctx.map{|ctx2| visit(ctx2)}.flatten if ctx
|
59
|
+
end
|
60
|
+
|
61
|
+
def get_tokens(ctx)
|
62
|
+
start_index, stop_index = if ctx.instance_of? ::ExpressParser::SyntaxContext
|
63
|
+
[0, @tokens.size - 1]
|
64
|
+
else
|
65
|
+
[ctx.start.token_index, ctx.stop.token_index]
|
66
|
+
end
|
67
|
+
|
68
|
+
@tokens[start_index..stop_index]
|
69
|
+
end
|
70
|
+
|
71
|
+
def attach_source(ctx, node)
|
72
|
+
if node.class.method_defined? :source
|
73
|
+
source_tokens = get_tokens(ctx).select{|x| x.text != '<EOF>'}
|
74
|
+
node.source = source_tokens.map{|x| x.text}.join('').force_encoding('UTF-8')
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
41
78
|
def attach_parent(ctx, node)
|
42
79
|
if node.class.method_defined? :children
|
43
80
|
node.children.each do |child_node|
|
@@ -49,15 +86,7 @@ module Expressir
|
|
49
86
|
end
|
50
87
|
|
51
88
|
def attach_remarks(ctx, node)
|
52
|
-
|
53
|
-
start_index, stop_index = if ctx.instance_of? Generated::ExpressParser::SyntaxContext
|
54
|
-
[0, @tokens.size - 1]
|
55
|
-
else
|
56
|
-
[ctx.start.token_index, ctx.stop.token_index]
|
57
|
-
end
|
58
|
-
# puts [start_index, stop_index, ctx.class].inspect
|
59
|
-
|
60
|
-
remark_tokens = @tokens.filter_for_channel(start_index, stop_index, REMARK_CHANNEL)
|
89
|
+
remark_tokens = get_tokens(ctx).select{|x| x.channel == REMARK_CHANNEL}
|
61
90
|
if remark_tokens
|
62
91
|
remark_tokens.each do |remark_token|
|
63
92
|
remark_text = remark_token.text
|
@@ -78,26 +107,22 @@ module Expressir
|
|
78
107
|
end
|
79
108
|
|
80
109
|
# attach tagged remark
|
81
|
-
remark_tag = match[1]
|
82
|
-
remark_content = match[2].strip
|
110
|
+
remark_tag = match[1]
|
111
|
+
remark_content = match[2].strip.force_encoding('UTF-8')
|
83
112
|
|
113
|
+
target_node = nil
|
84
114
|
current_node = node
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
break
|
92
|
-
end
|
93
|
-
else
|
94
|
-
break
|
95
|
-
end
|
115
|
+
if current_node.class.method_defined? :find
|
116
|
+
target_node = current_node.find(remark_tag)
|
117
|
+
end
|
118
|
+
while !target_node and current_node.class.method_defined? :parent and current_node.parent.class.method_defined? :find
|
119
|
+
current_node = current_node.parent
|
120
|
+
target_node = current_node.find(remark_tag)
|
96
121
|
end
|
97
122
|
|
98
|
-
if
|
99
|
-
|
100
|
-
|
123
|
+
if target_node
|
124
|
+
target_node.remarks ||= []
|
125
|
+
target_node.remarks << remark_content
|
101
126
|
|
102
127
|
# mark remark as attached, so that it is not attached again at higher nesting level
|
103
128
|
@attached_remarks << remark_token
|
@@ -106,194 +131,237 @@ module Expressir
|
|
106
131
|
end
|
107
132
|
end
|
108
133
|
|
109
|
-
def
|
110
|
-
|
134
|
+
def visit_attribute_ref(ctx)
|
135
|
+
ctx__attribute_id = ctx.attribute_id
|
136
|
+
|
137
|
+
id = visit_if(ctx__attribute_id)
|
111
138
|
|
112
139
|
Model::Expressions::SimpleReference.new({
|
113
140
|
id: id
|
114
141
|
})
|
115
142
|
end
|
116
143
|
|
117
|
-
def
|
118
|
-
|
144
|
+
def visit_constant_ref(ctx)
|
145
|
+
ctx__constant_id = ctx.constant_id
|
146
|
+
|
147
|
+
id = visit_if(ctx__constant_id)
|
119
148
|
|
120
149
|
Model::Expressions::SimpleReference.new({
|
121
150
|
id: id
|
122
151
|
})
|
123
152
|
end
|
124
153
|
|
125
|
-
def
|
126
|
-
|
154
|
+
def visit_entity_ref(ctx)
|
155
|
+
ctx__entity_id = ctx.entity_id
|
156
|
+
|
157
|
+
id = visit_if(ctx__entity_id)
|
127
158
|
|
128
159
|
Model::Expressions::SimpleReference.new({
|
129
160
|
id: id
|
130
161
|
})
|
131
162
|
end
|
132
163
|
|
133
|
-
def
|
134
|
-
|
164
|
+
def visit_enumeration_ref(ctx)
|
165
|
+
ctx__enumeration_id = ctx.enumeration_id
|
166
|
+
|
167
|
+
id = visit_if(ctx__enumeration_id)
|
135
168
|
|
136
169
|
Model::Expressions::SimpleReference.new({
|
137
170
|
id: id
|
138
171
|
})
|
139
172
|
end
|
140
173
|
|
141
|
-
def
|
142
|
-
|
174
|
+
def visit_function_ref(ctx)
|
175
|
+
ctx__function_id = ctx.function_id
|
176
|
+
|
177
|
+
id = visit_if(ctx__function_id)
|
143
178
|
|
144
179
|
Model::Expressions::SimpleReference.new({
|
145
180
|
id: id
|
146
181
|
})
|
147
182
|
end
|
148
183
|
|
149
|
-
def
|
150
|
-
|
184
|
+
def visit_parameter_ref(ctx)
|
185
|
+
ctx__parameter_id = ctx.parameter_id
|
186
|
+
|
187
|
+
id = visit_if(ctx__parameter_id)
|
151
188
|
|
152
189
|
Model::Expressions::SimpleReference.new({
|
153
190
|
id: id
|
154
191
|
})
|
155
192
|
end
|
156
193
|
|
157
|
-
def
|
158
|
-
|
194
|
+
def visit_procedure_ref(ctx)
|
195
|
+
ctx__procedure_id = ctx.procedure_id
|
196
|
+
|
197
|
+
id = visit_if(ctx__procedure_id)
|
159
198
|
|
160
199
|
Model::Expressions::SimpleReference.new({
|
161
200
|
id: id
|
162
201
|
})
|
163
202
|
end
|
164
203
|
|
165
|
-
def
|
166
|
-
|
204
|
+
def visit_rule_label_ref(ctx)
|
205
|
+
ctx__rule_label_id = ctx.rule_label_id
|
206
|
+
|
207
|
+
id = visit_if(ctx__rule_label_id)
|
167
208
|
|
168
209
|
Model::Expressions::SimpleReference.new({
|
169
210
|
id: id
|
170
211
|
})
|
171
212
|
end
|
172
213
|
|
173
|
-
def
|
174
|
-
|
214
|
+
def visit_rule_ref(ctx)
|
215
|
+
ctx__rule_id = ctx.rule_id
|
216
|
+
|
217
|
+
id = visit_if(ctx__rule_id)
|
175
218
|
|
176
219
|
Model::Expressions::SimpleReference.new({
|
177
220
|
id: id
|
178
221
|
})
|
179
222
|
end
|
180
223
|
|
181
|
-
def
|
182
|
-
|
224
|
+
def visit_schema_ref(ctx)
|
225
|
+
ctx__schema_id = ctx.schema_id
|
226
|
+
|
227
|
+
id = visit_if(ctx__schema_id)
|
183
228
|
|
184
229
|
Model::Expressions::SimpleReference.new({
|
185
230
|
id: id
|
186
231
|
})
|
187
232
|
end
|
188
233
|
|
189
|
-
def
|
190
|
-
|
234
|
+
def visit_subtype_constraint_ref(ctx)
|
235
|
+
ctx__subtype_constraint_id = ctx.subtype_constraint_id
|
236
|
+
|
237
|
+
id = visit_if(ctx__subtype_constraint_id)
|
191
238
|
|
192
239
|
Model::Expressions::SimpleReference.new({
|
193
240
|
id: id
|
194
241
|
})
|
195
242
|
end
|
196
243
|
|
197
|
-
def
|
198
|
-
|
244
|
+
def visit_type_label_ref(ctx)
|
245
|
+
ctx__type_label_id = ctx.type_label_id
|
246
|
+
|
247
|
+
id = visit_if(ctx__type_label_id)
|
199
248
|
|
200
249
|
Model::Expressions::SimpleReference.new({
|
201
250
|
id: id
|
202
251
|
})
|
203
252
|
end
|
204
253
|
|
205
|
-
def
|
206
|
-
|
254
|
+
def visit_type_ref(ctx)
|
255
|
+
ctx__type_id = ctx.type_id
|
256
|
+
|
257
|
+
id = visit_if(ctx__type_id)
|
207
258
|
|
208
259
|
Model::Expressions::SimpleReference.new({
|
209
260
|
id: id
|
210
261
|
})
|
211
262
|
end
|
212
263
|
|
213
|
-
def
|
214
|
-
|
264
|
+
def visit_variable_ref(ctx)
|
265
|
+
ctx__variable_id = ctx.variable_id
|
266
|
+
|
267
|
+
id = visit_if(ctx__variable_id)
|
215
268
|
|
216
269
|
Model::Expressions::SimpleReference.new({
|
217
270
|
id: id
|
218
271
|
})
|
219
272
|
end
|
220
273
|
|
221
|
-
def
|
274
|
+
def visit_abstract_entity_declaration(ctx)
|
222
275
|
raise 'Invalid state'
|
223
276
|
end
|
224
277
|
|
225
|
-
def
|
278
|
+
def visit_abstract_supertype(ctx)
|
226
279
|
raise 'Invalid state'
|
227
280
|
end
|
228
281
|
|
229
|
-
def
|
230
|
-
|
282
|
+
def visit_abstract_supertype_declaration(ctx)
|
283
|
+
ctx__subtype_constraint = ctx.subtype_constraint
|
284
|
+
|
285
|
+
visit_if(ctx__subtype_constraint)
|
231
286
|
end
|
232
287
|
|
233
|
-
def
|
234
|
-
|
288
|
+
def visit_actual_parameter_list(ctx)
|
289
|
+
ctx__parameter = ctx.parameter
|
290
|
+
|
291
|
+
visit_if_map(ctx__parameter)
|
235
292
|
end
|
236
293
|
|
237
|
-
def
|
238
|
-
|
294
|
+
def visit_add_like_op(ctx)
|
295
|
+
ctx__text = ctx.text
|
296
|
+
ctx__ADDITION = ctx__text == '+'
|
297
|
+
ctx__SUBTRACTION = ctx__text == '-'
|
298
|
+
ctx__OR = ctx.OR
|
299
|
+
ctx__XOR = ctx.XOR
|
300
|
+
|
301
|
+
if ctx__ADDITION
|
239
302
|
Model::Expressions::BinaryExpression::ADDITION
|
240
|
-
elsif
|
303
|
+
elsif ctx__SUBTRACTION
|
241
304
|
Model::Expressions::BinaryExpression::SUBTRACTION
|
242
|
-
elsif
|
305
|
+
elsif ctx__OR
|
243
306
|
Model::Expressions::BinaryExpression::OR
|
244
|
-
elsif
|
307
|
+
elsif ctx__XOR
|
245
308
|
Model::Expressions::BinaryExpression::XOR
|
246
309
|
else
|
247
310
|
raise 'Invalid state'
|
248
311
|
end
|
249
312
|
end
|
250
313
|
|
251
|
-
def
|
252
|
-
|
314
|
+
def visit_aggregate_initializer(ctx)
|
315
|
+
ctx__element = ctx.element
|
316
|
+
|
317
|
+
items = visit_if_map(ctx__element)
|
253
318
|
|
254
319
|
Model::Expressions::AggregateInitializer.new({
|
255
320
|
items: items
|
256
321
|
})
|
257
322
|
end
|
258
323
|
|
259
|
-
def
|
260
|
-
|
324
|
+
def visit_aggregate_source(ctx)
|
325
|
+
ctx__simple_expression = ctx.simple_expression
|
326
|
+
|
327
|
+
visit_if(ctx__simple_expression)
|
261
328
|
end
|
262
329
|
|
263
|
-
def
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
330
|
+
def visit_aggregate_type(ctx)
|
331
|
+
ctx__type_label = ctx.type_label
|
332
|
+
ctx__parameter_type = ctx.parameter_type
|
333
|
+
|
334
|
+
id = visit_if(ctx__type_label)
|
335
|
+
base_type = visit_if(ctx__parameter_type)
|
268
336
|
|
269
337
|
Model::Types::Aggregate.new({
|
270
|
-
|
338
|
+
id: id,
|
271
339
|
base_type: base_type
|
272
340
|
})
|
273
341
|
end
|
274
342
|
|
275
|
-
def
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
elsif ctx.setType()
|
283
|
-
visit(ctx.setType())
|
284
|
-
else
|
285
|
-
raise 'Invalid state'
|
286
|
-
end
|
343
|
+
def visit_aggregation_types(ctx)
|
344
|
+
ctx__array_type = ctx.array_type
|
345
|
+
ctx__bag_type = ctx.bag_type
|
346
|
+
ctx__list_type = ctx.list_type
|
347
|
+
ctx__set_type = ctx.set_type
|
348
|
+
|
349
|
+
visit_if(ctx__array_type || ctx__bag_type || ctx__list_type || ctx__set_type)
|
287
350
|
end
|
288
351
|
|
289
|
-
def
|
352
|
+
def visit_algorithm_head(ctx)
|
290
353
|
raise 'Invalid state'
|
291
354
|
end
|
292
355
|
|
293
|
-
def
|
294
|
-
|
295
|
-
|
296
|
-
|
356
|
+
def visit_alias_stmt(ctx)
|
357
|
+
ctx__variable_id = ctx.variable_id
|
358
|
+
ctx__general_ref = ctx.general_ref
|
359
|
+
ctx__qualifier = ctx.qualifier
|
360
|
+
ctx__stmt = ctx.stmt
|
361
|
+
|
362
|
+
id = visit_if(ctx__variable_id)
|
363
|
+
expression = handle_qualified_ref(visit_if(ctx__general_ref), ctx__qualifier)
|
364
|
+
statements = visit_if_map(ctx__stmt)
|
297
365
|
|
298
366
|
Model::Statements::Alias.new({
|
299
367
|
id: id,
|
@@ -302,12 +370,19 @@ module Expressir
|
|
302
370
|
})
|
303
371
|
end
|
304
372
|
|
305
|
-
def
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
373
|
+
def visit_array_type(ctx)
|
374
|
+
ctx__bound_spec = ctx.bound_spec
|
375
|
+
ctx__OPTIONAL = ctx.OPTIONAL
|
376
|
+
ctx__UNIQUE = ctx.UNIQUE
|
377
|
+
ctx__instantiable_type = ctx.instantiable_type
|
378
|
+
ctx__bound_spec__bound1 = ctx__bound_spec&.bound1
|
379
|
+
ctx__bound_spec__bound2 = ctx__bound_spec&.bound2
|
380
|
+
|
381
|
+
bound1 = visit_if(ctx__bound_spec__bound1)
|
382
|
+
bound2 = visit_if(ctx__bound_spec__bound2)
|
383
|
+
optional = !!ctx__OPTIONAL
|
384
|
+
unique = !!ctx__UNIQUE
|
385
|
+
base_type = visit_if(ctx__instantiable_type)
|
311
386
|
|
312
387
|
Model::Types::Array.new({
|
313
388
|
bound1: bound1,
|
@@ -318,9 +393,13 @@ module Expressir
|
|
318
393
|
})
|
319
394
|
end
|
320
395
|
|
321
|
-
def
|
322
|
-
|
323
|
-
|
396
|
+
def visit_assignment_stmt(ctx)
|
397
|
+
ctx__general_ref = ctx.general_ref
|
398
|
+
ctx__qualifier = ctx.qualifier
|
399
|
+
ctx__expression = ctx.expression
|
400
|
+
|
401
|
+
ref = handle_qualified_ref(visit_if(ctx__general_ref), ctx__qualifier)
|
402
|
+
expression = visit_if(ctx__expression)
|
324
403
|
|
325
404
|
Model::Statements::Assignment.new({
|
326
405
|
ref: ref,
|
@@ -328,26 +407,50 @@ module Expressir
|
|
328
407
|
})
|
329
408
|
end
|
330
409
|
|
331
|
-
def
|
332
|
-
|
410
|
+
def visit_attribute_decl(ctx)
|
411
|
+
ctx__attribute_id = ctx.attribute_id
|
412
|
+
ctx__redeclared_attribute = ctx.redeclared_attribute
|
413
|
+
ctx__redeclared_attribute__qualified_attribute = ctx__redeclared_attribute&.qualified_attribute
|
414
|
+
ctx__redeclared_attribute__attribute_id = ctx__redeclared_attribute&.attribute_id
|
415
|
+
|
416
|
+
id = visit_if(ctx__attribute_id || ctx__redeclared_attribute__attribute_id)
|
417
|
+
supertype_attribute = visit_if(ctx__redeclared_attribute__qualified_attribute)
|
418
|
+
|
419
|
+
Model::Attribute.new({
|
420
|
+
id: id,
|
421
|
+
supertype_attribute: supertype_attribute
|
422
|
+
})
|
333
423
|
end
|
334
424
|
|
335
|
-
def
|
336
|
-
|
425
|
+
def visit_attribute_id(ctx)
|
426
|
+
ctx__SimpleId = ctx.SimpleId
|
427
|
+
|
428
|
+
handle_simple_id(ctx__SimpleId)
|
337
429
|
end
|
338
430
|
|
339
|
-
def
|
431
|
+
def visit_attribute_qualifier(ctx)
|
432
|
+
ctx__attribute_ref = ctx.attribute_ref
|
433
|
+
|
434
|
+
attribute = visit_if(ctx__attribute_ref)
|
435
|
+
|
436
|
+
Model::Expressions::AttributeReference.new({
|
437
|
+
attribute: attribute
|
438
|
+
})
|
439
|
+
end
|
440
|
+
|
441
|
+
def visit_attribute_reference(ctx)
|
340
442
|
raise 'Invalid state'
|
341
443
|
end
|
342
444
|
|
343
|
-
def
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
445
|
+
def visit_bag_type(ctx)
|
446
|
+
ctx__bound_spec = ctx.bound_spec
|
447
|
+
ctx__instantiable_type = ctx.instantiable_type
|
448
|
+
ctx__bound_spec__bound1 = ctx__bound_spec&.bound1
|
449
|
+
ctx__bound_spec__bound2 = ctx__bound_spec&.bound2
|
450
|
+
|
451
|
+
bound1 = visit_if(ctx__bound_spec__bound1)
|
452
|
+
bound2 = visit_if(ctx__bound_spec__bound2)
|
453
|
+
base_type = visit_if(ctx__instantiable_type)
|
351
454
|
|
352
455
|
Model::Types::Bag.new({
|
353
456
|
bound1: bound1,
|
@@ -356,13 +459,13 @@ module Expressir
|
|
356
459
|
})
|
357
460
|
end
|
358
461
|
|
359
|
-
def
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
462
|
+
def visit_binary_type(ctx)
|
463
|
+
ctx__width_spec = ctx.width_spec
|
464
|
+
ctx__width_spec__width = ctx__width_spec&.width
|
465
|
+
ctx__width_spec__FIXED = ctx__width_spec&.FIXED
|
466
|
+
|
467
|
+
width = visit_if(ctx__width_spec__width)
|
468
|
+
fixed = !!ctx__width_spec__FIXED
|
366
469
|
|
367
470
|
Model::Types::Binary.new({
|
368
471
|
width: width,
|
@@ -370,49 +473,62 @@ module Expressir
|
|
370
473
|
})
|
371
474
|
end
|
372
475
|
|
373
|
-
def
|
374
|
-
Model::Types::Boolean.new
|
476
|
+
def visit_boolean_type(ctx)
|
477
|
+
Model::Types::Boolean.new
|
375
478
|
end
|
376
479
|
|
377
|
-
def
|
378
|
-
|
480
|
+
def visit_bound1(ctx)
|
481
|
+
ctx__numeric_expression = ctx.numeric_expression
|
482
|
+
|
483
|
+
visit_if(ctx__numeric_expression)
|
379
484
|
end
|
380
485
|
|
381
|
-
def
|
382
|
-
|
486
|
+
def visit_bound2(ctx)
|
487
|
+
ctx__numeric_expression = ctx.numeric_expression
|
488
|
+
|
489
|
+
visit_if(ctx__numeric_expression)
|
383
490
|
end
|
384
491
|
|
385
|
-
def
|
492
|
+
def visit_bound_spec(ctx)
|
386
493
|
raise 'Invalid state'
|
387
494
|
end
|
388
495
|
|
389
|
-
def
|
390
|
-
|
496
|
+
def visit_built_in_constant(ctx)
|
497
|
+
ctx__text = ctx.text
|
498
|
+
|
499
|
+
id = ctx__text
|
391
500
|
|
392
501
|
Model::Expressions::SimpleReference.new({
|
393
502
|
id: id
|
394
503
|
})
|
395
504
|
end
|
396
505
|
|
397
|
-
def
|
398
|
-
|
506
|
+
def visit_built_in_function(ctx)
|
507
|
+
ctx__text = ctx.text
|
508
|
+
|
509
|
+
id = ctx__text
|
399
510
|
|
400
511
|
Model::Expressions::SimpleReference.new({
|
401
512
|
id: id
|
402
513
|
})
|
403
514
|
end
|
404
515
|
|
405
|
-
def
|
406
|
-
|
516
|
+
def visit_built_in_procedure(ctx)
|
517
|
+
ctx__text = ctx.text
|
518
|
+
|
519
|
+
id = ctx__text
|
407
520
|
|
408
521
|
Model::Expressions::SimpleReference.new({
|
409
522
|
id: id
|
410
523
|
})
|
411
524
|
end
|
412
525
|
|
413
|
-
def
|
414
|
-
|
415
|
-
|
526
|
+
def visit_case_action(ctx)
|
527
|
+
ctx__case_label = ctx.case_label
|
528
|
+
ctx__stmt = ctx.stmt
|
529
|
+
|
530
|
+
labels = visit_if_map(ctx__case_label)
|
531
|
+
statement = visit_if(ctx__stmt)
|
416
532
|
|
417
533
|
Model::Statements::CaseAction.new({
|
418
534
|
labels: labels,
|
@@ -420,16 +536,21 @@ module Expressir
|
|
420
536
|
})
|
421
537
|
end
|
422
538
|
|
423
|
-
def
|
424
|
-
|
539
|
+
def visit_case_label(ctx)
|
540
|
+
ctx__expression = ctx.expression
|
541
|
+
|
542
|
+
visit_if(ctx__expression)
|
425
543
|
end
|
426
544
|
|
427
|
-
def
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
545
|
+
def visit_case_stmt(ctx)
|
546
|
+
ctx__selector = ctx.selector
|
547
|
+
ctx__case_action = ctx.case_action
|
548
|
+
ctx__stmt = ctx.stmt
|
549
|
+
ctx__selector__expression = ctx__selector&.expression
|
550
|
+
|
551
|
+
expression = visit_if(ctx__selector__expression)
|
552
|
+
actions = visit_if_map_flatten(ctx__case_action)
|
553
|
+
otherwise_statement = visit_if(ctx__stmt)
|
433
554
|
|
434
555
|
Model::Statements::Case.new({
|
435
556
|
expression: expression,
|
@@ -438,30 +559,32 @@ module Expressir
|
|
438
559
|
})
|
439
560
|
end
|
440
561
|
|
441
|
-
def
|
442
|
-
|
562
|
+
def visit_compound_stmt(ctx)
|
563
|
+
ctx__stmt = ctx.stmt
|
564
|
+
|
565
|
+
statements = visit_if_map(ctx__stmt)
|
443
566
|
|
444
567
|
Model::Statements::Compound.new({
|
445
568
|
statements: statements
|
446
569
|
})
|
447
570
|
end
|
448
571
|
|
449
|
-
def
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
visit(ctx.typeRef())
|
456
|
-
else
|
457
|
-
raise 'Invalid state'
|
458
|
-
end
|
572
|
+
def visit_concrete_types(ctx)
|
573
|
+
ctx__aggregation_types = ctx.aggregation_types
|
574
|
+
ctx__simple_types = ctx.simple_types
|
575
|
+
ctx__type_ref = ctx.type_ref
|
576
|
+
|
577
|
+
visit_if(ctx__aggregation_types || ctx__simple_types || ctx__type_ref)
|
459
578
|
end
|
460
579
|
|
461
|
-
def
|
462
|
-
|
463
|
-
|
464
|
-
|
580
|
+
def visit_constant_body(ctx)
|
581
|
+
ctx__constant_id = ctx.constant_id
|
582
|
+
ctx__instantiable_type = ctx.instantiable_type
|
583
|
+
ctx__expression = ctx.expression
|
584
|
+
|
585
|
+
id = visit_if(ctx__constant_id)
|
586
|
+
type = visit_if(ctx__instantiable_type)
|
587
|
+
expression = visit_if(ctx__expression)
|
465
588
|
|
466
589
|
Model::Constant.new({
|
467
590
|
id: id,
|
@@ -470,80 +593,72 @@ module Expressir
|
|
470
593
|
})
|
471
594
|
end
|
472
595
|
|
473
|
-
def
|
474
|
-
|
596
|
+
def visit_constant_decl(ctx)
|
597
|
+
ctx__constant_body = ctx.constant_body
|
598
|
+
|
599
|
+
visit_if_map(ctx__constant_body)
|
475
600
|
end
|
476
601
|
|
477
|
-
def
|
478
|
-
|
479
|
-
|
480
|
-
|
481
|
-
|
482
|
-
else
|
483
|
-
raise 'Invalid state'
|
484
|
-
end
|
602
|
+
def visit_constant_factor(ctx)
|
603
|
+
ctx__built_in_constant = ctx.built_in_constant
|
604
|
+
ctx__constant_ref = ctx.constant_ref
|
605
|
+
|
606
|
+
visit_if(ctx__built_in_constant || ctx__constant_ref)
|
485
607
|
end
|
486
608
|
|
487
|
-
def
|
488
|
-
|
609
|
+
def visit_constant_id(ctx)
|
610
|
+
ctx__SimpleId = ctx.SimpleId
|
611
|
+
|
612
|
+
handle_simple_id(ctx__SimpleId)
|
489
613
|
end
|
490
614
|
|
491
|
-
def
|
492
|
-
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
else
|
497
|
-
raise 'Invalid state'
|
498
|
-
end
|
615
|
+
def visit_constructed_types(ctx)
|
616
|
+
ctx__enumeration_type = ctx.enumeration_type
|
617
|
+
ctx__select_type = ctx.select_type
|
618
|
+
|
619
|
+
visit_if(ctx__enumeration_type || ctx__select_type)
|
499
620
|
end
|
500
621
|
|
501
|
-
def
|
502
|
-
|
503
|
-
|
504
|
-
|
505
|
-
|
506
|
-
|
507
|
-
|
508
|
-
|
509
|
-
visit(ctx.subtypeConstraintDecl())
|
510
|
-
elsif ctx.typeDecl()
|
511
|
-
visit(ctx.typeDecl())
|
512
|
-
else
|
513
|
-
raise 'Invalid state'
|
514
|
-
end
|
622
|
+
def visit_declaration(ctx)
|
623
|
+
ctx__entity_decl = ctx.entity_decl
|
624
|
+
ctx__function_decl = ctx.function_decl
|
625
|
+
ctx__procedure_decl = ctx.procedure_decl
|
626
|
+
ctx__subtype_constraint_decl = ctx.subtype_constraint_decl
|
627
|
+
ctx__type_decl = ctx.type_decl
|
628
|
+
|
629
|
+
visit_if(ctx__entity_decl || ctx__function_decl || ctx__procedure_decl || ctx__subtype_constraint_decl || ctx__type_decl)
|
515
630
|
end
|
516
631
|
|
517
|
-
def
|
518
|
-
|
519
|
-
|
520
|
-
|
521
|
-
|
522
|
-
|
523
|
-
|
524
|
-
|
525
|
-
end
|
526
|
-
type = visit(ctx.parameterType())
|
527
|
-
expression = visit(ctx.expression())
|
632
|
+
def visit_derived_attr(ctx)
|
633
|
+
ctx__attribute_decl = ctx.attribute_decl
|
634
|
+
ctx__parameter_type = ctx.parameter_type
|
635
|
+
ctx__expression = ctx.expression
|
636
|
+
|
637
|
+
attribute = visit_if(ctx__attribute_decl)
|
638
|
+
type = visit_if(ctx__parameter_type)
|
639
|
+
expression = visit_if(ctx__expression)
|
528
640
|
|
529
641
|
Model::Attribute.new({
|
642
|
+
id: attribute.id,
|
530
643
|
kind: Model::Attribute::DERIVED,
|
531
|
-
supertype_attribute: supertype_attribute,
|
532
|
-
id: id,
|
644
|
+
supertype_attribute: attribute.supertype_attribute,
|
533
645
|
type: type,
|
534
646
|
expression: expression
|
535
647
|
})
|
536
648
|
end
|
537
649
|
|
538
|
-
def
|
539
|
-
|
650
|
+
def visit_derive_clause(ctx)
|
651
|
+
ctx__derived_attr = ctx.derived_attr
|
652
|
+
|
653
|
+
visit_if_map(ctx__derived_attr)
|
540
654
|
end
|
541
655
|
|
542
|
-
def
|
543
|
-
|
544
|
-
|
545
|
-
|
546
|
-
|
656
|
+
def visit_domain_rule(ctx)
|
657
|
+
ctx__rule_label_id = ctx.rule_label_id
|
658
|
+
ctx__expression = ctx.expression
|
659
|
+
|
660
|
+
id = visit_if(ctx__rule_label_id)
|
661
|
+
expression = visit_if(ctx__expression)
|
547
662
|
|
548
663
|
Model::Where.new({
|
549
664
|
id: id,
|
@@ -551,27 +666,33 @@ module Expressir
|
|
551
666
|
})
|
552
667
|
end
|
553
668
|
|
554
|
-
def
|
555
|
-
|
556
|
-
|
557
|
-
|
669
|
+
def visit_element(ctx)
|
670
|
+
ctx__expression = ctx.expression
|
671
|
+
ctx__repetition = ctx.repetition
|
672
|
+
|
673
|
+
if ctx__repetition
|
674
|
+
expression = visit_if(ctx__expression)
|
675
|
+
repetition = visit_if(ctx__repetition)
|
558
676
|
|
559
677
|
Model::Expressions::AggregateItem.new({
|
560
678
|
expression: expression,
|
561
679
|
repetition: repetition
|
562
680
|
})
|
563
681
|
else
|
564
|
-
|
682
|
+
visit_if(ctx__expression)
|
565
683
|
end
|
566
684
|
end
|
567
685
|
|
568
|
-
def
|
686
|
+
def visit_entity_body(ctx)
|
569
687
|
raise 'Invalid state'
|
570
688
|
end
|
571
689
|
|
572
|
-
def
|
573
|
-
|
574
|
-
|
690
|
+
def visit_entity_constructor(ctx)
|
691
|
+
ctx__entity_ref = ctx.entity_ref
|
692
|
+
ctx__expression = ctx.expression
|
693
|
+
|
694
|
+
ref = visit_if(ctx__entity_ref)
|
695
|
+
parameters = visit_if_map(ctx__expression)
|
575
696
|
|
576
697
|
Model::Expressions::Call.new({
|
577
698
|
ref: ref,
|
@@ -579,34 +700,33 @@ module Expressir
|
|
579
700
|
})
|
580
701
|
end
|
581
702
|
|
582
|
-
def
|
583
|
-
|
584
|
-
|
585
|
-
|
586
|
-
|
587
|
-
|
588
|
-
|
589
|
-
|
590
|
-
|
591
|
-
|
592
|
-
|
593
|
-
|
594
|
-
|
703
|
+
def visit_entity_decl(ctx)
|
704
|
+
ctx__entity_head = ctx.entity_head
|
705
|
+
ctx__entity_body = ctx.entity_body
|
706
|
+
ctx__entity_head__entity_id = ctx__entity_head&.entity_id
|
707
|
+
ctx__entity_head__subsuper = ctx__entity_head&.subsuper
|
708
|
+
ctx__entity_head__subsuper__supertype_constraint = ctx__entity_head__subsuper&.supertype_constraint
|
709
|
+
ctx__entity_head__subsuper__supertype_constraint__abstract_entity_declaration = ctx__entity_head__subsuper__supertype_constraint&.abstract_entity_declaration
|
710
|
+
ctx__entity_head__subsuper__supertype_constraint__abstract_supertype_declaration = ctx__entity_head__subsuper__supertype_constraint&.abstract_supertype_declaration
|
711
|
+
ctx__entity_head__subsuper__supertype_constraint__supertype_rule = ctx__entity_head__subsuper__supertype_constraint&.supertype_rule
|
712
|
+
ctx__entity_head__subsuper__subtype_declaration = ctx__entity_head__subsuper&.subtype_declaration
|
713
|
+
ctx__entity_body__explicit_attr = ctx__entity_body&.explicit_attr
|
714
|
+
ctx__entity_body__derive_clause = ctx__entity_body&.derive_clause
|
715
|
+
ctx__entity_body__inverse_clause = ctx__entity_body&.inverse_clause
|
716
|
+
ctx__entity_body__unique_clause = ctx__entity_body&.unique_clause
|
717
|
+
ctx__entity_body__where_clause = ctx__entity_body&.where_clause
|
718
|
+
|
719
|
+
id = visit_if(ctx__entity_head__entity_id)
|
720
|
+
abstract = !!(ctx__entity_head__subsuper__supertype_constraint__abstract_entity_declaration || ctx__entity_head__subsuper__supertype_constraint__abstract_supertype_declaration)
|
721
|
+
supertype_expression = visit_if(ctx__entity_head__subsuper__supertype_constraint__abstract_supertype_declaration || ctx__entity_head__subsuper__supertype_constraint__supertype_rule)
|
722
|
+
subtype_of = visit_if(ctx__entity_head__subsuper__subtype_declaration)
|
595
723
|
attributes = [
|
596
|
-
*
|
597
|
-
*
|
598
|
-
|
599
|
-
end,
|
600
|
-
*if ctx.entityBody().inverseClause()
|
601
|
-
ctx.entityBody().inverseClause().inverseAttr().map{|ctx| visit(ctx)}
|
602
|
-
end
|
724
|
+
*visit_if_map_flatten(ctx__entity_body__explicit_attr),
|
725
|
+
*visit_if(ctx__entity_body__derive_clause),
|
726
|
+
*visit_if(ctx__entity_body__inverse_clause)
|
603
727
|
]
|
604
|
-
unique =
|
605
|
-
|
606
|
-
end
|
607
|
-
where = if ctx.entityBody().whereClause()
|
608
|
-
ctx.entityBody().whereClause().domainRule().map{|ctx| visit(ctx)}
|
609
|
-
end
|
728
|
+
unique = visit_if(ctx__entity_body__unique_clause)
|
729
|
+
where = visit_if(ctx__entity_body__where_clause)
|
610
730
|
|
611
731
|
Model::Entity.new({
|
612
732
|
id: id,
|
@@ -619,51 +739,70 @@ module Expressir
|
|
619
739
|
})
|
620
740
|
end
|
621
741
|
|
622
|
-
def
|
742
|
+
def visit_entity_head(ctx)
|
623
743
|
raise 'Invalid state'
|
624
744
|
end
|
625
745
|
|
626
|
-
def
|
627
|
-
|
746
|
+
def visit_entity_id(ctx)
|
747
|
+
ctx__SimpleId = ctx.SimpleId
|
748
|
+
|
749
|
+
handle_simple_id(ctx__SimpleId)
|
628
750
|
end
|
629
751
|
|
630
|
-
def
|
752
|
+
def visit_enumeration_extension(ctx)
|
631
753
|
raise 'Invalid state'
|
632
754
|
end
|
633
755
|
|
634
|
-
def
|
635
|
-
|
756
|
+
def visit_enumeration_id(ctx)
|
757
|
+
ctx__SimpleId = ctx.SimpleId
|
758
|
+
|
759
|
+
handle_simple_id(ctx__SimpleId)
|
636
760
|
end
|
637
761
|
|
638
|
-
def
|
639
|
-
|
762
|
+
def visit_enumeration_items(ctx)
|
763
|
+
ctx__enumeration_item = ctx.enumeration_item
|
764
|
+
|
765
|
+
visit_if_map(ctx__enumeration_item)
|
766
|
+
end
|
767
|
+
|
768
|
+
def visit_enumeration_item(ctx)
|
769
|
+
ctx__enumeration_id = ctx.enumeration_id
|
770
|
+
|
771
|
+
id = visit_if(ctx__enumeration_id)
|
772
|
+
|
773
|
+
Model::EnumerationItem.new({
|
774
|
+
id: id
|
775
|
+
})
|
640
776
|
end
|
641
777
|
|
642
|
-
def
|
643
|
-
|
644
|
-
|
645
|
-
|
778
|
+
def visit_enumeration_reference(ctx)
|
779
|
+
ctx__type_ref = ctx.type_ref
|
780
|
+
ctx__enumeration_ref = ctx.enumeration_ref
|
781
|
+
|
782
|
+
if ctx__type_ref
|
783
|
+
ref = visit_if(ctx__type_ref)
|
784
|
+
attribute = visit_if(ctx__enumeration_ref)
|
646
785
|
|
647
786
|
Model::Expressions::AttributeReference.new({
|
648
787
|
ref: ref,
|
649
788
|
attribute: attribute
|
650
789
|
})
|
651
790
|
else
|
652
|
-
|
791
|
+
visit_if(ctx__enumeration_ref)
|
653
792
|
end
|
654
793
|
end
|
655
794
|
|
656
|
-
def
|
657
|
-
|
658
|
-
|
659
|
-
|
660
|
-
|
661
|
-
|
662
|
-
|
663
|
-
|
664
|
-
|
665
|
-
|
666
|
-
|
795
|
+
def visit_enumeration_type(ctx)
|
796
|
+
ctx__EXTENSIBLE = ctx.EXTENSIBLE
|
797
|
+
ctx__enumeration_items = ctx.enumeration_items
|
798
|
+
ctx__enumeration_extension = ctx.enumeration_extension
|
799
|
+
ctx__enumeration_extension__type_ref = ctx__enumeration_extension&.type_ref
|
800
|
+
ctx__enumeration_extension__enumeration_items = ctx__enumeration_extension&.enumeration_items
|
801
|
+
|
802
|
+
extensible = !!ctx__EXTENSIBLE
|
803
|
+
items = visit_if(ctx__enumeration_items)
|
804
|
+
extension_type = visit_if(ctx__enumeration_extension__type_ref)
|
805
|
+
extension_items = visit_if(ctx__enumeration_extension__enumeration_items)
|
667
806
|
|
668
807
|
Model::Types::Enumeration.new({
|
669
808
|
extensible: extensible,
|
@@ -673,40 +812,38 @@ module Expressir
|
|
673
812
|
})
|
674
813
|
end
|
675
814
|
|
676
|
-
def
|
677
|
-
Model::Statements::Escape.new
|
815
|
+
def visit_escape_stmt(ctx)
|
816
|
+
Model::Statements::Escape.new
|
678
817
|
end
|
679
818
|
|
680
|
-
def
|
681
|
-
|
682
|
-
|
683
|
-
|
819
|
+
def visit_explicit_attr(ctx)
|
820
|
+
ctx__attribute_decl = ctx.attribute_decl
|
821
|
+
ctx__OPTIONAL = ctx.OPTIONAL
|
822
|
+
ctx__parameter_type = ctx.parameter_type
|
684
823
|
|
685
|
-
|
686
|
-
|
687
|
-
|
688
|
-
end
|
689
|
-
id = if decl.attributeId()
|
690
|
-
visit(decl.attributeId())
|
691
|
-
elsif decl.redeclaredAttribute() && decl.redeclaredAttribute().attributeId()
|
692
|
-
visit(decl.redeclaredAttribute().attributeId())
|
693
|
-
end
|
824
|
+
attributes = visit_if_map(ctx__attribute_decl)
|
825
|
+
optional = !!ctx__OPTIONAL
|
826
|
+
type = visit_if(ctx__parameter_type)
|
694
827
|
|
828
|
+
attributes.map do |attribute|
|
695
829
|
Model::Attribute.new({
|
830
|
+
id: attribute.id,
|
696
831
|
kind: Model::Attribute::EXPLICIT,
|
697
|
-
supertype_attribute: supertype_attribute,
|
698
|
-
id: id,
|
832
|
+
supertype_attribute: attribute.supertype_attribute,
|
699
833
|
optional: optional,
|
700
834
|
type: type
|
701
835
|
})
|
702
836
|
end
|
703
837
|
end
|
704
838
|
|
705
|
-
def
|
706
|
-
|
707
|
-
|
708
|
-
|
709
|
-
|
839
|
+
def visit_expression(ctx)
|
840
|
+
ctx__simple_expression = ctx.simple_expression
|
841
|
+
ctx__rel_op_extended = ctx.rel_op_extended
|
842
|
+
|
843
|
+
if ctx__simple_expression.length == 2
|
844
|
+
operator = visit_if(ctx__rel_op_extended)
|
845
|
+
operand1 = visit_if(ctx__simple_expression[0])
|
846
|
+
operand2 = visit_if(ctx__simple_expression[1])
|
710
847
|
|
711
848
|
Model::Expressions::BinaryExpression.new({
|
712
849
|
operator: operator,
|
@@ -714,29 +851,36 @@ module Expressir
|
|
714
851
|
operand2: operand2
|
715
852
|
})
|
716
853
|
else
|
717
|
-
|
854
|
+
visit_if(ctx__simple_expression[0])
|
718
855
|
end
|
719
856
|
end
|
720
857
|
|
721
|
-
def
|
722
|
-
|
858
|
+
def visit_factor(ctx)
|
859
|
+
ctx__simple_factor = ctx.simple_factor
|
860
|
+
|
861
|
+
if ctx__simple_factor.length == 2
|
723
862
|
operator = Model::Expressions::BinaryExpression::EXPONENTIATION
|
724
|
-
operand1 = visit(
|
725
|
-
operand2 = visit(
|
863
|
+
operand1 = visit(ctx__simple_factor[0])
|
864
|
+
operand2 = visit(ctx__simple_factor[1])
|
726
865
|
|
727
866
|
Model::Expressions::BinaryExpression.new({
|
728
867
|
operator: operator,
|
729
868
|
operand1: operand1,
|
730
869
|
operand2: operand2
|
731
870
|
})
|
871
|
+
elsif ctx__simple_factor.length == 1
|
872
|
+
visit_if(ctx__simple_factor[0])
|
732
873
|
else
|
733
|
-
|
874
|
+
raise 'Invalid state'
|
734
875
|
end
|
735
876
|
end
|
736
877
|
|
737
|
-
def
|
738
|
-
|
739
|
-
|
878
|
+
def visit_formal_parameter(ctx)
|
879
|
+
ctx__parameter_id = ctx.parameter_id
|
880
|
+
ctx__parameter_type = ctx.parameter_type
|
881
|
+
|
882
|
+
ids = visit_if_map(ctx__parameter_id)
|
883
|
+
type = visit_if(ctx__parameter_type)
|
740
884
|
|
741
885
|
ids.map do |id|
|
742
886
|
Model::Parameter.new({
|
@@ -746,17 +890,13 @@ module Expressir
|
|
746
890
|
end
|
747
891
|
end
|
748
892
|
|
749
|
-
def
|
750
|
-
|
751
|
-
|
752
|
-
|
753
|
-
|
754
|
-
|
755
|
-
|
756
|
-
end
|
757
|
-
parameters = if ctx.actualParameterList()
|
758
|
-
ctx.actualParameterList().parameter().map{|ctx| visit(ctx.expression)}
|
759
|
-
end
|
893
|
+
def visit_function_call(ctx)
|
894
|
+
ctx__built_in_function = ctx.built_in_function
|
895
|
+
ctx__function_ref = ctx.function_ref
|
896
|
+
ctx__actual_parameter_list = ctx.actual_parameter_list
|
897
|
+
|
898
|
+
ref = visit_if(ctx__built_in_function || ctx__function_ref)
|
899
|
+
parameters = visit_if(ctx__actual_parameter_list)
|
760
900
|
|
761
901
|
Model::Expressions::Call.new({
|
762
902
|
ref: ref,
|
@@ -764,19 +904,24 @@ module Expressir
|
|
764
904
|
})
|
765
905
|
end
|
766
906
|
|
767
|
-
def
|
768
|
-
|
769
|
-
|
770
|
-
|
771
|
-
|
772
|
-
|
773
|
-
|
774
|
-
|
775
|
-
|
776
|
-
|
777
|
-
|
778
|
-
|
779
|
-
|
907
|
+
def visit_function_decl(ctx)
|
908
|
+
ctx__function_head = ctx.function_head
|
909
|
+
ctx__algorithm_head = ctx.algorithm_head
|
910
|
+
ctx__stmt = ctx.stmt
|
911
|
+
ctx__function_head__function_id = ctx__function_head&.function_id
|
912
|
+
ctx__function_head__formal_parameter = ctx__function_head&.formal_parameter
|
913
|
+
ctx__function_head__parameter_type = ctx__function_head&.parameter_type
|
914
|
+
ctx__algorithm_head__declaration = ctx__algorithm_head&.declaration
|
915
|
+
ctx__algorithm_head__constant_decl = ctx__algorithm_head&.constant_decl
|
916
|
+
ctx__algorithm_head__local_decl = ctx__algorithm_head&.local_decl
|
917
|
+
|
918
|
+
id = visit_if(ctx__function_head__function_id)
|
919
|
+
parameters = visit_if_map_flatten(ctx__function_head__formal_parameter)
|
920
|
+
return_type = visit_if(ctx__function_head__parameter_type)
|
921
|
+
declarations = visit_if_map(ctx__algorithm_head__declaration)
|
922
|
+
constants = visit_if(ctx__algorithm_head__constant_decl)
|
923
|
+
variables = visit_if(ctx__algorithm_head__local_decl)
|
924
|
+
statements = visit_if_map(ctx__stmt)
|
780
925
|
|
781
926
|
Model::Function.new({
|
782
927
|
id: id,
|
@@ -789,52 +934,47 @@ module Expressir
|
|
789
934
|
})
|
790
935
|
end
|
791
936
|
|
792
|
-
def
|
937
|
+
def visit_function_head(ctx)
|
793
938
|
raise 'Invalid state'
|
794
939
|
end
|
795
940
|
|
796
|
-
def
|
797
|
-
|
941
|
+
def visit_function_id(ctx)
|
942
|
+
ctx__SimpleId = ctx.SimpleId
|
943
|
+
|
944
|
+
handle_simple_id(ctx__SimpleId)
|
798
945
|
end
|
799
946
|
|
800
|
-
def
|
801
|
-
|
802
|
-
|
803
|
-
|
804
|
-
|
805
|
-
|
806
|
-
|
807
|
-
elsif ctx.genericType()
|
808
|
-
visit(ctx.genericType())
|
809
|
-
else
|
810
|
-
raise 'Invalid state'
|
811
|
-
end
|
947
|
+
def visit_generalized_types(ctx)
|
948
|
+
ctx__aggregate_type = ctx.aggregate_type
|
949
|
+
ctx__general_aggregation_types = ctx.general_aggregation_types
|
950
|
+
ctx__generic_entity_type = ctx.generic_entity_type
|
951
|
+
ctx__generic_type = ctx.generic_type
|
952
|
+
|
953
|
+
visit_if(ctx__aggregate_type || ctx__general_aggregation_types || ctx__generic_entity_type || ctx__generic_type)
|
812
954
|
end
|
813
955
|
|
814
|
-
def
|
815
|
-
|
816
|
-
|
817
|
-
|
818
|
-
|
819
|
-
|
820
|
-
|
821
|
-
elsif ctx.generalSetType()
|
822
|
-
visit(ctx.generalSetType())
|
823
|
-
else
|
824
|
-
raise 'Invalid state'
|
825
|
-
end
|
956
|
+
def visit_general_aggregation_types(ctx)
|
957
|
+
ctx__general_array_type = ctx.general_array_type
|
958
|
+
ctx__general_bag_type = ctx.general_bag_type
|
959
|
+
ctx__general_list_type = ctx.general_list_type
|
960
|
+
ctx__general_set_type = ctx.general_set_type
|
961
|
+
|
962
|
+
visit_if(ctx__general_array_type || ctx__general_bag_type || ctx__general_list_type || ctx__general_set_type)
|
826
963
|
end
|
827
964
|
|
828
|
-
def
|
829
|
-
|
830
|
-
|
831
|
-
|
832
|
-
|
833
|
-
|
834
|
-
|
835
|
-
|
836
|
-
|
837
|
-
|
965
|
+
def visit_general_array_type(ctx)
|
966
|
+
ctx__bound_spec = ctx.bound_spec
|
967
|
+
ctx__OPTIONAL = ctx.OPTIONAL
|
968
|
+
ctx__UNIQUE = ctx.UNIQUE
|
969
|
+
ctx__parameter_type = ctx.parameter_type
|
970
|
+
ctx__bound_spec__bound1 = ctx__bound_spec&.bound1
|
971
|
+
ctx__bound_spec__bound2 = ctx__bound_spec&.bound2
|
972
|
+
|
973
|
+
bound1 = visit_if(ctx__bound_spec__bound1)
|
974
|
+
bound2 = visit_if(ctx__bound_spec__bound2)
|
975
|
+
optional = !!ctx__OPTIONAL
|
976
|
+
unique = !!ctx__UNIQUE
|
977
|
+
base_type = visit_if(ctx__parameter_type)
|
838
978
|
|
839
979
|
Model::Types::Array.new({
|
840
980
|
bound1: bound1,
|
@@ -845,14 +985,15 @@ module Expressir
|
|
845
985
|
})
|
846
986
|
end
|
847
987
|
|
848
|
-
def
|
849
|
-
|
850
|
-
|
851
|
-
|
852
|
-
|
853
|
-
|
854
|
-
|
855
|
-
|
988
|
+
def visit_general_bag_type(ctx)
|
989
|
+
ctx__bound_spec = ctx.bound_spec
|
990
|
+
ctx__parameter_type = ctx.parameter_type
|
991
|
+
ctx__bound_spec__bound1 = ctx__bound_spec&.bound1
|
992
|
+
ctx__bound_spec__bound2 = ctx__bound_spec&.bound2
|
993
|
+
|
994
|
+
bound1 = visit_if(ctx__bound_spec__bound1)
|
995
|
+
bound2 = visit_if(ctx__bound_spec__bound2)
|
996
|
+
base_type = visit_if(ctx__parameter_type)
|
856
997
|
|
857
998
|
Model::Types::Bag.new({
|
858
999
|
bound1: bound1,
|
@@ -861,15 +1002,17 @@ module Expressir
|
|
861
1002
|
})
|
862
1003
|
end
|
863
1004
|
|
864
|
-
def
|
865
|
-
|
866
|
-
|
867
|
-
|
868
|
-
|
869
|
-
|
870
|
-
|
871
|
-
|
872
|
-
|
1005
|
+
def visit_general_list_type(ctx)
|
1006
|
+
ctx__bound_spec = ctx.bound_spec
|
1007
|
+
ctx__UNIQUE = ctx.UNIQUE
|
1008
|
+
ctx__parameter_type = ctx.parameter_type
|
1009
|
+
ctx__bound_spec__bound1 = ctx__bound_spec&.bound1
|
1010
|
+
ctx__bound_spec__bound2 = ctx__bound_spec&.bound2
|
1011
|
+
|
1012
|
+
bound1 = visit_if(ctx__bound_spec__bound1)
|
1013
|
+
bound2 = visit_if(ctx__bound_spec__bound2)
|
1014
|
+
unique = !!ctx__UNIQUE
|
1015
|
+
base_type = visit_if(ctx__parameter_type)
|
873
1016
|
|
874
1017
|
Model::Types::List.new({
|
875
1018
|
bound1: bound1,
|
@@ -879,24 +1022,22 @@ module Expressir
|
|
879
1022
|
})
|
880
1023
|
end
|
881
1024
|
|
882
|
-
def
|
883
|
-
|
884
|
-
|
885
|
-
|
886
|
-
|
887
|
-
else
|
888
|
-
raise 'Invalid state'
|
889
|
-
end
|
1025
|
+
def visit_general_ref(ctx)
|
1026
|
+
ctx__parameter_ref = ctx.parameter_ref
|
1027
|
+
ctx__variable_id = ctx.variable_id
|
1028
|
+
|
1029
|
+
visit_if(ctx__parameter_ref || ctx__variable_id)
|
890
1030
|
end
|
891
1031
|
|
892
|
-
def
|
893
|
-
|
894
|
-
|
895
|
-
|
896
|
-
|
897
|
-
|
898
|
-
|
899
|
-
|
1032
|
+
def visit_general_set_type(ctx)
|
1033
|
+
ctx__bound_spec = ctx.bound_spec
|
1034
|
+
ctx__parameter_type = ctx.parameter_type
|
1035
|
+
ctx__bound_spec__bound1 = ctx__bound_spec&.bound1
|
1036
|
+
ctx__bound_spec__bound2 = ctx__bound_spec&.bound2
|
1037
|
+
|
1038
|
+
bound1 = visit_if(ctx__bound_spec__bound1)
|
1039
|
+
bound2 = visit_if(ctx__bound_spec__bound2)
|
1040
|
+
base_type = visit_if(ctx__parameter_type)
|
900
1041
|
|
901
1042
|
Model::Types::Set.new({
|
902
1043
|
bound1: bound1,
|
@@ -905,46 +1046,48 @@ module Expressir
|
|
905
1046
|
})
|
906
1047
|
end
|
907
1048
|
|
908
|
-
def
|
909
|
-
|
910
|
-
|
911
|
-
|
1049
|
+
def visit_generic_entity_type(ctx)
|
1050
|
+
ctx__type_label = ctx.type_label
|
1051
|
+
|
1052
|
+
id = visit_if(ctx__type_label)
|
912
1053
|
|
913
1054
|
Model::Types::GenericEntity.new({
|
914
|
-
|
1055
|
+
id: id
|
915
1056
|
})
|
916
1057
|
end
|
917
1058
|
|
918
|
-
def
|
919
|
-
|
920
|
-
|
921
|
-
|
1059
|
+
def visit_generic_type(ctx)
|
1060
|
+
ctx__type_label = ctx.type_label
|
1061
|
+
|
1062
|
+
id = visit_if(ctx__type_label)
|
922
1063
|
|
923
1064
|
Model::Types::Generic.new({
|
924
|
-
|
1065
|
+
id: id
|
925
1066
|
})
|
926
1067
|
end
|
927
1068
|
|
928
|
-
def
|
1069
|
+
def visit_group_qualifier(ctx)
|
1070
|
+
ctx__entity_ref = ctx.entity_ref
|
1071
|
+
|
1072
|
+
entity = visit_if(ctx__entity_ref)
|
1073
|
+
|
1074
|
+
Model::Expressions::GroupReference.new({
|
1075
|
+
entity: entity
|
1076
|
+
})
|
1077
|
+
end
|
1078
|
+
|
1079
|
+
def visit_group_reference(ctx)
|
929
1080
|
raise 'Invalid state'
|
930
1081
|
end
|
931
1082
|
|
932
|
-
def
|
933
|
-
|
934
|
-
|
935
|
-
|
936
|
-
|
937
|
-
|
938
|
-
|
939
|
-
|
940
|
-
statements = if else_statement_index
|
941
|
-
ctx.stmt()[0..(else_statement_index - 1)].map{|ctx| visit(ctx)}
|
942
|
-
else
|
943
|
-
ctx.stmt().map{|ctx| visit(ctx)}
|
944
|
-
end
|
945
|
-
else_statements = if else_statement_index
|
946
|
-
ctx.stmt()[else_statement_index..(ctx.stmt().length - 1)].map{|ctx| visit(ctx)}
|
947
|
-
end
|
1083
|
+
def visit_if_stmt(ctx)
|
1084
|
+
ctx__logical_expression = ctx.logical_expression
|
1085
|
+
ctx__if_stmt_statements = ctx.if_stmt_statements
|
1086
|
+
ctx__if_stmt_else_statements = ctx.if_stmt_else_statements
|
1087
|
+
|
1088
|
+
expression = visit_if(ctx__logical_expression)
|
1089
|
+
statements = visit_if(ctx__if_stmt_statements)
|
1090
|
+
else_statements = visit_if(ctx__if_stmt_else_statements)
|
948
1091
|
|
949
1092
|
Model::Statements::If.new({
|
950
1093
|
expression: expression,
|
@@ -953,60 +1096,92 @@ module Expressir
|
|
953
1096
|
})
|
954
1097
|
end
|
955
1098
|
|
956
|
-
def
|
957
|
-
|
1099
|
+
def visit_if_stmt_statements(ctx)
|
1100
|
+
ctx__stmt = ctx.stmt
|
1101
|
+
|
1102
|
+
visit_if_map(ctx__stmt)
|
958
1103
|
end
|
959
1104
|
|
960
|
-
def
|
961
|
-
|
1105
|
+
def visit_if_stmt_else_statements(ctx)
|
1106
|
+
ctx__stmt = ctx.stmt
|
1107
|
+
|
1108
|
+
visit_if_map(ctx__stmt)
|
962
1109
|
end
|
963
1110
|
|
964
|
-
def
|
965
|
-
|
1111
|
+
def visit_increment(ctx)
|
1112
|
+
ctx__numeric_expression = ctx.numeric_expression
|
1113
|
+
|
1114
|
+
visit_if(ctx__numeric_expression)
|
966
1115
|
end
|
967
1116
|
|
968
|
-
def
|
1117
|
+
def visit_increment_control(ctx)
|
969
1118
|
raise 'Invalid state'
|
970
1119
|
end
|
971
1120
|
|
972
|
-
def
|
973
|
-
|
1121
|
+
def visit_index(ctx)
|
1122
|
+
ctx__numeric_expression = ctx.numeric_expression
|
1123
|
+
|
1124
|
+
visit_if(ctx__numeric_expression)
|
974
1125
|
end
|
975
1126
|
|
976
|
-
def
|
1127
|
+
def visit_index1(ctx)
|
1128
|
+
ctx__index = ctx.index
|
1129
|
+
|
1130
|
+
visit_if(ctx__index)
|
1131
|
+
end
|
1132
|
+
|
1133
|
+
def visit_index2(ctx)
|
1134
|
+
ctx__index = ctx.index
|
1135
|
+
|
1136
|
+
visit_if(ctx__index)
|
1137
|
+
end
|
1138
|
+
|
1139
|
+
def visit_index_qualifier(ctx)
|
1140
|
+
ctx__index1 = ctx.index1
|
1141
|
+
ctx__index2 = ctx.index2
|
1142
|
+
|
1143
|
+
index1 = visit_if(ctx__index1)
|
1144
|
+
index2 = visit_if(ctx__index2)
|
1145
|
+
|
1146
|
+
Model::Expressions::IndexReference.new({
|
1147
|
+
index1: index1,
|
1148
|
+
index2: index2
|
1149
|
+
})
|
1150
|
+
end
|
1151
|
+
|
1152
|
+
def visit_index_reference(ctx)
|
977
1153
|
raise 'Invalid state'
|
978
1154
|
end
|
979
1155
|
|
980
|
-
def
|
981
|
-
|
982
|
-
|
983
|
-
|
984
|
-
|
985
|
-
else
|
986
|
-
raise 'Invalid state'
|
987
|
-
end
|
1156
|
+
def visit_instantiable_type(ctx)
|
1157
|
+
ctx__concrete_types = ctx.concrete_types
|
1158
|
+
ctx__entity_ref = ctx.entity_ref
|
1159
|
+
|
1160
|
+
visit_if(ctx__concrete_types || ctx__entity_ref)
|
988
1161
|
end
|
989
1162
|
|
990
|
-
def
|
991
|
-
Model::Types::Integer.new
|
1163
|
+
def visit_integer_type(ctx)
|
1164
|
+
Model::Types::Integer.new
|
992
1165
|
end
|
993
1166
|
|
994
|
-
def
|
995
|
-
|
996
|
-
|
997
|
-
|
998
|
-
|
999
|
-
else
|
1000
|
-
raise 'Invalid state'
|
1001
|
-
end
|
1167
|
+
def visit_interface_specification(ctx)
|
1168
|
+
ctx__reference_clause = ctx.reference_clause
|
1169
|
+
ctx__use_clause = ctx.use_clause
|
1170
|
+
|
1171
|
+
visit_if(ctx__reference_clause || ctx__use_clause)
|
1002
1172
|
end
|
1003
1173
|
|
1004
|
-
def
|
1005
|
-
|
1006
|
-
|
1007
|
-
|
1008
|
-
|
1009
|
-
|
1174
|
+
def visit_interval(ctx)
|
1175
|
+
ctx__interval_low = ctx.interval_low
|
1176
|
+
ctx__interval_op = ctx.interval_op
|
1177
|
+
ctx__interval_item = ctx.interval_item
|
1178
|
+
ctx__interval_high = ctx.interval_high
|
1179
|
+
|
1180
|
+
low = visit_if(ctx__interval_low)
|
1181
|
+
operator1 = visit_if(ctx__interval_op[0])
|
1182
|
+
item = visit_if(ctx__interval_item)
|
1183
|
+
operator2 = visit_if(ctx__interval_op[1])
|
1184
|
+
high = visit_if(ctx__interval_high)
|
1010
1185
|
|
1011
1186
|
Model::Expressions::Interval.new({
|
1012
1187
|
low: low,
|
@@ -1017,59 +1192,89 @@ module Expressir
|
|
1017
1192
|
})
|
1018
1193
|
end
|
1019
1194
|
|
1020
|
-
def
|
1021
|
-
|
1195
|
+
def visit_interval_high(ctx)
|
1196
|
+
ctx__simple_expression = ctx.simple_expression
|
1197
|
+
|
1198
|
+
visit_if(ctx__simple_expression)
|
1022
1199
|
end
|
1023
1200
|
|
1024
|
-
def
|
1025
|
-
|
1201
|
+
def visit_interval_item(ctx)
|
1202
|
+
ctx__simple_expression = ctx.simple_expression
|
1203
|
+
|
1204
|
+
visit_if(ctx__simple_expression)
|
1026
1205
|
end
|
1027
1206
|
|
1028
|
-
def
|
1029
|
-
|
1207
|
+
def visit_interval_low(ctx)
|
1208
|
+
ctx__simple_expression = ctx.simple_expression
|
1209
|
+
|
1210
|
+
visit_if(ctx__simple_expression)
|
1030
1211
|
end
|
1031
1212
|
|
1032
|
-
def
|
1033
|
-
|
1213
|
+
def visit_interval_op(ctx)
|
1214
|
+
ctx__text = ctx.text
|
1215
|
+
ctx__LESS_THAN = ctx__text == '<'
|
1216
|
+
ctx__LESS_THAN_OR_EQUAL = ctx__text == '<='
|
1217
|
+
|
1218
|
+
if ctx__LESS_THAN
|
1034
1219
|
Model::Expressions::BinaryExpression::LESS_THAN
|
1035
|
-
elsif
|
1220
|
+
elsif ctx__LESS_THAN_OR_EQUAL
|
1036
1221
|
Model::Expressions::BinaryExpression::LESS_THAN_OR_EQUAL
|
1037
1222
|
else
|
1038
1223
|
raise 'Invalid state'
|
1039
1224
|
end
|
1040
1225
|
end
|
1041
1226
|
|
1042
|
-
def
|
1043
|
-
|
1044
|
-
|
1045
|
-
|
1046
|
-
|
1047
|
-
|
1048
|
-
|
1049
|
-
|
1227
|
+
def visit_inverse_attr(ctx)
|
1228
|
+
ctx__attribute_decl = ctx.attribute_decl
|
1229
|
+
ctx__inverse_attr_type = ctx.inverse_attr_type
|
1230
|
+
ctx__entity_ref = ctx.entity_ref
|
1231
|
+
ctx__attribute_ref = ctx.attribute_ref
|
1232
|
+
|
1233
|
+
attribute = visit_if(ctx__attribute_decl)
|
1234
|
+
type = visit_if(ctx__inverse_attr_type)
|
1235
|
+
expression = if ctx__entity_ref
|
1236
|
+
ref = visit(ctx__entity_ref)
|
1237
|
+
attribute_ref = visit(ctx__attribute_ref)
|
1238
|
+
|
1239
|
+
Model::Expressions::AttributeReference.new({
|
1240
|
+
ref: ref,
|
1241
|
+
attribute: attribute_ref
|
1242
|
+
})
|
1243
|
+
else
|
1244
|
+
visit(ctx__attribute_ref)
|
1050
1245
|
end
|
1051
|
-
|
1052
|
-
|
1053
|
-
|
1054
|
-
|
1055
|
-
|
1056
|
-
|
1057
|
-
|
1058
|
-
|
1246
|
+
|
1247
|
+
Model::Attribute.new({
|
1248
|
+
id: attribute.id,
|
1249
|
+
kind: Model::Attribute::INVERSE,
|
1250
|
+
supertype_attribute: attribute.supertype_attribute,
|
1251
|
+
type: type,
|
1252
|
+
expression: expression
|
1253
|
+
})
|
1254
|
+
end
|
1255
|
+
|
1256
|
+
def visit_inverse_attr_type(ctx)
|
1257
|
+
ctx__SET = ctx.SET
|
1258
|
+
ctx__BAG = ctx.BAG
|
1259
|
+
ctx__bound_spec = ctx.bound_spec
|
1260
|
+
ctx__entity_ref = ctx.entity_ref
|
1261
|
+
ctx__bound_spec__bound1 = ctx__bound_spec&.bound1
|
1262
|
+
ctx__bound_spec__bound2 = ctx__bound_spec&.bound2
|
1263
|
+
|
1264
|
+
if ctx__SET
|
1265
|
+
bound1 = visit_if(ctx__bound_spec__bound1)
|
1266
|
+
bound2 = visit_if(ctx__bound_spec__bound2)
|
1267
|
+
base_type = visit_if(ctx__entity_ref)
|
1059
1268
|
|
1060
1269
|
Model::Types::Set.new({
|
1061
1270
|
bound1: bound1,
|
1062
1271
|
bound2: bound2,
|
1063
1272
|
base_type: base_type
|
1064
1273
|
})
|
1065
|
-
elsif
|
1066
|
-
bound1 =
|
1067
|
-
|
1068
|
-
|
1069
|
-
bound2 = if ctx.boundSpec()
|
1070
|
-
visit(ctx.boundSpec().bound2().numericExpression().simpleExpression())
|
1071
|
-
end
|
1072
|
-
base_type = visit(ctx.entityRef()[0])
|
1274
|
+
elsif ctx__BAG
|
1275
|
+
bound1 = visit_if(ctx__bound_spec__bound1)
|
1276
|
+
bound2 = visit_if(ctx__bound_spec__bound2)
|
1277
|
+
base_type = visit_if(ctx__entity_ref)
|
1073
1278
|
|
1074
1279
|
Model::Types::Bag.new({
|
1075
1280
|
bound1: bound1,
|
@@ -1077,42 +1282,27 @@ module Expressir
|
|
1077
1282
|
base_type: base_type
|
1078
1283
|
})
|
1079
1284
|
else
|
1080
|
-
|
1285
|
+
visit_if(ctx__entity_ref)
|
1081
1286
|
end
|
1082
|
-
|
1083
|
-
ref = visit(ctx.entityRef()[1])
|
1084
|
-
attribute = visit(ctx.attributeRef())
|
1287
|
+
end
|
1085
1288
|
|
1086
|
-
|
1087
|
-
|
1088
|
-
attribute: attribute
|
1089
|
-
})
|
1090
|
-
else
|
1091
|
-
visit(ctx.attributeRef())
|
1092
|
-
end
|
1289
|
+
def visit_inverse_clause(ctx)
|
1290
|
+
ctx__inverse_attr = ctx.inverse_attr
|
1093
1291
|
|
1094
|
-
|
1095
|
-
kind: Model::Attribute::INVERSE,
|
1096
|
-
supertype_attribute: supertype_attribute,
|
1097
|
-
id: id,
|
1098
|
-
type: type,
|
1099
|
-
expression: expression
|
1100
|
-
})
|
1292
|
+
visit_if_map(ctx__inverse_attr)
|
1101
1293
|
end
|
1102
1294
|
|
1103
|
-
def
|
1104
|
-
|
1105
|
-
|
1295
|
+
def visit_list_type(ctx)
|
1296
|
+
ctx__bound_spec = ctx.bound_spec
|
1297
|
+
ctx__UNIQUE = ctx.UNIQUE
|
1298
|
+
ctx__instantiable_type = ctx.instantiable_type
|
1299
|
+
ctx__bound_spec__bound1 = ctx__bound_spec&.bound1
|
1300
|
+
ctx__bound_spec__bound2 = ctx__bound_spec&.bound2
|
1106
1301
|
|
1107
|
-
|
1108
|
-
|
1109
|
-
|
1110
|
-
|
1111
|
-
bound2 = if ctx.boundSpec()
|
1112
|
-
visit(ctx.boundSpec().bound2().numericExpression().simpleExpression())
|
1113
|
-
end
|
1114
|
-
unique = !!ctx.UNIQUE()
|
1115
|
-
base_type = visit(ctx.instantiableType())
|
1302
|
+
bound1 = visit_if(ctx__bound_spec__bound1)
|
1303
|
+
bound2 = visit_if(ctx__bound_spec__bound2)
|
1304
|
+
unique = !!ctx__UNIQUE
|
1305
|
+
base_type = visit_if(ctx__instantiable_type)
|
1116
1306
|
|
1117
1307
|
Model::Types::List.new({
|
1118
1308
|
bound1: bound1,
|
@@ -1122,32 +1312,42 @@ module Expressir
|
|
1122
1312
|
})
|
1123
1313
|
end
|
1124
1314
|
|
1125
|
-
def
|
1126
|
-
|
1127
|
-
|
1128
|
-
|
1129
|
-
|
1130
|
-
|
1131
|
-
|
1132
|
-
|
1133
|
-
|
1134
|
-
elsif
|
1135
|
-
|
1315
|
+
def visit_literal(ctx)
|
1316
|
+
ctx__BinaryLiteral = ctx.BinaryLiteral
|
1317
|
+
ctx__IntegerLiteral = ctx.IntegerLiteral
|
1318
|
+
ctx__logical_literal = ctx.logical_literal
|
1319
|
+
ctx__RealLiteral = ctx.RealLiteral
|
1320
|
+
ctx__string_literal = ctx.string_literal
|
1321
|
+
|
1322
|
+
if ctx__BinaryLiteral
|
1323
|
+
handle_binary_literal(ctx__BinaryLiteral)
|
1324
|
+
elsif ctx__IntegerLiteral
|
1325
|
+
handle_integer_literal(ctx__IntegerLiteral)
|
1326
|
+
elsif ctx__logical_literal
|
1327
|
+
visit(ctx__logical_literal)
|
1328
|
+
elsif ctx__RealLiteral
|
1329
|
+
handle_real_literal(ctx__RealLiteral)
|
1330
|
+
elsif ctx__string_literal
|
1331
|
+
visit(ctx__string_literal)
|
1136
1332
|
else
|
1137
1333
|
raise 'Invalid state'
|
1138
1334
|
end
|
1139
1335
|
end
|
1140
1336
|
|
1141
|
-
def
|
1142
|
-
|
1337
|
+
def visit_local_decl(ctx)
|
1338
|
+
ctx__local_variable = ctx.local_variable
|
1339
|
+
|
1340
|
+
visit_if_map_flatten(ctx__local_variable)
|
1143
1341
|
end
|
1144
1342
|
|
1145
|
-
def
|
1146
|
-
|
1147
|
-
|
1148
|
-
|
1149
|
-
|
1150
|
-
|
1343
|
+
def visit_local_variable(ctx)
|
1344
|
+
ctx__variable_id = ctx.variable_id
|
1345
|
+
ctx__parameter_type = ctx.parameter_type
|
1346
|
+
ctx__expression = ctx.expression
|
1347
|
+
|
1348
|
+
ids = visit_if_map(ctx__variable_id)
|
1349
|
+
type = visit_if(ctx__parameter_type)
|
1350
|
+
expression = visit_if(ctx__expression)
|
1151
1351
|
|
1152
1352
|
ids.map do |id|
|
1153
1353
|
Model::Variable.new({
|
@@ -1158,16 +1358,22 @@ module Expressir
|
|
1158
1358
|
end
|
1159
1359
|
end
|
1160
1360
|
|
1161
|
-
def
|
1162
|
-
|
1361
|
+
def visit_logical_expression(ctx)
|
1362
|
+
ctx__expression = ctx.expression
|
1363
|
+
|
1364
|
+
visit_if(ctx__expression)
|
1163
1365
|
end
|
1164
1366
|
|
1165
|
-
def
|
1166
|
-
|
1367
|
+
def visit_logical_literal(ctx)
|
1368
|
+
ctx__TRUE = ctx.TRUE
|
1369
|
+
ctx__FALSE = ctx.FALSE
|
1370
|
+
ctx__UNKNOWN = ctx.UNKNOWN
|
1371
|
+
|
1372
|
+
value = if ctx__TRUE
|
1167
1373
|
Model::Literals::Logical::TRUE
|
1168
|
-
elsif
|
1374
|
+
elsif ctx__FALSE
|
1169
1375
|
Model::Literals::Logical::FALSE
|
1170
|
-
elsif
|
1376
|
+
elsif ctx__UNKNOWN
|
1171
1377
|
Model::Literals::Logical::UNKNOWN
|
1172
1378
|
else
|
1173
1379
|
raise 'Invalid state'
|
@@ -1178,71 +1384,80 @@ module Expressir
|
|
1178
1384
|
})
|
1179
1385
|
end
|
1180
1386
|
|
1181
|
-
def
|
1182
|
-
Model::Types::Logical.new
|
1387
|
+
def visit_logical_type(ctx)
|
1388
|
+
Model::Types::Logical.new
|
1183
1389
|
end
|
1184
1390
|
|
1185
|
-
def
|
1186
|
-
|
1391
|
+
def visit_multiplication_like_op(ctx)
|
1392
|
+
ctx__text = ctx.text
|
1393
|
+
ctx__MULTIPLICATION = ctx__text == '*'
|
1394
|
+
ctx__REAL_DIVISION = ctx__text == '/'
|
1395
|
+
ctx__INTEGER_DIVISION = ctx.DIV
|
1396
|
+
ctx__MODULO = ctx.MOD
|
1397
|
+
ctx__AND = ctx.AND
|
1398
|
+
ctx__COMBINE = ctx__text == '||'
|
1399
|
+
|
1400
|
+
if ctx__MULTIPLICATION
|
1187
1401
|
Model::Expressions::BinaryExpression::MULTIPLICATION
|
1188
|
-
elsif
|
1402
|
+
elsif ctx__REAL_DIVISION
|
1189
1403
|
Model::Expressions::BinaryExpression::REAL_DIVISION
|
1190
|
-
elsif
|
1404
|
+
elsif ctx__INTEGER_DIVISION
|
1191
1405
|
Model::Expressions::BinaryExpression::INTEGER_DIVISION
|
1192
|
-
elsif
|
1406
|
+
elsif ctx__MODULO
|
1193
1407
|
Model::Expressions::BinaryExpression::MODULO
|
1194
|
-
elsif
|
1408
|
+
elsif ctx__AND
|
1195
1409
|
Model::Expressions::BinaryExpression::AND
|
1196
|
-
elsif
|
1410
|
+
elsif ctx__COMBINE
|
1197
1411
|
Model::Expressions::BinaryExpression::COMBINE
|
1198
1412
|
else
|
1199
1413
|
raise 'Invalid state'
|
1200
1414
|
end
|
1201
1415
|
end
|
1202
1416
|
|
1203
|
-
def
|
1204
|
-
|
1205
|
-
|
1206
|
-
|
1207
|
-
|
1208
|
-
else
|
1209
|
-
raise 'Invalid state'
|
1210
|
-
end
|
1417
|
+
def visit_named_types(ctx)
|
1418
|
+
ctx__entity_ref = ctx.entity_ref
|
1419
|
+
ctx__type_ref = ctx.type_ref
|
1420
|
+
|
1421
|
+
visit_if(ctx__entity_ref || ctx__type_ref)
|
1211
1422
|
end
|
1212
1423
|
|
1213
|
-
def
|
1214
|
-
|
1215
|
-
|
1216
|
-
|
1217
|
-
visit(ctx.entityId())
|
1218
|
-
elsif ctx.typeId()
|
1219
|
-
visit(ctx.typeId())
|
1220
|
-
end
|
1424
|
+
def visit_named_type_or_rename(ctx)
|
1425
|
+
ctx__named_types = ctx.named_types
|
1426
|
+
ctx__entity_id = ctx.entity_id
|
1427
|
+
ctx__type_id = ctx.type_id
|
1221
1428
|
|
1429
|
+
ref = visit_if(ctx__named_types)
|
1430
|
+
id = visit_if(ctx__entity_id || ctx__type_id)
|
1431
|
+
|
1432
|
+
if id
|
1222
1433
|
Model::RenamedRef.new({
|
1223
1434
|
ref: ref,
|
1224
1435
|
id: id
|
1225
1436
|
})
|
1226
1437
|
else
|
1227
|
-
|
1438
|
+
ref
|
1228
1439
|
end
|
1229
1440
|
end
|
1230
1441
|
|
1231
|
-
def
|
1232
|
-
Model::Statements::Null.new
|
1442
|
+
def visit_null_stmt(ctx)
|
1443
|
+
Model::Statements::Null.new
|
1233
1444
|
end
|
1234
1445
|
|
1235
|
-
def
|
1236
|
-
Model::Types::Number.new
|
1446
|
+
def visit_number_type(ctx)
|
1447
|
+
Model::Types::Number.new
|
1237
1448
|
end
|
1238
1449
|
|
1239
|
-
def
|
1240
|
-
|
1450
|
+
def visit_numeric_expression(ctx)
|
1451
|
+
ctx__simple_expression = ctx.simple_expression
|
1452
|
+
|
1453
|
+
visit_if(ctx__simple_expression)
|
1241
1454
|
end
|
1242
1455
|
|
1243
|
-
def
|
1456
|
+
def visit_one_of(ctx)
|
1457
|
+
ctx__supertype_expression = ctx.supertype_expression
|
1458
|
+
|
1244
1459
|
ref = Model::Expressions::SimpleReference.new({ id: 'ONEOF' })
|
1245
|
-
parameters =
|
1460
|
+
parameters = visit_if_map(ctx__supertype_expression)
|
1246
1461
|
|
1247
1462
|
Model::Expressions::Call.new({
|
1248
1463
|
ref: ref,
|
@@ -1250,55 +1465,59 @@ module Expressir
|
|
1250
1465
|
})
|
1251
1466
|
end
|
1252
1467
|
|
1253
|
-
def
|
1254
|
-
|
1468
|
+
def visit_parameter(ctx)
|
1469
|
+
ctx__expression = ctx.expression
|
1470
|
+
|
1471
|
+
visit_if(ctx__expression)
|
1255
1472
|
end
|
1256
1473
|
|
1257
|
-
def
|
1258
|
-
|
1474
|
+
def visit_parameter_id(ctx)
|
1475
|
+
ctx__SimpleId = ctx.SimpleId
|
1476
|
+
|
1477
|
+
handle_simple_id(ctx__SimpleId)
|
1259
1478
|
end
|
1260
1479
|
|
1261
|
-
def
|
1262
|
-
|
1263
|
-
|
1264
|
-
|
1265
|
-
|
1266
|
-
|
1267
|
-
visit(ctx.simpleTypes())
|
1268
|
-
else
|
1269
|
-
raise 'Invalid state'
|
1270
|
-
end
|
1480
|
+
def visit_parameter_type(ctx)
|
1481
|
+
ctx__generalized_types = ctx.generalized_types
|
1482
|
+
ctx__named_types = ctx.named_types
|
1483
|
+
ctx__simple_types = ctx.simple_types
|
1484
|
+
|
1485
|
+
visit_if(ctx__generalized_types || ctx__named_types || ctx__simple_types)
|
1271
1486
|
end
|
1272
1487
|
|
1273
|
-
def
|
1274
|
-
|
1488
|
+
def visit_population(ctx)
|
1489
|
+
ctx__entity_ref = ctx.entity_ref
|
1490
|
+
|
1491
|
+
visit_if(ctx__entity_ref)
|
1275
1492
|
end
|
1276
1493
|
|
1277
|
-
def
|
1278
|
-
|
1494
|
+
def visit_precision_spec(ctx)
|
1495
|
+
ctx__numeric_expression = ctx.numeric_expression
|
1496
|
+
|
1497
|
+
visit_if(ctx__numeric_expression)
|
1279
1498
|
end
|
1280
1499
|
|
1281
|
-
def
|
1282
|
-
|
1283
|
-
|
1284
|
-
|
1285
|
-
|
1500
|
+
def visit_primary(ctx)
|
1501
|
+
ctx__literal = ctx.literal
|
1502
|
+
ctx__qualifiable_factor = ctx.qualifiable_factor
|
1503
|
+
ctx__qualifier = ctx.qualifier
|
1504
|
+
|
1505
|
+
if ctx__literal
|
1506
|
+
visit(ctx__literal)
|
1507
|
+
elsif ctx__qualifiable_factor
|
1508
|
+
handle_qualified_ref(visit(ctx__qualifiable_factor), ctx__qualifier)
|
1286
1509
|
else
|
1287
1510
|
raise 'Invalid state'
|
1288
1511
|
end
|
1289
1512
|
end
|
1290
1513
|
|
1291
|
-
def
|
1292
|
-
|
1293
|
-
|
1294
|
-
|
1295
|
-
|
1296
|
-
|
1297
|
-
|
1298
|
-
end
|
1299
|
-
parameters = if ctx.actualParameterList()
|
1300
|
-
ctx.actualParameterList().parameter().map{|ctx| visit(ctx.expression)}
|
1301
|
-
end
|
1514
|
+
def visit_procedure_call_stmt(ctx)
|
1515
|
+
ctx__built_in_procedure = ctx.built_in_procedure
|
1516
|
+
ctx__procedure_ref = ctx.procedure_ref
|
1517
|
+
ctx__actual_parameter_list = ctx.actual_parameter_list
|
1518
|
+
|
1519
|
+
ref = visit_if(ctx__built_in_procedure || ctx__procedure_ref)
|
1520
|
+
parameters = visit_if(ctx__actual_parameter_list)
|
1302
1521
|
|
1303
1522
|
Model::Statements::Call.new({
|
1304
1523
|
ref: ref,
|
@@ -1306,32 +1525,22 @@ module Expressir
|
|
1306
1525
|
})
|
1307
1526
|
end
|
1308
1527
|
|
1309
|
-
def
|
1310
|
-
|
1311
|
-
|
1312
|
-
|
1313
|
-
|
1314
|
-
|
1315
|
-
|
1316
|
-
|
1317
|
-
|
1318
|
-
|
1319
|
-
|
1320
|
-
|
1321
|
-
|
1322
|
-
|
1323
|
-
|
1324
|
-
|
1325
|
-
end
|
1326
|
-
end.flatten
|
1327
|
-
declarations = ctx.algorithmHead().declaration().map{|ctx| visit(ctx)}
|
1328
|
-
constants = if ctx.algorithmHead().constantDecl()
|
1329
|
-
ctx.algorithmHead().constantDecl().constantBody().map{|ctx| visit(ctx)}
|
1330
|
-
end
|
1331
|
-
variables = if ctx.algorithmHead().localDecl()
|
1332
|
-
ctx.algorithmHead().localDecl().localVariable().map{|ctx| visit(ctx)}.flatten
|
1333
|
-
end
|
1334
|
-
statements = ctx.stmt().map{|ctx| visit(ctx)}
|
1528
|
+
def visit_procedure_decl(ctx)
|
1529
|
+
ctx__procedure_head = ctx.procedure_head
|
1530
|
+
ctx__algorithm_head = ctx.algorithm_head
|
1531
|
+
ctx__stmt = ctx.stmt
|
1532
|
+
ctx__procedure_head__procedure_id = ctx__procedure_head&.procedure_id
|
1533
|
+
ctx__procedure_head__procedure_head_parameter = ctx__procedure_head&.procedure_head_parameter
|
1534
|
+
ctx__algorithm_head__declaration = ctx__algorithm_head&.declaration
|
1535
|
+
ctx__algorithm_head__constant_decl = ctx__algorithm_head&.constant_decl
|
1536
|
+
ctx__algorithm_head__local_decl = ctx__algorithm_head&.local_decl
|
1537
|
+
|
1538
|
+
id = visit_if(ctx__procedure_head__procedure_id)
|
1539
|
+
parameters = visit_if_map_flatten(ctx__procedure_head__procedure_head_parameter)
|
1540
|
+
declarations = visit_if_map(ctx__algorithm_head__declaration)
|
1541
|
+
constants = visit_if(ctx__algorithm_head__constant_decl)
|
1542
|
+
variables = visit_if(ctx__algorithm_head__local_decl)
|
1543
|
+
statements = visit_if_map(ctx__stmt)
|
1335
1544
|
|
1336
1545
|
Model::Procedure.new({
|
1337
1546
|
id: id,
|
@@ -1343,97 +1552,115 @@ module Expressir
|
|
1343
1552
|
})
|
1344
1553
|
end
|
1345
1554
|
|
1346
|
-
def
|
1555
|
+
def visit_procedure_head(ctx)
|
1347
1556
|
raise 'Invalid state'
|
1348
1557
|
end
|
1349
1558
|
|
1350
|
-
def
|
1351
|
-
|
1352
|
-
|
1559
|
+
def visit_procedure_head_parameter(ctx)
|
1560
|
+
ctx__formal_parameter = ctx.formal_parameter
|
1561
|
+
ctx__VAR = ctx.VAR
|
1353
1562
|
|
1354
|
-
|
1355
|
-
|
1356
|
-
|
1357
|
-
|
1358
|
-
|
1359
|
-
|
1360
|
-
|
1361
|
-
|
1362
|
-
|
1363
|
-
|
1364
|
-
visit(ctx.population().entityRef())
|
1563
|
+
parameters = visit(ctx__formal_parameter)
|
1564
|
+
|
1565
|
+
if ctx.VAR
|
1566
|
+
parameters.map do |parameter|
|
1567
|
+
Model::Parameter.new({
|
1568
|
+
id: parameter.id,
|
1569
|
+
var: true,
|
1570
|
+
type: parameter.type
|
1571
|
+
})
|
1572
|
+
end
|
1365
1573
|
else
|
1366
|
-
|
1574
|
+
parameters
|
1367
1575
|
end
|
1368
1576
|
end
|
1369
1577
|
|
1370
|
-
def
|
1371
|
-
|
1372
|
-
|
1373
|
-
|
1578
|
+
def visit_procedure_id(ctx)
|
1579
|
+
ctx__SimpleId = ctx.SimpleId
|
1580
|
+
|
1581
|
+
handle_simple_id(ctx__SimpleId)
|
1582
|
+
end
|
1583
|
+
|
1584
|
+
def visit_qualifiable_factor(ctx)
|
1585
|
+
ctx__attribute_ref = ctx.attribute_ref
|
1586
|
+
ctx__constant_factor = ctx.constant_factor
|
1587
|
+
ctx__function_call = ctx.function_call
|
1588
|
+
ctx__general_ref = ctx.general_ref
|
1589
|
+
ctx__population = ctx.population
|
1590
|
+
|
1591
|
+
visit_if(ctx__attribute_ref || ctx__constant_factor || ctx__function_call || ctx__general_ref || ctx__population)
|
1592
|
+
end
|
1593
|
+
|
1594
|
+
def visit_qualified_attribute(ctx)
|
1595
|
+
ctx__group_qualifier = ctx.group_qualifier
|
1596
|
+
ctx__attribute_qualifier = ctx.attribute_qualifier
|
1597
|
+
|
1598
|
+
id = 'SELF'
|
1599
|
+
group_reference = visit_if(ctx__group_qualifier)
|
1600
|
+
attribute_reference = visit_if(ctx__attribute_qualifier)
|
1374
1601
|
|
1375
1602
|
Model::Expressions::AttributeReference.new({
|
1376
1603
|
ref: Model::Expressions::GroupReference.new({
|
1377
1604
|
ref: Model::Expressions::SimpleReference.new({
|
1378
1605
|
id: id
|
1379
1606
|
}),
|
1380
|
-
entity: entity
|
1607
|
+
entity: group_reference.entity
|
1381
1608
|
}),
|
1382
|
-
attribute: attribute
|
1609
|
+
attribute: attribute_reference.attribute
|
1383
1610
|
})
|
1384
1611
|
end
|
1385
1612
|
|
1386
|
-
def
|
1387
|
-
|
1388
|
-
|
1389
|
-
|
1390
|
-
|
1391
|
-
|
1392
|
-
visit(ctx.indexQualifier())
|
1393
|
-
else
|
1394
|
-
raise 'Invalid state'
|
1395
|
-
end
|
1613
|
+
def visit_qualifier(ctx)
|
1614
|
+
ctx__attribute_qualifier = ctx.attribute_qualifier
|
1615
|
+
ctx__group_qualifier = ctx.group_qualifier
|
1616
|
+
ctx__index_qualifier = ctx.index_qualifier
|
1617
|
+
|
1618
|
+
visit_if(ctx__attribute_qualifier || ctx__group_qualifier || ctx__index_qualifier)
|
1396
1619
|
end
|
1397
1620
|
|
1398
|
-
def
|
1399
|
-
|
1400
|
-
|
1401
|
-
|
1621
|
+
def visit_query_expression(ctx)
|
1622
|
+
ctx__variable_id = ctx.variable_id
|
1623
|
+
ctx__aggregate_source = ctx.aggregate_source
|
1624
|
+
ctx__logical_expression = ctx.logical_expression
|
1625
|
+
|
1626
|
+
id = visit_if(ctx__variable_id)
|
1627
|
+
aggregate_source = visit_if(ctx__aggregate_source)
|
1628
|
+
expression = visit_if(ctx__logical_expression)
|
1402
1629
|
|
1403
1630
|
Model::Expressions::QueryExpression.new({
|
1404
1631
|
id: id,
|
1405
|
-
|
1632
|
+
aggregate_source: aggregate_source,
|
1406
1633
|
expression: expression
|
1407
1634
|
})
|
1408
1635
|
end
|
1409
1636
|
|
1410
|
-
def
|
1411
|
-
|
1412
|
-
|
1413
|
-
|
1637
|
+
def visit_real_type(ctx)
|
1638
|
+
ctx__precision_spec = ctx.precision_spec
|
1639
|
+
|
1640
|
+
precision = visit_if(ctx__precision_spec)
|
1414
1641
|
|
1415
1642
|
Model::Types::Real.new({
|
1416
1643
|
precision: precision
|
1417
1644
|
})
|
1418
1645
|
end
|
1419
1646
|
|
1420
|
-
def
|
1647
|
+
def visit_redeclared_attribute(ctx)
|
1421
1648
|
raise 'Invalid state'
|
1422
1649
|
end
|
1423
1650
|
|
1424
|
-
def
|
1425
|
-
|
1426
|
-
|
1427
|
-
|
1428
|
-
|
1429
|
-
else
|
1430
|
-
raise 'Invalid state'
|
1431
|
-
end
|
1651
|
+
def visit_referenced_attribute(ctx)
|
1652
|
+
ctx__attribute_ref = ctx.attribute_ref
|
1653
|
+
ctx__qualified_attribute = ctx.qualified_attribute
|
1654
|
+
|
1655
|
+
visit_if(ctx__attribute_ref || ctx__qualified_attribute)
|
1432
1656
|
end
|
1433
1657
|
|
1434
|
-
def
|
1435
|
-
|
1436
|
-
|
1658
|
+
def visit_reference_clause(ctx)
|
1659
|
+
ctx__schema_ref = ctx.schema_ref
|
1660
|
+
ctx__resource_or_rename = ctx.resource_or_rename
|
1661
|
+
|
1662
|
+
schema = visit_if(ctx__schema_ref)
|
1663
|
+
items = visit_if_map(ctx__resource_or_rename)
|
1437
1664
|
|
1438
1665
|
Model::Interface.new({
|
1439
1666
|
kind: Model::Interface::REFERENCE,
|
@@ -1442,80 +1669,86 @@ module Expressir
|
|
1442
1669
|
})
|
1443
1670
|
end
|
1444
1671
|
|
1445
|
-
def
|
1446
|
-
|
1672
|
+
def visit_rel_op(ctx)
|
1673
|
+
ctx__text = ctx.text
|
1674
|
+
ctx__LESS_THAN = ctx__text == '<'
|
1675
|
+
ctx__GREATER_THAN = ctx__text == '>'
|
1676
|
+
ctx__LESS_THAN_OR_EQUAL = ctx__text == '<='
|
1677
|
+
ctx__GREATER_THAN_OR_EQUAL = ctx__text == '>='
|
1678
|
+
ctx__NOT_EQUAL = ctx__text == '<>'
|
1679
|
+
ctx__EQUAL = ctx__text == '='
|
1680
|
+
ctx__INSTANCE_NOT_EQUAL = ctx__text == ':<>:'
|
1681
|
+
ctx__INSTANCE_EQUAL = ctx__text == ':=:'
|
1682
|
+
|
1683
|
+
if ctx__LESS_THAN
|
1447
1684
|
Model::Expressions::BinaryExpression::LESS_THAN
|
1448
|
-
elsif
|
1685
|
+
elsif ctx__GREATER_THAN
|
1449
1686
|
Model::Expressions::BinaryExpression::GREATER_THAN
|
1450
|
-
elsif
|
1687
|
+
elsif ctx__LESS_THAN_OR_EQUAL
|
1451
1688
|
Model::Expressions::BinaryExpression::LESS_THAN_OR_EQUAL
|
1452
|
-
elsif
|
1689
|
+
elsif ctx__GREATER_THAN_OR_EQUAL
|
1453
1690
|
Model::Expressions::BinaryExpression::GREATER_THAN_OR_EQUAL
|
1454
|
-
elsif
|
1691
|
+
elsif ctx__NOT_EQUAL
|
1455
1692
|
Model::Expressions::BinaryExpression::NOT_EQUAL
|
1456
|
-
elsif
|
1693
|
+
elsif ctx__EQUAL
|
1457
1694
|
Model::Expressions::BinaryExpression::EQUAL
|
1458
|
-
elsif
|
1695
|
+
elsif ctx__INSTANCE_NOT_EQUAL
|
1459
1696
|
Model::Expressions::BinaryExpression::INSTANCE_NOT_EQUAL
|
1460
|
-
elsif
|
1697
|
+
elsif ctx__INSTANCE_EQUAL
|
1461
1698
|
Model::Expressions::BinaryExpression::INSTANCE_EQUAL
|
1462
1699
|
else
|
1463
1700
|
raise 'Invalid state'
|
1464
1701
|
end
|
1465
1702
|
end
|
1466
1703
|
|
1467
|
-
def
|
1468
|
-
|
1469
|
-
|
1470
|
-
|
1704
|
+
def visit_rel_op_extended(ctx)
|
1705
|
+
ctx__rel_op = ctx.rel_op
|
1706
|
+
ctx__IN = ctx.IN
|
1707
|
+
ctx__LIKE = ctx.LIKE
|
1708
|
+
|
1709
|
+
if ctx__rel_op
|
1710
|
+
visit(ctx__rel_op)
|
1711
|
+
elsif ctx__IN
|
1471
1712
|
Model::Expressions::BinaryExpression::IN
|
1472
|
-
elsif
|
1713
|
+
elsif ctx__LIKE
|
1473
1714
|
Model::Expressions::BinaryExpression::LIKE
|
1474
1715
|
else
|
1475
1716
|
raise 'Invalid state'
|
1476
1717
|
end
|
1477
1718
|
end
|
1478
1719
|
|
1479
|
-
def
|
1480
|
-
|
1481
|
-
|
1482
|
-
|
1483
|
-
|
1484
|
-
|
1485
|
-
|
1486
|
-
|
1487
|
-
visit(ctx.procedureId())
|
1488
|
-
elsif ctx.typeId()
|
1489
|
-
visit(ctx.typeId())
|
1490
|
-
else
|
1491
|
-
raise 'Invalid state'
|
1492
|
-
end
|
1720
|
+
def visit_rename_id(ctx)
|
1721
|
+
ctx__constant_id = ctx.constant_id
|
1722
|
+
ctx__entity_id = ctx.entity_id
|
1723
|
+
ctx__function_id = ctx.function_id
|
1724
|
+
ctx__procedure_id = ctx.procedure_id
|
1725
|
+
ctx__type_id = ctx.type_id
|
1726
|
+
|
1727
|
+
visit_if(ctx__constant_id || ctx__entity_id || ctx__function_id || ctx__procedure_id || ctx__type_id)
|
1493
1728
|
end
|
1494
1729
|
|
1495
|
-
def
|
1730
|
+
def visit_repeat_control(ctx)
|
1496
1731
|
raise 'Invalid state'
|
1497
1732
|
end
|
1498
1733
|
|
1499
|
-
def
|
1500
|
-
|
1501
|
-
|
1502
|
-
|
1503
|
-
|
1504
|
-
|
1505
|
-
|
1506
|
-
|
1507
|
-
|
1508
|
-
|
1509
|
-
|
1510
|
-
|
1511
|
-
|
1512
|
-
|
1513
|
-
|
1514
|
-
|
1515
|
-
until_expression =
|
1516
|
-
|
1517
|
-
end
|
1518
|
-
statements = ctx.stmt().map{|ctx| visit(ctx)}
|
1734
|
+
def visit_repeat_stmt(ctx)
|
1735
|
+
ctx__repeat_control = ctx.repeat_control
|
1736
|
+
ctx__stmt = ctx.stmt
|
1737
|
+
ctx__repeat_control__increment_control = ctx__repeat_control&.increment_control
|
1738
|
+
ctx__repeat_control__increment_control__variable_id = ctx__repeat_control__increment_control&.variable_id
|
1739
|
+
ctx__repeat_control__increment_control__bound1 = ctx__repeat_control__increment_control&.bound1
|
1740
|
+
ctx__repeat_control__increment_control__bound2 = ctx__repeat_control__increment_control&.bound2
|
1741
|
+
ctx__repeat_control__increment_control__increment = ctx__repeat_control__increment_control&.increment
|
1742
|
+
ctx__repeat_control__while_control = ctx__repeat_control&.while_control
|
1743
|
+
ctx__repeat_control__until_control = ctx__repeat_control&.until_control
|
1744
|
+
|
1745
|
+
id = visit_if(ctx__repeat_control__increment_control__variable_id)
|
1746
|
+
bound1 = visit_if(ctx__repeat_control__increment_control__bound1)
|
1747
|
+
bound2 = visit_if(ctx__repeat_control__increment_control__bound2)
|
1748
|
+
increment = visit_if(ctx__repeat_control__increment_control__increment)
|
1749
|
+
while_expression = visit_if(ctx__repeat_control__while_control)
|
1750
|
+
until_expression = visit_if(ctx__repeat_control__until_control)
|
1751
|
+
statements = visit_if_map(ctx__stmt)
|
1519
1752
|
|
1520
1753
|
Model::Statements::Repeat.new({
|
1521
1754
|
id: id,
|
@@ -1528,62 +1761,71 @@ module Expressir
|
|
1528
1761
|
})
|
1529
1762
|
end
|
1530
1763
|
|
1531
|
-
def
|
1532
|
-
|
1764
|
+
def visit_repetition(ctx)
|
1765
|
+
ctx__numeric_expression = ctx.numeric_expression
|
1766
|
+
|
1767
|
+
visit_if(ctx__numeric_expression)
|
1533
1768
|
end
|
1534
1769
|
|
1535
|
-
def
|
1536
|
-
|
1537
|
-
|
1538
|
-
id = visit(ctx.renameId())
|
1770
|
+
def visit_resource_or_rename(ctx)
|
1771
|
+
ctx__resource_ref = ctx.resource_ref
|
1772
|
+
ctx__rename_id = ctx.rename_id
|
1539
1773
|
|
1540
|
-
|
1541
|
-
|
1542
|
-
|
1543
|
-
|
1544
|
-
else
|
1545
|
-
visit(ctx.resourceRef())
|
1546
|
-
end
|
1547
|
-
end
|
1774
|
+
if ctx__resource_ref
|
1775
|
+
if ctx__rename_id
|
1776
|
+
ref = visit(ctx__resource_ref)
|
1777
|
+
id = visit(ctx__rename_id)
|
1548
1778
|
|
1549
|
-
|
1550
|
-
|
1551
|
-
|
1552
|
-
|
1553
|
-
|
1554
|
-
|
1555
|
-
|
1556
|
-
elsif ctx.procedureRef()
|
1557
|
-
visit(ctx.procedureRef())
|
1558
|
-
elsif ctx.typeRef()
|
1559
|
-
visit(ctx.typeRef())
|
1779
|
+
Model::RenamedRef.new({
|
1780
|
+
ref: ref,
|
1781
|
+
id: id
|
1782
|
+
})
|
1783
|
+
else
|
1784
|
+
visit(ctx__resource_ref)
|
1785
|
+
end
|
1560
1786
|
else
|
1561
1787
|
raise 'Invalid state'
|
1562
1788
|
end
|
1563
1789
|
end
|
1564
1790
|
|
1565
|
-
def
|
1566
|
-
|
1567
|
-
|
1568
|
-
|
1791
|
+
def visit_resource_ref(ctx)
|
1792
|
+
ctx__constant_ref = ctx.constant_ref
|
1793
|
+
ctx__entity_ref = ctx.entity_ref
|
1794
|
+
ctx__function_ref = ctx.function_ref
|
1795
|
+
ctx__procedure_ref = ctx.procedure_ref
|
1796
|
+
ctx__type_ref = ctx.type_ref
|
1797
|
+
|
1798
|
+
visit_if(ctx__constant_ref || ctx__entity_ref || ctx__function_ref || ctx__procedure_ref || ctx__type_ref)
|
1799
|
+
end
|
1800
|
+
|
1801
|
+
def visit_return_stmt(ctx)
|
1802
|
+
ctx__expression = ctx.expression
|
1803
|
+
|
1804
|
+
expression = visit_if(ctx__expression)
|
1569
1805
|
|
1570
1806
|
Model::Statements::Return.new({
|
1571
1807
|
expression: expression
|
1572
1808
|
})
|
1573
1809
|
end
|
1574
1810
|
|
1575
|
-
def
|
1576
|
-
|
1577
|
-
|
1578
|
-
|
1579
|
-
|
1580
|
-
|
1581
|
-
|
1582
|
-
|
1583
|
-
|
1584
|
-
|
1585
|
-
|
1586
|
-
|
1811
|
+
def visit_rule_decl(ctx)
|
1812
|
+
ctx__rule_head = ctx.rule_head
|
1813
|
+
ctx__algorithm_head = ctx.algorithm_head
|
1814
|
+
ctx__stmt = ctx.stmt
|
1815
|
+
ctx__where_clause = ctx.where_clause
|
1816
|
+
ctx__rule_head__rule_id = ctx__rule_head&.rule_id
|
1817
|
+
ctx__rule_head__entity_ref = ctx__rule_head&.entity_ref
|
1818
|
+
ctx__algorithm_head__declaration = ctx__algorithm_head&.declaration
|
1819
|
+
ctx__algorithm_head__constant_decl = ctx__algorithm_head&.constant_decl
|
1820
|
+
ctx__algorithm_head__local_decl = ctx__algorithm_head&.local_decl
|
1821
|
+
|
1822
|
+
id = visit_if(ctx__rule_head__rule_id)
|
1823
|
+
applies_to = visit_if_map(ctx__rule_head__entity_ref)
|
1824
|
+
declarations = visit_if_map(ctx__algorithm_head__declaration)
|
1825
|
+
constants = visit_if(ctx__algorithm_head__constant_decl)
|
1826
|
+
variables = visit_if(ctx__algorithm_head__local_decl)
|
1827
|
+
statements = visit_if_map(ctx__stmt)
|
1828
|
+
where = visit_if(ctx__where_clause)
|
1587
1829
|
|
1588
1830
|
Model::Rule.new({
|
1589
1831
|
id: id,
|
@@ -1596,35 +1838,46 @@ module Expressir
|
|
1596
1838
|
})
|
1597
1839
|
end
|
1598
1840
|
|
1599
|
-
def
|
1841
|
+
def visit_rule_head(ctx)
|
1600
1842
|
raise 'Invalid state'
|
1601
1843
|
end
|
1602
1844
|
|
1603
|
-
def
|
1604
|
-
|
1845
|
+
def visit_rule_id(ctx)
|
1846
|
+
ctx__SimpleId = ctx.SimpleId
|
1847
|
+
|
1848
|
+
handle_simple_id(ctx__SimpleId)
|
1605
1849
|
end
|
1606
1850
|
|
1607
|
-
def
|
1608
|
-
|
1851
|
+
def visit_rule_label_id(ctx)
|
1852
|
+
ctx__SimpleId = ctx.SimpleId
|
1853
|
+
|
1854
|
+
handle_simple_id(ctx__SimpleId)
|
1609
1855
|
end
|
1610
1856
|
|
1611
|
-
def
|
1857
|
+
def visit_schema_body(ctx)
|
1612
1858
|
raise 'Invalid state'
|
1613
1859
|
end
|
1614
1860
|
|
1615
|
-
def
|
1616
|
-
|
1617
|
-
|
1618
|
-
|
1619
|
-
|
1620
|
-
|
1621
|
-
|
1622
|
-
|
1623
|
-
|
1624
|
-
|
1625
|
-
|
1626
|
-
|
1627
|
-
|
1861
|
+
def visit_schema_body_declaration(ctx)
|
1862
|
+
ctx__declaration = ctx.declaration
|
1863
|
+
ctx__rule_decl = ctx.rule_decl
|
1864
|
+
|
1865
|
+
visit_if(ctx__declaration || ctx__rule_decl)
|
1866
|
+
end
|
1867
|
+
|
1868
|
+
def visit_schema_decl(ctx)
|
1869
|
+
ctx__schema_id = ctx.schema_id
|
1870
|
+
ctx__schema_version_id = ctx.schema_version_id
|
1871
|
+
ctx__schema_body = ctx.schema_body
|
1872
|
+
ctx__schema_body__interface_specification = ctx__schema_body&.interface_specification
|
1873
|
+
ctx__schema_body__constant_decl = ctx__schema_body&.constant_decl
|
1874
|
+
ctx__schema_body__schema_body_declaration = ctx__schema_body&.schema_body_declaration
|
1875
|
+
|
1876
|
+
id = visit_if(ctx__schema_id)
|
1877
|
+
version = visit_if(ctx__schema_version_id)
|
1878
|
+
interfaces = visit_if_map(ctx__schema_body__interface_specification)
|
1879
|
+
constants = visit_if(ctx__schema_body__constant_decl)
|
1880
|
+
declarations = visit_if_map(ctx__schema_body__schema_body_declaration)
|
1628
1881
|
|
1629
1882
|
Model::Schema.new({
|
1630
1883
|
id: id,
|
@@ -1635,38 +1888,47 @@ module Expressir
|
|
1635
1888
|
})
|
1636
1889
|
end
|
1637
1890
|
|
1638
|
-
def
|
1639
|
-
|
1891
|
+
def visit_schema_id(ctx)
|
1892
|
+
ctx__SimpleId = ctx.SimpleId
|
1893
|
+
|
1894
|
+
handle_simple_id(ctx__SimpleId)
|
1640
1895
|
end
|
1641
1896
|
|
1642
|
-
def
|
1643
|
-
|
1897
|
+
def visit_schema_version_id(ctx)
|
1898
|
+
ctx__string_literal = ctx.string_literal
|
1899
|
+
|
1900
|
+
visit_if(ctx__string_literal)
|
1644
1901
|
end
|
1645
1902
|
|
1646
|
-
def
|
1903
|
+
def visit_selector(ctx)
|
1647
1904
|
raise 'Invalid state'
|
1648
1905
|
end
|
1649
1906
|
|
1650
|
-
def
|
1651
|
-
|
1907
|
+
def visit_select_extension(ctx)
|
1908
|
+
ctx__named_types = ctx.named_types
|
1909
|
+
|
1910
|
+
visit_if_map(ctx__named_types)
|
1652
1911
|
end
|
1653
1912
|
|
1654
|
-
def
|
1655
|
-
|
1913
|
+
def visit_select_list(ctx)
|
1914
|
+
ctx__named_types = ctx.named_types
|
1915
|
+
|
1916
|
+
visit_if_map(ctx__named_types)
|
1656
1917
|
end
|
1657
1918
|
|
1658
|
-
def
|
1659
|
-
|
1660
|
-
|
1661
|
-
|
1662
|
-
|
1663
|
-
|
1664
|
-
|
1665
|
-
|
1666
|
-
|
1667
|
-
|
1668
|
-
|
1669
|
-
|
1919
|
+
def visit_select_type(ctx)
|
1920
|
+
ctx__EXTENSIBLE = ctx.EXTENSIBLE
|
1921
|
+
ctx__GENERIC_ENTITY = ctx.GENERIC_ENTITY
|
1922
|
+
ctx__select_list = ctx.select_list
|
1923
|
+
ctx__select_extension = ctx.select_extension
|
1924
|
+
ctx__select_extension__type_ref = ctx.select_extension&.type_ref
|
1925
|
+
ctx__select_extension__select_list = ctx__select_extension&.select_list
|
1926
|
+
|
1927
|
+
extensible = !!ctx__EXTENSIBLE
|
1928
|
+
generic_entity = !!ctx__GENERIC_ENTITY
|
1929
|
+
items = visit_if(ctx__select_list)
|
1930
|
+
extension_type = visit_if(ctx__select_extension__type_ref)
|
1931
|
+
extension_items = visit_if(ctx__select_extension__select_list)
|
1670
1932
|
|
1671
1933
|
Model::Types::Select.new({
|
1672
1934
|
extensible: extensible,
|
@@ -1677,14 +1939,15 @@ module Expressir
|
|
1677
1939
|
})
|
1678
1940
|
end
|
1679
1941
|
|
1680
|
-
def
|
1681
|
-
|
1682
|
-
|
1683
|
-
|
1684
|
-
|
1685
|
-
|
1686
|
-
|
1687
|
-
|
1942
|
+
def visit_set_type(ctx)
|
1943
|
+
ctx__bound_spec = ctx.bound_spec
|
1944
|
+
ctx__instantiable_type = ctx.instantiable_type
|
1945
|
+
ctx__bound_spec__bound1 = ctx__bound_spec&.bound1
|
1946
|
+
ctx__bound_spec__bound2 = ctx__bound_spec&.bound2
|
1947
|
+
|
1948
|
+
bound1 = visit_if(ctx__bound_spec__bound1)
|
1949
|
+
bound2 = visit_if(ctx__bound_spec__bound2)
|
1950
|
+
base_type = visit_if(ctx__instantiable_type)
|
1688
1951
|
|
1689
1952
|
Model::Types::Set.new({
|
1690
1953
|
bound1: bound1,
|
@@ -1693,122 +1956,112 @@ module Expressir
|
|
1693
1956
|
})
|
1694
1957
|
end
|
1695
1958
|
|
1696
|
-
def
|
1697
|
-
|
1698
|
-
|
1699
|
-
operators = ctx.addLikeOp().map{|ctx| visit(ctx)}
|
1959
|
+
def visit_simple_expression(ctx)
|
1960
|
+
ctx__term = ctx.term
|
1961
|
+
ctx__add_like_op = ctx.add_like_op
|
1700
1962
|
|
1701
|
-
|
1702
|
-
|
1703
|
-
|
1963
|
+
if ctx__term
|
1964
|
+
if ctx__term.length >= 2
|
1965
|
+
if ctx__add_like_op and ctx__add_like_op.length == ctx__term.length - 1
|
1966
|
+
operands = ctx__term.map(&self.method(:visit))
|
1967
|
+
operators = ctx__add_like_op.map(&self.method(:visit))
|
1968
|
+
|
1969
|
+
handle_binary_expression(operands, operators)
|
1970
|
+
else
|
1971
|
+
raise 'Invalid state'
|
1972
|
+
end
|
1973
|
+
elsif ctx__term.length == 1
|
1974
|
+
visit(ctx__term[0])
|
1975
|
+
else
|
1976
|
+
raise 'Invalid state'
|
1977
|
+
end
|
1704
1978
|
end
|
1705
1979
|
end
|
1706
1980
|
|
1707
|
-
def
|
1708
|
-
|
1709
|
-
|
1710
|
-
|
1711
|
-
|
1712
|
-
|
1713
|
-
|
1714
|
-
|
1715
|
-
visit(ctx.interval())
|
1716
|
-
elsif ctx.queryExpression()
|
1717
|
-
visit(ctx.queryExpression())
|
1718
|
-
elsif !ctx.unaryOp() && ctx.expression()
|
1719
|
-
visit(ctx.expression())
|
1720
|
-
elsif !ctx.unaryOp() && ctx.primary()
|
1721
|
-
visit(ctx.primary())
|
1722
|
-
elsif ctx.unaryOp() && ctx.expression()
|
1723
|
-
operator = visit(ctx.unaryOp())
|
1724
|
-
operand = visit(ctx.expression())
|
1725
|
-
|
1726
|
-
Model::Expressions::UnaryExpression.new({
|
1727
|
-
operator: operator,
|
1728
|
-
operand: operand
|
1729
|
-
})
|
1730
|
-
elsif ctx.unaryOp() && ctx.primary()
|
1731
|
-
operator = visit(ctx.unaryOp())
|
1732
|
-
operand = visit(ctx.primary())
|
1981
|
+
def visit_simple_factor(ctx)
|
1982
|
+
ctx__aggregate_initializer = ctx.aggregate_initializer
|
1983
|
+
ctx__entity_constructor = ctx.entity_constructor
|
1984
|
+
ctx__enumeration_reference = ctx.enumeration_reference
|
1985
|
+
ctx__interval = ctx.interval
|
1986
|
+
ctx__query_expression = ctx.query_expression
|
1987
|
+
ctx__simple_factor_expression = ctx.simple_factor_expression
|
1988
|
+
ctx__simple_factor_unary_expression = ctx.simple_factor_unary_expression
|
1733
1989
|
|
1734
|
-
|
1735
|
-
operator: operator,
|
1736
|
-
operand: operand
|
1737
|
-
})
|
1738
|
-
else
|
1739
|
-
raise 'Invalid state'
|
1740
|
-
end
|
1990
|
+
visit_if(ctx__aggregate_initializer || ctx__entity_constructor || ctx__enumeration_reference || ctx__interval || ctx__query_expression || ctx__simple_factor_expression || ctx__simple_factor_unary_expression)
|
1741
1991
|
end
|
1742
1992
|
|
1743
|
-
def
|
1744
|
-
|
1745
|
-
|
1746
|
-
|
1747
|
-
|
1748
|
-
elsif ctx.integerType()
|
1749
|
-
visit(ctx.integerType())
|
1750
|
-
elsif ctx.logicalType()
|
1751
|
-
visit(ctx.logicalType())
|
1752
|
-
elsif ctx.numberType()
|
1753
|
-
visit(ctx.numberType())
|
1754
|
-
elsif ctx.realType()
|
1755
|
-
visit(ctx.realType())
|
1756
|
-
elsif ctx.stringType()
|
1757
|
-
visit(ctx.stringType())
|
1758
|
-
else
|
1759
|
-
raise 'Invalid state'
|
1760
|
-
end
|
1993
|
+
def visit_simple_factor_expression(ctx)
|
1994
|
+
ctx__expression = ctx.expression
|
1995
|
+
ctx__primary = ctx.primary
|
1996
|
+
|
1997
|
+
visit_if(ctx__expression || ctx__primary)
|
1761
1998
|
end
|
1762
1999
|
|
1763
|
-
def
|
1764
|
-
|
1765
|
-
|
1766
|
-
|
1767
|
-
|
1768
|
-
|
1769
|
-
|
1770
|
-
|
1771
|
-
|
1772
|
-
|
1773
|
-
|
1774
|
-
|
1775
|
-
|
1776
|
-
|
1777
|
-
|
1778
|
-
|
1779
|
-
|
1780
|
-
|
1781
|
-
|
1782
|
-
|
1783
|
-
|
1784
|
-
|
1785
|
-
|
1786
|
-
elsif ctx.returnStmt()
|
1787
|
-
visit(ctx.returnStmt())
|
1788
|
-
elsif ctx.skipStmt()
|
1789
|
-
visit(ctx.skipStmt())
|
1790
|
-
else
|
1791
|
-
raise 'Invalid state'
|
1792
|
-
end
|
2000
|
+
def visit_simple_factor_unary_expression(ctx)
|
2001
|
+
ctx__unary_op = ctx.unary_op
|
2002
|
+
ctx__simple_factor_expression = ctx.simple_factor_expression
|
2003
|
+
|
2004
|
+
operator = visit_if(ctx__unary_op)
|
2005
|
+
operand = visit_if(ctx__simple_factor_expression)
|
2006
|
+
|
2007
|
+
Model::Expressions::UnaryExpression.new({
|
2008
|
+
operator: operator,
|
2009
|
+
operand: operand
|
2010
|
+
})
|
2011
|
+
end
|
2012
|
+
|
2013
|
+
def visit_simple_types(ctx)
|
2014
|
+
ctx__binary_type = ctx.binary_type
|
2015
|
+
ctx__boolean_type = ctx.boolean_type
|
2016
|
+
ctx__integer_type = ctx.integer_type
|
2017
|
+
ctx__logical_type = ctx.logical_type
|
2018
|
+
ctx__number_type = ctx.number_type
|
2019
|
+
ctx__real_type = ctx.real_type
|
2020
|
+
ctx__string_type = ctx.string_type
|
2021
|
+
|
2022
|
+
visit_if(ctx__binary_type || ctx__boolean_type || ctx__integer_type || ctx__logical_type || ctx__number_type || ctx__real_type || ctx__string_type)
|
1793
2023
|
end
|
1794
2024
|
|
1795
|
-
def
|
1796
|
-
|
1797
|
-
|
1798
|
-
|
1799
|
-
|
2025
|
+
def visit_skip_stmt(ctx)
|
2026
|
+
Model::Statements::Skip.new
|
2027
|
+
end
|
2028
|
+
|
2029
|
+
def visit_stmt(ctx)
|
2030
|
+
ctx__alias_stmt = ctx.alias_stmt
|
2031
|
+
ctx__assignment_stmt = ctx.assignment_stmt
|
2032
|
+
ctx__case_stmt = ctx.case_stmt
|
2033
|
+
ctx__compound_stmt = ctx.compound_stmt
|
2034
|
+
ctx__escape_stmt = ctx.escape_stmt
|
2035
|
+
ctx__if_stmt = ctx.if_stmt
|
2036
|
+
ctx__null_stmt = ctx.null_stmt
|
2037
|
+
ctx__procedure_call_stmt = ctx.procedure_call_stmt
|
2038
|
+
ctx__repeat_stmt = ctx.repeat_stmt
|
2039
|
+
ctx__return_stmt = ctx.return_stmt
|
2040
|
+
ctx__skip_stmt = ctx.skip_stmt
|
2041
|
+
|
2042
|
+
visit_if(ctx__alias_stmt || ctx__assignment_stmt || ctx__case_stmt || ctx__compound_stmt || ctx__escape_stmt || ctx__if_stmt || ctx__null_stmt || ctx__procedure_call_stmt || ctx__repeat_stmt || ctx__return_stmt || ctx__skip_stmt)
|
2043
|
+
end
|
2044
|
+
|
2045
|
+
def visit_string_literal(ctx)
|
2046
|
+
ctx__SimpleStringLiteral = ctx.SimpleStringLiteral
|
2047
|
+
ctx__EncodedStringLiteral = ctx.EncodedStringLiteral
|
2048
|
+
|
2049
|
+
if ctx__SimpleStringLiteral
|
2050
|
+
handle_simple_string_literal(ctx__SimpleStringLiteral)
|
2051
|
+
elsif ctx__EncodedStringLiteral
|
2052
|
+
handle_encoded_string_literal(ctx__EncodedStringLiteral)
|
1800
2053
|
else
|
1801
2054
|
raise 'Invalid state'
|
1802
2055
|
end
|
1803
2056
|
end
|
1804
2057
|
|
1805
|
-
def
|
1806
|
-
|
1807
|
-
|
1808
|
-
|
1809
|
-
|
1810
|
-
|
1811
|
-
|
2058
|
+
def visit_string_type(ctx)
|
2059
|
+
ctx__width_spec = ctx.width_spec
|
2060
|
+
ctx__width_spec__width = ctx__width_spec&.width
|
2061
|
+
ctx__width_spec__FIXED = ctx__width_spec&.FIXED
|
2062
|
+
|
2063
|
+
width = visit_if(ctx__width_spec__width)
|
2064
|
+
fixed = !!ctx__width_spec__FIXED
|
1812
2065
|
|
1813
2066
|
Model::Types::String.new({
|
1814
2067
|
width: width,
|
@@ -1816,28 +2069,34 @@ module Expressir
|
|
1816
2069
|
})
|
1817
2070
|
end
|
1818
2071
|
|
1819
|
-
def
|
2072
|
+
def visit_subsuper(ctx)
|
1820
2073
|
raise 'Invalid state'
|
1821
2074
|
end
|
1822
2075
|
|
1823
|
-
def
|
1824
|
-
|
2076
|
+
def visit_subtype_constraint(ctx)
|
2077
|
+
ctx__supertype_expression = ctx.supertype_expression
|
2078
|
+
|
2079
|
+
visit_if(ctx__supertype_expression)
|
1825
2080
|
end
|
1826
2081
|
|
1827
|
-
def
|
2082
|
+
def visit_subtype_constraint_body(ctx)
|
1828
2083
|
raise 'Invalid state'
|
1829
2084
|
end
|
1830
2085
|
|
1831
|
-
def
|
1832
|
-
|
1833
|
-
|
1834
|
-
|
1835
|
-
|
1836
|
-
|
1837
|
-
|
1838
|
-
|
1839
|
-
|
1840
|
-
|
2086
|
+
def visit_subtype_constraint_decl(ctx)
|
2087
|
+
ctx__subtype_constraint_head = ctx.subtype_constraint_head
|
2088
|
+
ctx__subtype_constraint_body = ctx.subtype_constraint_body
|
2089
|
+
ctx__subtype_constraint_head__subtype_constraint_id = ctx__subtype_constraint_head&.subtype_constraint_id
|
2090
|
+
ctx__subtype_constraint_head__entity_ref = ctx__subtype_constraint_head&.entity_ref
|
2091
|
+
ctx__subtype_constraint_body__abstract_supertype = ctx__subtype_constraint_body&.abstract_supertype
|
2092
|
+
ctx__subtype_constraint_body__total_over = ctx__subtype_constraint_body&.total_over
|
2093
|
+
ctx__subtype_constraint_body__supertype_expression = ctx__subtype_constraint_body&.supertype_expression
|
2094
|
+
|
2095
|
+
id = visit_if(ctx__subtype_constraint_head__subtype_constraint_id)
|
2096
|
+
applies_to = visit_if(ctx__subtype_constraint_head__entity_ref)
|
2097
|
+
abstract = !!ctx__subtype_constraint_body__abstract_supertype
|
2098
|
+
total_over = visit_if(ctx__subtype_constraint_body__total_over)
|
2099
|
+
supertype_expression = visit_if(ctx__subtype_constraint_body__supertype_expression)
|
1841
2100
|
|
1842
2101
|
Model::SubtypeConstraint.new({
|
1843
2102
|
id: id,
|
@@ -1848,89 +2107,130 @@ module Expressir
|
|
1848
2107
|
})
|
1849
2108
|
end
|
1850
2109
|
|
1851
|
-
def
|
2110
|
+
def visit_subtype_constraint_head(ctx)
|
1852
2111
|
raise 'Invalid state'
|
1853
2112
|
end
|
1854
2113
|
|
1855
|
-
def
|
1856
|
-
|
2114
|
+
def visit_subtype_constraint_id(ctx)
|
2115
|
+
ctx__SimpleId = ctx.SimpleId
|
2116
|
+
|
2117
|
+
handle_simple_id(ctx__SimpleId)
|
1857
2118
|
end
|
1858
2119
|
|
1859
|
-
def
|
1860
|
-
|
2120
|
+
def visit_subtype_declaration(ctx)
|
2121
|
+
ctx__entity_ref = ctx.entity_ref
|
2122
|
+
|
2123
|
+
visit_if_map(ctx__entity_ref)
|
1861
2124
|
end
|
1862
2125
|
|
1863
|
-
def
|
2126
|
+
def visit_supertype_constraint(ctx)
|
1864
2127
|
raise 'Invalid state'
|
1865
2128
|
end
|
1866
2129
|
|
1867
|
-
def
|
1868
|
-
|
1869
|
-
|
1870
|
-
operators = ctx.ANDOR().map{|ctx| Model::Expressions::BinaryExpression::ANDOR}
|
2130
|
+
def visit_supertype_expression(ctx)
|
2131
|
+
ctx__supertype_factor = ctx.supertype_factor
|
2132
|
+
ctx__ANDOR = ctx.ANDOR
|
1871
2133
|
|
1872
|
-
|
1873
|
-
|
1874
|
-
|
2134
|
+
if ctx__supertype_factor
|
2135
|
+
if ctx__supertype_factor.length >= 2
|
2136
|
+
if ctx__ANDOR and ctx__ANDOR.length == ctx__supertype_factor.length - 1
|
2137
|
+
operands = ctx__supertype_factor.map(&self.method(:visit))
|
2138
|
+
operators = ctx__ANDOR.map{Model::Expressions::BinaryExpression::ANDOR}
|
2139
|
+
|
2140
|
+
handle_binary_expression(operands, operators)
|
2141
|
+
else
|
2142
|
+
raise 'Invalid state'
|
2143
|
+
end
|
2144
|
+
elsif ctx__supertype_factor.length == 1
|
2145
|
+
visit(ctx__supertype_factor[0])
|
2146
|
+
else
|
2147
|
+
raise 'Invalid state'
|
2148
|
+
end
|
1875
2149
|
end
|
1876
2150
|
end
|
1877
2151
|
|
1878
|
-
def
|
1879
|
-
|
1880
|
-
|
1881
|
-
operators = ctx.AND().map{|ctx| Model::Expressions::BinaryExpression::AND}
|
2152
|
+
def visit_supertype_factor(ctx)
|
2153
|
+
ctx__supertype_term = ctx.supertype_term
|
2154
|
+
ctx__AND = ctx.AND
|
1882
2155
|
|
1883
|
-
|
1884
|
-
|
1885
|
-
|
2156
|
+
if ctx__supertype_term
|
2157
|
+
if ctx__supertype_term.length >= 2
|
2158
|
+
if ctx__AND and ctx__AND.length == ctx__supertype_term.length - 1
|
2159
|
+
operands = ctx__supertype_term.map(&self.method(:visit))
|
2160
|
+
operators = ctx__AND.map{Model::Expressions::BinaryExpression::AND}
|
2161
|
+
|
2162
|
+
handle_binary_expression(operands, operators)
|
2163
|
+
else
|
2164
|
+
raise 'Invalid state'
|
2165
|
+
end
|
2166
|
+
elsif ctx__supertype_term.length == 1
|
2167
|
+
visit(ctx__supertype_term[0])
|
2168
|
+
else
|
2169
|
+
raise 'Invalid state'
|
2170
|
+
end
|
1886
2171
|
end
|
1887
2172
|
end
|
1888
2173
|
|
1889
|
-
def
|
1890
|
-
|
2174
|
+
def visit_supertype_rule(ctx)
|
2175
|
+
ctx__subtype_constraint = ctx.subtype_constraint
|
2176
|
+
|
2177
|
+
visit_if(ctx__subtype_constraint)
|
1891
2178
|
end
|
1892
2179
|
|
1893
|
-
def
|
1894
|
-
|
1895
|
-
|
1896
|
-
|
1897
|
-
|
1898
|
-
|
1899
|
-
visit(ctx.supertypeExpression())
|
1900
|
-
else
|
1901
|
-
raise 'Invalid state'
|
1902
|
-
end
|
2180
|
+
def visit_supertype_term(ctx)
|
2181
|
+
ctx__entity_ref = ctx.entity_ref
|
2182
|
+
ctx__one_of = ctx.one_of
|
2183
|
+
ctx__supertype_expression = ctx.supertype_expression
|
2184
|
+
|
2185
|
+
visit_if(ctx__entity_ref || ctx__one_of || ctx__supertype_expression)
|
1903
2186
|
end
|
1904
2187
|
|
1905
|
-
def
|
1906
|
-
|
2188
|
+
def visit_syntax(ctx)
|
2189
|
+
ctx__schema_decl = ctx.schema_decl
|
2190
|
+
|
2191
|
+
schemas = visit_if_map(ctx__schema_decl)
|
1907
2192
|
|
1908
2193
|
Model::Repository.new({
|
1909
2194
|
schemas: schemas
|
1910
2195
|
})
|
1911
2196
|
end
|
1912
2197
|
|
1913
|
-
def
|
1914
|
-
|
1915
|
-
|
1916
|
-
operators = ctx.multiplicationLikeOp().map{|ctx| visit(ctx)}
|
2198
|
+
def visit_term(ctx)
|
2199
|
+
ctx__factor = ctx.factor
|
2200
|
+
ctx__multiplication_like_op = ctx.multiplication_like_op
|
1917
2201
|
|
1918
|
-
|
1919
|
-
|
1920
|
-
|
2202
|
+
if ctx__factor
|
2203
|
+
if ctx__factor.length >= 2
|
2204
|
+
if ctx__multiplication_like_op and ctx__multiplication_like_op.length == ctx__factor.length - 1
|
2205
|
+
operands = ctx__factor.map(&self.method(:visit))
|
2206
|
+
operators = ctx__multiplication_like_op.map(&self.method(:visit))
|
2207
|
+
|
2208
|
+
handle_binary_expression(operands, operators)
|
2209
|
+
else
|
2210
|
+
raise 'Invalid state'
|
2211
|
+
end
|
2212
|
+
elsif ctx__factor.length == 1
|
2213
|
+
visit(ctx__factor[0])
|
2214
|
+
else
|
2215
|
+
raise 'Invalid state'
|
2216
|
+
end
|
1921
2217
|
end
|
1922
2218
|
end
|
1923
2219
|
|
1924
|
-
def
|
1925
|
-
|
2220
|
+
def visit_total_over(ctx)
|
2221
|
+
ctx__entity_ref = ctx.entity_ref
|
2222
|
+
|
2223
|
+
visit_if_map(ctx__entity_ref)
|
1926
2224
|
end
|
1927
2225
|
|
1928
|
-
def
|
1929
|
-
|
1930
|
-
|
1931
|
-
|
1932
|
-
|
1933
|
-
|
2226
|
+
def visit_type_decl(ctx)
|
2227
|
+
ctx__type_id = ctx.type_id
|
2228
|
+
ctx__underlying_type = ctx.underlying_type
|
2229
|
+
ctx__where_clause = ctx.where_clause
|
2230
|
+
|
2231
|
+
id = visit_if(ctx__type_id)
|
2232
|
+
type = visit_if(ctx__underlying_type)
|
2233
|
+
where = visit_if(ctx__where_clause)
|
1934
2234
|
|
1935
2235
|
Model::Type.new({
|
1936
2236
|
id: id,
|
@@ -1939,55 +2239,61 @@ module Expressir
|
|
1939
2239
|
})
|
1940
2240
|
end
|
1941
2241
|
|
1942
|
-
def
|
1943
|
-
|
2242
|
+
def visit_type_id(ctx)
|
2243
|
+
ctx__SimpleId = ctx.SimpleId
|
2244
|
+
|
2245
|
+
handle_simple_id(ctx__SimpleId)
|
1944
2246
|
end
|
1945
2247
|
|
1946
|
-
def
|
1947
|
-
|
1948
|
-
|
1949
|
-
|
1950
|
-
|
1951
|
-
else
|
1952
|
-
raise 'Invalid state'
|
1953
|
-
end
|
2248
|
+
def visit_type_label(ctx)
|
2249
|
+
ctx__type_label_id = ctx.type_label_id
|
2250
|
+
ctx__type_label_ref = ctx.type_label_ref
|
2251
|
+
|
2252
|
+
visit_if(ctx__type_label_id || ctx__type_label_ref)
|
1954
2253
|
end
|
1955
2254
|
|
1956
|
-
def
|
1957
|
-
|
2255
|
+
def visit_type_label_id(ctx)
|
2256
|
+
ctx__SimpleId = ctx.SimpleId
|
2257
|
+
|
2258
|
+
handle_simple_id(ctx__SimpleId)
|
1958
2259
|
end
|
1959
2260
|
|
1960
|
-
def
|
1961
|
-
|
2261
|
+
def visit_unary_op(ctx)
|
2262
|
+
ctx__text = ctx.text
|
2263
|
+
ctx__PLUS = ctx__text == '+'
|
2264
|
+
ctx__MINUS = ctx__text == '-'
|
2265
|
+
ctx__NOT = ctx.NOT
|
2266
|
+
|
2267
|
+
if ctx__PLUS
|
1962
2268
|
Model::Expressions::UnaryExpression::PLUS
|
1963
|
-
elsif
|
2269
|
+
elsif ctx__MINUS
|
1964
2270
|
Model::Expressions::UnaryExpression::MINUS
|
1965
|
-
elsif
|
2271
|
+
elsif ctx__NOT
|
1966
2272
|
Model::Expressions::UnaryExpression::NOT
|
1967
2273
|
else
|
1968
2274
|
raise 'Invalid state'
|
1969
2275
|
end
|
1970
2276
|
end
|
1971
2277
|
|
1972
|
-
def
|
1973
|
-
|
1974
|
-
|
1975
|
-
|
1976
|
-
|
1977
|
-
else
|
1978
|
-
raise 'Invalid state'
|
1979
|
-
end
|
2278
|
+
def visit_underlying_type(ctx)
|
2279
|
+
ctx__concrete_types = ctx.concrete_types
|
2280
|
+
ctx__constructed_types = ctx.constructed_types
|
2281
|
+
|
2282
|
+
visit_if(ctx__concrete_types || ctx__constructed_types)
|
1980
2283
|
end
|
1981
2284
|
|
1982
|
-
def
|
1983
|
-
|
2285
|
+
def visit_unique_clause(ctx)
|
2286
|
+
ctx__unique_rule = ctx.unique_rule
|
2287
|
+
|
2288
|
+
visit_if_map(ctx__unique_rule)
|
1984
2289
|
end
|
1985
2290
|
|
1986
|
-
def
|
1987
|
-
|
1988
|
-
|
1989
|
-
|
1990
|
-
|
2291
|
+
def visit_unique_rule(ctx)
|
2292
|
+
ctx__rule_label_id = ctx.rule_label_id
|
2293
|
+
ctx__referenced_attribute = ctx.referenced_attribute
|
2294
|
+
|
2295
|
+
id = visit_if(ctx__rule_label_id)
|
2296
|
+
attributes = visit_if_map(ctx__referenced_attribute)
|
1991
2297
|
|
1992
2298
|
Model::Unique.new({
|
1993
2299
|
id: id,
|
@@ -1995,13 +2301,18 @@ module Expressir
|
|
1995
2301
|
})
|
1996
2302
|
end
|
1997
2303
|
|
1998
|
-
def
|
1999
|
-
|
2304
|
+
def visit_until_control(ctx)
|
2305
|
+
ctx__logical_expression = ctx.logical_expression
|
2306
|
+
|
2307
|
+
visit_if(ctx__logical_expression)
|
2000
2308
|
end
|
2001
2309
|
|
2002
|
-
def
|
2003
|
-
|
2004
|
-
|
2310
|
+
def visit_use_clause(ctx)
|
2311
|
+
ctx__schema_ref = ctx.schema_ref
|
2312
|
+
ctx__named_type_or_rename = ctx.named_type_or_rename
|
2313
|
+
|
2314
|
+
schema = visit_if(ctx__schema_ref)
|
2315
|
+
items = visit_if_map(ctx__named_type_or_rename)
|
2005
2316
|
|
2006
2317
|
Model::Interface.new({
|
2007
2318
|
kind: Model::Interface::USE,
|
@@ -2010,37 +2321,37 @@ module Expressir
|
|
2010
2321
|
})
|
2011
2322
|
end
|
2012
2323
|
|
2013
|
-
def
|
2014
|
-
|
2324
|
+
def visit_variable_id(ctx)
|
2325
|
+
ctx__SimpleId = ctx.SimpleId
|
2326
|
+
|
2327
|
+
handle_simple_id(ctx__SimpleId)
|
2015
2328
|
end
|
2016
2329
|
|
2017
|
-
def
|
2018
|
-
|
2330
|
+
def visit_where_clause(ctx)
|
2331
|
+
ctx__domain_rule = ctx.domain_rule
|
2332
|
+
|
2333
|
+
visit_if_map(ctx__domain_rule)
|
2019
2334
|
end
|
2020
2335
|
|
2021
|
-
def
|
2022
|
-
|
2336
|
+
def visit_while_control(ctx)
|
2337
|
+
ctx__logical_expression = ctx.logical_expression
|
2338
|
+
|
2339
|
+
visit_if(ctx__logical_expression)
|
2023
2340
|
end
|
2024
2341
|
|
2025
|
-
def
|
2026
|
-
|
2342
|
+
def visit_width(ctx)
|
2343
|
+
ctx__numeric_expression = ctx.numeric_expression
|
2344
|
+
|
2345
|
+
visit_if(ctx__numeric_expression)
|
2027
2346
|
end
|
2028
2347
|
|
2029
|
-
def
|
2348
|
+
def visit_width_spec(ctx)
|
2030
2349
|
raise 'Invalid state'
|
2031
2350
|
end
|
2032
2351
|
|
2033
2352
|
private
|
2034
2353
|
|
2035
|
-
def
|
2036
|
-
id = handleSimpleId(ctx.SimpleId())
|
2037
|
-
|
2038
|
-
Model::EnumerationItem.new({
|
2039
|
-
id: id
|
2040
|
-
})
|
2041
|
-
end
|
2042
|
-
|
2043
|
-
def handleBinaryExpression(operands, operators)
|
2354
|
+
def handle_binary_expression(operands, operators)
|
2044
2355
|
if operands.length != operators.length + 1
|
2045
2356
|
raise 'Invalid state'
|
2046
2357
|
end
|
@@ -2060,32 +2371,33 @@ module Expressir
|
|
2060
2371
|
expression
|
2061
2372
|
end
|
2062
2373
|
|
2063
|
-
def
|
2374
|
+
def handle_qualified_ref(ref, qualifiers)
|
2064
2375
|
qualifiers.reduce(ref) do |ref, ctx|
|
2065
|
-
|
2066
|
-
|
2376
|
+
ctx__attribute_qualifier = ctx.attribute_qualifier
|
2377
|
+
ctx__group_qualifier = ctx.group_qualifier
|
2378
|
+
ctx__index_qualifier = ctx.index_qualifier
|
2379
|
+
|
2380
|
+
if ctx__attribute_qualifier
|
2381
|
+
attribute_reference = visit_if(ctx__attribute_qualifier)
|
2067
2382
|
|
2068
2383
|
Model::Expressions::AttributeReference.new({
|
2069
2384
|
ref: ref,
|
2070
|
-
attribute: attribute
|
2385
|
+
attribute: attribute_reference.attribute
|
2071
2386
|
})
|
2072
|
-
elsif
|
2073
|
-
|
2387
|
+
elsif ctx__group_qualifier
|
2388
|
+
group_reference = visit_if(ctx__group_qualifier)
|
2074
2389
|
|
2075
2390
|
Model::Expressions::GroupReference.new({
|
2076
2391
|
ref: ref,
|
2077
|
-
entity: entity
|
2392
|
+
entity: group_reference.entity
|
2078
2393
|
})
|
2079
|
-
elsif
|
2080
|
-
|
2081
|
-
index2 = if ctx.indexQualifier().index2()
|
2082
|
-
visit(ctx.indexQualifier().index2().index().numericExpression().simpleExpression())
|
2083
|
-
end
|
2394
|
+
elsif ctx__index_qualifier
|
2395
|
+
index_reference = visit_if(ctx__index_qualifier)
|
2084
2396
|
|
2085
2397
|
Model::Expressions::IndexReference.new({
|
2086
2398
|
ref: ref,
|
2087
|
-
index1: index1,
|
2088
|
-
index2: index2
|
2399
|
+
index1: index_reference.index1,
|
2400
|
+
index2: index_reference.index2
|
2089
2401
|
})
|
2090
2402
|
else
|
2091
2403
|
raise 'Invalid state'
|
@@ -2093,44 +2405,56 @@ module Expressir
|
|
2093
2405
|
end
|
2094
2406
|
end
|
2095
2407
|
|
2096
|
-
def
|
2097
|
-
|
2408
|
+
def handle_binary_literal(ctx)
|
2409
|
+
ctx__text = ctx.text
|
2410
|
+
|
2411
|
+
value = ctx__text[1..(ctx__text.length - 1)]
|
2098
2412
|
|
2099
2413
|
Model::Literals::Binary.new({
|
2100
2414
|
value: value
|
2101
2415
|
})
|
2102
2416
|
end
|
2103
2417
|
|
2104
|
-
def
|
2105
|
-
|
2418
|
+
def handle_integer_literal(ctx)
|
2419
|
+
ctx__text = ctx.text
|
2420
|
+
|
2421
|
+
value = ctx__text
|
2106
2422
|
|
2107
2423
|
Model::Literals::Integer.new({
|
2108
2424
|
value: value
|
2109
2425
|
})
|
2110
2426
|
end
|
2111
2427
|
|
2112
|
-
def
|
2113
|
-
|
2428
|
+
def handle_real_literal(ctx)
|
2429
|
+
ctx__text = ctx.text
|
2430
|
+
|
2431
|
+
value = ctx__text
|
2114
2432
|
|
2115
2433
|
Model::Literals::Real.new({
|
2116
2434
|
value: value
|
2117
2435
|
})
|
2118
2436
|
end
|
2119
2437
|
|
2120
|
-
def
|
2121
|
-
ctx.text
|
2438
|
+
def handle_simple_id(ctx)
|
2439
|
+
ctx__text = ctx.text
|
2440
|
+
|
2441
|
+
ctx__text
|
2122
2442
|
end
|
2123
2443
|
|
2124
|
-
def
|
2125
|
-
|
2444
|
+
def handle_simple_string_literal(ctx)
|
2445
|
+
ctx__text = ctx.text
|
2446
|
+
|
2447
|
+
value = ctx__text[1..(ctx__text.length - 2)].force_encoding('UTF-8')
|
2126
2448
|
|
2127
2449
|
Model::Literals::String.new({
|
2128
2450
|
value: value
|
2129
2451
|
})
|
2130
2452
|
end
|
2131
2453
|
|
2132
|
-
def
|
2133
|
-
|
2454
|
+
def handle_encoded_string_literal(ctx)
|
2455
|
+
ctx__text = ctx.text
|
2456
|
+
|
2457
|
+
value = ctx__text[1..(ctx__text.length - 2)].force_encoding('UTF-8')
|
2134
2458
|
|
2135
2459
|
Model::Literals::String.new({
|
2136
2460
|
value: value,
|