expressir 1.2.3 → 1.2.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.cross_rubies +0 -6
- data/.github/workflows/rake.yml +223 -31
- data/.gitignore +7 -1
- data/.gitmodules +3 -0
- data/.rubocop.yml +13 -4
- data/README.adoc +8 -0
- data/Rakefile +4 -1
- data/bin/console +0 -1
- data/bin/rspec +3 -3
- data/exe/expressir +4 -2
- data/exe/format +1 -1
- data/exe/format-test +25 -25
- data/exe/generate-parser +16 -13
- data/expressir.gemspec +11 -9
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/CMakeLists.txt +44 -9
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlr4cpp-vs2013.vcxproj +11 -5
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlr4cpp-vs2013.vcxproj.filters +0 -3
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlr4cpp-vs2015.vcxproj +11 -4
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlr4cpp-vs2015.vcxproj.filters +0 -3
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlr4cpp-vs2017.vcxproj +11 -4
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlr4cpp-vs2017.vcxproj.filters +0 -3
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlr4cpp-vs2019.vcxproj +19 -4
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlr4cpp-vs2019.vcxproj.filters +0 -3
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlrcpp.xcodeproj/project.pbxproj +51 -35
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlrcpp.xcodeproj/xcshareddata/xcschemes/antlr4.xcscheme +1 -1
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlrcpp.xcodeproj/xcshareddata/xcschemes/antlr4_ios.xcscheme +1 -5
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlrcpp.xcodeproj/xcshareddata/xcschemes/antlr4_static.xcscheme +1 -5
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ANTLRFileStream.cpp +1 -12
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ANTLRFileStream.h +9 -6
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ANTLRInputStream.cpp +43 -18
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ANTLRInputStream.h +16 -6
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/CommonToken.cpp +2 -4
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/CommonTokenFactory.cpp +1 -1
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/CommonTokenFactory.h +1 -1
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/DefaultErrorStrategy.cpp +16 -13
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/Exceptions.cpp +2 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/Exceptions.h +2 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/FailedPredicateException.cpp +5 -4
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/FailedPredicateException.h +1 -1
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/IntStream.h +1 -1
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/Lexer.cpp +2 -3
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/Lexer.h +9 -9
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/LexerInterpreter.cpp +0 -15
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/LexerInterpreter.h +1 -7
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ListTokenSource.cpp +2 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ListTokenSource.h +2 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/Parser.cpp +51 -31
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/Parser.h +1 -7
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ParserInterpreter.cpp +27 -39
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ParserInterpreter.h +1 -7
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ParserRuleContext.cpp +20 -23
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ParserRuleContext.h +21 -21
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ProxyErrorListener.cpp +4 -4
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/RecognitionException.cpp +0 -1
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/Recognizer.cpp +16 -27
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/Recognizer.h +12 -17
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/RuleContext.cpp +4 -3
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/RuleContext.h +5 -1
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/RuntimeMetaData.cpp +2 -1
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/Token.h +7 -7
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/TokenSource.h +1 -1
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/TokenStreamRewriter.cpp +6 -6
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/TokenStreamRewriter.h +4 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/UnbufferedCharStream.cpp +15 -18
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/UnbufferedCharStream.h +12 -18
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/Version.h +42 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/Vocabulary.cpp +13 -53
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/Vocabulary.h +11 -27
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/antlr4-common.h +19 -58
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/antlr4-runtime.h +7 -5
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATN.cpp +6 -57
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATN.h +35 -15
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNConfig.cpp +29 -36
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNConfig.h +36 -27
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNConfigSet.cpp +58 -54
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNConfigSet.h +77 -31
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNDeserializationOptions.cpp +22 -32
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNDeserializationOptions.h +22 -24
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNDeserializer.cpp +335 -464
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNDeserializer.h +9 -62
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNSimulator.cpp +9 -39
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNSimulator.h +6 -22
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNState.cpp +10 -26
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNState.h +42 -36
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNStateType.cpp +33 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNStateType.h +36 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ActionTransition.cpp +2 -6
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ActionTransition.h +4 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ArrayPredictionContext.cpp +49 -22
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ArrayPredictionContext.h +20 -12
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/AtomTransition.cpp +1 -5
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/AtomTransition.h +5 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/BasicBlockStartState.h +4 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/BasicState.h +4 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/BlockEndState.h +5 -3
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/BlockStartState.h +10 -1
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/DecisionInfo.h +1 -1
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/DecisionState.cpp +0 -5
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/DecisionState.h +12 -8
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/EpsilonTransition.cpp +2 -6
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/EpsilonTransition.h +6 -3
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LL1Analyzer.cpp +139 -108
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LL1Analyzer.h +10 -43
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerATNConfig.cpp +16 -33
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerATNConfig.h +12 -12
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerATNSimulator.cpp +69 -82
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerATNSimulator.h +17 -28
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerAction.cpp +12 -6
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerAction.h +45 -11
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerActionExecutor.cpp +48 -44
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerActionExecutor.h +31 -18
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerActionType.h +3 -1
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerChannelAction.cpp +14 -26
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerChannelAction.h +12 -16
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerCustomAction.cpp +15 -32
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerCustomAction.h +12 -24
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerIndexedCustomAction.cpp +23 -29
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerIndexedCustomAction.h +13 -19
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerModeAction.cpp +13 -26
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerModeAction.h +12 -16
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerMoreAction.cpp +6 -17
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerMoreAction.h +12 -16
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerPopModeAction.cpp +6 -17
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerPopModeAction.h +12 -16
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerPushModeAction.cpp +13 -26
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerPushModeAction.h +12 -16
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerSkipAction.cpp +6 -17
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerSkipAction.h +11 -15
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerTypeAction.cpp +13 -26
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerTypeAction.h +13 -17
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LoopEndState.h +5 -1
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/NotSetTransition.cpp +1 -6
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/NotSetTransition.h +4 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/OrderedATNConfigSet.cpp +6 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/OrderedATNConfigSet.h +8 -3
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ParserATNSimulator.cpp +169 -152
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ParserATNSimulator.h +26 -19
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ParserATNSimulatorOptions.h +50 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PlusBlockStartState.h +5 -1
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PlusLoopbackState.h +5 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PrecedencePredicateTransition.cpp +2 -11
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PrecedencePredicateTransition.h +15 -9
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredicateEvalInfo.cpp +2 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredicateEvalInfo.h +2 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredicateTransition.cpp +4 -14
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredicateTransition.h +22 -11
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredictionContext.cpp +255 -338
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredictionContext.h +87 -116
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredictionContextCache.cpp +56 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredictionContextCache.h +64 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredictionContextMergeCache.cpp +167 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredictionContextMergeCache.h +101 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredictionContextMergeCacheOptions.h +71 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredictionContextType.h +21 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredictionMode.cpp +18 -17
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredictionMode.h +1 -1
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ProfilingATNSimulator.cpp +2 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ProfilingATNSimulator.h +2 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/RangeTransition.cpp +1 -5
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/RangeTransition.h +4 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/RuleStartState.h +4 -3
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/RuleStopState.h +4 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/RuleTransition.cpp +1 -5
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/RuleTransition.h +5 -3
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/SemanticContext.cpp +197 -156
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/SemanticContext.h +92 -81
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/SemanticContextType.h +23 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/SerializedATNView.h +101 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/SetTransition.cpp +2 -6
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/SetTransition.h +11 -3
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/SingletonPredictionContext.cpp +39 -34
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/SingletonPredictionContext.h +17 -10
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/StarBlockStartState.h +5 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/StarLoopEntryState.h +4 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/StarLoopbackState.cpp +6 -6
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/StarLoopbackState.h +6 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/TokensStartState.h +5 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/Transition.cpp +1 -9
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/Transition.h +11 -22
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/TransitionType.cpp +27 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/TransitionType.h +33 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/WildcardTransition.cpp +1 -5
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/WildcardTransition.h +4 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/dfa/DFA.cpp +11 -23
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/dfa/DFA.h +20 -15
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/dfa/DFASerializer.cpp +2 -9
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/dfa/DFASerializer.h +4 -4
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/dfa/DFAState.cpp +9 -50
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/dfa/DFAState.h +57 -48
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/dfa/LexerDFASerializer.cpp +1 -4
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/dfa/LexerDFASerializer.h +3 -4
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/misc/InterpreterDataReader.cpp +2 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/misc/InterpreterDataReader.h +3 -1
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/misc/Interval.cpp +1 -29
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/misc/Interval.h +10 -10
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/misc/IntervalSet.cpp +15 -28
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/misc/IntervalSet.h +1 -9
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/misc/MurmurHash.cpp +54 -68
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/misc/MurmurHash.h +35 -9
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/Any.cpp +0 -5
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/Any.h +1 -155
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/Arrays.cpp +2 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/Arrays.h +39 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/BitSet.h +1 -1
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/CPPUtils.cpp +13 -54
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/CPPUtils.h +16 -29
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/Casts.h +34 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/Declarations.h +0 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/StringUtils.cpp +25 -23
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/StringUtils.h +2 -40
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/Unicode.h +28 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/Utf8.cpp +242 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/Utf8.h +54 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/AbstractParseTreeVisitor.h +13 -12
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ErrorNode.h +7 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ErrorNodeImpl.cpp +36 -5
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ErrorNodeImpl.h +14 -4
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/IterativeParseTreeWalker.cpp +14 -19
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ParseTree.cpp +0 -3
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ParseTree.h +14 -5
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ParseTreeType.h +22 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ParseTreeVisitor.h +4 -4
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ParseTreeWalker.cpp +8 -9
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ParseTreeWalker.h +30 -6
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/TerminalNode.h +10 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/TerminalNodeImpl.cpp +2 -5
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/TerminalNodeImpl.h +4 -5
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/Trees.cpp +1 -1
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/pattern/ParseTreePattern.cpp +1 -1
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/pattern/ParseTreePatternMatcher.cpp +1 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPath.cpp +1 -1
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathLexer.cpp +128 -119
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathLexer.h +18 -27
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathRuleElement.cpp +1 -1
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathTokenElement.cpp +1 -1
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/tests/Utf8Test.cpp +110 -0
- data/ext/express-parser/antlrgen/Express.interp +1 -1
- data/ext/express-parser/antlrgen/ExpressBaseListener.cpp +1 -1
- data/ext/express-parser/antlrgen/ExpressBaseListener.h +1 -1
- data/ext/express-parser/antlrgen/ExpressBaseVisitor.cpp +1 -1
- data/ext/express-parser/antlrgen/ExpressBaseVisitor.h +200 -200
- data/ext/express-parser/antlrgen/ExpressLexer.cpp +645 -1129
- data/ext/express-parser/antlrgen/ExpressLexer.h +20 -27
- data/ext/express-parser/antlrgen/ExpressLexer.interp +1 -1
- data/ext/express-parser/antlrgen/ExpressListener.cpp +1 -1
- data/ext/express-parser/antlrgen/ExpressListener.h +1 -1
- data/ext/express-parser/antlrgen/ExpressParser.cpp +1754 -1447
- data/ext/express-parser/antlrgen/ExpressParser.h +219 -223
- data/ext/express-parser/antlrgen/ExpressVisitor.cpp +1 -1
- data/ext/express-parser/antlrgen/ExpressVisitor.h +200 -200
- data/ext/express-parser/express_parser.cpp +165 -101
- data/ext/express-parser/extconf.rb +14 -14
- data/lib/expressir/config.rb +1 -1
- data/lib/expressir/express/parser.rb +17 -15
- data/lib/expressir/express/visitor.rb +7 -3
- data/lib/expressir/model.rb +78 -78
- data/lib/expressir/version.rb +1 -1
- data/rakelib/antlr4-native.rake +161 -0
- data/rakelib/cross-ruby.rake +213 -162
- data/spec/acceptance/version_spec.rb +17 -2
- data/spec/expressir/express/cache_spec.rb +23 -5
- data/spec/expressir/express/formatter_spec.rb +54 -8
- data/spec/expressir/express/parser_spec.rb +47 -11
- data/spec/expressir/model/model_element_spec.rb +198 -146
- data/spec/spec_helper.rb +7 -0
- metadata +79 -91
- data/demo.rb +0 -18
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNSerializer.cpp +0 -621
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNSerializer.h +0 -61
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/AbstractPredicateTransition.cpp +0 -14
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/AbstractPredicateTransition.h +0 -24
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/BasicBlockStartState.cpp +0 -12
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/BasicState.cpp +0 -12
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/BlockEndState.cpp +0 -15
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/BlockStartState.cpp +0 -9
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/EmptyPredictionContext.cpp +0 -35
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/EmptyPredictionContext.h +0 -27
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LoopEndState.cpp +0 -12
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/Makefile +0 -67
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PlusBlockStartState.cpp +0 -12
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PlusLoopbackState.cpp +0 -12
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/RuleStartState.cpp +0 -16
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/RuleStopState.cpp +0 -12
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/StarBlockStartState.cpp +0 -12
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/StarLoopEntryState.cpp +0 -15
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/TokensStartState.cpp +0 -12
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/guid.cpp +0 -303
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/guid.h +0 -112
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ErrorNode.cpp +0 -9
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/TerminalNode.cpp +0 -9
- data/original/examples/ap233/ap233e1_arm_lf_stepmod-2010-11-12.exp +0 -9589
- data/original/examples/ap233/ap233e1_arm_lf_stepmod-2010-11-12.owl +0 -36619
- data/original/examples/ap233/ap233e1_arm_lf_stepmod-2010-11-12.xml +0 -13294
- data/original/examples/employment/eclipse/.project +0 -17
- data/original/examples/employment/eclipse/Export/Employment.png +0 -0
- data/original/examples/employment/eclipse/Express/employment_schema.exp +0 -33
- data/original/examples/employment/eclipse/Express/employment_schema.xmi +0 -77
- data/original/examples/employment/eclipse/Express/employment_schema.xml +0 -93
- data/original/examples/employment/eclipse/Models/Employment.uml +0 -4
- data/original/examples/employment/eclipse/Models/Employment.umldi +0 -240
- data/original/examples/employment/eclipse/readme.txt +0 -7
- data/original/examples/employment/employment_schema.exp +0 -33
- data/original/examples/employment/employment_schema.rb +0 -232
- data/original/examples/employment/employment_schema.xml +0 -93
- data/original/examples/employment/employment_schema___module.rb +0 -46
- data/original/examples/employment/employment_schema___p28attr.rb +0 -126
- data/original/examples/employment/employment_schema___p28inst.rb +0 -26
- data/original/examples/employment/example_employment_data.xml +0 -1
- data/original/examples/employment/example_employment_data_copy.xml +0 -1
- data/original/examples/employment/example_employment_reader.rb +0 -30
- data/original/examples/employment/example_employment_writer.rb +0 -51
- data/original/examples/plcs/ap239e1_arm_lf_dexlib_2010-01-06.exp +0 -3710
- data/original/examples/plcs/ap239e1_arm_lf_dexlib_2010-01-06.owl +0 -35880
- data/original/examples/plcs/ap239e1_arm_lf_dexlib_2010-01-06.xmi +0 -15357
- data/original/examples/plcs/ap239e1_arm_lf_dexlib_2010-01-06.xml +0 -9468
- data/original/examples/plcs/ap239e2_arm_lf_stepmod-2010-01-25.exp +0 -8404
- data/original/examples/plcs/ap239e2_arm_lf_stepmod-2010-01-25.owl +0 -43147
- data/original/examples/plcs/ap239e2_arm_lf_stepmod-2010-01-25.xmi +0 -18341
- data/original/examples/plcs/ap239e2_arm_lf_stepmod-2010-01-25.xml +0 -11632
- data/original/exp2ruby.rb +0 -525
- data/original/expsm.rb +0 -34
- data/original/mapping_owl.rb +0 -1018
- data/original/mapping_sysml.rb +0 -2281
- data/original/mapping_uml2.rb +0 -599
- data/original/mapping_uml2_eclipse.rb +0 -433
- data/original/reeper.rb +0 -134
- data/spec/expressr_spec.rb +0 -5
data/rakelib/cross-ruby.rake
CHANGED
@@ -1,11 +1,15 @@
|
|
1
1
|
require "rbconfig"
|
2
2
|
require "shellwords"
|
3
3
|
|
4
|
+
WINDOWS_PLATFORM_REGEX = /mingw|mswin/.freeze
|
5
|
+
LINUX_PLATFORM_REGEX = /linux/.freeze
|
6
|
+
DARWIN_PLATFORM_REGEX = /darwin/.freeze
|
7
|
+
GLIBC_MIN_VERSION = "2.17".freeze
|
8
|
+
|
4
9
|
CrossRuby = Struct.new(:version, :host) do
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
DARWIN_PLATFORM_REGEX = /darwin/
|
10
|
+
def dll_staging_path
|
11
|
+
"tmp/#{platform}/stage/lib/expressir/express/#{minor_ver}/express_parser.#{dll_ext}"
|
12
|
+
end
|
9
13
|
|
10
14
|
def windows?
|
11
15
|
!!(platform =~ WINDOWS_PLATFORM_REGEX)
|
@@ -27,6 +31,14 @@ CrossRuby = Struct.new(:version, :host) do
|
|
27
31
|
@minor_ver ||= ver[/\A\d\.\d(?=\.)/]
|
28
32
|
end
|
29
33
|
|
34
|
+
def minor_ver_digi
|
35
|
+
@minor_ver_digi = minor_ver.delete(".").to_i
|
36
|
+
end
|
37
|
+
|
38
|
+
def ucrt?
|
39
|
+
minor_ver_digi >= 31
|
40
|
+
end
|
41
|
+
|
30
42
|
def api_ver_suffix
|
31
43
|
case minor_ver
|
32
44
|
when nil
|
@@ -36,18 +48,21 @@ CrossRuby = Struct.new(:version, :host) do
|
|
36
48
|
end
|
37
49
|
end
|
38
50
|
|
51
|
+
# rubocop:disable Metrics/MethodLength
|
52
|
+
# rubocop:disable Metrics/CyclomaticComplexity
|
39
53
|
def platform
|
40
|
-
@platform ||=
|
54
|
+
@platform ||=
|
55
|
+
case host
|
41
56
|
when /\Ax86_64.*mingw32/
|
42
|
-
|
43
|
-
|
44
|
-
|
57
|
+
if ucrt?
|
58
|
+
"x64-mingw-ucrt"
|
59
|
+
else
|
60
|
+
"x64-mingw32"
|
61
|
+
end
|
45
62
|
when /\Ax86_64.*linux/
|
46
63
|
"x86_64-linux"
|
47
64
|
when /\A(arm64|aarch64).*linux/
|
48
65
|
"aarch64-linux"
|
49
|
-
when /\Ai[3-6]86.*linux/
|
50
|
-
"x86-linux"
|
51
66
|
when /\Ax86_64-darwin/
|
52
67
|
"x86_64-darwin"
|
53
68
|
when /\Aarm64-darwin/
|
@@ -58,216 +73,264 @@ CrossRuby = Struct.new(:version, :host) do
|
|
58
73
|
end
|
59
74
|
|
60
75
|
def tool(name)
|
61
|
-
(@binutils_prefix ||=
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
"aarch64-apple-darwin-"
|
76
|
-
else
|
77
|
-
raise "CrossRuby.tool: unmatched platform: #{platform}"
|
78
|
-
end) + name
|
76
|
+
(@binutils_prefix ||=
|
77
|
+
case platform
|
78
|
+
when /x64-mingw(32|-ucrt)/
|
79
|
+
"x86_64-w64-mingw32-"
|
80
|
+
when /(x86_64|aarch64)-linux/
|
81
|
+
# We do believe that we are on Linux and can use native tools
|
82
|
+
""
|
83
|
+
when /x86_64.*darwin/
|
84
|
+
"x86_64-apple-darwin-"
|
85
|
+
when /a.*64.*darwin/
|
86
|
+
"aarch64-apple-darwin-"
|
87
|
+
else
|
88
|
+
raise "CrossRuby.tool: unmatched platform: #{platform}"
|
89
|
+
end) + name
|
79
90
|
end
|
80
91
|
|
81
92
|
def target_file_format
|
82
93
|
case platform
|
83
|
-
when
|
94
|
+
when /64-mingw(32|-ucrt)/
|
84
95
|
"pei-x86-64"
|
85
|
-
when "x86-mingw32"
|
86
|
-
"pei-i386"
|
87
96
|
when "x86_64-linux"
|
88
97
|
"elf64-x86-64"
|
89
98
|
when "aarch64-linux"
|
90
|
-
"elf64-
|
91
|
-
when "x86-linux"
|
92
|
-
"elf32-i386"
|
99
|
+
"elf64-little"
|
93
100
|
when "x86_64-darwin"
|
94
|
-
"Mach-O 64-bit x86-64"
|
101
|
+
"Mach-O 64-bit x86-64"
|
95
102
|
when "arm64-darwin"
|
96
103
|
"Mach-O arm64"
|
97
104
|
else
|
98
105
|
raise "CrossRuby.target_file_format: unmatched platform: #{platform}"
|
99
106
|
end
|
100
107
|
end
|
108
|
+
# rubocop:enable Metrics/MethodLength
|
109
|
+
# rubocop:enable Metrics/CyclomaticComplexity
|
101
110
|
|
102
111
|
def dll_ext
|
103
112
|
darwin? ? "bundle" : "so"
|
104
113
|
end
|
105
114
|
|
106
|
-
def
|
107
|
-
|
115
|
+
def verify_format(dump, dll)
|
116
|
+
format_match = (/file format #{Regexp.quote(target_file_format)}\s/ === dump)
|
117
|
+
format_error = "Unexpected file format for '#{dll}', '#{target_file_format}' required"
|
118
|
+
raise format_error unless format_match
|
108
119
|
end
|
109
120
|
|
110
|
-
def
|
111
|
-
|
112
|
-
|
113
|
-
"x64-msvcrt-ruby#{api_ver_suffix}.dll"
|
114
|
-
when "x86-mingw32"
|
115
|
-
"msvcrt-ruby#{api_ver_suffix}.dll"
|
116
|
-
else
|
117
|
-
raise "CrossRuby.libruby_dll: unmatched platform: #{platform}"
|
121
|
+
def verify_entry_windows(dump, dll)
|
122
|
+
unless /Table.*\sInit_express_parser\s/mi === dump
|
123
|
+
raise "Export function Init_express_parser not in dll #{dll}"
|
118
124
|
end
|
119
125
|
end
|
120
126
|
|
121
|
-
def
|
127
|
+
def verify_entry_linux(dll)
|
128
|
+
nm = `#{["env", "LANG=C", tool("nm"), "-D", dll].shelljoin}`
|
129
|
+
unless / T Init_express_parser/.match?(nm)
|
130
|
+
raise "Export function Init_express_parser not in dll #{dll}"
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|
134
|
+
def verify_entry_darwin(dll)
|
135
|
+
nm = `#{["env", "LANG=C", tool("nm"), "-g", dll].shelljoin}`
|
136
|
+
unless / T _?Init_express_parser/.match?(nm)
|
137
|
+
raise "Export function Init_express_parser not in dll #{dll}"
|
138
|
+
end
|
139
|
+
end
|
140
|
+
|
141
|
+
def verify_entry(dump, dll)
|
122
142
|
case platform
|
123
|
-
when
|
124
|
-
|
125
|
-
"kernel32.dll",
|
126
|
-
"msvcrt.dll",
|
127
|
-
"ws2_32.dll",
|
128
|
-
"user32.dll",
|
129
|
-
"advapi32.dll",
|
130
|
-
libruby_dll,
|
131
|
-
]
|
143
|
+
when WINDOWS_PLATFORM_REGEX
|
144
|
+
verify_entry_windows(dump, dll)
|
132
145
|
when LINUX_PLATFORM_REGEX
|
133
|
-
|
134
|
-
"libm.so.6",
|
135
|
-
*(case
|
136
|
-
when ver < "2.6.0"
|
137
|
-
"libpthread.so.0"
|
138
|
-
end),
|
139
|
-
"libc.so.6",
|
140
|
-
"libdl.so.2", # on old dists only - now in libc
|
141
|
-
]
|
146
|
+
verify_entry_linux(dll)
|
142
147
|
when DARWIN_PLATFORM_REGEX
|
143
|
-
|
144
|
-
"/usr/lib/libSystem.B.dylib",
|
145
|
-
"/usr/lib/liblzma.5.dylib",
|
146
|
-
"/usr/lib/libobjc.A.dylib",
|
147
|
-
]
|
148
|
+
verify_entry_darwin(dll)
|
148
149
|
else
|
149
|
-
raise "CrossRuby.
|
150
|
+
raise "CrossRuby.verify_entry: unmatched platform: #{platform}"
|
150
151
|
end
|
151
152
|
end
|
152
153
|
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
154
|
+
# rubocop:disable Metrics/MethodLength
|
155
|
+
def allowed_dlls_ucrt
|
156
|
+
["kernel32.dll",
|
157
|
+
"api-ms-win-crt-convert-l1-1-0.dll",
|
158
|
+
"api-ms-win-crt-environment-l1-1-0.dll",
|
159
|
+
"api-ms-win-crt-heap-l1-1-0.dll",
|
160
|
+
"api-ms-win-crt-locale-l1-1-0.dll",
|
161
|
+
"api-ms-win-crt-private-l1-1-0.dll",
|
162
|
+
"api-ms-win-crt-runtime-l1-1-0.dll",
|
163
|
+
"api-ms-win-crt-stdio-l1-1-0.dll",
|
164
|
+
"api-ms-win-crt-string-l1-1-0.dll",
|
165
|
+
"api-ms-win-crt-time-l1-1-0.dll",
|
166
|
+
"api-ms-win-crt-filesystem-l1-1-0.dll",
|
167
|
+
"api-ms-win-crt-math-l1-1-0.dll",
|
168
|
+
"libwinpthread-1.dll",
|
169
|
+
"x64-ucrt-ruby310.dll"]
|
170
|
+
end
|
171
|
+
# rubocop:enable Metrics/MethodLength
|
172
|
+
|
173
|
+
def allowed_dlls_mingw
|
174
|
+
[
|
175
|
+
"kernel32.dll",
|
176
|
+
"msvcrt.dll",
|
177
|
+
"libwinpthread-1.dll",
|
178
|
+
"x64-msvcrt-ruby#{api_ver_suffix}.dll",
|
179
|
+
]
|
180
|
+
end
|
181
|
+
|
182
|
+
def allowed_dlls_windows
|
183
|
+
if ucrt?
|
184
|
+
allowed_dlls_ucrt
|
157
185
|
else
|
158
|
-
|
186
|
+
allowed_dlls_mingw
|
159
187
|
end
|
160
188
|
end
|
161
|
-
end
|
162
189
|
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
190
|
+
def allowed_dlls_linux
|
191
|
+
suffix = (platform == "x86_64-linux" ? "x86-64" : "aarch64")
|
192
|
+
[
|
193
|
+
"ld-linux-#{suffix}.so",
|
194
|
+
"libc.so",
|
195
|
+
"libm.so",
|
196
|
+
"libstdc++.so",
|
197
|
+
"libgcc_s.so",
|
198
|
+
]
|
167
199
|
end
|
168
|
-
end.compact
|
169
|
-
|
170
|
-
ENV["RUBY_CC_VERSION"] = CROSS_RUBIES.map(&:ver).uniq.join(":")
|
171
200
|
|
172
|
-
|
201
|
+
def allowed_dlls_darwin
|
202
|
+
[
|
203
|
+
"/usr/lib/libSystem.B.dylib",
|
204
|
+
"/usr/lib/libc++.1.dylib",
|
205
|
+
]
|
206
|
+
end
|
173
207
|
|
174
|
-
def
|
175
|
-
|
176
|
-
|
208
|
+
def allowed_dlls
|
209
|
+
case platform
|
210
|
+
when WINDOWS_PLATFORM_REGEX
|
211
|
+
allowed_dlls_windows
|
212
|
+
when LINUX_PLATFORM_REGEX
|
213
|
+
allowed_dlls_linux
|
214
|
+
when DARWIN_PLATFORM_REGEX
|
215
|
+
allowed_dlls_darwin
|
216
|
+
else
|
217
|
+
raise "CrossRuby.allowed_dlls: unmatched platform: #{platform}"
|
218
|
+
end
|
219
|
+
end
|
177
220
|
|
178
|
-
|
179
|
-
|
180
|
-
|
221
|
+
def actual_dlls_linux(dump)
|
222
|
+
dump.scan(/NEEDED\s+(.*)/).map(&:first).uniq
|
223
|
+
end
|
181
224
|
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
raise "unallowed so imports #{actual_imports.inspect} in #{dll} (allowed #{allowed_imports.inspect})"
|
186
|
-
end
|
225
|
+
def actual_dlls_windows(dump)
|
226
|
+
dump.scan(/DLL Name: (.*)$/).map(&:first).map(&:downcase).uniq
|
227
|
+
end
|
187
228
|
|
188
|
-
|
189
|
-
|
229
|
+
def actual_dlls_darwin(dll)
|
230
|
+
ldd = `#{[tool("otool"), "-L", dll].shelljoin}`
|
231
|
+
ldd.scan(/^\t([^ ]+) /).map(&:first).uniq
|
232
|
+
end
|
190
233
|
|
191
|
-
|
192
|
-
|
234
|
+
def actual_dlls(dump, dll)
|
235
|
+
case platform
|
236
|
+
when DARWIN_PLATFORM_REGEX
|
237
|
+
actual_dlls_darwin(dll)
|
238
|
+
when LINUX_PLATFORM_REGEX
|
239
|
+
actual_dlls_linux(dump)
|
240
|
+
when WINDOWS_PLATFORM_REGEX
|
241
|
+
actual_dlls_windows(dump)
|
242
|
+
else
|
243
|
+
raise "CrossRuby.actual_dlls: unmatched platform: #{platform}"
|
244
|
+
end
|
245
|
+
end
|
193
246
|
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
247
|
+
def verify_imports(dump, dll)
|
248
|
+
l = actual_dlls(dump, dll)
|
249
|
+
libs = allowed_dlls
|
250
|
+
l.delete_if { |ln| libs.any? { |lib| ln.include?(lib) } }
|
251
|
+
unless l.empty?
|
252
|
+
raise "Unexpected references in '#{dll}' : #{l}"
|
198
253
|
end
|
254
|
+
end
|
199
255
|
|
200
|
-
|
201
|
-
ref_versions_data = dump.scan(/0x[\da-f]+ 0x[\da-f]+ \d+ (\w+)_([\d\.]+)$/i)
|
256
|
+
def lib_ref_versions(data)
|
202
257
|
# Build a hash of library versions like {"LIBUDEV"=>"183", "GLIBC"=>"2.17"}
|
203
|
-
|
258
|
+
data.each.with_object({}) do |(lib, ver), h|
|
204
259
|
if !h[lib] || ver.split(".").map(&:to_i).pack("C*") > h[lib].split(".").map(&:to_i).pack("C*")
|
205
260
|
h[lib] = ver
|
206
261
|
end
|
207
262
|
end
|
208
|
-
|
209
|
-
raise "unexpected so version requirements #{actual_ref_versions.inspect} in #{dll}"
|
210
|
-
end
|
211
|
-
|
212
|
-
elsif cross_ruby.darwin?
|
213
|
-
nm = `#{["env", "LANG=C", cross_ruby.tool("nm"), "-g", dll].shelljoin}`
|
214
|
-
|
215
|
-
raise "unexpected file format for generated dll #{dll}" unless /file format #{Regexp.quote(cross_ruby.target_file_format)}\s/ === dump
|
216
|
-
raise "export function Init_nokogiri not in dll #{dll}" unless / T _?Init_nokogiri/ === nm
|
263
|
+
end
|
217
264
|
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
if liblzma_refs = ldd.scan(/^\t([^ ]+) /).map(&:first).uniq.grep(/liblzma/)
|
222
|
-
liblzma_refs.each do |ref|
|
223
|
-
new_ref = File.join("/usr/lib", File.basename(ref))
|
224
|
-
sh ["env", "LANG=C", cross_ruby.tool("install_name_tool"), "-change", ref, new_ref, dll].shelljoin
|
225
|
-
end
|
265
|
+
def verify_glibc_version(dump, dll)
|
266
|
+
ref_versions_data = dump.scan(/0x[\da-f]+ 0x[\da-f]+ \d+ (\w+)_([\d.]+)$/i)
|
267
|
+
ref_ver = lib_ref_versions(ref_versions_data)
|
226
268
|
|
227
|
-
|
228
|
-
|
269
|
+
unless ref_ver["GLIBC"].delete(".").to_i <= GLIBC_MIN_VERSION.delete(".").to_i
|
270
|
+
raise "Unexpected GLIBC version #{ref_ver['GLIBC']} for #{dll}, #{GLIBC_MIN_VERSION} or lower is expected"
|
229
271
|
end
|
272
|
+
end
|
273
|
+
end
|
230
274
|
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
raise "unallowed so imports #{actual_imports.inspect} in #{dll} (allowed #{allowed_imports.inspect})"
|
236
|
-
end
|
275
|
+
CROSS_RUBIES = File.read(".cross_rubies").split("\n").map do |line|
|
276
|
+
case line
|
277
|
+
when /\A([^#]+):([^#]+)/
|
278
|
+
CrossRuby.new($1, $2)
|
237
279
|
end
|
238
|
-
|
280
|
+
end.compact
|
281
|
+
|
282
|
+
ENV["RUBY_CC_VERSION"] = CROSS_RUBIES.map(&:ver).uniq.join(":")
|
283
|
+
|
284
|
+
require "rake_compiler_dock"
|
285
|
+
|
286
|
+
def verify_dll(dll, cross_ruby)
|
287
|
+
dump = `#{["env", "LANG=C", cross_ruby.tool("objdump"), "-p", dll].shelljoin}`
|
288
|
+
cross_ruby.verify_format(dump, dll)
|
289
|
+
cross_ruby.verify_entry(dump, dll)
|
290
|
+
cross_ruby.verify_imports(dump, dll)
|
291
|
+
# Not sure if it is required, probably not
|
292
|
+
# I am keeping related code as a reference for future advances
|
293
|
+
# cross_ruby.verify_glibc_version(dump, dll) if cross_ruby.linux?
|
294
|
+
|
295
|
+
puts "#{dll}: passed shared library sanity checks"
|
239
296
|
end
|
240
297
|
|
241
298
|
CROSS_RUBIES.each do |cross_ruby|
|
242
|
-
|
243
|
-
|
299
|
+
unless Rake::Task.task_defined?(cross_ruby.dll_staging_path)
|
300
|
+
task cross_ruby.dll_staging_path do |t|
|
301
|
+
verify_dll t.name, cross_ruby
|
302
|
+
end
|
244
303
|
end
|
245
304
|
end
|
246
305
|
|
247
306
|
def gem_builder(plat)
|
248
307
|
# use Task#invoke because the pkg/*gem task is defined at runtime
|
249
308
|
Rake::Task["native:#{plat}"].invoke
|
250
|
-
Rake::Task["pkg/#{GEMSPEC.full_name}-#{Gem::Platform.new(plat)
|
309
|
+
Rake::Task["pkg/#{GEMSPEC.full_name}-#{Gem::Platform.new(plat)}.gem"].invoke
|
310
|
+
end
|
311
|
+
|
312
|
+
REDHAT_PREREQ = "sudo yum install -y git".freeze
|
313
|
+
UBUNTU_PREREQ = "sudo apt-get update -y && sudo apt-get install -y automake autoconf libtool build-essential".freeze
|
314
|
+
|
315
|
+
def pre_req(plat)
|
316
|
+
case plat
|
317
|
+
when /\linux/
|
318
|
+
"if [[ $(awk -F= '/^NAME/{print $2}' /etc/os-release) == '\"Ubuntu\"' ]]; then #{UBUNTU_PREREQ}; else #{REDHAT_PREREQ}; fi"
|
319
|
+
else
|
320
|
+
UBUNTU_PREREQ.to_s
|
321
|
+
end
|
251
322
|
end
|
252
323
|
|
253
324
|
namespace "gem" do
|
254
|
-
REDHAT_PREREQ = "sudo yum install -y git"
|
255
|
-
UBUNTU_PREREQ = "sudo apt-get update -y && sudo apt-get install -y automake autoconf libtool build-essential"
|
256
325
|
CROSS_RUBIES.find_all { |cr| cr.windows? || cr.linux? || cr.darwin? }.map(&:platform).uniq.each do |plat|
|
257
|
-
pre_req = case plat
|
258
|
-
when /\linux/
|
259
|
-
"if [[ $(awk -F= '/^NAME/{print $2}' /etc/os-release) == '\"Ubuntu\"' ]]; then #{UBUNTU_PREREQ}; else #{REDHAT_PREREQ}; fi"
|
260
|
-
else
|
261
|
-
"#{UBUNTU_PREREQ}"
|
262
|
-
end
|
263
326
|
desc "build native gem for #{plat} platform"
|
264
327
|
task plat do
|
265
|
-
RakeCompilerDock.sh <<~
|
266
|
-
#{pre_req} &&
|
328
|
+
RakeCompilerDock.sh <<~RCD, platform: plat
|
329
|
+
#{pre_req(plat)} &&
|
267
330
|
gem install bundler --no-document &&
|
268
331
|
bundle &&
|
269
332
|
bundle exec rake gem:#{plat}:builder MAKE='nice make -j`nproc`'
|
270
|
-
|
333
|
+
RCD
|
271
334
|
end
|
272
335
|
|
273
336
|
namespace plat do
|
@@ -275,7 +338,6 @@ namespace "gem" do
|
|
275
338
|
task "builder" do
|
276
339
|
gem_builder(plat)
|
277
340
|
end
|
278
|
-
task "guest" => "builder" # TODO: remove me after this code is on master, temporary backwards compat for CI
|
279
341
|
end
|
280
342
|
end
|
281
343
|
|
@@ -289,28 +351,17 @@ namespace "gem" do
|
|
289
351
|
multitask "darwin" => CROSS_RUBIES.find_all(&:darwin?).map(&:platform).uniq
|
290
352
|
end
|
291
353
|
|
292
|
-
namespace "native" do
|
293
|
-
plat = "x86_64-darwin"
|
294
|
-
namespace plat do
|
295
|
-
desc "build native gem for #{plat} platform on host OS"
|
296
|
-
task "builder" do
|
297
|
-
gem_builder(plat)
|
298
|
-
end
|
299
|
-
task "guest" => "builder" # TODO: remove me after this code is on master, temporary backwards compat for CI
|
300
|
-
end
|
301
|
-
end
|
302
|
-
|
303
354
|
require "rake/extensiontask"
|
304
355
|
|
305
356
|
Rake::ExtensionTask.new("express_parser", GEMSPEC) do |ext|
|
306
357
|
ext.ext_dir = "ext/express-parser"
|
307
|
-
ext.lib_dir = File.join(*[
|
308
|
-
ext.config_options << ENV
|
358
|
+
ext.lib_dir = File.join(*["lib", "expressir", "express", ENV.fetch("FAT_DIR", nil)].compact)
|
359
|
+
ext.config_options << ENV.fetch("EXTOPTS", nil)
|
309
360
|
ext.cross_compile = true
|
310
361
|
ext.cross_platform = CROSS_RUBIES.map(&:platform).uniq
|
311
362
|
ext.cross_config_options << "--enable-cross-build"
|
312
363
|
ext.cross_compiling do |spec|
|
313
|
-
spec.files.reject! { |path| File.fnmatch?(
|
314
|
-
spec.dependencies.reject! { |dep| dep.name ==
|
364
|
+
spec.files.reject! { |path| File.fnmatch?("ext/*", path) }
|
365
|
+
spec.dependencies.reject! { |dep| dep.name == "rice" }
|
315
366
|
end
|
316
367
|
end
|
@@ -2,11 +2,26 @@ require "spec_helper"
|
|
2
2
|
|
3
3
|
RSpec.describe "Expressir" do
|
4
4
|
describe "version" do
|
5
|
-
it "
|
5
|
+
it "has a version number" do |example|
|
6
|
+
print "\n[#{example.description}] "
|
7
|
+
expect(Expressir::VERSION).not_to be nil
|
8
|
+
|
9
|
+
# Validate Object Space
|
10
|
+
GC.start
|
11
|
+
GC.verify_compaction_references
|
12
|
+
GC.verify_internal_consistency
|
13
|
+
end
|
14
|
+
|
15
|
+
it "displays the current verison" do |example|
|
16
|
+
print "\n[#{example.description}] "
|
6
17
|
command = %w(version)
|
7
18
|
output = capture_stdout { Expressir::Cli.start(command) }
|
8
|
-
|
9
19
|
expect(output).to include("Version #{Expressir::VERSION}")
|
20
|
+
|
21
|
+
# Validate Object Space
|
22
|
+
GC.start
|
23
|
+
GC.verify_compaction_references
|
24
|
+
GC.verify_internal_consistency
|
10
25
|
end
|
11
26
|
end
|
12
27
|
end
|
@@ -4,11 +4,12 @@ require "spec_helper"
|
|
4
4
|
require "expressir/express/parser"
|
5
5
|
require "expressir/express/cache"
|
6
6
|
|
7
|
-
|
8
|
-
TEST_VERSION = "0.0.0"
|
7
|
+
TEST_VERSION = "0.0.0".freeze
|
9
8
|
|
9
|
+
RSpec.describe Expressir::Express::Cache do
|
10
10
|
describe ".to_file" do
|
11
|
-
it "exports an object" do
|
11
|
+
it "exports an object" do |example|
|
12
|
+
print "\n[#{example.description}] "
|
12
13
|
temp_file = Tempfile.new
|
13
14
|
|
14
15
|
repository = Expressir::Model::Repository.new
|
@@ -23,11 +24,17 @@ RSpec.describe Expressir::Express::Cache do
|
|
23
24
|
temp_file.close
|
24
25
|
temp_file.unlink
|
25
26
|
end
|
27
|
+
|
28
|
+
# Validate Object Space
|
29
|
+
GC.start
|
30
|
+
GC.verify_compaction_references
|
31
|
+
GC.verify_internal_consistency
|
26
32
|
end
|
27
33
|
end
|
28
34
|
|
29
35
|
describe ".from_file" do
|
30
|
-
it "parses a file" do
|
36
|
+
it "parses a file" do |example|
|
37
|
+
print "\n[#{example.description}] "
|
31
38
|
temp_file = Tempfile.new
|
32
39
|
|
33
40
|
repository = Expressir::Model::Repository.new
|
@@ -42,9 +49,15 @@ RSpec.describe Expressir::Express::Cache do
|
|
42
49
|
temp_file.close
|
43
50
|
temp_file.unlink
|
44
51
|
end
|
52
|
+
|
53
|
+
# Validate Object Space
|
54
|
+
GC.start
|
55
|
+
GC.verify_compaction_references
|
56
|
+
GC.verify_internal_consistency
|
45
57
|
end
|
46
58
|
|
47
|
-
it "fails parsing a file from a different Expressir version" do
|
59
|
+
it "fails parsing a file from a different Expressir version" do |example|
|
60
|
+
print "\n[#{example.description}] "
|
48
61
|
temp_file = Tempfile.new
|
49
62
|
|
50
63
|
repository = Expressir::Model::Repository.new
|
@@ -59,6 +72,11 @@ RSpec.describe Expressir::Express::Cache do
|
|
59
72
|
temp_file.close
|
60
73
|
temp_file.unlink
|
61
74
|
end
|
75
|
+
|
76
|
+
# Validate Object Space
|
77
|
+
GC.start
|
78
|
+
GC.verify_compaction_references
|
79
|
+
GC.verify_internal_consistency
|
62
80
|
end
|
63
81
|
end
|
64
82
|
end
|