expressir 1.2.3 → 1.2.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (328) hide show
  1. checksums.yaml +4 -4
  2. data/.cross_rubies +0 -6
  3. data/.github/workflows/rake.yml +223 -31
  4. data/.gitignore +7 -1
  5. data/.gitmodules +3 -0
  6. data/.rubocop.yml +13 -4
  7. data/README.adoc +8 -0
  8. data/Rakefile +4 -1
  9. data/bin/console +0 -1
  10. data/bin/rspec +3 -3
  11. data/exe/expressir +4 -2
  12. data/exe/format +1 -1
  13. data/exe/format-test +25 -25
  14. data/exe/generate-parser +16 -13
  15. data/expressir.gemspec +11 -9
  16. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/CMakeLists.txt +44 -9
  17. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlr4cpp-vs2013.vcxproj +11 -5
  18. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlr4cpp-vs2013.vcxproj.filters +0 -3
  19. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlr4cpp-vs2015.vcxproj +11 -4
  20. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlr4cpp-vs2015.vcxproj.filters +0 -3
  21. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlr4cpp-vs2017.vcxproj +11 -4
  22. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlr4cpp-vs2017.vcxproj.filters +0 -3
  23. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlr4cpp-vs2019.vcxproj +19 -4
  24. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlr4cpp-vs2019.vcxproj.filters +0 -3
  25. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlrcpp.xcodeproj/project.pbxproj +51 -35
  26. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlrcpp.xcodeproj/xcshareddata/xcschemes/antlr4.xcscheme +1 -1
  27. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlrcpp.xcodeproj/xcshareddata/xcschemes/antlr4_ios.xcscheme +1 -5
  28. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlrcpp.xcodeproj/xcshareddata/xcschemes/antlr4_static.xcscheme +1 -5
  29. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ANTLRFileStream.cpp +1 -12
  30. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ANTLRFileStream.h +9 -6
  31. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ANTLRInputStream.cpp +43 -18
  32. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ANTLRInputStream.h +16 -6
  33. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/CommonToken.cpp +2 -4
  34. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/CommonTokenFactory.cpp +1 -1
  35. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/CommonTokenFactory.h +1 -1
  36. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/DefaultErrorStrategy.cpp +16 -13
  37. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/Exceptions.cpp +2 -2
  38. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/Exceptions.h +2 -2
  39. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/FailedPredicateException.cpp +5 -4
  40. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/FailedPredicateException.h +1 -1
  41. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/IntStream.h +1 -1
  42. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/Lexer.cpp +2 -3
  43. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/Lexer.h +9 -9
  44. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/LexerInterpreter.cpp +0 -15
  45. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/LexerInterpreter.h +1 -7
  46. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ListTokenSource.cpp +2 -2
  47. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ListTokenSource.h +2 -2
  48. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/Parser.cpp +51 -31
  49. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/Parser.h +1 -7
  50. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ParserInterpreter.cpp +27 -39
  51. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ParserInterpreter.h +1 -7
  52. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ParserRuleContext.cpp +20 -23
  53. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ParserRuleContext.h +21 -21
  54. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ProxyErrorListener.cpp +4 -4
  55. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/RecognitionException.cpp +0 -1
  56. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/Recognizer.cpp +16 -27
  57. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/Recognizer.h +12 -17
  58. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/RuleContext.cpp +4 -3
  59. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/RuleContext.h +5 -1
  60. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/RuntimeMetaData.cpp +2 -1
  61. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/Token.h +7 -7
  62. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/TokenSource.h +1 -1
  63. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/TokenStreamRewriter.cpp +6 -6
  64. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/TokenStreamRewriter.h +4 -2
  65. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/UnbufferedCharStream.cpp +15 -18
  66. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/UnbufferedCharStream.h +12 -18
  67. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/Version.h +42 -0
  68. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/Vocabulary.cpp +13 -53
  69. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/Vocabulary.h +11 -27
  70. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/antlr4-common.h +19 -58
  71. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/antlr4-runtime.h +7 -5
  72. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATN.cpp +6 -57
  73. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATN.h +35 -15
  74. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNConfig.cpp +29 -36
  75. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNConfig.h +36 -27
  76. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNConfigSet.cpp +58 -54
  77. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNConfigSet.h +77 -31
  78. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNDeserializationOptions.cpp +22 -32
  79. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNDeserializationOptions.h +22 -24
  80. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNDeserializer.cpp +335 -464
  81. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNDeserializer.h +9 -62
  82. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNSimulator.cpp +9 -39
  83. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNSimulator.h +6 -22
  84. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNState.cpp +10 -26
  85. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNState.h +42 -36
  86. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNStateType.cpp +33 -0
  87. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNStateType.h +36 -0
  88. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ActionTransition.cpp +2 -6
  89. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ActionTransition.h +4 -2
  90. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ArrayPredictionContext.cpp +49 -22
  91. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ArrayPredictionContext.h +20 -12
  92. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/AtomTransition.cpp +1 -5
  93. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/AtomTransition.h +5 -2
  94. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/BasicBlockStartState.h +4 -2
  95. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/BasicState.h +4 -2
  96. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/BlockEndState.h +5 -3
  97. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/BlockStartState.h +10 -1
  98. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/DecisionInfo.h +1 -1
  99. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/DecisionState.cpp +0 -5
  100. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/DecisionState.h +12 -8
  101. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/EpsilonTransition.cpp +2 -6
  102. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/EpsilonTransition.h +6 -3
  103. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LL1Analyzer.cpp +139 -108
  104. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LL1Analyzer.h +10 -43
  105. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerATNConfig.cpp +16 -33
  106. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerATNConfig.h +12 -12
  107. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerATNSimulator.cpp +69 -82
  108. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerATNSimulator.h +17 -28
  109. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerAction.cpp +12 -6
  110. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerAction.h +45 -11
  111. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerActionExecutor.cpp +48 -44
  112. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerActionExecutor.h +31 -18
  113. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerActionType.h +3 -1
  114. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerChannelAction.cpp +14 -26
  115. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerChannelAction.h +12 -16
  116. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerCustomAction.cpp +15 -32
  117. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerCustomAction.h +12 -24
  118. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerIndexedCustomAction.cpp +23 -29
  119. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerIndexedCustomAction.h +13 -19
  120. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerModeAction.cpp +13 -26
  121. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerModeAction.h +12 -16
  122. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerMoreAction.cpp +6 -17
  123. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerMoreAction.h +12 -16
  124. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerPopModeAction.cpp +6 -17
  125. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerPopModeAction.h +12 -16
  126. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerPushModeAction.cpp +13 -26
  127. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerPushModeAction.h +12 -16
  128. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerSkipAction.cpp +6 -17
  129. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerSkipAction.h +11 -15
  130. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerTypeAction.cpp +13 -26
  131. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerTypeAction.h +13 -17
  132. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LoopEndState.h +5 -1
  133. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/NotSetTransition.cpp +1 -6
  134. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/NotSetTransition.h +4 -2
  135. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/OrderedATNConfigSet.cpp +6 -2
  136. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/OrderedATNConfigSet.h +8 -3
  137. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ParserATNSimulator.cpp +169 -152
  138. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ParserATNSimulator.h +26 -19
  139. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ParserATNSimulatorOptions.h +50 -0
  140. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PlusBlockStartState.h +5 -1
  141. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PlusLoopbackState.h +5 -2
  142. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PrecedencePredicateTransition.cpp +2 -11
  143. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PrecedencePredicateTransition.h +15 -9
  144. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredicateEvalInfo.cpp +2 -2
  145. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredicateEvalInfo.h +2 -2
  146. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredicateTransition.cpp +4 -14
  147. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredicateTransition.h +22 -11
  148. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredictionContext.cpp +255 -338
  149. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredictionContext.h +87 -116
  150. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredictionContextCache.cpp +56 -0
  151. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredictionContextCache.h +64 -0
  152. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredictionContextMergeCache.cpp +167 -0
  153. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredictionContextMergeCache.h +101 -0
  154. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredictionContextMergeCacheOptions.h +71 -0
  155. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredictionContextType.h +21 -0
  156. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredictionMode.cpp +18 -17
  157. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredictionMode.h +1 -1
  158. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ProfilingATNSimulator.cpp +2 -2
  159. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ProfilingATNSimulator.h +2 -2
  160. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/RangeTransition.cpp +1 -5
  161. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/RangeTransition.h +4 -2
  162. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/RuleStartState.h +4 -3
  163. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/RuleStopState.h +4 -2
  164. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/RuleTransition.cpp +1 -5
  165. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/RuleTransition.h +5 -3
  166. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/SemanticContext.cpp +197 -156
  167. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/SemanticContext.h +92 -81
  168. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/SemanticContextType.h +23 -0
  169. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/SerializedATNView.h +101 -0
  170. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/SetTransition.cpp +2 -6
  171. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/SetTransition.h +11 -3
  172. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/SingletonPredictionContext.cpp +39 -34
  173. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/SingletonPredictionContext.h +17 -10
  174. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/StarBlockStartState.h +5 -2
  175. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/StarLoopEntryState.h +4 -2
  176. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/StarLoopbackState.cpp +6 -6
  177. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/StarLoopbackState.h +6 -2
  178. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/TokensStartState.h +5 -2
  179. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/Transition.cpp +1 -9
  180. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/Transition.h +11 -22
  181. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/TransitionType.cpp +27 -0
  182. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/TransitionType.h +33 -0
  183. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/WildcardTransition.cpp +1 -5
  184. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/WildcardTransition.h +4 -2
  185. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/dfa/DFA.cpp +11 -23
  186. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/dfa/DFA.h +20 -15
  187. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/dfa/DFASerializer.cpp +2 -9
  188. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/dfa/DFASerializer.h +4 -4
  189. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/dfa/DFAState.cpp +9 -50
  190. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/dfa/DFAState.h +57 -48
  191. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/dfa/LexerDFASerializer.cpp +1 -4
  192. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/dfa/LexerDFASerializer.h +3 -4
  193. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/misc/InterpreterDataReader.cpp +2 -2
  194. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/misc/InterpreterDataReader.h +3 -1
  195. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/misc/Interval.cpp +1 -29
  196. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/misc/Interval.h +10 -10
  197. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/misc/IntervalSet.cpp +15 -28
  198. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/misc/IntervalSet.h +1 -9
  199. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/misc/MurmurHash.cpp +54 -68
  200. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/misc/MurmurHash.h +35 -9
  201. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/Any.cpp +0 -5
  202. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/Any.h +1 -155
  203. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/Arrays.cpp +2 -2
  204. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/Arrays.h +39 -0
  205. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/BitSet.h +1 -1
  206. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/CPPUtils.cpp +13 -54
  207. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/CPPUtils.h +16 -29
  208. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/Casts.h +34 -0
  209. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/Declarations.h +0 -2
  210. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/StringUtils.cpp +25 -23
  211. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/StringUtils.h +2 -40
  212. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/Unicode.h +28 -0
  213. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/Utf8.cpp +242 -0
  214. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/Utf8.h +54 -0
  215. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/AbstractParseTreeVisitor.h +13 -12
  216. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ErrorNode.h +7 -2
  217. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ErrorNodeImpl.cpp +36 -5
  218. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ErrorNodeImpl.h +14 -4
  219. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/IterativeParseTreeWalker.cpp +14 -19
  220. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ParseTree.cpp +0 -3
  221. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ParseTree.h +14 -5
  222. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ParseTreeType.h +22 -0
  223. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ParseTreeVisitor.h +4 -4
  224. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ParseTreeWalker.cpp +8 -9
  225. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ParseTreeWalker.h +30 -6
  226. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/TerminalNode.h +10 -2
  227. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/TerminalNodeImpl.cpp +2 -5
  228. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/TerminalNodeImpl.h +4 -5
  229. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/Trees.cpp +1 -1
  230. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/pattern/ParseTreePattern.cpp +1 -1
  231. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/pattern/ParseTreePatternMatcher.cpp +1 -2
  232. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPath.cpp +1 -1
  233. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathLexer.cpp +128 -119
  234. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathLexer.h +18 -27
  235. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathRuleElement.cpp +1 -1
  236. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathTokenElement.cpp +1 -1
  237. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/tests/Utf8Test.cpp +110 -0
  238. data/ext/express-parser/antlrgen/Express.interp +1 -1
  239. data/ext/express-parser/antlrgen/ExpressBaseListener.cpp +1 -1
  240. data/ext/express-parser/antlrgen/ExpressBaseListener.h +1 -1
  241. data/ext/express-parser/antlrgen/ExpressBaseVisitor.cpp +1 -1
  242. data/ext/express-parser/antlrgen/ExpressBaseVisitor.h +200 -200
  243. data/ext/express-parser/antlrgen/ExpressLexer.cpp +645 -1129
  244. data/ext/express-parser/antlrgen/ExpressLexer.h +20 -27
  245. data/ext/express-parser/antlrgen/ExpressLexer.interp +1 -1
  246. data/ext/express-parser/antlrgen/ExpressListener.cpp +1 -1
  247. data/ext/express-parser/antlrgen/ExpressListener.h +1 -1
  248. data/ext/express-parser/antlrgen/ExpressParser.cpp +1754 -1447
  249. data/ext/express-parser/antlrgen/ExpressParser.h +219 -223
  250. data/ext/express-parser/antlrgen/ExpressVisitor.cpp +1 -1
  251. data/ext/express-parser/antlrgen/ExpressVisitor.h +200 -200
  252. data/ext/express-parser/express_parser.cpp +165 -101
  253. data/ext/express-parser/extconf.rb +14 -14
  254. data/lib/expressir/config.rb +1 -1
  255. data/lib/expressir/express/parser.rb +17 -15
  256. data/lib/expressir/express/visitor.rb +7 -3
  257. data/lib/expressir/model.rb +78 -78
  258. data/lib/expressir/version.rb +1 -1
  259. data/rakelib/antlr4-native.rake +161 -0
  260. data/rakelib/cross-ruby.rake +213 -162
  261. data/spec/acceptance/version_spec.rb +17 -2
  262. data/spec/expressir/express/cache_spec.rb +23 -5
  263. data/spec/expressir/express/formatter_spec.rb +54 -8
  264. data/spec/expressir/express/parser_spec.rb +47 -11
  265. data/spec/expressir/model/model_element_spec.rb +198 -146
  266. data/spec/spec_helper.rb +7 -0
  267. metadata +79 -91
  268. data/demo.rb +0 -18
  269. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNSerializer.cpp +0 -621
  270. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNSerializer.h +0 -61
  271. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/AbstractPredicateTransition.cpp +0 -14
  272. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/AbstractPredicateTransition.h +0 -24
  273. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/BasicBlockStartState.cpp +0 -12
  274. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/BasicState.cpp +0 -12
  275. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/BlockEndState.cpp +0 -15
  276. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/BlockStartState.cpp +0 -9
  277. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/EmptyPredictionContext.cpp +0 -35
  278. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/EmptyPredictionContext.h +0 -27
  279. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LoopEndState.cpp +0 -12
  280. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/Makefile +0 -67
  281. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PlusBlockStartState.cpp +0 -12
  282. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PlusLoopbackState.cpp +0 -12
  283. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/RuleStartState.cpp +0 -16
  284. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/RuleStopState.cpp +0 -12
  285. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/StarBlockStartState.cpp +0 -12
  286. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/StarLoopEntryState.cpp +0 -15
  287. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/TokensStartState.cpp +0 -12
  288. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/guid.cpp +0 -303
  289. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/guid.h +0 -112
  290. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ErrorNode.cpp +0 -9
  291. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/TerminalNode.cpp +0 -9
  292. data/original/examples/ap233/ap233e1_arm_lf_stepmod-2010-11-12.exp +0 -9589
  293. data/original/examples/ap233/ap233e1_arm_lf_stepmod-2010-11-12.owl +0 -36619
  294. data/original/examples/ap233/ap233e1_arm_lf_stepmod-2010-11-12.xml +0 -13294
  295. data/original/examples/employment/eclipse/.project +0 -17
  296. data/original/examples/employment/eclipse/Export/Employment.png +0 -0
  297. data/original/examples/employment/eclipse/Express/employment_schema.exp +0 -33
  298. data/original/examples/employment/eclipse/Express/employment_schema.xmi +0 -77
  299. data/original/examples/employment/eclipse/Express/employment_schema.xml +0 -93
  300. data/original/examples/employment/eclipse/Models/Employment.uml +0 -4
  301. data/original/examples/employment/eclipse/Models/Employment.umldi +0 -240
  302. data/original/examples/employment/eclipse/readme.txt +0 -7
  303. data/original/examples/employment/employment_schema.exp +0 -33
  304. data/original/examples/employment/employment_schema.rb +0 -232
  305. data/original/examples/employment/employment_schema.xml +0 -93
  306. data/original/examples/employment/employment_schema___module.rb +0 -46
  307. data/original/examples/employment/employment_schema___p28attr.rb +0 -126
  308. data/original/examples/employment/employment_schema___p28inst.rb +0 -26
  309. data/original/examples/employment/example_employment_data.xml +0 -1
  310. data/original/examples/employment/example_employment_data_copy.xml +0 -1
  311. data/original/examples/employment/example_employment_reader.rb +0 -30
  312. data/original/examples/employment/example_employment_writer.rb +0 -51
  313. data/original/examples/plcs/ap239e1_arm_lf_dexlib_2010-01-06.exp +0 -3710
  314. data/original/examples/plcs/ap239e1_arm_lf_dexlib_2010-01-06.owl +0 -35880
  315. data/original/examples/plcs/ap239e1_arm_lf_dexlib_2010-01-06.xmi +0 -15357
  316. data/original/examples/plcs/ap239e1_arm_lf_dexlib_2010-01-06.xml +0 -9468
  317. data/original/examples/plcs/ap239e2_arm_lf_stepmod-2010-01-25.exp +0 -8404
  318. data/original/examples/plcs/ap239e2_arm_lf_stepmod-2010-01-25.owl +0 -43147
  319. data/original/examples/plcs/ap239e2_arm_lf_stepmod-2010-01-25.xmi +0 -18341
  320. data/original/examples/plcs/ap239e2_arm_lf_stepmod-2010-01-25.xml +0 -11632
  321. data/original/exp2ruby.rb +0 -525
  322. data/original/expsm.rb +0 -34
  323. data/original/mapping_owl.rb +0 -1018
  324. data/original/mapping_sysml.rb +0 -2281
  325. data/original/mapping_uml2.rb +0 -599
  326. data/original/mapping_uml2_eclipse.rb +0 -433
  327. data/original/reeper.rb +0 -134
  328. data/spec/expressr_spec.rb +0 -5
@@ -15,7 +15,6 @@
15
15
  #undef OUT
16
16
  #endif
17
17
 
18
- // ruby-3.0
19
18
  #undef FALSE
20
19
  #undef TRUE
21
20
 
@@ -25,8 +24,6 @@ using namespace std;
25
24
  using namespace Rice;
26
25
  using namespace antlr4;
27
26
 
28
- Module rb_mExpressParser;
29
-
30
27
  Class rb_cAttributeRefContext;
31
28
  Class rb_cAttributeIdContext;
32
29
  Class rb_cConstantRefContext;
@@ -231,6 +228,8 @@ Class rb_cParser;
231
228
  Class rb_cParseTree;
232
229
  Class rb_cTerminalNode;
233
230
  Class rb_cContextProxy;
231
+ Class rb_cParserExt;
232
+ Class rb_cTokenExt;
234
233
 
235
234
  namespace Rice::detail {
236
235
  template <>
@@ -261,6 +260,28 @@ namespace Rice::detail {
261
260
  };
262
261
  }
263
262
 
263
+ class TokenProxy : public Object {
264
+ public:
265
+ TokenProxy(Token* orig) {
266
+ this -> orig = orig;
267
+ }
268
+
269
+ std::string getText() {
270
+ return orig->getText();
271
+ }
272
+
273
+ size_t getChannel() {
274
+ return orig->getChannel();
275
+ }
276
+
277
+ size_t getTokenIndex() {
278
+ return orig->getTokenIndex();
279
+ }
280
+
281
+ private:
282
+ Token * orig = nullptr;
283
+ };
284
+
264
285
  class ContextProxy {
265
286
  public:
266
287
  ContextProxy(tree::ParseTree* orig) {
@@ -288,39 +309,25 @@ public:
288
309
  }
289
310
 
290
311
  Array getChildren() {
291
- if (children == nullptr) {
292
- children = new Array();
293
-
294
- if (orig != nullptr) {
295
- for (auto it = orig -> children.begin(); it != orig -> children.end(); it ++) {
296
- Object parseTree = ContextProxy::wrapParseTree(*it);
312
+ Array children;
313
+ if (orig != nullptr) {
314
+ for (auto it = orig -> children.begin(); it != orig -> children.end(); it ++) {
315
+ Object parseTree = ContextProxy::wrapParseTree(*it);
297
316
 
298
- if (parseTree != Nil) {
299
- children -> push(parseTree);
300
- }
317
+ if (parseTree != Nil) {
318
+ children.push(parseTree);
301
319
  }
302
320
  }
303
321
  }
304
-
305
- return *children;
322
+ return children;
306
323
  }
307
324
 
308
325
  Object getParent() {
309
- if (parent == Nil) {
310
- if (orig != nullptr) {
311
- parent = ContextProxy::wrapParseTree(orig -> parent);
312
- }
313
- }
314
-
315
- return parent;
326
+ return orig == nullptr ? Nil : ContextProxy::wrapParseTree(orig -> parent);
316
327
  }
317
328
 
318
329
  size_t childCount() {
319
- if (orig == nullptr) {
320
- return 0;
321
- }
322
-
323
- return getChildren().size();
330
+ return orig == nullptr ? 0 : orig -> children.size();
324
331
  }
325
332
 
326
333
  bool doubleEquals(Object other) {
@@ -337,8 +344,6 @@ private:
337
344
 
338
345
  protected:
339
346
  tree::ParseTree* orig = nullptr;
340
- Array* children = nullptr;
341
- Object parent = Nil;
342
347
  };
343
348
 
344
349
  class TerminalNodeProxy : public ContextProxy {
@@ -6660,7 +6665,7 @@ Object ActualParameterListContextProxy::parameter() {
6660
6665
  }
6661
6666
  }
6662
6667
 
6663
- return a;
6668
+ return std::move(a);
6664
6669
  }
6665
6670
 
6666
6671
  Object ActualParameterListContextProxy::parameterAt(size_t i) {
@@ -6744,7 +6749,7 @@ Object AggregateInitializerContextProxy::element() {
6744
6749
  }
6745
6750
  }
6746
6751
 
6747
- return a;
6752
+ return std::move(a);
6748
6753
  }
6749
6754
 
6750
6755
  Object AggregateInitializerContextProxy::elementAt(size_t i) {
@@ -6838,7 +6843,7 @@ Object SimpleExpressionContextProxy::term() {
6838
6843
  }
6839
6844
  }
6840
6845
 
6841
- return a;
6846
+ return std::move(a);
6842
6847
  }
6843
6848
 
6844
6849
  Object SimpleExpressionContextProxy::termAt(size_t i) {
@@ -6872,7 +6877,7 @@ Object SimpleExpressionContextProxy::addLikeOp() {
6872
6877
  }
6873
6878
  }
6874
6879
 
6875
- return a;
6880
+ return std::move(a);
6876
6881
  }
6877
6882
 
6878
6883
  Object SimpleExpressionContextProxy::addLikeOpAt(size_t i) {
@@ -7481,7 +7486,7 @@ Object AlgorithmHeadContextProxy::declaration() {
7481
7486
  }
7482
7487
  }
7483
7488
 
7484
- return a;
7489
+ return std::move(a);
7485
7490
  }
7486
7491
 
7487
7492
  Object AlgorithmHeadContextProxy::declarationAt(size_t i) {
@@ -7655,7 +7660,7 @@ Object ConstantDeclContextProxy::constantBody() {
7655
7660
  }
7656
7661
  }
7657
7662
 
7658
- return a;
7663
+ return std::move(a);
7659
7664
  }
7660
7665
 
7661
7666
  Object ConstantDeclContextProxy::constantBodyAt(size_t i) {
@@ -7719,7 +7724,7 @@ Object LocalDeclContextProxy::localVariable() {
7719
7724
  }
7720
7725
  }
7721
7726
 
7722
- return a;
7727
+ return std::move(a);
7723
7728
  }
7724
7729
 
7725
7730
  Object LocalDeclContextProxy::localVariableAt(size_t i) {
@@ -7823,7 +7828,7 @@ Object AliasStmtContextProxy::stmt() {
7823
7828
  }
7824
7829
  }
7825
7830
 
7826
- return a;
7831
+ return std::move(a);
7827
7832
  }
7828
7833
 
7829
7834
  Object AliasStmtContextProxy::stmtAt(size_t i) {
@@ -7857,7 +7862,7 @@ Object AliasStmtContextProxy::qualifier() {
7857
7862
  }
7858
7863
  }
7859
7864
 
7860
- return a;
7865
+ return std::move(a);
7861
7866
  }
7862
7867
 
7863
7868
  Object AliasStmtContextProxy::qualifierAt(size_t i) {
@@ -8376,7 +8381,7 @@ Object AssignmentStmtContextProxy::qualifier() {
8376
8381
  }
8377
8382
  }
8378
8383
 
8379
- return a;
8384
+ return std::move(a);
8380
8385
  }
8381
8386
 
8382
8387
  Object AssignmentStmtContextProxy::qualifierAt(size_t i) {
@@ -8410,7 +8415,7 @@ Object ExpressionContextProxy::simpleExpression() {
8410
8415
  }
8411
8416
  }
8412
8417
 
8413
- return a;
8418
+ return std::move(a);
8414
8419
  }
8415
8420
 
8416
8421
  Object ExpressionContextProxy::simpleExpressionAt(size_t i) {
@@ -9234,7 +9239,7 @@ Object CaseActionContextProxy::caseLabel() {
9234
9239
  }
9235
9240
  }
9236
9241
 
9237
- return a;
9242
+ return std::move(a);
9238
9243
  }
9239
9244
 
9240
9245
  Object CaseActionContextProxy::caseLabelAt(size_t i) {
@@ -9328,7 +9333,7 @@ Object CaseStmtContextProxy::caseAction() {
9328
9333
  }
9329
9334
  }
9330
9335
 
9331
- return a;
9336
+ return std::move(a);
9332
9337
  }
9333
9338
 
9334
9339
  Object CaseStmtContextProxy::caseActionAt(size_t i) {
@@ -9462,7 +9467,7 @@ Object CompoundStmtContextProxy::stmt() {
9462
9467
  }
9463
9468
  }
9464
9469
 
9465
- return a;
9470
+ return std::move(a);
9466
9471
  }
9467
9472
 
9468
9473
  Object CompoundStmtContextProxy::stmtAt(size_t i) {
@@ -10131,7 +10136,7 @@ Object FunctionDeclContextProxy::stmt() {
10131
10136
  }
10132
10137
  }
10133
10138
 
10134
- return a;
10139
+ return std::move(a);
10135
10140
  }
10136
10141
 
10137
10142
  Object FunctionDeclContextProxy::stmtAt(size_t i) {
@@ -10220,7 +10225,7 @@ Object ProcedureDeclContextProxy::stmt() {
10220
10225
  }
10221
10226
  }
10222
10227
 
10223
- return a;
10228
+ return std::move(a);
10224
10229
  }
10225
10230
 
10226
10231
  Object ProcedureDeclContextProxy::stmtAt(size_t i) {
@@ -10474,7 +10479,7 @@ Object DeriveClauseContextProxy::derivedAttr() {
10474
10479
  }
10475
10480
  }
10476
10481
 
10477
- return a;
10482
+ return std::move(a);
10478
10483
  }
10479
10484
 
10480
10485
  Object DeriveClauseContextProxy::derivedAttrAt(size_t i) {
@@ -10583,7 +10588,7 @@ Object EntityBodyContextProxy::explicitAttr() {
10583
10588
  }
10584
10589
  }
10585
10590
 
10586
- return a;
10591
+ return std::move(a);
10587
10592
  }
10588
10593
 
10589
10594
  Object EntityBodyContextProxy::explicitAttrAt(size_t i) {
@@ -10697,7 +10702,7 @@ Object ExplicitAttrContextProxy::attributeDecl() {
10697
10702
  }
10698
10703
  }
10699
10704
 
10700
- return a;
10705
+ return std::move(a);
10701
10706
  }
10702
10707
 
10703
10708
  Object ExplicitAttrContextProxy::attributeDeclAt(size_t i) {
@@ -10766,7 +10771,7 @@ Object InverseClauseContextProxy::inverseAttr() {
10766
10771
  }
10767
10772
  }
10768
10773
 
10769
- return a;
10774
+ return std::move(a);
10770
10775
  }
10771
10776
 
10772
10777
  Object InverseClauseContextProxy::inverseAttrAt(size_t i) {
@@ -10815,7 +10820,7 @@ Object UniqueClauseContextProxy::uniqueRule() {
10815
10820
  }
10816
10821
  }
10817
10822
 
10818
- return a;
10823
+ return std::move(a);
10819
10824
  }
10820
10825
 
10821
10826
  Object UniqueClauseContextProxy::uniqueRuleAt(size_t i) {
@@ -10864,7 +10869,7 @@ Object WhereClauseContextProxy::domainRule() {
10864
10869
  }
10865
10870
  }
10866
10871
 
10867
- return a;
10872
+ return std::move(a);
10868
10873
  }
10869
10874
 
10870
10875
  Object WhereClauseContextProxy::domainRuleAt(size_t i) {
@@ -10933,7 +10938,7 @@ Object EntityConstructorContextProxy::expression() {
10933
10938
  }
10934
10939
  }
10935
10940
 
10936
- return a;
10941
+ return std::move(a);
10937
10942
  }
10938
10943
 
10939
10944
  Object EntityConstructorContextProxy::expressionAt(size_t i) {
@@ -11132,7 +11137,7 @@ Object EnumerationItemsContextProxy::enumerationItem() {
11132
11137
  }
11133
11138
  }
11134
11139
 
11135
- return a;
11140
+ return std::move(a);
11136
11141
  }
11137
11142
 
11138
11143
  Object EnumerationItemsContextProxy::enumerationItemAt(size_t i) {
@@ -11291,7 +11296,7 @@ Object FactorContextProxy::simpleFactor() {
11291
11296
  }
11292
11297
  }
11293
11298
 
11294
- return a;
11299
+ return std::move(a);
11295
11300
  }
11296
11301
 
11297
11302
  Object FactorContextProxy::simpleFactorAt(size_t i) {
@@ -11465,7 +11470,7 @@ Object FormalParameterContextProxy::parameterId() {
11465
11470
  }
11466
11471
  }
11467
11472
 
11468
- return a;
11473
+ return std::move(a);
11469
11474
  }
11470
11475
 
11471
11476
  Object FormalParameterContextProxy::parameterIdAt(size_t i) {
@@ -11619,7 +11624,7 @@ Object FunctionHeadContextProxy::formalParameter() {
11619
11624
  }
11620
11625
  }
11621
11626
 
11622
- return a;
11627
+ return std::move(a);
11623
11628
  }
11624
11629
 
11625
11630
  Object FunctionHeadContextProxy::formalParameterAt(size_t i) {
@@ -12383,7 +12388,7 @@ Object IfStmtStatementsContextProxy::stmt() {
12383
12388
  }
12384
12389
  }
12385
12390
 
12386
- return a;
12391
+ return std::move(a);
12387
12392
  }
12388
12393
 
12389
12394
  Object IfStmtStatementsContextProxy::stmtAt(size_t i) {
@@ -12417,7 +12422,7 @@ Object IfStmtElseStatementsContextProxy::stmt() {
12417
12422
  }
12418
12423
  }
12419
12424
 
12420
- return a;
12425
+ return std::move(a);
12421
12426
  }
12422
12427
 
12423
12428
  Object IfStmtElseStatementsContextProxy::stmtAt(size_t i) {
@@ -12756,7 +12761,7 @@ Object ReferenceClauseContextProxy::resourceOrRename() {
12756
12761
  }
12757
12762
  }
12758
12763
 
12759
- return a;
12764
+ return std::move(a);
12760
12765
  }
12761
12766
 
12762
12767
  Object ReferenceClauseContextProxy::resourceOrRenameAt(size_t i) {
@@ -12840,7 +12845,7 @@ Object UseClauseContextProxy::namedTypeOrRename() {
12840
12845
  }
12841
12846
  }
12842
12847
 
12843
- return a;
12848
+ return std::move(a);
12844
12849
  }
12845
12850
 
12846
12851
  Object UseClauseContextProxy::namedTypeOrRenameAt(size_t i) {
@@ -12924,7 +12929,7 @@ Object IntervalContextProxy::intervalOp() {
12924
12929
  }
12925
12930
  }
12926
12931
 
12927
- return a;
12932
+ return std::move(a);
12928
12933
  }
12929
12934
 
12930
12935
  Object IntervalContextProxy::intervalOpAt(size_t i) {
@@ -13398,7 +13403,7 @@ Object LocalVariableContextProxy::variableId() {
13398
13403
  }
13399
13404
  }
13400
13405
 
13401
- return a;
13406
+ return std::move(a);
13402
13407
  }
13403
13408
 
13404
13409
  Object LocalVariableContextProxy::variableIdAt(size_t i) {
@@ -13662,7 +13667,7 @@ Object OneOfContextProxy::supertypeExpression() {
13662
13667
  }
13663
13668
  }
13664
13669
 
13665
- return a;
13670
+ return std::move(a);
13666
13671
  }
13667
13672
 
13668
13673
  Object OneOfContextProxy::supertypeExpressionAt(size_t i) {
@@ -13711,7 +13716,7 @@ Object SupertypeExpressionContextProxy::supertypeFactor() {
13711
13716
  }
13712
13717
  }
13713
13718
 
13714
- return a;
13719
+ return std::move(a);
13715
13720
  }
13716
13721
 
13717
13722
  Object SupertypeExpressionContextProxy::supertypeFactorAt(size_t i) {
@@ -13738,7 +13743,7 @@ Object SupertypeExpressionContextProxy::ANDOR() {
13738
13743
  Array a;
13739
13744
 
13740
13745
  if (orig == nullptr) {
13741
- return a;
13746
+ return std::move(a);
13742
13747
  }
13743
13748
 
13744
13749
  auto vec = ((ExpressParser::SupertypeExpressionContext*)orig) -> ANDOR();
@@ -13748,7 +13753,7 @@ Object SupertypeExpressionContextProxy::ANDOR() {
13748
13753
  a.push(detail::To_Ruby<TerminalNodeProxy>().convert(proxy));
13749
13754
  }
13750
13755
 
13751
- return a;
13756
+ return std::move(a);
13752
13757
  }
13753
13758
 
13754
13759
  Object SupertypeExpressionContextProxy::ANDORAt(size_t i) {
@@ -13857,7 +13862,7 @@ Object PrimaryContextProxy::qualifier() {
13857
13862
  }
13858
13863
  }
13859
13864
 
13860
- return a;
13865
+ return std::move(a);
13861
13866
  }
13862
13867
 
13863
13868
  Object PrimaryContextProxy::qualifierAt(size_t i) {
@@ -14071,7 +14076,7 @@ Object ProcedureHeadContextProxy::procedureHeadParameter() {
14071
14076
  }
14072
14077
  }
14073
14078
 
14074
- return a;
14079
+ return std::move(a);
14075
14080
  }
14076
14081
 
14077
14082
  Object ProcedureHeadContextProxy::procedureHeadParameterAt(size_t i) {
@@ -14665,7 +14670,7 @@ Object RepeatStmtContextProxy::stmt() {
14665
14670
  }
14666
14671
  }
14667
14672
 
14668
- return a;
14673
+ return std::move(a);
14669
14674
  }
14670
14675
 
14671
14676
  Object RepeatStmtContextProxy::stmtAt(size_t i) {
@@ -14924,7 +14929,7 @@ Object RuleDeclContextProxy::stmt() {
14924
14929
  }
14925
14930
  }
14926
14931
 
14927
- return a;
14932
+ return std::move(a);
14928
14933
  }
14929
14934
 
14930
14935
  Object RuleDeclContextProxy::stmtAt(size_t i) {
@@ -14993,7 +14998,7 @@ Object RuleHeadContextProxy::entityRef() {
14993
14998
  }
14994
14999
  }
14995
15000
 
14996
- return a;
15001
+ return std::move(a);
14997
15002
  }
14998
15003
 
14999
15004
  Object RuleHeadContextProxy::entityRefAt(size_t i) {
@@ -15057,7 +15062,7 @@ Object SchemaBodyContextProxy::interfaceSpecification() {
15057
15062
  }
15058
15063
  }
15059
15064
 
15060
- return a;
15065
+ return std::move(a);
15061
15066
  }
15062
15067
 
15063
15068
  Object SchemaBodyContextProxy::interfaceSpecificationAt(size_t i) {
@@ -15111,7 +15116,7 @@ Object SchemaBodyContextProxy::schemaBodyDeclaration() {
15111
15116
  }
15112
15117
  }
15113
15118
 
15114
- return a;
15119
+ return std::move(a);
15115
15120
  }
15116
15121
 
15117
15122
  Object SchemaBodyContextProxy::schemaBodyDeclarationAt(size_t i) {
@@ -15365,7 +15370,7 @@ Object SelectListContextProxy::namedTypes() {
15365
15370
  }
15366
15371
  }
15367
15372
 
15368
- return a;
15373
+ return std::move(a);
15369
15374
  }
15370
15375
 
15371
15376
  Object SelectListContextProxy::namedTypesAt(size_t i) {
@@ -15399,7 +15404,7 @@ Object TermContextProxy::factor() {
15399
15404
  }
15400
15405
  }
15401
15406
 
15402
- return a;
15407
+ return std::move(a);
15403
15408
  }
15404
15409
 
15405
15410
  Object TermContextProxy::factorAt(size_t i) {
@@ -15433,7 +15438,7 @@ Object TermContextProxy::multiplicationLikeOp() {
15433
15438
  }
15434
15439
  }
15435
15440
 
15436
- return a;
15441
+ return std::move(a);
15437
15442
  }
15438
15443
 
15439
15444
  Object TermContextProxy::multiplicationLikeOpAt(size_t i) {
@@ -15672,7 +15677,7 @@ Object SubtypeDeclarationContextProxy::entityRef() {
15672
15677
  }
15673
15678
  }
15674
15679
 
15675
- return a;
15680
+ return std::move(a);
15676
15681
  }
15677
15682
 
15678
15683
  Object SubtypeDeclarationContextProxy::entityRefAt(size_t i) {
@@ -15796,7 +15801,7 @@ Object TotalOverContextProxy::entityRef() {
15796
15801
  }
15797
15802
  }
15798
15803
 
15799
- return a;
15804
+ return std::move(a);
15800
15805
  }
15801
15806
 
15802
15807
  Object TotalOverContextProxy::entityRefAt(size_t i) {
@@ -15950,7 +15955,7 @@ Object SupertypeFactorContextProxy::supertypeTerm() {
15950
15955
  }
15951
15956
  }
15952
15957
 
15953
- return a;
15958
+ return std::move(a);
15954
15959
  }
15955
15960
 
15956
15961
  Object SupertypeFactorContextProxy::supertypeTermAt(size_t i) {
@@ -15977,7 +15982,7 @@ Object SupertypeFactorContextProxy::AND() {
15977
15982
  Array a;
15978
15983
 
15979
15984
  if (orig == nullptr) {
15980
- return a;
15985
+ return std::move(a);
15981
15986
  }
15982
15987
 
15983
15988
  auto vec = ((ExpressParser::SupertypeFactorContext*)orig) -> AND();
@@ -15987,7 +15992,7 @@ Object SupertypeFactorContextProxy::AND() {
15987
15992
  a.push(detail::To_Ruby<TerminalNodeProxy>().convert(proxy));
15988
15993
  }
15989
15994
 
15990
- return a;
15995
+ return std::move(a);
15991
15996
  }
15992
15997
 
15993
15998
  Object SupertypeFactorContextProxy::ANDAt(size_t i) {
@@ -16076,7 +16081,7 @@ Object SyntaxContextProxy::schemaDecl() {
16076
16081
  }
16077
16082
  }
16078
16083
 
16079
- return a;
16084
+ return std::move(a);
16080
16085
  }
16081
16086
 
16082
16087
  Object SyntaxContextProxy::schemaDeclAt(size_t i) {
@@ -16165,7 +16170,7 @@ Object UniqueRuleContextProxy::referencedAttribute() {
16165
16170
  }
16166
16171
  }
16167
16172
 
16168
- return a;
16173
+ return std::move(a);
16169
16174
  }
16170
16175
 
16171
16176
  Object UniqueRuleContextProxy::referencedAttributeAt(size_t i) {
@@ -16235,12 +16240,20 @@ public:
16235
16240
 
16236
16241
  Object ruby_visit(ContextProxy* proxy) {
16237
16242
  auto result = visit(proxy -> getOriginal());
16238
- return result.as<Object>();
16243
+ try {
16244
+ return std::any_cast<Object>(result);
16245
+ } catch(std::bad_cast) {
16246
+ return Qnil;
16247
+ }
16239
16248
  }
16240
16249
 
16241
16250
  Object ruby_visitChildren(ContextProxy* proxy) {
16242
16251
  auto result = visitChildren(proxy -> getOriginal());
16243
- return result.as<Object>();
16252
+ try {
16253
+ return std::any_cast<Object>(result);
16254
+ } catch(std::bad_cast) {
16255
+ return Qnil;
16256
+ }
16244
16257
  }
16245
16258
 
16246
16259
  virtual antlrcpp::Any visitAttributeRef(ExpressParser::AttributeRefContext *ctx) override {
@@ -17267,18 +17280,6 @@ public:
17267
17280
  return detail::To_Ruby<SyntaxContextProxy>().convert(proxy);
17268
17281
  }
17269
17282
 
17270
- Array getTokens() {
17271
- Array a;
17272
-
17273
- std::vector<Token*> tokens = this -> tokens -> getTokens();
17274
-
17275
- for (auto &token : tokens) {
17276
- a.push(token);
17277
- }
17278
-
17279
- return a;
17280
- }
17281
-
17282
17283
  Object visit(VisitorProxy* visitor) {
17283
17284
  auto result = visitor -> visit(this -> parser -> syntax());
17284
17285
 
@@ -17286,7 +17287,7 @@ public:
17286
17287
  this -> lexer -> reset();
17287
17288
  this -> parser -> reset();
17288
17289
 
17289
- return result;
17290
+ return std::any_cast<Object>(result);
17290
17291
  }
17291
17292
 
17292
17293
  ~ParserProxy() {
@@ -18133,10 +18134,63 @@ Object ContextProxy::wrapParseTree(tree::ParseTree* node) {
18133
18134
  }
18134
18135
  }
18135
18136
 
18137
+ class ParserProxyExt : public Object {
18138
+ public:
18139
+ ParserProxyExt(Object self, string file) {
18140
+ ifstream stream;
18141
+ stream.open(file);
18142
+ input = new ANTLRInputStream(stream);
18143
+ lexer = new ExpressLexer(input);
18144
+ tokens = new CommonTokenStream(lexer);
18145
+ parser = new ExpressParser(tokens);
18146
+ stream.close();
18147
+ };
18148
+
18149
+ ~ParserProxyExt() {
18150
+ delete parser;
18151
+ delete tokens;
18152
+ delete lexer;
18153
+ delete input;
18154
+ }
18155
+
18156
+ Object syntax() {
18157
+ auto ctx = parser -> syntax();
18158
+
18159
+ SyntaxContextProxy proxy((ExpressParser::SyntaxContext*) ctx);
18160
+ return detail::To_Ruby<SyntaxContextProxy>().convert(proxy);
18161
+ }
18162
+
18163
+ Array getTokens() {
18164
+ Array a;
18165
+ for (auto token : tokens -> getTokens()) {
18166
+ a.push(new TokenProxy(token));
18167
+ }
18168
+ return a;
18169
+ }
18170
+
18171
+ Object visit(VisitorProxy* visitor) {
18172
+ auto result = visitor -> visit(parser -> syntax());
18173
+
18174
+ lexer -> reset();
18175
+ parser -> reset();
18176
+
18177
+ try {
18178
+ return std::any_cast<Object>(result);
18179
+ } catch(std::bad_cast) {
18180
+ return Qnil;
18181
+ }
18182
+ }
18183
+
18184
+ private:
18185
+ ANTLRInputStream* input;
18186
+ ExpressLexer* lexer;
18187
+ CommonTokenStream* tokens;
18188
+ ExpressParser* parser;
18189
+ };
18136
18190
 
18137
18191
  extern "C"
18138
18192
  void Init_express_parser() {
18139
- rb_mExpressParser = define_module("ExpressParser");
18193
+ Module rb_mExpressParser = define_module("ExpressParser");
18140
18194
 
18141
18195
  rb_cToken = define_class_under<Token>(rb_mExpressParser, "Token")
18142
18196
  .define_method("text", &Token::getText)
@@ -18364,9 +18418,19 @@ void Init_express_parser() {
18364
18418
  rb_cParser = define_class_under<ParserProxy>(rb_mExpressParser, "Parser")
18365
18419
  .define_singleton_function("parse", &ParserProxy::parse)
18366
18420
  .define_singleton_function("parse_file", &ParserProxy::parseFile)
18367
- .define_method("syntax", &ParserProxy::syntax)
18368
- .define_method("tokens", &ParserProxy::getTokens)
18369
- .define_method("visit", &ParserProxy::visit);
18421
+ .define_method("syntax", &ParserProxy::syntax, Return().keepAlive())
18422
+ .define_method("visit", &ParserProxy::visit, Return().keepAlive());
18423
+
18424
+ rb_cTokenExt = define_class_under<TokenProxy>(rb_mExpressParser, "TokenExt")
18425
+ .define_method("text", &TokenProxy::getText)
18426
+ .define_method("channel", &TokenProxy::getChannel)
18427
+ .define_method("token_index", &TokenProxy::getTokenIndex);
18428
+
18429
+ rb_cParserExt = define_class_under<ParserProxyExt>(rb_mExpressParser, "ParserExt")
18430
+ .define_constructor(Constructor<ParserProxyExt, Object, string>())
18431
+ .define_method("syntax", &ParserProxyExt::syntax, Return().keepAlive())
18432
+ .define_method("tokens", &ParserProxyExt::getTokens)
18433
+ .define_method("visit", &ParserProxyExt::visit, Return().keepAlive());
18370
18434
 
18371
18435
  rb_cAttributeRefContext = define_class_under<AttributeRefContextProxy, ContextProxy>(rb_mExpressParser, "AttributeRefContext")
18372
18436
  .define_method("attribute_id", &AttributeRefContextProxy::attributeId);