expressir 1.4.2 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/codeql.yml +2 -14
- data/.github/workflows/rake.yml +6 -364
- data/.github/workflows/release.yml +15 -178
- data/.github/workflows/stress.yml +1 -18
- data/.rubocop.yml +1 -0
- data/.rubocop_todo.yml +7 -0
- data/Gemfile +13 -0
- data/README.adoc +6 -19
- data/Rakefile +6 -7
- data/expressir.gemspec +23 -32
- data/expressir_wrapped.txt +23068 -0
- data/lib/expressir/cli.rb +3 -2
- data/lib/expressir/express/formatter.rb +661 -661
- data/lib/expressir/express/parser.rb +299 -33
- data/lib/expressir/express/visitor.rb +238 -133
- data/lib/expressir/model/declarations/interface_item.rb +1 -1
- data/lib/expressir/version.rb +1 -1
- metadata +15 -573
- data/.cross_rubies +0 -28
- data/.gitmodules +0 -6
- data/.yardopts +0 -11
- data/exe/generate-parser +0 -51
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/CMakeLists.txt +0 -191
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/antlr4cpp-vs2019.vcxproj +0 -652
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/antlr4cpp-vs2019.vcxproj.filters +0 -948
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/antlr4cpp-vs2022.vcxproj +0 -652
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/antlr4cpp-vs2022.vcxproj.filters +0 -948
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/antlrcpp-ios/Info.plist +0 -26
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/antlrcpp-ios/antlrcpp_ios.h +0 -17
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/antlrcpp.xcodeproj/project.pbxproj +0 -3040
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/antlrcpp.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -7
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/antlrcpp.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/antlrcpp.xcodeproj/xcshareddata/xcschemes/antlr4.xcscheme +0 -76
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/antlrcpp.xcodeproj/xcshareddata/xcschemes/antlr4_ios.xcscheme +0 -76
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/antlrcpp.xcodeproj/xcshareddata/xcschemes/antlr4_static.xcscheme +0 -76
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/nuget/ANTLR4.Runtime.cpp.noarch.nuspec +0 -23
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/nuget/ANTLR4.Runtime.cpp.noarch.targets +0 -8
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/nuget/ANTLR4.Runtime.cpp.shared.nuspec +0 -30
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/nuget/ANTLR4.Runtime.cpp.shared.props +0 -21
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/nuget/ANTLR4.Runtime.cpp.shared.targets +0 -44
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/nuget/ANTLR4.Runtime.cpp.static.nuspec +0 -29
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/nuget/ANTLR4.Runtime.cpp.static.targets +0 -44
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/nuget/antlr4.jpg +0 -0
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/nuget/pack.cmd +0 -93
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/ANTLRErrorListener.cpp +0 -10
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/ANTLRErrorListener.h +0 -167
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/ANTLRErrorStrategy.cpp +0 -10
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/ANTLRErrorStrategy.h +0 -121
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/ANTLRFileStream.cpp +0 -23
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/ANTLRFileStream.h +0 -30
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/ANTLRInputStream.cpp +0 -180
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/ANTLRInputStream.h +0 -79
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/BailErrorStrategy.cpp +0 -61
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/BailErrorStrategy.h +0 -59
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/BaseErrorListener.cpp +0 -25
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/BaseErrorListener.h +0 -36
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/BufferedTokenStream.cpp +0 -414
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/BufferedTokenStream.h +0 -200
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/CharStream.cpp +0 -11
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/CharStream.h +0 -37
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/CommonToken.cpp +0 -193
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/CommonToken.h +0 -158
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/CommonTokenFactory.cpp +0 -39
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/CommonTokenFactory.h +0 -74
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/CommonTokenStream.cpp +0 -78
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/CommonTokenStream.h +0 -79
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/ConsoleErrorListener.cpp +0 -15
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/ConsoleErrorListener.h +0 -35
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/DefaultErrorStrategy.cpp +0 -336
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/DefaultErrorStrategy.h +0 -466
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/DiagnosticErrorListener.cpp +0 -84
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/DiagnosticErrorListener.h +0 -80
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/Exceptions.cpp +0 -64
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/Exceptions.h +0 -99
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/FailedPredicateException.cpp +0 -52
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/FailedPredicateException.h +0 -32
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/FlatHashMap.h +0 -57
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/FlatHashSet.h +0 -57
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/InputMismatchException.cpp +0 -18
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/InputMismatchException.h +0 -24
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/IntStream.cpp +0 -12
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/IntStream.h +0 -218
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/InterpreterRuleContext.cpp +0 -19
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/InterpreterRuleContext.h +0 -45
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/Lexer.cpp +0 -294
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/Lexer.h +0 -196
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/LexerInterpreter.cpp +0 -60
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/LexerInterpreter.h +0 -46
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/LexerNoViableAltException.cpp +0 -36
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/LexerNoViableAltException.h +0 -31
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/ListTokenSource.cpp +0 -92
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/ListTokenSource.h +0 -88
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/NoViableAltException.cpp +0 -46
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/NoViableAltException.h +0 -42
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/Parser.cpp +0 -670
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/Parser.h +0 -461
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/ParserInterpreter.cpp +0 -294
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/ParserInterpreter.h +0 -173
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/ParserRuleContext.cpp +0 -138
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/ParserRuleContext.h +0 -147
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/ProxyErrorListener.cpp +0 -53
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/ProxyErrorListener.h +0 -38
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/RecognitionException.cpp +0 -65
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/RecognitionException.h +0 -98
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/Recognizer.cpp +0 -157
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/Recognizer.h +0 -160
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/RuleContext.cpp +0 -144
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/RuleContext.h +0 -141
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/RuleContextWithAltNum.cpp +0 -27
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/RuleContextWithAltNum.h +0 -32
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/RuntimeMetaData.cpp +0 -54
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/RuntimeMetaData.h +0 -155
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/Token.cpp +0 -9
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/Token.h +0 -92
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/TokenFactory.h +0 -30
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/TokenSource.cpp +0 -9
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/TokenSource.h +0 -85
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/TokenStream.cpp +0 -11
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/TokenStream.h +0 -137
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/TokenStreamRewriter.cpp +0 -425
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/TokenStreamRewriter.h +0 -295
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/UnbufferedCharStream.cpp +0 -208
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/UnbufferedCharStream.h +0 -117
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/UnbufferedTokenStream.cpp +0 -270
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/UnbufferedTokenStream.h +0 -115
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/Version.h +0 -42
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/Vocabulary.cpp +0 -64
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/Vocabulary.h +0 -177
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/WritableToken.cpp +0 -9
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/WritableToken.h +0 -23
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/antlr4-common.h +0 -101
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/antlr4-runtime.h +0 -168
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATN.cpp +0 -159
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATN.h +0 -133
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNConfig.cpp +0 -106
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNConfig.h +0 -157
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNConfigSet.cpp +0 -233
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNConfigSet.h +0 -157
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNDeserializationOptions.cpp +0 -39
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNDeserializationOptions.h +0 -48
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNDeserializer.cpp +0 -628
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNDeserializer.h +0 -32
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNSimulator.cpp +0 -33
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNSimulator.h +0 -71
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNState.cpp +0 -56
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNState.h +0 -139
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNStateType.cpp +0 -33
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNStateType.h +0 -36
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNType.h +0 -20
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ActionTransition.cpp +0 -29
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ActionTransition.h +0 -35
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/AmbiguityInfo.cpp +0 -16
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/AmbiguityInfo.h +0 -68
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ArrayPredictionContext.cpp +0 -129
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ArrayPredictionContext.h +0 -51
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/AtomTransition.cpp +0 -27
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/AtomTransition.h +0 -33
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/BasicBlockStartState.h +0 -24
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/BasicState.h +0 -23
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/BlockEndState.h +0 -26
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/BlockStartState.h +0 -30
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ContextSensitivityInfo.cpp +0 -14
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ContextSensitivityInfo.h +0 -47
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/DecisionEventInfo.cpp +0 -14
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/DecisionEventInfo.h +0 -70
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/DecisionInfo.cpp +0 -25
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/DecisionInfo.h +0 -227
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/DecisionState.cpp +0 -12
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/DecisionState.h +0 -34
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/EpsilonTransition.cpp +0 -31
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/EpsilonTransition.h +0 -42
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ErrorInfo.cpp +0 -15
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ErrorInfo.h +0 -43
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/HashUtils.h +0 -18
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LL1Analyzer.cpp +0 -189
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LL1Analyzer.h +0 -76
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerATNConfig.cpp +0 -67
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerATNConfig.h +0 -44
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerATNSimulator.cpp +0 -621
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerATNSimulator.h +0 -199
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerAction.cpp +0 -15
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerAction.h +0 -100
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerActionExecutor.cpp +0 -108
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerActionExecutor.h +0 -128
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerActionType.h +0 -57
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerChannelAction.cpp +0 -43
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerChannelAction.h +0 -59
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerCustomAction.cpp +0 -45
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerCustomAction.h +0 -75
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerIndexedCustomAction.cpp +0 -50
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerIndexedCustomAction.h +0 -76
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerModeAction.cpp +0 -43
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerModeAction.h +0 -57
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerMoreAction.cpp +0 -36
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerMoreAction.h +0 -53
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerPopModeAction.cpp +0 -36
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerPopModeAction.h +0 -53
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerPushModeAction.cpp +0 -43
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerPushModeAction.h +0 -57
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerSkipAction.cpp +0 -36
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerSkipAction.h +0 -51
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerTypeAction.cpp +0 -43
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerTypeAction.h +0 -51
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LookaheadEventInfo.cpp +0 -16
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LookaheadEventInfo.h +0 -42
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LoopEndState.h +0 -26
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/NotSetTransition.cpp +0 -22
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/NotSetTransition.h +0 -27
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/OrderedATNConfigSet.cpp +0 -16
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/OrderedATNConfigSet.h +0 -25
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ParseInfo.cpp +0 -102
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ParseInfo.h +0 -102
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ParserATNSimulator.cpp +0 -1413
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ParserATNSimulator.h +0 -911
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ParserATNSimulatorOptions.h +0 -50
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PlusBlockStartState.h +0 -29
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PlusLoopbackState.h +0 -25
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PrecedencePredicateTransition.cpp +0 -23
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PrecedencePredicateTransition.h +0 -35
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredicateEvalInfo.cpp +0 -17
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredicateEvalInfo.h +0 -62
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredicateTransition.cpp +0 -24
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredicateTransition.h +0 -50
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredictionContext.cpp +0 -601
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredictionContext.h +0 -225
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredictionContextCache.cpp +0 -56
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredictionContextCache.h +0 -63
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredictionContextMergeCache.cpp +0 -167
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredictionContextMergeCache.h +0 -101
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredictionContextMergeCacheOptions.h +0 -71
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredictionContextType.h +0 -21
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredictionMode.cpp +0 -202
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredictionMode.h +0 -436
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ProfilingATNSimulator.cpp +0 -179
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ProfilingATNSimulator.h +0 -60
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/RangeTransition.cpp +0 -26
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/RangeTransition.h +0 -31
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/RuleStartState.h +0 -26
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/RuleStopState.h +0 -27
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/RuleTransition.cpp +0 -33
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/RuleTransition.h +0 -42
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/SemanticContext.cpp +0 -418
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/SemanticContext.h +0 -237
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/SemanticContextType.h +0 -23
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/SerializedATNView.h +0 -101
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/SetTransition.cpp +0 -28
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/SetTransition.h +0 -38
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/SingletonPredictionContext.cpp +0 -79
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/SingletonPredictionContext.h +0 -43
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/StarBlockStartState.h +0 -24
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/StarLoopEntryState.h +0 -37
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/StarLoopbackState.cpp +0 -19
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/StarLoopbackState.h +0 -25
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/TokensStartState.h +0 -24
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/Transition.cpp +0 -36
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/Transition.h +0 -65
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/TransitionType.cpp +0 -27
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/TransitionType.h +0 -33
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/WildcardTransition.cpp +0 -21
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/WildcardTransition.h +0 -27
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/dfa/DFA.cpp +0 -115
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/dfa/DFA.h +0 -96
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/dfa/DFASerializer.cpp +0 -60
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/dfa/DFASerializer.h +0 -32
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/dfa/DFAState.cpp +0 -59
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/dfa/DFAState.h +0 -154
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/dfa/LexerDFASerializer.cpp +0 -17
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/dfa/LexerDFASerializer.h +0 -22
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/internal/Synchronization.cpp +0 -100
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/internal/Synchronization.h +0 -154
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/misc/InterpreterDataReader.cpp +0 -124
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/misc/InterpreterDataReader.h +0 -33
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/misc/Interval.cpp +0 -61
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/misc/Interval.h +0 -84
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/misc/IntervalSet.cpp +0 -508
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/misc/IntervalSet.h +0 -190
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/misc/MurmurHash.cpp +0 -120
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/misc/MurmurHash.h +0 -102
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/misc/Predicate.cpp +0 -4
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/misc/Predicate.h +0 -21
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/support/Any.cpp +0 -8
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/support/Any.h +0 -16
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/support/Arrays.cpp +0 -43
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/support/Arrays.h +0 -149
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/support/BitSet.h +0 -76
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/support/CPPUtils.cpp +0 -207
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/support/CPPUtils.h +0 -65
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/support/Casts.h +0 -34
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/support/Declarations.h +0 -161
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/support/StringUtils.cpp +0 -38
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/support/StringUtils.h +0 -16
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/support/Unicode.h +0 -28
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/support/Utf8.cpp +0 -242
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/support/Utf8.h +0 -54
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/AbstractParseTreeVisitor.h +0 -129
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ErrorNode.h +0 -24
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ErrorNodeImpl.cpp +0 -54
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ErrorNodeImpl.h +0 -43
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/IterativeParseTreeWalker.cpp +0 -66
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/IterativeParseTreeWalker.h +0 -53
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ParseTree.cpp +0 -12
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ParseTree.h +0 -111
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ParseTreeListener.cpp +0 -9
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ParseTreeListener.h +0 -39
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ParseTreeProperty.h +0 -50
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ParseTreeType.h +0 -22
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ParseTreeVisitor.cpp +0 -9
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ParseTreeVisitor.h +0 -57
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ParseTreeWalker.cpp +0 -48
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ParseTreeWalker.h +0 -55
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/TerminalNode.h +0 -40
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/TerminalNodeImpl.cpp +0 -54
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/TerminalNodeImpl.h +0 -32
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/Trees.cpp +0 -241
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/Trees.h +0 -78
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/pattern/Chunk.cpp +0 -9
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/pattern/Chunk.h +0 -44
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/pattern/ParseTreeMatch.cpp +0 -69
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/pattern/ParseTreeMatch.h +0 -132
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/pattern/ParseTreePattern.cpp +0 -64
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/pattern/ParseTreePattern.h +0 -105
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/pattern/ParseTreePatternMatcher.cpp +0 -370
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/pattern/ParseTreePatternMatcher.h +0 -185
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/pattern/RuleTagToken.cpp +0 -77
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/pattern/RuleTagToken.h +0 -117
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/pattern/TagChunk.cpp +0 -39
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/pattern/TagChunk.h +0 -86
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/pattern/TextChunk.cpp +0 -28
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/pattern/TextChunk.h +0 -51
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/pattern/TokenTagToken.cpp +0 -36
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/pattern/TokenTagToken.h +0 -80
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPath.cpp +0 -154
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPath.h +0 -86
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathElement.cpp +0 -31
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathElement.h +0 -40
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathLexer.cpp +0 -180
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathLexer.g4 +0 -64
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathLexer.h +0 -53
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathLexer.tokens +0 -12
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathLexerErrorListener.cpp +0 -13
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathLexerErrorListener.h +0 -22
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathRuleAnywhereElement.cpp +0 -20
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathRuleAnywhereElement.h +0 -27
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathRuleElement.cpp +0 -30
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathRuleElement.h +0 -26
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathTokenAnywhereElement.cpp +0 -20
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathTokenAnywhereElement.h +0 -25
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathTokenElement.cpp +0 -33
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathTokenElement.h +0 -26
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathWildcardAnywhereElement.cpp +0 -23
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathWildcardAnywhereElement.h +0 -23
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathWildcardElement.cpp +0 -24
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathWildcardElement.h +0 -23
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/tests/Utf8Test.cpp +0 -110
- data/ext/express_parser/antlrgen/Express.interp +0 -532
- data/ext/express_parser/antlrgen/Express.tokens +0 -190
- data/ext/express_parser/antlrgen/ExpressBaseListener.cpp +0 -7
- data/ext/express_parser/antlrgen/ExpressBaseListener.h +0 -623
- data/ext/express_parser/antlrgen/ExpressBaseVisitor.cpp +0 -7
- data/ext/express_parser/antlrgen/ExpressBaseVisitor.h +0 -816
- data/ext/express_parser/antlrgen/ExpressLexer.cpp +0 -685
- data/ext/express_parser/antlrgen/ExpressLexer.h +0 -78
- data/ext/express_parser/antlrgen/ExpressLexer.interp +0 -534
- data/ext/express_parser/antlrgen/ExpressLexer.tokens +0 -190
- data/ext/express_parser/antlrgen/ExpressListener.cpp +0 -7
- data/ext/express_parser/antlrgen/ExpressListener.h +0 -616
- data/ext/express_parser/antlrgen/ExpressParser.cpp +0 -17591
- data/ext/express_parser/antlrgen/ExpressParser.h +0 -3692
- data/ext/express_parser/antlrgen/ExpressVisitor.cpp +0 -7
- data/ext/express_parser/antlrgen/ExpressVisitor.h +0 -422
- data/ext/express_parser/express_parser.cpp +0 -19405
- data/ext/express_parser/extconf.rb +0 -63
- data/rakelib/antlr4-native.rake +0 -173
- data/rakelib/cross-ruby.rake +0 -403
- data/spec/acceptance/version_spec.rb +0 -30
- data/spec/expressir/express/cache_spec.rb +0 -89
- data/spec/expressir/express/formatter_spec.rb +0 -171
- data/spec/expressir/express/parser_spec.rb +0 -141
- data/spec/expressir/model/model_element_spec.rb +0 -343
- data/spec/spec_helper.rb +0 -24
- data/spec/support/console_helper.rb +0 -29
- data/spec/syntax/multiple.exp +0 -23
- data/spec/syntax/multiple.yaml +0 -198
- data/spec/syntax/multiple_formatted.exp +0 -71
- data/spec/syntax/multiple_hyperlink_formatted.exp +0 -71
- data/spec/syntax/multiple_schema_head_hyperlink_formatted.exp +0 -13
- data/spec/syntax/remark.exp +0 -193
- data/spec/syntax/remark.yaml +0 -471
- data/spec/syntax/remark_formatted.exp +0 -228
- data/spec/syntax/single.exp +0 -4
- data/spec/syntax/single.yaml +0 -18
- data/spec/syntax/single_formatted.exp +0 -10
- data/spec/syntax/single_formatted.yaml +0 -36
- data/spec/syntax/syntax.exp +0 -333
- data/spec/syntax/syntax.yaml +0 -3509
- data/spec/syntax/syntax_formatted.exp +0 -902
- data/spec/syntax/syntax_hyperlink_formatted.exp +0 -902
- data/spec/syntax/syntax_schema_head_formatted.exp +0 -18
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
require
|
|
1
|
+
require "expressir/model"
|
|
2
2
|
|
|
3
3
|
module Expressir
|
|
4
4
|
module Express
|
|
5
5
|
class Formatter
|
|
6
|
-
INDENT_CHAR =
|
|
6
|
+
INDENT_CHAR = " "
|
|
7
7
|
INDENT_WIDTH = 2
|
|
8
8
|
INDENT = INDENT_CHAR * INDENT_WIDTH
|
|
9
9
|
OPERATOR_PRECEDENCE = {
|
|
@@ -184,14 +184,14 @@ module Expressir
|
|
|
184
184
|
format_supertype_expressions_oneof_supertype_expression(node)
|
|
185
185
|
else
|
|
186
186
|
STDERR.puts "#{node.class.name} format not implemented"
|
|
187
|
-
|
|
187
|
+
""
|
|
188
188
|
end
|
|
189
189
|
end
|
|
190
190
|
|
|
191
191
|
private
|
|
192
192
|
|
|
193
193
|
def format_repository(node)
|
|
194
|
-
node.schemas.map{|x| format(x)}.join("\n\n")
|
|
194
|
+
node.schemas.map { |x| format(x) }.join("\n\n")
|
|
195
195
|
end
|
|
196
196
|
|
|
197
197
|
def format_declarations_attribute(node)
|
|
@@ -199,252 +199,252 @@ module Expressir
|
|
|
199
199
|
*if node.supertype_attribute
|
|
200
200
|
[
|
|
201
201
|
format(node.supertype_attribute),
|
|
202
|
-
|
|
203
|
-
].join(
|
|
202
|
+
" ",
|
|
203
|
+
].join("")
|
|
204
204
|
end,
|
|
205
205
|
*if node.supertype_attribute and node.id
|
|
206
206
|
[
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
].join(
|
|
207
|
+
"RENAMED",
|
|
208
|
+
" ",
|
|
209
|
+
].join("")
|
|
210
210
|
end,
|
|
211
211
|
*if node.id
|
|
212
212
|
[
|
|
213
213
|
node.id,
|
|
214
|
-
|
|
215
|
-
].join(
|
|
214
|
+
" ",
|
|
215
|
+
].join("")
|
|
216
216
|
end,
|
|
217
|
-
|
|
217
|
+
":",
|
|
218
218
|
*if node.optional
|
|
219
219
|
[
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
].join(
|
|
220
|
+
" ",
|
|
221
|
+
"OPTIONAL",
|
|
222
|
+
].join("")
|
|
223
223
|
end,
|
|
224
|
-
|
|
224
|
+
" ",
|
|
225
225
|
format(node.type),
|
|
226
226
|
*if node.kind == Model::Declarations::Attribute::DERIVED
|
|
227
227
|
[
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
format(node.expression)
|
|
232
|
-
].join(
|
|
228
|
+
" ",
|
|
229
|
+
":=",
|
|
230
|
+
" ",
|
|
231
|
+
format(node.expression),
|
|
232
|
+
].join("")
|
|
233
233
|
elsif node.kind == Model::Declarations::Attribute::INVERSE
|
|
234
234
|
[
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
format(node.expression)
|
|
239
|
-
].join(
|
|
235
|
+
" ",
|
|
236
|
+
"FOR",
|
|
237
|
+
" ",
|
|
238
|
+
format(node.expression),
|
|
239
|
+
].join("")
|
|
240
240
|
end,
|
|
241
|
-
|
|
242
|
-
].join(
|
|
241
|
+
";",
|
|
242
|
+
].join("")
|
|
243
243
|
end
|
|
244
244
|
|
|
245
245
|
def format_declarations_constant(node)
|
|
246
246
|
[
|
|
247
247
|
node.id,
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
248
|
+
" ",
|
|
249
|
+
":",
|
|
250
|
+
" ",
|
|
251
251
|
format(node.type),
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
252
|
+
" ",
|
|
253
|
+
":=",
|
|
254
|
+
" ",
|
|
255
255
|
format(node.expression),
|
|
256
|
-
|
|
257
|
-
].join(
|
|
256
|
+
";",
|
|
257
|
+
].join("")
|
|
258
258
|
end
|
|
259
259
|
|
|
260
260
|
def format_declarations_entity(node)
|
|
261
|
-
explicit_attributes = node.attributes.select{|x| x.kind == Model::Declarations::Attribute::EXPLICIT}
|
|
262
|
-
derived_attributes = node.attributes.select{|x| x.kind == Model::Declarations::Attribute::DERIVED}
|
|
263
|
-
inverse_attributes = node.attributes.select{|x| x.kind == Model::Declarations::Attribute::INVERSE}
|
|
261
|
+
explicit_attributes = node.attributes.select { |x| x.kind == Model::Declarations::Attribute::EXPLICIT }
|
|
262
|
+
derived_attributes = node.attributes.select { |x| x.kind == Model::Declarations::Attribute::DERIVED }
|
|
263
|
+
inverse_attributes = node.attributes.select { |x| x.kind == Model::Declarations::Attribute::INVERSE }
|
|
264
264
|
|
|
265
265
|
[
|
|
266
266
|
[
|
|
267
|
-
|
|
268
|
-
|
|
267
|
+
"ENTITY",
|
|
268
|
+
" ",
|
|
269
269
|
node.id,
|
|
270
270
|
*if node.abstract and !node.supertype_expression
|
|
271
271
|
[
|
|
272
272
|
"\n",
|
|
273
273
|
indent([
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
].join(
|
|
278
|
-
].join(
|
|
274
|
+
"ABSTRACT",
|
|
275
|
+
" ",
|
|
276
|
+
"SUPERTYPE",
|
|
277
|
+
].join("")),
|
|
278
|
+
].join("")
|
|
279
279
|
end,
|
|
280
280
|
*if node.abstract and node.supertype_expression
|
|
281
281
|
[
|
|
282
282
|
"\n",
|
|
283
283
|
indent([
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
284
|
+
"ABSTRACT",
|
|
285
|
+
" ",
|
|
286
|
+
"SUPERTYPE",
|
|
287
|
+
" ",
|
|
288
|
+
"OF",
|
|
289
|
+
" ",
|
|
290
|
+
"(",
|
|
291
291
|
format(node.supertype_expression),
|
|
292
|
-
|
|
293
|
-
].join(
|
|
294
|
-
].join(
|
|
292
|
+
")",
|
|
293
|
+
].join("")),
|
|
294
|
+
].join("")
|
|
295
295
|
end,
|
|
296
296
|
*if !node.abstract and node.supertype_expression
|
|
297
297
|
[
|
|
298
298
|
"\n",
|
|
299
299
|
indent([
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
300
|
+
"SUPERTYPE",
|
|
301
|
+
" ",
|
|
302
|
+
"OF",
|
|
303
|
+
" ",
|
|
304
|
+
"(",
|
|
305
305
|
format(node.supertype_expression),
|
|
306
|
-
|
|
307
|
-
].join(
|
|
308
|
-
].join(
|
|
306
|
+
")",
|
|
307
|
+
].join("")),
|
|
308
|
+
].join("")
|
|
309
309
|
end,
|
|
310
310
|
*if node.subtype_of.length > 0
|
|
311
311
|
[
|
|
312
312
|
"\n",
|
|
313
313
|
indent([
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
node.subtype_of.map{|x| format(x)}.join(
|
|
320
|
-
|
|
321
|
-
].join(
|
|
322
|
-
].join(
|
|
314
|
+
"SUBTYPE",
|
|
315
|
+
" ",
|
|
316
|
+
"OF",
|
|
317
|
+
" ",
|
|
318
|
+
"(",
|
|
319
|
+
node.subtype_of.map { |x| format(x) }.join(", "),
|
|
320
|
+
")",
|
|
321
|
+
].join("")),
|
|
322
|
+
].join("")
|
|
323
323
|
end,
|
|
324
|
-
|
|
325
|
-
].join(
|
|
324
|
+
";",
|
|
325
|
+
].join(""),
|
|
326
326
|
*if explicit_attributes and explicit_attributes.length > 0
|
|
327
|
-
indent(explicit_attributes.map{|x| format(x)}.join("\n"))
|
|
327
|
+
indent(explicit_attributes.map { |x| format(x) }.join("\n"))
|
|
328
328
|
end,
|
|
329
329
|
*if derived_attributes and derived_attributes.length > 0
|
|
330
330
|
[
|
|
331
|
-
|
|
332
|
-
indent(derived_attributes.map{|x| format(x)}.join("\n")),
|
|
331
|
+
"DERIVE",
|
|
332
|
+
indent(derived_attributes.map { |x| format(x) }.join("\n")),
|
|
333
333
|
]
|
|
334
334
|
end,
|
|
335
335
|
*if inverse_attributes and inverse_attributes.length > 0
|
|
336
336
|
[
|
|
337
|
-
|
|
338
|
-
indent(inverse_attributes.map{|x| format(x)}.join("\n")),
|
|
337
|
+
"INVERSE",
|
|
338
|
+
indent(inverse_attributes.map { |x| format(x) }.join("\n")),
|
|
339
339
|
]
|
|
340
340
|
end,
|
|
341
341
|
*if node.unique_rules.length > 0
|
|
342
342
|
[
|
|
343
|
-
|
|
344
|
-
indent(node.unique_rules.map{|x| format(x)}.join("\n"))
|
|
343
|
+
"UNIQUE",
|
|
344
|
+
indent(node.unique_rules.map { |x| format(x) }.join("\n")),
|
|
345
345
|
]
|
|
346
346
|
end,
|
|
347
347
|
*if node.where_rules.length > 0
|
|
348
348
|
[
|
|
349
|
-
|
|
350
|
-
indent(node.where_rules.map{|x| format(x)}.join("\n")),
|
|
349
|
+
"WHERE",
|
|
350
|
+
indent(node.where_rules.map { |x| format(x) }.join("\n")),
|
|
351
351
|
]
|
|
352
352
|
end,
|
|
353
353
|
[
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
].join(
|
|
354
|
+
"END_ENTITY",
|
|
355
|
+
";",
|
|
356
|
+
].join(""),
|
|
357
357
|
].join("\n")
|
|
358
358
|
end
|
|
359
359
|
|
|
360
360
|
def format_declarations_function(node)
|
|
361
361
|
[
|
|
362
362
|
[
|
|
363
|
-
|
|
364
|
-
|
|
363
|
+
"FUNCTION",
|
|
364
|
+
" ",
|
|
365
365
|
node.id,
|
|
366
366
|
*if node.parameters.length > 0
|
|
367
367
|
parameter_indent = INDENT_CHAR * "FUNCTION #{node.id}(".length
|
|
368
368
|
[
|
|
369
|
-
|
|
370
|
-
node.parameters.map{|x| format(x)}.join(";\n#{parameter_indent}"),
|
|
371
|
-
|
|
372
|
-
].join(
|
|
369
|
+
"(",
|
|
370
|
+
node.parameters.map { |x| format(x) }.join(";\n#{parameter_indent}"),
|
|
371
|
+
")",
|
|
372
|
+
].join("")
|
|
373
373
|
end,
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
374
|
+
" ",
|
|
375
|
+
":",
|
|
376
|
+
" ",
|
|
377
377
|
format(node.return_type),
|
|
378
|
-
|
|
379
|
-
].join(
|
|
378
|
+
";",
|
|
379
|
+
].join(""),
|
|
380
380
|
*if node.types.length > 0
|
|
381
|
-
indent(node.types.map{|x| format(x)}.join("\n"))
|
|
381
|
+
indent(node.types.map { |x| format(x) }.join("\n"))
|
|
382
382
|
end,
|
|
383
383
|
*if node.entities.length > 0
|
|
384
|
-
indent(node.entities.map{|x| format(x)}.join("\n"))
|
|
384
|
+
indent(node.entities.map { |x| format(x) }.join("\n"))
|
|
385
385
|
end,
|
|
386
386
|
*if node.subtype_constraints.length > 0
|
|
387
|
-
indent(node.subtype_constraints.map{|x| format(x)}.join("\n"))
|
|
387
|
+
indent(node.subtype_constraints.map { |x| format(x) }.join("\n"))
|
|
388
388
|
end,
|
|
389
389
|
*if node.functions.length > 0
|
|
390
|
-
indent(node.functions.map{|x| format(x)}.join("\n"))
|
|
390
|
+
indent(node.functions.map { |x| format(x) }.join("\n"))
|
|
391
391
|
end,
|
|
392
392
|
*if node.procedures.length > 0
|
|
393
|
-
indent(node.procedures.map{|x| format(x)}.join("\n"))
|
|
393
|
+
indent(node.procedures.map { |x| format(x) }.join("\n"))
|
|
394
394
|
end,
|
|
395
395
|
*if node.constants.length > 0
|
|
396
396
|
indent([
|
|
397
|
-
|
|
398
|
-
indent(node.constants.map{|x| format(x)}.join("\n")),
|
|
397
|
+
"CONSTANT",
|
|
398
|
+
indent(node.constants.map { |x| format(x) }.join("\n")),
|
|
399
399
|
[
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
].join(
|
|
400
|
+
"END_CONSTANT",
|
|
401
|
+
";",
|
|
402
|
+
].join(""),
|
|
403
403
|
].join("\n"))
|
|
404
404
|
end,
|
|
405
405
|
*if node.variables.length > 0
|
|
406
406
|
indent([
|
|
407
|
-
|
|
408
|
-
indent(node.variables.map{|x| format(x)}.join("\n")),
|
|
407
|
+
"LOCAL",
|
|
408
|
+
indent(node.variables.map { |x| format(x) }.join("\n")),
|
|
409
409
|
[
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
].join(
|
|
410
|
+
"END_LOCAL",
|
|
411
|
+
";",
|
|
412
|
+
].join(""),
|
|
413
413
|
].join("\n"))
|
|
414
414
|
end,
|
|
415
415
|
*if node.statements.length > 0
|
|
416
|
-
indent(node.statements.map{|x| format(x)}.join("\n"))
|
|
416
|
+
indent(node.statements.map { |x| format(x) }.join("\n"))
|
|
417
417
|
end,
|
|
418
418
|
[
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
].join(
|
|
419
|
+
"END_FUNCTION",
|
|
420
|
+
";",
|
|
421
|
+
].join(""),
|
|
422
422
|
].join("\n")
|
|
423
423
|
end
|
|
424
424
|
|
|
425
425
|
def format_declarations_interface(node)
|
|
426
426
|
[
|
|
427
427
|
case node.kind
|
|
428
|
-
|
|
429
|
-
|
|
428
|
+
when Model::Declarations::Interface::USE then "USE"
|
|
429
|
+
when Model::Declarations::Interface::REFERENCE then "REFERENCE"
|
|
430
430
|
end,
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
431
|
+
" ",
|
|
432
|
+
"FROM",
|
|
433
|
+
" ",
|
|
434
434
|
format(node.schema),
|
|
435
435
|
*if node.items.length > 0
|
|
436
|
-
item_indent = INDENT_CHAR *
|
|
436
|
+
item_indent = INDENT_CHAR * "(".length
|
|
437
437
|
[
|
|
438
438
|
"\n",
|
|
439
439
|
indent([
|
|
440
|
-
|
|
441
|
-
node.items.map{|x| format(x)}.join(",\n#{item_indent}"),
|
|
442
|
-
|
|
443
|
-
].join(
|
|
444
|
-
].join(
|
|
440
|
+
"(",
|
|
441
|
+
node.items.map { |x| format(x) }.join(",\n#{item_indent}"),
|
|
442
|
+
")",
|
|
443
|
+
].join("")),
|
|
444
|
+
].join("")
|
|
445
445
|
end,
|
|
446
|
-
|
|
447
|
-
].join(
|
|
446
|
+
";",
|
|
447
|
+
].join("")
|
|
448
448
|
end
|
|
449
449
|
|
|
450
450
|
def format_declarations_interface_item(node)
|
|
@@ -452,177 +452,177 @@ module Expressir
|
|
|
452
452
|
format(node.ref),
|
|
453
453
|
*if node.id
|
|
454
454
|
[
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
node.id
|
|
455
|
+
" ",
|
|
456
|
+
"AS",
|
|
457
|
+
" ",
|
|
458
|
+
node.id,
|
|
459
459
|
]
|
|
460
|
-
end
|
|
461
|
-
].join(
|
|
460
|
+
end,
|
|
461
|
+
].join("")
|
|
462
462
|
end
|
|
463
463
|
|
|
464
464
|
def format_declarations_parameter(node)
|
|
465
465
|
[
|
|
466
466
|
*if node.var
|
|
467
467
|
[
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
].join(
|
|
468
|
+
"VAR",
|
|
469
|
+
" ",
|
|
470
|
+
].join("")
|
|
471
471
|
end,
|
|
472
472
|
node.id,
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
format(node.type)
|
|
477
|
-
].join(
|
|
473
|
+
" ",
|
|
474
|
+
":",
|
|
475
|
+
" ",
|
|
476
|
+
format(node.type),
|
|
477
|
+
].join("")
|
|
478
478
|
end
|
|
479
479
|
|
|
480
480
|
def format_declarations_procedure(node)
|
|
481
481
|
[
|
|
482
482
|
[
|
|
483
|
-
|
|
484
|
-
|
|
483
|
+
"PROCEDURE",
|
|
484
|
+
" ",
|
|
485
485
|
node.id,
|
|
486
486
|
*if node.parameters.length > 0
|
|
487
487
|
parameter_indent = INDENT_CHAR * "PROCEDURE #{node.id}(".length
|
|
488
488
|
[
|
|
489
|
-
|
|
490
|
-
node.parameters.map{|x| format(x)}.join(";\n#{parameter_indent}"),
|
|
491
|
-
|
|
492
|
-
].join(
|
|
489
|
+
"(",
|
|
490
|
+
node.parameters.map { |x| format(x) }.join(";\n#{parameter_indent}"),
|
|
491
|
+
")",
|
|
492
|
+
].join("")
|
|
493
493
|
end,
|
|
494
|
-
|
|
495
|
-
].join(
|
|
494
|
+
";",
|
|
495
|
+
].join(""),
|
|
496
496
|
*if node.types.length > 0
|
|
497
|
-
indent(node.types.map{|x| format(x)}.join("\n"))
|
|
497
|
+
indent(node.types.map { |x| format(x) }.join("\n"))
|
|
498
498
|
end,
|
|
499
499
|
*if node.entities.length > 0
|
|
500
|
-
indent(node.entities.map{|x| format(x)}.join("\n"))
|
|
500
|
+
indent(node.entities.map { |x| format(x) }.join("\n"))
|
|
501
501
|
end,
|
|
502
502
|
*if node.subtype_constraints.length > 0
|
|
503
|
-
indent(node.subtype_constraints.map{|x| format(x)}.join("\n"))
|
|
503
|
+
indent(node.subtype_constraints.map { |x| format(x) }.join("\n"))
|
|
504
504
|
end,
|
|
505
505
|
*if node.functions.length > 0
|
|
506
|
-
indent(node.functions.map{|x| format(x)}.join("\n"))
|
|
506
|
+
indent(node.functions.map { |x| format(x) }.join("\n"))
|
|
507
507
|
end,
|
|
508
508
|
*if node.procedures.length > 0
|
|
509
|
-
indent(node.procedures.map{|x| format(x)}.join("\n"))
|
|
509
|
+
indent(node.procedures.map { |x| format(x) }.join("\n"))
|
|
510
510
|
end,
|
|
511
511
|
*if node.constants.length > 0
|
|
512
512
|
indent([
|
|
513
|
-
|
|
514
|
-
indent(node.constants.map{|x| format(x)}.join("\n")),
|
|
513
|
+
"CONSTANT",
|
|
514
|
+
indent(node.constants.map { |x| format(x) }.join("\n")),
|
|
515
515
|
[
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
].join(
|
|
516
|
+
"END_CONSTANT",
|
|
517
|
+
";",
|
|
518
|
+
].join(""),
|
|
519
519
|
].join("\n"))
|
|
520
520
|
end,
|
|
521
521
|
*if node.variables.length > 0
|
|
522
522
|
indent([
|
|
523
|
-
|
|
524
|
-
indent(node.variables.map{|x| format(x)}.join("\n")),
|
|
523
|
+
"LOCAL",
|
|
524
|
+
indent(node.variables.map { |x| format(x) }.join("\n")),
|
|
525
525
|
[
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
].join(
|
|
526
|
+
"END_LOCAL",
|
|
527
|
+
";",
|
|
528
|
+
].join(""),
|
|
529
529
|
].join("\n"))
|
|
530
530
|
end,
|
|
531
531
|
*if node.statements.length > 0
|
|
532
|
-
indent(node.statements.map{|x| format(x)}.join("\n"))
|
|
532
|
+
indent(node.statements.map { |x| format(x) }.join("\n"))
|
|
533
533
|
end,
|
|
534
534
|
[
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
].join(
|
|
535
|
+
"END_PROCEDURE",
|
|
536
|
+
";",
|
|
537
|
+
].join(""),
|
|
538
538
|
].join("\n")
|
|
539
539
|
end
|
|
540
540
|
|
|
541
541
|
def format_declarations_rule(node)
|
|
542
542
|
[
|
|
543
543
|
[
|
|
544
|
-
|
|
545
|
-
|
|
544
|
+
"RULE",
|
|
545
|
+
" ",
|
|
546
546
|
node.id,
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
node.applies_to.map{|x| format(x)}.join(
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
].join(
|
|
547
|
+
" ",
|
|
548
|
+
"FOR",
|
|
549
|
+
" ",
|
|
550
|
+
"(",
|
|
551
|
+
node.applies_to.map { |x| format(x) }.join(", "),
|
|
552
|
+
")",
|
|
553
|
+
";",
|
|
554
|
+
].join(""),
|
|
555
555
|
*if node.types.length > 0
|
|
556
|
-
indent(node.types.map{|x| format(x)}.join("\n"))
|
|
556
|
+
indent(node.types.map { |x| format(x) }.join("\n"))
|
|
557
557
|
end,
|
|
558
558
|
*if node.entities.length > 0
|
|
559
|
-
indent(node.entities.map{|x| format(x)}.join("\n"))
|
|
559
|
+
indent(node.entities.map { |x| format(x) }.join("\n"))
|
|
560
560
|
end,
|
|
561
561
|
*if node.subtype_constraints.length > 0
|
|
562
|
-
indent(node.subtype_constraints.map{|x| format(x)}.join("\n"))
|
|
562
|
+
indent(node.subtype_constraints.map { |x| format(x) }.join("\n"))
|
|
563
563
|
end,
|
|
564
564
|
*if node.functions.length > 0
|
|
565
|
-
indent(node.functions.map{|x| format(x)}.join("\n"))
|
|
565
|
+
indent(node.functions.map { |x| format(x) }.join("\n"))
|
|
566
566
|
end,
|
|
567
567
|
*if node.procedures.length > 0
|
|
568
|
-
indent(node.procedures.map{|x| format(x)}.join("\n"))
|
|
568
|
+
indent(node.procedures.map { |x| format(x) }.join("\n"))
|
|
569
569
|
end,
|
|
570
570
|
*if node.constants.length > 0
|
|
571
571
|
indent([
|
|
572
|
-
|
|
573
|
-
indent(node.constants.map{|x| format(x)}.join("\n")),
|
|
572
|
+
"CONSTANT",
|
|
573
|
+
indent(node.constants.map { |x| format(x) }.join("\n")),
|
|
574
574
|
[
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
].join(
|
|
575
|
+
"END_CONSTANT",
|
|
576
|
+
";",
|
|
577
|
+
].join(""),
|
|
578
578
|
].join("\n"))
|
|
579
579
|
end,
|
|
580
580
|
*if node.variables.length > 0
|
|
581
581
|
indent([
|
|
582
|
-
|
|
583
|
-
indent(node.variables.map{|x| format(x)}.join("\n")),
|
|
582
|
+
"LOCAL",
|
|
583
|
+
indent(node.variables.map { |x| format(x) }.join("\n")),
|
|
584
584
|
[
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
].join(
|
|
585
|
+
"END_LOCAL",
|
|
586
|
+
";",
|
|
587
|
+
].join(""),
|
|
588
588
|
].join("\n"))
|
|
589
589
|
end,
|
|
590
590
|
*if node.statements.length > 0
|
|
591
|
-
indent(node.statements.map{|x| format(x)}.join("\n"))
|
|
591
|
+
indent(node.statements.map { |x| format(x) }.join("\n"))
|
|
592
592
|
end,
|
|
593
593
|
*if node.where_rules.length > 0
|
|
594
594
|
[
|
|
595
|
-
|
|
596
|
-
indent(node.where_rules.map{|x| format(x)}.join("\n"))
|
|
595
|
+
"WHERE",
|
|
596
|
+
indent(node.where_rules.map { |x| format(x) }.join("\n")),
|
|
597
597
|
]
|
|
598
598
|
end,
|
|
599
599
|
[
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
].join(
|
|
600
|
+
"END_RULE",
|
|
601
|
+
";",
|
|
602
|
+
].join(""),
|
|
603
603
|
].join("\n")
|
|
604
604
|
end
|
|
605
605
|
|
|
606
606
|
def format_declarations_schema_head(node)
|
|
607
607
|
[
|
|
608
608
|
[
|
|
609
|
-
|
|
610
|
-
|
|
609
|
+
"SCHEMA",
|
|
610
|
+
" ",
|
|
611
611
|
node.id,
|
|
612
612
|
*if node.version
|
|
613
613
|
[
|
|
614
|
-
|
|
614
|
+
" ",
|
|
615
615
|
format(node.version),
|
|
616
|
-
].join(
|
|
616
|
+
].join("")
|
|
617
617
|
end,
|
|
618
|
-
|
|
619
|
-
].join(
|
|
618
|
+
";",
|
|
619
|
+
].join(""),
|
|
620
620
|
*if node.interfaces.length > 0
|
|
621
621
|
[
|
|
622
|
-
|
|
623
|
-
node.interfaces.map{|x| format(x)}.join("\n")
|
|
622
|
+
"",
|
|
623
|
+
node.interfaces.map { |x| format(x) }.join("\n"),
|
|
624
624
|
]
|
|
625
|
-
end
|
|
625
|
+
end,
|
|
626
626
|
].join("\n")
|
|
627
627
|
end
|
|
628
628
|
|
|
@@ -630,48 +630,48 @@ module Expressir
|
|
|
630
630
|
schema_declarations = [
|
|
631
631
|
*if node.constants.length > 0
|
|
632
632
|
[
|
|
633
|
-
|
|
634
|
-
indent(node.constants.map{|x| format(x)}.join("\n")),
|
|
633
|
+
"CONSTANT",
|
|
634
|
+
indent(node.constants.map { |x| format(x) }.join("\n")),
|
|
635
635
|
[
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
].join(
|
|
636
|
+
"END_CONSTANT",
|
|
637
|
+
";",
|
|
638
|
+
].join(""),
|
|
639
639
|
].join("\n")
|
|
640
640
|
end,
|
|
641
641
|
*if node.types.length > 0
|
|
642
|
-
node.types.map{|x| format(x)}
|
|
642
|
+
node.types.map { |x| format(x) }
|
|
643
643
|
end,
|
|
644
644
|
*if node.entities.length > 0
|
|
645
|
-
node.entities.map{|x| format(x)}
|
|
645
|
+
node.entities.map { |x| format(x) }
|
|
646
646
|
end,
|
|
647
647
|
*if node.subtype_constraints.length > 0
|
|
648
|
-
node.subtype_constraints.map{|x| format(x)}
|
|
648
|
+
node.subtype_constraints.map { |x| format(x) }
|
|
649
649
|
end,
|
|
650
650
|
*if node.functions.length > 0
|
|
651
|
-
node.functions.map{|x| format(x)}
|
|
651
|
+
node.functions.map { |x| format(x) }
|
|
652
652
|
end,
|
|
653
653
|
*if node.rules.length > 0
|
|
654
|
-
node.rules.map{|x| format(x)}
|
|
654
|
+
node.rules.map { |x| format(x) }
|
|
655
655
|
end,
|
|
656
656
|
*if node.procedures and node.procedures.length > 0
|
|
657
|
-
node.procedures.map{|x| format(x)}
|
|
658
|
-
end
|
|
657
|
+
node.procedures.map { |x| format(x) }
|
|
658
|
+
end,
|
|
659
659
|
]
|
|
660
660
|
|
|
661
661
|
[
|
|
662
662
|
format_declarations_schema_head(node),
|
|
663
663
|
*if schema_declarations.length > 0
|
|
664
664
|
[
|
|
665
|
-
|
|
665
|
+
"",
|
|
666
666
|
schema_declarations.join("\n\n"),
|
|
667
|
-
|
|
667
|
+
"",
|
|
668
668
|
]
|
|
669
669
|
end,
|
|
670
670
|
[
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
].join(
|
|
674
|
-
*format_scope_remarks(node)
|
|
671
|
+
"END_SCHEMA",
|
|
672
|
+
";",
|
|
673
|
+
].join(""),
|
|
674
|
+
*format_scope_remarks(node),
|
|
675
675
|
].join("\n")
|
|
676
676
|
end
|
|
677
677
|
|
|
@@ -679,74 +679,74 @@ module Expressir
|
|
|
679
679
|
[
|
|
680
680
|
"'",
|
|
681
681
|
node.value,
|
|
682
|
-
"'"
|
|
683
|
-
].join(
|
|
682
|
+
"'",
|
|
683
|
+
].join("")
|
|
684
684
|
end
|
|
685
685
|
|
|
686
686
|
def format_declarations_subtype_constraint(node)
|
|
687
687
|
[
|
|
688
688
|
[
|
|
689
|
-
|
|
690
|
-
|
|
689
|
+
"SUBTYPE_CONSTRAINT",
|
|
690
|
+
" ",
|
|
691
691
|
node.id,
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
692
|
+
" ",
|
|
693
|
+
"FOR",
|
|
694
|
+
" ",
|
|
695
695
|
format(node.applies_to),
|
|
696
|
-
|
|
697
|
-
].join(
|
|
696
|
+
";",
|
|
697
|
+
].join(""),
|
|
698
698
|
*if node.abstract
|
|
699
699
|
indent([
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
].join(
|
|
700
|
+
"ABSTRACT",
|
|
701
|
+
" ",
|
|
702
|
+
"SUPERTYPE",
|
|
703
|
+
";",
|
|
704
|
+
].join(""))
|
|
705
705
|
end,
|
|
706
706
|
*if node.total_over.length > 0
|
|
707
707
|
indent([
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
node.total_over.map{|x| format(x)}.join(
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
].join(
|
|
708
|
+
"TOTAL_OVER",
|
|
709
|
+
"(",
|
|
710
|
+
node.total_over.map { |x| format(x) }.join(", "),
|
|
711
|
+
")",
|
|
712
|
+
";",
|
|
713
|
+
].join(""))
|
|
714
714
|
end,
|
|
715
715
|
*if node.supertype_expression
|
|
716
716
|
indent([
|
|
717
717
|
format(node.supertype_expression),
|
|
718
|
-
|
|
719
|
-
].join(
|
|
718
|
+
";",
|
|
719
|
+
].join(""))
|
|
720
720
|
end,
|
|
721
721
|
[
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
].join(
|
|
722
|
+
"END_SUBTYPE_CONSTRAINT",
|
|
723
|
+
";",
|
|
724
|
+
].join(""),
|
|
725
725
|
].join("\n")
|
|
726
726
|
end
|
|
727
727
|
|
|
728
728
|
def format_declarations_type(node)
|
|
729
729
|
[
|
|
730
730
|
[
|
|
731
|
-
|
|
732
|
-
|
|
731
|
+
"TYPE",
|
|
732
|
+
" ",
|
|
733
733
|
node.id,
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
734
|
+
" ",
|
|
735
|
+
"=",
|
|
736
|
+
" ",
|
|
737
737
|
format(node.underlying_type),
|
|
738
|
-
|
|
739
|
-
].join(
|
|
738
|
+
";",
|
|
739
|
+
].join(""),
|
|
740
740
|
*if node.where_rules.length > 0
|
|
741
741
|
[
|
|
742
|
-
|
|
743
|
-
indent(node.where_rules.map{|x| format(x)}.join("\n"))
|
|
742
|
+
"WHERE",
|
|
743
|
+
indent(node.where_rules.map { |x| format(x) }.join("\n")),
|
|
744
744
|
]
|
|
745
745
|
end,
|
|
746
746
|
[
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
].join(
|
|
747
|
+
"END_TYPE",
|
|
748
|
+
";",
|
|
749
|
+
].join(""),
|
|
750
750
|
].join("\n")
|
|
751
751
|
end
|
|
752
752
|
|
|
@@ -755,32 +755,32 @@ module Expressir
|
|
|
755
755
|
*if node.id
|
|
756
756
|
[
|
|
757
757
|
node.id,
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
].join(
|
|
758
|
+
":",
|
|
759
|
+
" ",
|
|
760
|
+
].join("")
|
|
761
761
|
end,
|
|
762
|
-
node.attributes.map{|x| format(x)}.join(
|
|
763
|
-
|
|
764
|
-
].join(
|
|
762
|
+
node.attributes.map { |x| format(x) }.join(", "),
|
|
763
|
+
";",
|
|
764
|
+
].join("")
|
|
765
765
|
end
|
|
766
766
|
|
|
767
767
|
def format_declarations_variable(node)
|
|
768
768
|
[
|
|
769
769
|
node.id,
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
770
|
+
" ",
|
|
771
|
+
":",
|
|
772
|
+
" ",
|
|
773
773
|
format(node.type),
|
|
774
774
|
*if node.expression
|
|
775
775
|
[
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
776
|
+
" ",
|
|
777
|
+
":=",
|
|
778
|
+
" ",
|
|
779
779
|
format(node.expression),
|
|
780
|
-
].join(
|
|
780
|
+
].join("")
|
|
781
781
|
end,
|
|
782
|
-
|
|
783
|
-
].join(
|
|
782
|
+
";",
|
|
783
|
+
].join("")
|
|
784
784
|
end
|
|
785
785
|
|
|
786
786
|
def format_declarations_where_rule(node)
|
|
@@ -788,158 +788,158 @@ module Expressir
|
|
|
788
788
|
*if node.id
|
|
789
789
|
[
|
|
790
790
|
node.id,
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
].join(
|
|
791
|
+
":",
|
|
792
|
+
" ",
|
|
793
|
+
].join("")
|
|
794
794
|
end,
|
|
795
795
|
format(node.expression),
|
|
796
|
-
|
|
797
|
-
].join(
|
|
796
|
+
";",
|
|
797
|
+
].join("")
|
|
798
798
|
end
|
|
799
799
|
|
|
800
800
|
def format_expressions_aggregate_initializer(node)
|
|
801
801
|
[
|
|
802
|
-
|
|
803
|
-
node.items.map{|x| format(x)}.join(
|
|
804
|
-
|
|
805
|
-
].join(
|
|
802
|
+
"[",
|
|
803
|
+
node.items.map { |x| format(x) }.join(", "),
|
|
804
|
+
"]",
|
|
805
|
+
].join("")
|
|
806
806
|
end
|
|
807
807
|
|
|
808
808
|
def format_expressions_aggregate_initializer_item(node)
|
|
809
809
|
[
|
|
810
810
|
format(node.expression),
|
|
811
|
-
|
|
812
|
-
format(node.repetition)
|
|
813
|
-
].join(
|
|
811
|
+
":",
|
|
812
|
+
format(node.repetition),
|
|
813
|
+
].join("")
|
|
814
814
|
end
|
|
815
815
|
|
|
816
816
|
def format_expressions_binary_expression(node)
|
|
817
817
|
[
|
|
818
818
|
*if node.operand1.is_a? Model::Expressions::BinaryExpression and OPERATOR_PRECEDENCE[node.operand1.operator] > OPERATOR_PRECEDENCE[node.operator]
|
|
819
|
-
|
|
819
|
+
"("
|
|
820
820
|
end,
|
|
821
821
|
format(node.operand1),
|
|
822
822
|
*if node.operand1.is_a? Model::Expressions::BinaryExpression and OPERATOR_PRECEDENCE[node.operand1.operator] > OPERATOR_PRECEDENCE[node.operator]
|
|
823
|
-
|
|
823
|
+
")"
|
|
824
824
|
end,
|
|
825
|
-
|
|
825
|
+
" ",
|
|
826
826
|
case node.operator
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
end,
|
|
849
|
-
|
|
827
|
+
when Model::Expressions::BinaryExpression::ADDITION then "+"
|
|
828
|
+
when Model::Expressions::BinaryExpression::AND then "AND"
|
|
829
|
+
when Model::Expressions::BinaryExpression::COMBINE then "||"
|
|
830
|
+
when Model::Expressions::BinaryExpression::EQUAL then "="
|
|
831
|
+
when Model::Expressions::BinaryExpression::EXPONENTIATION then "**"
|
|
832
|
+
when Model::Expressions::BinaryExpression::GREATER_THAN then ">"
|
|
833
|
+
when Model::Expressions::BinaryExpression::GREATER_THAN_OR_EQUAL then ">="
|
|
834
|
+
when Model::Expressions::BinaryExpression::IN then "IN"
|
|
835
|
+
when Model::Expressions::BinaryExpression::INSTANCE_EQUAL then ":=:"
|
|
836
|
+
when Model::Expressions::BinaryExpression::INSTANCE_NOT_EQUAL then ":<>:"
|
|
837
|
+
when Model::Expressions::BinaryExpression::INTEGER_DIVISION then "DIV"
|
|
838
|
+
when Model::Expressions::BinaryExpression::LESS_THAN then "<"
|
|
839
|
+
when Model::Expressions::BinaryExpression::LESS_THAN_OR_EQUAL then "<="
|
|
840
|
+
when Model::Expressions::BinaryExpression::LIKE then "LIKE"
|
|
841
|
+
when Model::Expressions::BinaryExpression::MODULO then "MOD"
|
|
842
|
+
when Model::Expressions::BinaryExpression::MULTIPLICATION then "*"
|
|
843
|
+
when Model::Expressions::BinaryExpression::NOT_EQUAL then "<>"
|
|
844
|
+
when Model::Expressions::BinaryExpression::OR then "OR"
|
|
845
|
+
when Model::Expressions::BinaryExpression::REAL_DIVISION then "/"
|
|
846
|
+
when Model::Expressions::BinaryExpression::SUBTRACTION then "-"
|
|
847
|
+
when Model::Expressions::BinaryExpression::XOR then "XOR"
|
|
848
|
+
end,
|
|
849
|
+
" ",
|
|
850
850
|
*if node.operand2.is_a? Model::Expressions::BinaryExpression and OPERATOR_PRECEDENCE[node.operand2.operator] > OPERATOR_PRECEDENCE[node.operator]
|
|
851
|
-
|
|
851
|
+
"("
|
|
852
852
|
end,
|
|
853
853
|
format(node.operand2),
|
|
854
854
|
*if node.operand2.is_a? Model::Expressions::BinaryExpression and OPERATOR_PRECEDENCE[node.operand2.operator] > OPERATOR_PRECEDENCE[node.operator]
|
|
855
|
-
|
|
855
|
+
")"
|
|
856
856
|
end,
|
|
857
|
-
].join(
|
|
857
|
+
].join("")
|
|
858
858
|
end
|
|
859
859
|
|
|
860
860
|
def format_expressions_entity_constructor(node)
|
|
861
861
|
[
|
|
862
862
|
format(node.entity),
|
|
863
|
-
|
|
864
|
-
node.parameters.map{|x| format(x)}.join(
|
|
865
|
-
|
|
866
|
-
].join(
|
|
863
|
+
"(",
|
|
864
|
+
node.parameters.map { |x| format(x) }.join(", "),
|
|
865
|
+
")",
|
|
866
|
+
].join("")
|
|
867
867
|
end
|
|
868
868
|
|
|
869
869
|
def format_expressions_function_call(node)
|
|
870
870
|
[
|
|
871
871
|
format(node.function),
|
|
872
|
-
|
|
873
|
-
node.parameters.map{|x| format(x)}.join(
|
|
874
|
-
|
|
875
|
-
].join(
|
|
872
|
+
"(",
|
|
873
|
+
node.parameters.map { |x| format(x) }.join(", "),
|
|
874
|
+
")",
|
|
875
|
+
].join("")
|
|
876
876
|
end
|
|
877
877
|
|
|
878
878
|
def format_expressions_interval(node)
|
|
879
879
|
[
|
|
880
|
-
|
|
880
|
+
"{",
|
|
881
881
|
format(node.low),
|
|
882
|
-
|
|
882
|
+
" ",
|
|
883
883
|
case node.operator1
|
|
884
|
-
|
|
885
|
-
|
|
884
|
+
when Model::Expressions::Interval::LESS_THAN then "<"
|
|
885
|
+
when Model::Expressions::Interval::LESS_THAN_OR_EQUAL then "<="
|
|
886
886
|
end,
|
|
887
|
-
|
|
887
|
+
" ",
|
|
888
888
|
format(node.item),
|
|
889
|
-
|
|
889
|
+
" ",
|
|
890
890
|
case node.operator2
|
|
891
|
-
|
|
892
|
-
|
|
891
|
+
when Model::Expressions::Interval::LESS_THAN then "<"
|
|
892
|
+
when Model::Expressions::Interval::LESS_THAN_OR_EQUAL then "<="
|
|
893
893
|
end,
|
|
894
|
-
|
|
894
|
+
" ",
|
|
895
895
|
format(node.high),
|
|
896
|
-
|
|
897
|
-
].join(
|
|
896
|
+
"}",
|
|
897
|
+
].join("")
|
|
898
898
|
end
|
|
899
899
|
|
|
900
900
|
def format_expressions_query_expression(node)
|
|
901
901
|
[
|
|
902
|
-
|
|
903
|
-
|
|
902
|
+
"QUERY",
|
|
903
|
+
"(",
|
|
904
904
|
node.id,
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
905
|
+
" ",
|
|
906
|
+
"<*",
|
|
907
|
+
" ",
|
|
908
908
|
format(node.aggregate_source),
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
909
|
+
" ",
|
|
910
|
+
"|",
|
|
911
|
+
" ",
|
|
912
912
|
format(node.expression),
|
|
913
|
-
*format_remarks(node).instance_eval{|x| x.length > 0 ? ["\n", *x, "\n"] : x},
|
|
914
|
-
|
|
915
|
-
].join(
|
|
913
|
+
*format_remarks(node).instance_eval { |x| x.length > 0 ? ["\n", *x, "\n"] : x },
|
|
914
|
+
")",
|
|
915
|
+
].join("")
|
|
916
916
|
end
|
|
917
917
|
|
|
918
918
|
def format_expressions_unary_expression(node)
|
|
919
919
|
[
|
|
920
920
|
case node.operator
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
921
|
+
when Model::Expressions::UnaryExpression::MINUS then "-"
|
|
922
|
+
when Model::Expressions::UnaryExpression::NOT then "NOT"
|
|
923
|
+
when Model::Expressions::UnaryExpression::PLUS then "+"
|
|
924
924
|
end,
|
|
925
925
|
if node.operator == Model::Expressions::UnaryExpression::NOT
|
|
926
|
-
|
|
926
|
+
" "
|
|
927
927
|
end,
|
|
928
928
|
*if node.operand.is_a? Model::Expressions::BinaryExpression
|
|
929
|
-
|
|
929
|
+
"("
|
|
930
930
|
end,
|
|
931
931
|
format(node.operand),
|
|
932
932
|
*if node.operand.is_a? Model::Expressions::BinaryExpression
|
|
933
|
-
|
|
934
|
-
end
|
|
935
|
-
].join(
|
|
933
|
+
")"
|
|
934
|
+
end,
|
|
935
|
+
].join("")
|
|
936
936
|
end
|
|
937
937
|
|
|
938
938
|
def format_literals_binary(node)
|
|
939
939
|
[
|
|
940
|
-
|
|
941
|
-
node.value
|
|
942
|
-
].join(
|
|
940
|
+
"%",
|
|
941
|
+
node.value,
|
|
942
|
+
].join("")
|
|
943
943
|
end
|
|
944
944
|
|
|
945
945
|
def format_literals_integer(node)
|
|
@@ -948,9 +948,9 @@ module Expressir
|
|
|
948
948
|
|
|
949
949
|
def format_literals_logical(node)
|
|
950
950
|
case node.value
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
951
|
+
when Model::Literals::Logical::TRUE then "TRUE"
|
|
952
|
+
when Model::Literals::Logical::FALSE then "FALSE"
|
|
953
|
+
when Model::Literals::Logical::UNKNOWN then "UNKNOWN"
|
|
954
954
|
end
|
|
955
955
|
end
|
|
956
956
|
|
|
@@ -963,46 +963,46 @@ module Expressir
|
|
|
963
963
|
[
|
|
964
964
|
"\"",
|
|
965
965
|
node.value,
|
|
966
|
-
"\""
|
|
967
|
-
].join(
|
|
966
|
+
"\"",
|
|
967
|
+
].join("")
|
|
968
968
|
else
|
|
969
969
|
[
|
|
970
970
|
"'",
|
|
971
971
|
node.value,
|
|
972
|
-
"'"
|
|
973
|
-
].join(
|
|
972
|
+
"'",
|
|
973
|
+
].join("")
|
|
974
974
|
end
|
|
975
975
|
end
|
|
976
976
|
|
|
977
977
|
def format_references_attribute_reference(node)
|
|
978
978
|
[
|
|
979
979
|
format(node.ref),
|
|
980
|
-
|
|
981
|
-
format(node.attribute)
|
|
982
|
-
].join(
|
|
980
|
+
".",
|
|
981
|
+
format(node.attribute),
|
|
982
|
+
].join("")
|
|
983
983
|
end
|
|
984
984
|
|
|
985
985
|
def format_references_group_reference(node)
|
|
986
986
|
[
|
|
987
987
|
format(node.ref),
|
|
988
988
|
'\\',
|
|
989
|
-
format(node.entity)
|
|
990
|
-
].join(
|
|
989
|
+
format(node.entity),
|
|
990
|
+
].join("")
|
|
991
991
|
end
|
|
992
992
|
|
|
993
993
|
def format_references_index_reference(node)
|
|
994
994
|
[
|
|
995
995
|
format(node.ref),
|
|
996
|
-
|
|
996
|
+
"[",
|
|
997
997
|
format(node.index1),
|
|
998
998
|
*if node.index2
|
|
999
999
|
[
|
|
1000
|
-
|
|
1001
|
-
format(node.index2)
|
|
1002
|
-
].join(
|
|
1000
|
+
":",
|
|
1001
|
+
format(node.index2),
|
|
1002
|
+
].join("")
|
|
1003
1003
|
end,
|
|
1004
|
-
|
|
1005
|
-
].join(
|
|
1004
|
+
"]",
|
|
1005
|
+
].join("")
|
|
1006
1006
|
end
|
|
1007
1007
|
|
|
1008
1008
|
def format_references_simple_reference(node)
|
|
@@ -1012,35 +1012,35 @@ module Expressir
|
|
|
1012
1012
|
def format_statements_alias(node)
|
|
1013
1013
|
[
|
|
1014
1014
|
[
|
|
1015
|
-
|
|
1016
|
-
|
|
1015
|
+
"ALIAS",
|
|
1016
|
+
" ",
|
|
1017
1017
|
node.id,
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1018
|
+
" ",
|
|
1019
|
+
"FOR",
|
|
1020
|
+
" ",
|
|
1021
1021
|
format(node.expression),
|
|
1022
|
-
|
|
1023
|
-
].join(
|
|
1022
|
+
";",
|
|
1023
|
+
].join(""),
|
|
1024
1024
|
*if node.statements.length > 0
|
|
1025
|
-
indent(node.statements.map{|x| format(x)}.join("\n"))
|
|
1025
|
+
indent(node.statements.map { |x| format(x) }.join("\n"))
|
|
1026
1026
|
end,
|
|
1027
1027
|
*format_remarks(node),
|
|
1028
1028
|
[
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
].join(
|
|
1029
|
+
"END_ALIAS",
|
|
1030
|
+
";",
|
|
1031
|
+
].join(""),
|
|
1032
1032
|
].join("\n")
|
|
1033
1033
|
end
|
|
1034
1034
|
|
|
1035
1035
|
def format_statements_assignment(node)
|
|
1036
1036
|
[
|
|
1037
1037
|
format(node.ref),
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1038
|
+
" ",
|
|
1039
|
+
":=",
|
|
1040
|
+
" ",
|
|
1041
1041
|
format(node.expression),
|
|
1042
|
-
|
|
1043
|
-
].join(
|
|
1042
|
+
";",
|
|
1043
|
+
].join("")
|
|
1044
1044
|
end
|
|
1045
1045
|
|
|
1046
1046
|
def format_statements_procedure_call(node)
|
|
@@ -1048,342 +1048,342 @@ module Expressir
|
|
|
1048
1048
|
format(node.procedure),
|
|
1049
1049
|
*if node.parameters.length > 0
|
|
1050
1050
|
[
|
|
1051
|
-
|
|
1052
|
-
node.parameters.map{|x| format(x)}.join(
|
|
1053
|
-
|
|
1054
|
-
].join(
|
|
1051
|
+
"(",
|
|
1052
|
+
node.parameters.map { |x| format(x) }.join(", "),
|
|
1053
|
+
")",
|
|
1054
|
+
].join("")
|
|
1055
1055
|
end,
|
|
1056
|
-
|
|
1057
|
-
].join(
|
|
1056
|
+
";",
|
|
1057
|
+
].join("")
|
|
1058
1058
|
end
|
|
1059
1059
|
|
|
1060
1060
|
def format_statements_case(node)
|
|
1061
1061
|
[
|
|
1062
1062
|
[
|
|
1063
|
-
|
|
1064
|
-
|
|
1063
|
+
"CASE",
|
|
1064
|
+
" ",
|
|
1065
1065
|
format(node.expression),
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
].join(
|
|
1066
|
+
" ",
|
|
1067
|
+
"OF",
|
|
1068
|
+
].join(""),
|
|
1069
1069
|
*if node.actions.length > 0
|
|
1070
|
-
node.actions.map{|x| format(x)}
|
|
1070
|
+
node.actions.map { |x| format(x) }
|
|
1071
1071
|
end,
|
|
1072
1072
|
*if node.otherwise_statement
|
|
1073
1073
|
[
|
|
1074
1074
|
[
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
].join(
|
|
1079
|
-
indent(format(node.otherwise_statement))
|
|
1075
|
+
"OTHERWISE",
|
|
1076
|
+
" ",
|
|
1077
|
+
":",
|
|
1078
|
+
].join(""),
|
|
1079
|
+
indent(format(node.otherwise_statement)),
|
|
1080
1080
|
]
|
|
1081
1081
|
end,
|
|
1082
1082
|
[
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
].join(
|
|
1083
|
+
"END_CASE",
|
|
1084
|
+
";",
|
|
1085
|
+
].join(""),
|
|
1086
1086
|
].join("\n")
|
|
1087
1087
|
end
|
|
1088
1088
|
|
|
1089
1089
|
def format_statements_case_action(node)
|
|
1090
1090
|
[
|
|
1091
1091
|
[
|
|
1092
|
-
node.labels.map{|x| format(x)}.join(
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
].join(
|
|
1096
|
-
indent(format(node.statement))
|
|
1092
|
+
node.labels.map { |x| format(x) }.join(", "),
|
|
1093
|
+
" ",
|
|
1094
|
+
":",
|
|
1095
|
+
].join(""),
|
|
1096
|
+
indent(format(node.statement)),
|
|
1097
1097
|
].join("\n")
|
|
1098
1098
|
end
|
|
1099
1099
|
|
|
1100
1100
|
def format_statements_compound(node)
|
|
1101
1101
|
[
|
|
1102
|
-
|
|
1102
|
+
"BEGIN",
|
|
1103
1103
|
*if node.statements.length > 0
|
|
1104
|
-
indent(node.statements.map{|x| format(x)}.join("\n"))
|
|
1104
|
+
indent(node.statements.map { |x| format(x) }.join("\n"))
|
|
1105
1105
|
end,
|
|
1106
1106
|
[
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
].join(
|
|
1107
|
+
"END",
|
|
1108
|
+
";",
|
|
1109
|
+
].join(""),
|
|
1110
1110
|
].join("\n")
|
|
1111
1111
|
end
|
|
1112
1112
|
|
|
1113
1113
|
def format_statements_escape(node)
|
|
1114
1114
|
[
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
].join(
|
|
1115
|
+
"ESCAPE",
|
|
1116
|
+
";",
|
|
1117
|
+
].join("")
|
|
1118
1118
|
end
|
|
1119
1119
|
|
|
1120
1120
|
def format_statements_if(node)
|
|
1121
1121
|
[
|
|
1122
1122
|
[
|
|
1123
|
-
|
|
1124
|
-
|
|
1123
|
+
"IF",
|
|
1124
|
+
" ",
|
|
1125
1125
|
format(node.expression),
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
].join(
|
|
1126
|
+
" ",
|
|
1127
|
+
"THEN",
|
|
1128
|
+
].join(""),
|
|
1129
1129
|
*if node.statements.length > 0
|
|
1130
|
-
indent(node.statements.map{|x| format(x)}.join("\n"))
|
|
1130
|
+
indent(node.statements.map { |x| format(x) }.join("\n"))
|
|
1131
1131
|
end,
|
|
1132
1132
|
*if node.else_statements.length > 0
|
|
1133
1133
|
[
|
|
1134
|
-
|
|
1135
|
-
indent(node.else_statements.map{|x| format(x)}.join("\n")),
|
|
1134
|
+
"ELSE",
|
|
1135
|
+
indent(node.else_statements.map { |x| format(x) }.join("\n")),
|
|
1136
1136
|
].join("\n")
|
|
1137
1137
|
end,
|
|
1138
1138
|
[
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
].join(
|
|
1139
|
+
"END_IF",
|
|
1140
|
+
";",
|
|
1141
|
+
].join(""),
|
|
1142
1142
|
].join("\n")
|
|
1143
1143
|
end
|
|
1144
1144
|
|
|
1145
1145
|
def format_statements_null(node)
|
|
1146
|
-
|
|
1146
|
+
";"
|
|
1147
1147
|
end
|
|
1148
1148
|
|
|
1149
1149
|
def format_statements_repeat(node)
|
|
1150
1150
|
[
|
|
1151
1151
|
[
|
|
1152
|
-
|
|
1152
|
+
"REPEAT",
|
|
1153
1153
|
*if node.id
|
|
1154
1154
|
[
|
|
1155
|
-
|
|
1155
|
+
" ",
|
|
1156
1156
|
node.id,
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1157
|
+
" ",
|
|
1158
|
+
":=",
|
|
1159
|
+
" ",
|
|
1160
1160
|
format(node.bound1),
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1161
|
+
" ",
|
|
1162
|
+
"TO",
|
|
1163
|
+
" ",
|
|
1164
1164
|
format(node.bound2),
|
|
1165
1165
|
*if node.increment
|
|
1166
1166
|
[
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
format(node.increment)
|
|
1171
|
-
].join(
|
|
1172
|
-
end
|
|
1173
|
-
].join(
|
|
1167
|
+
" ",
|
|
1168
|
+
"BY",
|
|
1169
|
+
" ",
|
|
1170
|
+
format(node.increment),
|
|
1171
|
+
].join("")
|
|
1172
|
+
end,
|
|
1173
|
+
].join("")
|
|
1174
1174
|
end,
|
|
1175
1175
|
*if node.while_expression
|
|
1176
1176
|
[
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
format(node.while_expression)
|
|
1181
|
-
].join(
|
|
1177
|
+
" ",
|
|
1178
|
+
"WHILE",
|
|
1179
|
+
" ",
|
|
1180
|
+
format(node.while_expression),
|
|
1181
|
+
].join("")
|
|
1182
1182
|
end,
|
|
1183
1183
|
*if node.until_expression
|
|
1184
1184
|
[
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
format(node.until_expression)
|
|
1189
|
-
].join(
|
|
1185
|
+
" ",
|
|
1186
|
+
"UNTIL",
|
|
1187
|
+
" ",
|
|
1188
|
+
format(node.until_expression),
|
|
1189
|
+
].join("")
|
|
1190
1190
|
end,
|
|
1191
|
-
|
|
1192
|
-
].join(
|
|
1191
|
+
";",
|
|
1192
|
+
].join(""),
|
|
1193
1193
|
*if node.statements.length > 0
|
|
1194
|
-
indent(node.statements.map{|x| format(x)}.join("\n"))
|
|
1194
|
+
indent(node.statements.map { |x| format(x) }.join("\n"))
|
|
1195
1195
|
end,
|
|
1196
1196
|
*format_remarks(node),
|
|
1197
1197
|
[
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
].join(
|
|
1198
|
+
"END_REPEAT",
|
|
1199
|
+
";",
|
|
1200
|
+
].join(""),
|
|
1201
1201
|
].join("\n")
|
|
1202
1202
|
end
|
|
1203
1203
|
|
|
1204
1204
|
def format_statements_return(node)
|
|
1205
1205
|
[
|
|
1206
|
-
|
|
1206
|
+
"RETURN",
|
|
1207
1207
|
*if node.expression
|
|
1208
1208
|
[
|
|
1209
|
-
|
|
1210
|
-
|
|
1209
|
+
" ",
|
|
1210
|
+
"(",
|
|
1211
1211
|
format(node.expression),
|
|
1212
|
-
|
|
1213
|
-
].join(
|
|
1212
|
+
")",
|
|
1213
|
+
].join("")
|
|
1214
1214
|
end,
|
|
1215
|
-
|
|
1216
|
-
].join(
|
|
1215
|
+
";",
|
|
1216
|
+
].join("")
|
|
1217
1217
|
end
|
|
1218
1218
|
|
|
1219
1219
|
def format_statements_skip(node)
|
|
1220
1220
|
[
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
].join(
|
|
1221
|
+
"SKIP",
|
|
1222
|
+
";",
|
|
1223
|
+
].join("")
|
|
1224
1224
|
end
|
|
1225
1225
|
|
|
1226
1226
|
def format_supertype_expressions_binary_supertype_expression(node)
|
|
1227
1227
|
[
|
|
1228
1228
|
*if node.operand1.is_a? Model::SupertypeExpressions::BinarySupertypeExpression and SUPERTYPE_OPERATOR_PRECEDENCE[node.operand1.operator] > SUPERTYPE_OPERATOR_PRECEDENCE[node.operator]
|
|
1229
|
-
|
|
1229
|
+
"("
|
|
1230
1230
|
end,
|
|
1231
1231
|
format(node.operand1),
|
|
1232
1232
|
*if node.operand1.is_a? Model::SupertypeExpressions::BinarySupertypeExpression and SUPERTYPE_OPERATOR_PRECEDENCE[node.operand1.operator] > SUPERTYPE_OPERATOR_PRECEDENCE[node.operator]
|
|
1233
|
-
|
|
1233
|
+
")"
|
|
1234
1234
|
end,
|
|
1235
|
-
|
|
1235
|
+
" ",
|
|
1236
1236
|
case node.operator
|
|
1237
|
-
|
|
1238
|
-
|
|
1237
|
+
when Model::SupertypeExpressions::BinarySupertypeExpression::AND then "AND"
|
|
1238
|
+
when Model::SupertypeExpressions::BinarySupertypeExpression::ANDOR then "ANDOR"
|
|
1239
1239
|
end,
|
|
1240
|
-
|
|
1240
|
+
" ",
|
|
1241
1241
|
*if node.operand2.is_a? Model::SupertypeExpressions::BinarySupertypeExpression and SUPERTYPE_OPERATOR_PRECEDENCE[node.operand2.operator] > SUPERTYPE_OPERATOR_PRECEDENCE[node.operator]
|
|
1242
|
-
|
|
1242
|
+
"("
|
|
1243
1243
|
end,
|
|
1244
1244
|
format(node.operand2),
|
|
1245
1245
|
*if node.operand2.is_a? Model::SupertypeExpressions::BinarySupertypeExpression and SUPERTYPE_OPERATOR_PRECEDENCE[node.operand2.operator] > SUPERTYPE_OPERATOR_PRECEDENCE[node.operator]
|
|
1246
|
-
|
|
1246
|
+
")"
|
|
1247
1247
|
end,
|
|
1248
|
-
].join(
|
|
1248
|
+
].join("")
|
|
1249
1249
|
end
|
|
1250
1250
|
|
|
1251
1251
|
def format_supertype_expressions_oneof_supertype_expression(node)
|
|
1252
1252
|
[
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
node.operands.map{|x| format(x)}.join(
|
|
1256
|
-
|
|
1257
|
-
].join(
|
|
1253
|
+
"ONEOF",
|
|
1254
|
+
"(",
|
|
1255
|
+
node.operands.map { |x| format(x) }.join(", "),
|
|
1256
|
+
")",
|
|
1257
|
+
].join("")
|
|
1258
1258
|
end
|
|
1259
1259
|
|
|
1260
1260
|
def format_data_types_aggregate(node)
|
|
1261
|
-
|
|
1261
|
+
"AGGREGATE"
|
|
1262
1262
|
end
|
|
1263
1263
|
|
|
1264
1264
|
def format_data_types_array(node)
|
|
1265
1265
|
[
|
|
1266
|
-
|
|
1266
|
+
"ARRAY",
|
|
1267
1267
|
*if node.bound1 and node.bound2
|
|
1268
1268
|
[
|
|
1269
|
-
|
|
1270
|
-
|
|
1269
|
+
" ",
|
|
1270
|
+
"[",
|
|
1271
1271
|
format(node.bound1),
|
|
1272
|
-
|
|
1272
|
+
":",
|
|
1273
1273
|
format(node.bound2),
|
|
1274
|
-
|
|
1275
|
-
].join(
|
|
1274
|
+
"]",
|
|
1275
|
+
].join("")
|
|
1276
1276
|
end,
|
|
1277
|
-
|
|
1278
|
-
|
|
1277
|
+
" ",
|
|
1278
|
+
"OF",
|
|
1279
1279
|
*if node.optional
|
|
1280
1280
|
[
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
].join(
|
|
1281
|
+
" ",
|
|
1282
|
+
"OPTIONAL",
|
|
1283
|
+
].join("")
|
|
1284
1284
|
end,
|
|
1285
1285
|
*if node.unique
|
|
1286
1286
|
[
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
].join(
|
|
1287
|
+
" ",
|
|
1288
|
+
"UNIQUE",
|
|
1289
|
+
].join("")
|
|
1290
1290
|
end,
|
|
1291
|
-
|
|
1292
|
-
format(node.base_type)
|
|
1293
|
-
].join(
|
|
1291
|
+
" ",
|
|
1292
|
+
format(node.base_type),
|
|
1293
|
+
].join("")
|
|
1294
1294
|
end
|
|
1295
1295
|
|
|
1296
1296
|
def format_data_types_bag(node)
|
|
1297
1297
|
[
|
|
1298
|
-
|
|
1298
|
+
"BAG",
|
|
1299
1299
|
*if node.bound1 and node.bound2
|
|
1300
1300
|
[
|
|
1301
|
-
|
|
1302
|
-
|
|
1301
|
+
" ",
|
|
1302
|
+
"[",
|
|
1303
1303
|
format(node.bound1),
|
|
1304
|
-
|
|
1304
|
+
":",
|
|
1305
1305
|
format(node.bound2),
|
|
1306
|
-
|
|
1307
|
-
].join(
|
|
1306
|
+
"]",
|
|
1307
|
+
].join("")
|
|
1308
1308
|
end,
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
format(node.base_type)
|
|
1313
|
-
].join(
|
|
1309
|
+
" ",
|
|
1310
|
+
"OF",
|
|
1311
|
+
" ",
|
|
1312
|
+
format(node.base_type),
|
|
1313
|
+
].join("")
|
|
1314
1314
|
end
|
|
1315
1315
|
|
|
1316
1316
|
def format_data_types_binary(node)
|
|
1317
1317
|
[
|
|
1318
|
-
|
|
1318
|
+
"BINARY",
|
|
1319
1319
|
*if node.width
|
|
1320
1320
|
[
|
|
1321
|
-
|
|
1322
|
-
|
|
1321
|
+
" ",
|
|
1322
|
+
"(",
|
|
1323
1323
|
format(node.width),
|
|
1324
|
-
|
|
1325
|
-
].join(
|
|
1324
|
+
")",
|
|
1325
|
+
].join("")
|
|
1326
1326
|
end,
|
|
1327
1327
|
*if node.fixed
|
|
1328
1328
|
[
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
].join(
|
|
1332
|
-
end
|
|
1333
|
-
].join(
|
|
1329
|
+
" ",
|
|
1330
|
+
"FIXED",
|
|
1331
|
+
].join("")
|
|
1332
|
+
end,
|
|
1333
|
+
].join("")
|
|
1334
1334
|
end
|
|
1335
1335
|
|
|
1336
1336
|
def format_data_types_boolean(node)
|
|
1337
|
-
|
|
1337
|
+
"BOOLEAN"
|
|
1338
1338
|
end
|
|
1339
1339
|
|
|
1340
1340
|
def format_data_types_enumeration(node)
|
|
1341
1341
|
[
|
|
1342
1342
|
*if node.extensible
|
|
1343
1343
|
[
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
].join(
|
|
1344
|
+
"EXTENSIBLE",
|
|
1345
|
+
" ",
|
|
1346
|
+
].join("")
|
|
1347
1347
|
end,
|
|
1348
|
-
|
|
1348
|
+
"ENUMERATION",
|
|
1349
1349
|
*if node.based_on
|
|
1350
1350
|
[
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1351
|
+
" ",
|
|
1352
|
+
"BASED_ON",
|
|
1353
|
+
" ",
|
|
1354
1354
|
format(node.based_on),
|
|
1355
1355
|
*if node.items.length > 0
|
|
1356
|
-
item_indent = INDENT_CHAR *
|
|
1356
|
+
item_indent = INDENT_CHAR * "(".length
|
|
1357
1357
|
[
|
|
1358
|
-
|
|
1359
|
-
|
|
1358
|
+
" ",
|
|
1359
|
+
"WITH",
|
|
1360
1360
|
"\n",
|
|
1361
1361
|
indent([
|
|
1362
|
-
|
|
1363
|
-
node.items.map{|x| format(x)}.join(",\n#{item_indent}"),
|
|
1364
|
-
|
|
1365
|
-
].join(
|
|
1366
|
-
].join(
|
|
1367
|
-
end
|
|
1368
|
-
].join(
|
|
1362
|
+
"(",
|
|
1363
|
+
node.items.map { |x| format(x) }.join(",\n#{item_indent}"),
|
|
1364
|
+
")",
|
|
1365
|
+
].join("")),
|
|
1366
|
+
].join("")
|
|
1367
|
+
end,
|
|
1368
|
+
].join("")
|
|
1369
1369
|
else
|
|
1370
1370
|
[
|
|
1371
1371
|
*if node.items.length > 0
|
|
1372
|
-
item_indent = INDENT_CHAR *
|
|
1372
|
+
item_indent = INDENT_CHAR * "(".length
|
|
1373
1373
|
[
|
|
1374
|
-
|
|
1375
|
-
|
|
1374
|
+
" ",
|
|
1375
|
+
"OF",
|
|
1376
1376
|
"\n",
|
|
1377
1377
|
indent([
|
|
1378
|
-
|
|
1379
|
-
node.items.map{|x| format(x)}.join(",\n#{item_indent}"),
|
|
1380
|
-
|
|
1381
|
-
].join(
|
|
1382
|
-
].join(
|
|
1383
|
-
end
|
|
1384
|
-
].join(
|
|
1385
|
-
end
|
|
1386
|
-
].join(
|
|
1378
|
+
"(",
|
|
1379
|
+
node.items.map { |x| format(x) }.join(",\n#{item_indent}"),
|
|
1380
|
+
")",
|
|
1381
|
+
].join("")),
|
|
1382
|
+
].join("")
|
|
1383
|
+
end,
|
|
1384
|
+
].join("")
|
|
1385
|
+
end,
|
|
1386
|
+
].join("")
|
|
1387
1387
|
end
|
|
1388
1388
|
|
|
1389
1389
|
def format_data_types_enumeration_item(node)
|
|
@@ -1392,198 +1392,198 @@ module Expressir
|
|
|
1392
1392
|
|
|
1393
1393
|
def format_data_types_generic_entity(node)
|
|
1394
1394
|
[
|
|
1395
|
-
|
|
1395
|
+
"GENERIC_ENTITY",
|
|
1396
1396
|
*if node.id
|
|
1397
1397
|
[
|
|
1398
|
-
|
|
1399
|
-
node.id
|
|
1398
|
+
":",
|
|
1399
|
+
node.id,
|
|
1400
1400
|
]
|
|
1401
|
-
end
|
|
1402
|
-
].join(
|
|
1401
|
+
end,
|
|
1402
|
+
].join("")
|
|
1403
1403
|
end
|
|
1404
1404
|
|
|
1405
1405
|
def format_data_types_generic(node)
|
|
1406
1406
|
[
|
|
1407
|
-
|
|
1407
|
+
"GENERIC",
|
|
1408
1408
|
*if node.id
|
|
1409
1409
|
[
|
|
1410
|
-
|
|
1411
|
-
node.id
|
|
1410
|
+
":",
|
|
1411
|
+
node.id,
|
|
1412
1412
|
]
|
|
1413
|
-
end
|
|
1414
|
-
].join(
|
|
1413
|
+
end,
|
|
1414
|
+
].join("")
|
|
1415
1415
|
end
|
|
1416
1416
|
|
|
1417
1417
|
def format_data_types_integer(node)
|
|
1418
|
-
|
|
1418
|
+
"INTEGER"
|
|
1419
1419
|
end
|
|
1420
1420
|
|
|
1421
1421
|
def format_data_types_list(node)
|
|
1422
1422
|
[
|
|
1423
|
-
|
|
1423
|
+
"LIST",
|
|
1424
1424
|
*if node.bound1 and node.bound2
|
|
1425
1425
|
[
|
|
1426
|
-
|
|
1427
|
-
|
|
1426
|
+
" ",
|
|
1427
|
+
"[",
|
|
1428
1428
|
format(node.bound1),
|
|
1429
|
-
|
|
1429
|
+
":",
|
|
1430
1430
|
format(node.bound2),
|
|
1431
|
-
|
|
1432
|
-
].join(
|
|
1431
|
+
"]",
|
|
1432
|
+
].join("")
|
|
1433
1433
|
end,
|
|
1434
|
-
|
|
1435
|
-
|
|
1434
|
+
" ",
|
|
1435
|
+
"OF",
|
|
1436
1436
|
*if node.unique
|
|
1437
1437
|
[
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
].join(
|
|
1438
|
+
" ",
|
|
1439
|
+
"UNIQUE",
|
|
1440
|
+
].join("")
|
|
1441
1441
|
end,
|
|
1442
|
-
|
|
1443
|
-
format(node.base_type)
|
|
1444
|
-
].join(
|
|
1442
|
+
" ",
|
|
1443
|
+
format(node.base_type),
|
|
1444
|
+
].join("")
|
|
1445
1445
|
end
|
|
1446
1446
|
|
|
1447
1447
|
def format_data_types_logical(node)
|
|
1448
|
-
|
|
1448
|
+
"LOGICAL"
|
|
1449
1449
|
end
|
|
1450
1450
|
|
|
1451
1451
|
def format_data_types_number(node)
|
|
1452
|
-
|
|
1452
|
+
"NUMBER"
|
|
1453
1453
|
end
|
|
1454
1454
|
|
|
1455
1455
|
def format_data_types_real(node)
|
|
1456
1456
|
[
|
|
1457
|
-
|
|
1457
|
+
"REAL",
|
|
1458
1458
|
*if node.precision
|
|
1459
1459
|
[
|
|
1460
|
-
|
|
1461
|
-
|
|
1460
|
+
" ",
|
|
1461
|
+
"(",
|
|
1462
1462
|
format(node.precision),
|
|
1463
|
-
|
|
1464
|
-
].join(
|
|
1465
|
-
end
|
|
1466
|
-
].join(
|
|
1463
|
+
")",
|
|
1464
|
+
].join("")
|
|
1465
|
+
end,
|
|
1466
|
+
].join("")
|
|
1467
1467
|
end
|
|
1468
1468
|
|
|
1469
1469
|
def format_data_types_select(node)
|
|
1470
1470
|
[
|
|
1471
1471
|
*if node.extensible
|
|
1472
1472
|
[
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
].join(
|
|
1473
|
+
"EXTENSIBLE",
|
|
1474
|
+
" ",
|
|
1475
|
+
].join("")
|
|
1476
1476
|
end,
|
|
1477
1477
|
*if node.generic_entity
|
|
1478
1478
|
[
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
].join(
|
|
1479
|
+
"GENERIC_ENTITY",
|
|
1480
|
+
" ",
|
|
1481
|
+
].join("")
|
|
1482
1482
|
end,
|
|
1483
|
-
|
|
1483
|
+
"SELECT",
|
|
1484
1484
|
*if node.based_on
|
|
1485
1485
|
[
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1486
|
+
" ",
|
|
1487
|
+
"BASED_ON",
|
|
1488
|
+
" ",
|
|
1489
1489
|
format(node.based_on),
|
|
1490
1490
|
*if node.items.length > 0
|
|
1491
|
-
item_indent = INDENT_CHAR *
|
|
1491
|
+
item_indent = INDENT_CHAR * "(".length
|
|
1492
1492
|
[
|
|
1493
|
-
|
|
1494
|
-
|
|
1493
|
+
" ",
|
|
1494
|
+
"WITH",
|
|
1495
1495
|
"\n",
|
|
1496
1496
|
indent([
|
|
1497
|
-
|
|
1498
|
-
node.items.map{|x| format(x)}.join(",\n#{item_indent}"),
|
|
1499
|
-
|
|
1500
|
-
].join(
|
|
1501
|
-
].join(
|
|
1502
|
-
end
|
|
1503
|
-
].join(
|
|
1497
|
+
"(",
|
|
1498
|
+
node.items.map { |x| format(x) }.join(",\n#{item_indent}"),
|
|
1499
|
+
")",
|
|
1500
|
+
].join("")),
|
|
1501
|
+
].join("")
|
|
1502
|
+
end,
|
|
1503
|
+
].join("")
|
|
1504
1504
|
else
|
|
1505
1505
|
[
|
|
1506
1506
|
*if node.items.length > 0
|
|
1507
|
-
item_indent = INDENT_CHAR *
|
|
1507
|
+
item_indent = INDENT_CHAR * "(".length
|
|
1508
1508
|
[
|
|
1509
1509
|
"\n",
|
|
1510
1510
|
indent([
|
|
1511
|
-
|
|
1512
|
-
node.items.map{|x| format(x)}.join(",\n#{item_indent}"),
|
|
1513
|
-
|
|
1514
|
-
].join(
|
|
1515
|
-
].join(
|
|
1516
|
-
end
|
|
1517
|
-
].join(
|
|
1518
|
-
end
|
|
1519
|
-
].join(
|
|
1511
|
+
"(",
|
|
1512
|
+
node.items.map { |x| format(x) }.join(",\n#{item_indent}"),
|
|
1513
|
+
")",
|
|
1514
|
+
].join("")),
|
|
1515
|
+
].join("")
|
|
1516
|
+
end,
|
|
1517
|
+
].join("")
|
|
1518
|
+
end,
|
|
1519
|
+
].join("")
|
|
1520
1520
|
end
|
|
1521
1521
|
|
|
1522
1522
|
def format_data_types_set(node)
|
|
1523
1523
|
[
|
|
1524
|
-
|
|
1524
|
+
"SET",
|
|
1525
1525
|
*if node.bound1 and node.bound2
|
|
1526
1526
|
[
|
|
1527
|
-
|
|
1528
|
-
|
|
1527
|
+
" ",
|
|
1528
|
+
"[",
|
|
1529
1529
|
format(node.bound1),
|
|
1530
|
-
|
|
1530
|
+
":",
|
|
1531
1531
|
format(node.bound2),
|
|
1532
|
-
|
|
1533
|
-
].join(
|
|
1532
|
+
"]",
|
|
1533
|
+
].join("")
|
|
1534
1534
|
end,
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
format(node.base_type)
|
|
1539
|
-
].join(
|
|
1535
|
+
" ",
|
|
1536
|
+
"OF",
|
|
1537
|
+
" ",
|
|
1538
|
+
format(node.base_type),
|
|
1539
|
+
].join("")
|
|
1540
1540
|
end
|
|
1541
1541
|
|
|
1542
1542
|
def format_data_types_string(node)
|
|
1543
1543
|
[
|
|
1544
|
-
|
|
1544
|
+
"STRING",
|
|
1545
1545
|
*if node.width
|
|
1546
1546
|
[
|
|
1547
|
-
|
|
1548
|
-
|
|
1547
|
+
" ",
|
|
1548
|
+
"(",
|
|
1549
1549
|
format(node.width),
|
|
1550
|
-
|
|
1551
|
-
].join(
|
|
1550
|
+
")",
|
|
1551
|
+
].join("")
|
|
1552
1552
|
end,
|
|
1553
1553
|
*if node.fixed
|
|
1554
1554
|
[
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
].join(
|
|
1558
|
-
end
|
|
1559
|
-
].join(
|
|
1555
|
+
" ",
|
|
1556
|
+
"FIXED",
|
|
1557
|
+
].join("")
|
|
1558
|
+
end,
|
|
1559
|
+
].join("")
|
|
1560
1560
|
end
|
|
1561
1561
|
|
|
1562
1562
|
def indent(str)
|
|
1563
|
-
str.split("\n").map{|x| "#{INDENT}#{x}"}.join("\n")
|
|
1563
|
+
str.split("\n").map { |x| "#{INDENT}#{x}" }.join("\n")
|
|
1564
1564
|
end
|
|
1565
1565
|
|
|
1566
1566
|
def format_remark(node, remark)
|
|
1567
1567
|
if remark.include?("\n")
|
|
1568
1568
|
[
|
|
1569
1569
|
[
|
|
1570
|
-
|
|
1570
|
+
"(*",
|
|
1571
1571
|
'"',
|
|
1572
1572
|
node.path || node.id,
|
|
1573
1573
|
'"',
|
|
1574
|
-
].join(
|
|
1574
|
+
].join(""),
|
|
1575
1575
|
remark,
|
|
1576
|
-
|
|
1576
|
+
"*)",
|
|
1577
1577
|
].join("\n")
|
|
1578
1578
|
else
|
|
1579
1579
|
[
|
|
1580
|
-
|
|
1580
|
+
"--",
|
|
1581
1581
|
'"',
|
|
1582
1582
|
node.path || node.id,
|
|
1583
1583
|
'"',
|
|
1584
|
-
|
|
1585
|
-
remark
|
|
1586
|
-
].join(
|
|
1584
|
+
" ",
|
|
1585
|
+
remark,
|
|
1586
|
+
].join("")
|
|
1587
1587
|
end
|
|
1588
1588
|
end
|
|
1589
1589
|
|
|
@@ -1600,9 +1600,9 @@ module Expressir
|
|
|
1600
1600
|
def format_scope_remarks(node)
|
|
1601
1601
|
[
|
|
1602
1602
|
*format_remarks(node),
|
|
1603
|
-
*node.children.select{|x| !x.is_a? Model::DataTypes::EnumerationItem or node.is_a? Model::Declarations::Type}.flat_map{|x| format_scope_remarks(x)}
|
|
1603
|
+
*node.children.select { |x| !x.is_a? Model::DataTypes::EnumerationItem or node.is_a? Model::Declarations::Type }.flat_map { |x| format_scope_remarks(x) },
|
|
1604
1604
|
]
|
|
1605
1605
|
end
|
|
1606
1606
|
end
|
|
1607
1607
|
end
|
|
1608
|
-
end
|
|
1608
|
+
end
|