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