expressir 1.2.3 → 1.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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
@@ -4,10 +4,11 @@
4
4
  */
5
5
 
6
6
  #include "RuntimeMetaData.h"
7
+ #include "Version.h"
7
8
 
8
9
  using namespace antlr4;
9
10
 
10
- const std::string RuntimeMetaData::VERSION = "4.8";
11
+ const std::string RuntimeMetaData::VERSION = ANTLRCPP_VERSION_STRING;
11
12
 
12
13
  std::string RuntimeMetaData::getRuntimeVersion() {
13
14
  return VERSION;
@@ -14,24 +14,24 @@ namespace antlr4 {
14
14
  /// we obtained this token.
15
15
  class ANTLR4CPP_PUBLIC Token {
16
16
  public:
17
- static const size_t INVALID_TYPE = 0;
17
+ static constexpr size_t INVALID_TYPE = 0;
18
18
 
19
19
  /// During lookahead operations, this "token" signifies we hit rule end ATN state
20
20
  /// and did not follow it despite needing to.
21
- static const size_t EPSILON = static_cast<size_t>(-2);
22
- static const size_t MIN_USER_TOKEN_TYPE = 1;
23
- static const size_t EOF = IntStream::EOF;
21
+ static constexpr size_t EPSILON = std::numeric_limits<size_t>::max() - 1;
22
+ static constexpr size_t MIN_USER_TOKEN_TYPE = 1;
23
+ static constexpr size_t EOF = IntStream::EOF;
24
24
 
25
25
  virtual ~Token();
26
26
 
27
27
  /// All tokens go to the parser (unless skip() is called in that rule)
28
28
  /// on a particular "channel". The parser tunes to a particular channel
29
29
  /// so that whitespace etc... can go to the parser on a "hidden" channel.
30
- static const size_t DEFAULT_CHANNEL = 0;
30
+ static constexpr size_t DEFAULT_CHANNEL = 0;
31
31
 
32
32
  /// Anything on different channel than DEFAULT_CHANNEL is not parsed
33
33
  /// by parser.
34
- static const size_t HIDDEN_CHANNEL = 1;
34
+ static constexpr size_t HIDDEN_CHANNEL = 1;
35
35
 
36
36
  /**
37
37
  * This is the minimum constant value which can be assigned to a
@@ -44,7 +44,7 @@ namespace antlr4 {
44
44
  *
45
45
  * @see Token#getChannel()
46
46
  */
47
- static const size_t MIN_USER_CHANNEL_VALUE = 2;
47
+ static constexpr size_t MIN_USER_CHANNEL_VALUE = 2;
48
48
 
49
49
  /// Get the text of the token.
50
50
  virtual std::string getText() const = 0;
@@ -79,7 +79,7 @@ namespace antlr4 {
79
79
  /// creating <seealso cref="Token"/> objects from the input.
80
80
  /// </summary>
81
81
  /// <returns> The <seealso cref="TokenFactory"/> currently used by this token source. </returns>
82
- virtual Ref<TokenFactory<CommonToken>> getTokenFactory() = 0;
82
+ virtual TokenFactory<CommonToken>* getTokenFactory() = 0;
83
83
  };
84
84
 
85
85
  } // namespace antlr4
@@ -93,8 +93,8 @@ TokenStreamRewriter::TokenStreamRewriter(TokenStream *tokens_) : tokens(tokens_)
93
93
  }
94
94
 
95
95
  TokenStreamRewriter::~TokenStreamRewriter() {
96
- for (auto program : _programs) {
97
- for (auto operation : program.second) {
96
+ for (const auto &program : _programs) {
97
+ for (auto *operation : program.second) {
98
98
  delete operation;
99
99
  }
100
100
  }
@@ -323,7 +323,7 @@ std::unordered_map<size_t, TokenStreamRewriter::RewriteOperation*> TokenStreamRe
323
323
 
324
324
  // Wipe prior inserts within range
325
325
  std::vector<InsertBeforeOp *> inserts = getKindOfOps<InsertBeforeOp>(rewrites, i);
326
- for (auto iop : inserts) {
326
+ for (auto *iop : inserts) {
327
327
  if (iop->index == rop->index) {
328
328
  // E.g., insert before 2, delete 2..2; update replace
329
329
  // text to include insert before, kill insert
@@ -339,7 +339,7 @@ std::unordered_map<size_t, TokenStreamRewriter::RewriteOperation*> TokenStreamRe
339
339
  }
340
340
  // Drop any prior replaces contained within
341
341
  std::vector<ReplaceOp*> prevReplaces = getKindOfOps<ReplaceOp>(rewrites, i);
342
- for (auto prevRop : prevReplaces) {
342
+ for (auto *prevRop : prevReplaces) {
343
343
  if (prevRop->index >= rop->index && prevRop->lastIndex <= rop->lastIndex) {
344
344
  // delete replace as it's a no-op.
345
345
  delete rewrites[prevRop->instructionIndex];
@@ -373,7 +373,7 @@ std::unordered_map<size_t, TokenStreamRewriter::RewriteOperation*> TokenStreamRe
373
373
  // combine current insert with prior if any at same index
374
374
 
375
375
  std::vector<InsertBeforeOp *> prevInserts = getKindOfOps<InsertBeforeOp>(rewrites, i);
376
- for (auto prevIop : prevInserts) {
376
+ for (auto *prevIop : prevInserts) {
377
377
  if (prevIop->index == iop->index) { // combine objects
378
378
  // convert to strings...we're in process of toString'ing
379
379
  // whole token buffer so no lazy eval issue with any templates
@@ -385,7 +385,7 @@ std::unordered_map<size_t, TokenStreamRewriter::RewriteOperation*> TokenStreamRe
385
385
  }
386
386
  // look for replaces where iop.index is in range; error
387
387
  std::vector<ReplaceOp*> prevReplaces = getKindOfOps<ReplaceOp>(rewrites, i);
388
- for (auto rop : prevReplaces) {
388
+ for (auto *rop : prevReplaces) {
389
389
  if (iop->index == rop->index) {
390
390
  rop->text = catOpText(&iop->text, &rop->text);
391
391
  delete rewrites[i];
@@ -5,6 +5,8 @@
5
5
 
6
6
  #pragma once
7
7
 
8
+ #include "antlr4-common.h"
9
+
8
10
  namespace antlr4 {
9
11
 
10
12
  /**
@@ -86,8 +88,8 @@ namespace antlr4 {
86
88
  class ANTLR4CPP_PUBLIC TokenStreamRewriter {
87
89
  public:
88
90
  static const std::string DEFAULT_PROGRAM_NAME;
89
- static const size_t PROGRAM_INIT_SIZE = 100;
90
- static const size_t MIN_TOKEN_INDEX = 0;
91
+ static constexpr size_t PROGRAM_INIT_SIZE = 100;
92
+ static constexpr size_t MIN_TOKEN_INDEX = 0;
91
93
 
92
94
  TokenStreamRewriter(TokenStream *tokens);
93
95
  virtual ~TokenStreamRewriter();
@@ -5,7 +5,7 @@
5
5
 
6
6
  #include "misc/Interval.h"
7
7
  #include "Exceptions.h"
8
- #include "support/StringUtils.h"
8
+ #include "support/Utf8.h"
9
9
 
10
10
  #include "UnbufferedCharStream.h"
11
11
 
@@ -13,9 +13,8 @@ using namespace antlrcpp;
13
13
  using namespace antlr4;
14
14
  using namespace antlr4::misc;
15
15
 
16
- UnbufferedCharStream::UnbufferedCharStream(std::wistream &input) : _input(input) {
17
- InitializeInstanceFields();
18
-
16
+ UnbufferedCharStream::UnbufferedCharStream(std::wistream &input)
17
+ : _p(0), _numMarkers(0), _lastChar(0), _lastCharBufferStart(0), _currentCharIndex(0), _input(input) {
19
18
  // The vector's size is what used to be n in Java code.
20
19
  fill(1); // prime
21
20
  }
@@ -74,9 +73,7 @@ size_t UnbufferedCharStream::fill(size_t n) {
74
73
  }
75
74
 
76
75
  char32_t UnbufferedCharStream::nextChar() {
77
- wchar_t result = 0;
78
- _input >> result;
79
- return result;
76
+ return _input.get();
80
77
  }
81
78
 
82
79
  void UnbufferedCharStream::add(char32_t c) {
@@ -101,7 +98,7 @@ size_t UnbufferedCharStream::LA(ssize_t i) {
101
98
  return EOF;
102
99
  }
103
100
 
104
- if (_data[static_cast<size_t>(index)] == 0xFFFF) {
101
+ if (_data[static_cast<size_t>(index)] == std::char_traits<wchar_t>::eof()) {
105
102
  return EOF;
106
103
  }
107
104
 
@@ -178,7 +175,7 @@ std::string UnbufferedCharStream::getSourceName() const {
178
175
  }
179
176
 
180
177
  std::string UnbufferedCharStream::getText(const misc::Interval &interval) {
181
- if (interval.a < 0 || interval.b >= interval.a - 1) {
178
+ if (interval.a < 0 || interval.b < interval.a - 1) {
182
179
  throw IllegalArgumentException("invalid interval");
183
180
  }
184
181
 
@@ -195,17 +192,17 @@ std::string UnbufferedCharStream::getText(const misc::Interval &interval) {
195
192
  }
196
193
  // convert from absolute to local index
197
194
  size_t i = interval.a - bufferStartIndex;
198
- return utf32_to_utf8(_data.substr(i, interval.length()));
195
+ auto maybeUtf8 = Utf8::strictEncode(std::u32string_view(_data).substr(i, interval.length()));
196
+ if (!maybeUtf8.has_value()) {
197
+ throw IllegalArgumentException("Unbuffered stream contains invalid Unicode code points");
198
+ }
199
+ return std::move(maybeUtf8).value();
199
200
  }
200
201
 
201
- size_t UnbufferedCharStream::getBufferStartIndex() const {
202
- return _currentCharIndex - _p;
202
+ std::string UnbufferedCharStream::toString() const {
203
+ throw UnsupportedOperationException("Unbuffered stream cannot be materialized to a string");
203
204
  }
204
205
 
205
- void UnbufferedCharStream::InitializeInstanceFields() {
206
- _p = 0;
207
- _numMarkers = 0;
208
- _lastChar = 0;
209
- _lastCharBufferStart = 0;
210
- _currentCharIndex = 0;
206
+ size_t UnbufferedCharStream::getBufferStartIndex() const {
207
+ return _currentCharIndex - _p;
211
208
  }
@@ -18,10 +18,10 @@ namespace antlr4 {
18
18
  /// The name or source of this char stream.
19
19
  std::string name;
20
20
 
21
- UnbufferedCharStream(std::wistream &input);
21
+ explicit UnbufferedCharStream(std::wistream &input);
22
22
 
23
- virtual void consume() override;
24
- virtual size_t LA(ssize_t i) override;
23
+ void consume() override;
24
+ size_t LA(ssize_t i) override;
25
25
 
26
26
  /// <summary>
27
27
  /// Return a marker that we can release later.
@@ -30,35 +30,32 @@ namespace antlr4 {
30
30
  /// protection against misuse where {@code seek()} is called on a mark or
31
31
  /// {@code release()} is called in the wrong order.
32
32
  /// </summary>
33
- virtual ssize_t mark() override;
33
+ ssize_t mark() override;
34
34
 
35
35
  /// <summary>
36
36
  /// Decrement number of markers, resetting buffer if we hit 0. </summary>
37
37
  /// <param name="marker"> </param>
38
- virtual void release(ssize_t marker) override;
39
- virtual size_t index() override;
38
+ void release(ssize_t marker) override;
39
+ size_t index() override;
40
40
 
41
41
  /// <summary>
42
42
  /// Seek to absolute character index, which might not be in the current
43
43
  /// sliding window. Move {@code p} to {@code index-bufferStartIndex}.
44
44
  /// </summary>
45
- virtual void seek(size_t index) override;
46
- virtual size_t size() override;
47
- virtual std::string getSourceName() const override;
48
- virtual std::string getText(const misc::Interval &interval) override;
45
+ void seek(size_t index) override;
46
+ size_t size() override;
47
+ std::string getSourceName() const override;
48
+ std::string getText(const misc::Interval &interval) override;
49
+
50
+ std::string toString() const override;
49
51
 
50
52
  protected:
51
53
  /// A moving window buffer of the data being scanned. While there's a marker,
52
54
  /// we keep adding to buffer. Otherwise, <seealso cref="#consume consume()"/> resets so
53
55
  /// we start filling at index 0 again.
54
56
  // UTF-32 encoded.
55
- #if defined(_MSC_VER) && _MSC_VER == 1900
56
- i32string _data; // Custom type for VS 2015.
57
- typedef __int32 storage_type;
58
- #else
59
57
  std::u32string _data;
60
58
  typedef char32_t storage_type;
61
- #endif
62
59
 
63
60
  /// <summary>
64
61
  /// 0..n-1 index into <seealso cref="#data data"/> of next character.
@@ -115,9 +112,6 @@ namespace antlr4 {
115
112
  virtual char32_t nextChar();
116
113
  virtual void add(char32_t c);
117
114
  size_t getBufferStartIndex() const;
118
-
119
- private:
120
- void InitializeInstanceFields();
121
115
  };
122
116
 
123
117
  } // namespace antlr4
@@ -0,0 +1,42 @@
1
+ // Copyright 2012-2022 The ANTLR Project
2
+ //
3
+ // Redistribution and use in source and binary forms, with or without modification, are permitted
4
+ // provided that the following conditions are met:
5
+ //
6
+ // 1. Redistributions of source code must retain the above copyright notice, this list of conditions
7
+ // and the following disclaimer.
8
+ //
9
+ // 2. Redistributions in binary form must reproduce the above copyright notice, this list of
10
+ // conditions and the following disclaimer in the documentation and/or other materials provided
11
+ // with the distribution.
12
+ //
13
+ // 3. Neither the name of the copyright holder nor the names of its contributors may be used to
14
+ // endorse or promote products derived from this software without specific prior written
15
+ // permission.
16
+ //
17
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
18
+ // IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
19
+ // FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
20
+ // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21
+ // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22
+ // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
23
+ // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
24
+ // WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25
+
26
+ #pragma once
27
+
28
+ #include "antlr4-common.h"
29
+
30
+ #define ANTLRCPP_VERSION_MAJOR 4
31
+ #define ANTLRCPP_VERSION_MINOR 10
32
+ #define ANTLRCPP_VERSION_PATCH 1
33
+
34
+ #define ANTLRCPP_MAKE_VERSION(major, minor, patch) ((major) * 100000 + (minor) * 1000 + (patch))
35
+
36
+ #define ANTLRCPP_VERSION \
37
+ ANTLRCPP_MAKE_VERSION(ANTLR4CPP_VERSION_MAJOR, ANTLR4CPP_VERSION_MINOR, ANTLR4CPP_VERSION_PATCH)
38
+
39
+ #define ANTLRCPP_VERSION_STRING \
40
+ ANTLR4CPP_STRINGIFY(ANTLR4CPP_VERSION_MAJOR) "." \
41
+ ANTLR4CPP_STRINGIFY(ANTLR4CPP_VERSION_MINOR) "." \
42
+ ANTLR4CPP_STRINGIFY(ANTLR4CPP_VERSION_PATCH)
@@ -11,58 +11,18 @@ using namespace antlr4::dfa;
11
11
 
12
12
  const Vocabulary Vocabulary::EMPTY_VOCABULARY;
13
13
 
14
- Vocabulary::Vocabulary(const std::vector<std::string> &literalNames, const std::vector<std::string> &symbolicNames)
15
- : Vocabulary(literalNames, symbolicNames, {}) {
14
+ Vocabulary::Vocabulary(std::vector<std::string> literalNames, std::vector<std::string> symbolicNames)
15
+ : Vocabulary(std::move(literalNames), std::move(symbolicNames), {}) {
16
16
  }
17
17
 
18
- Vocabulary::Vocabulary(const std::vector<std::string> &literalNames,
19
- const std::vector<std::string> &symbolicNames, const std::vector<std::string> &displayNames)
20
- : _literalNames(literalNames), _symbolicNames(symbolicNames), _displayNames(displayNames),
18
+ Vocabulary::Vocabulary(std::vector<std::string> literalNames,
19
+ std::vector<std::string> symbolicNames, std::vector<std::string> displayNames)
20
+ : _literalNames(std::move(literalNames)), _symbolicNames(std::move(symbolicNames)), _displayNames(std::move(displayNames)),
21
21
  _maxTokenType(std::max(_displayNames.size(), std::max(_literalNames.size(), _symbolicNames.size())) - 1) {
22
22
  // See note here on -1 part: https://github.com/antlr/antlr4/pull/1146
23
23
  }
24
24
 
25
- Vocabulary::~Vocabulary() {
26
- }
27
-
28
- Vocabulary Vocabulary::fromTokenNames(const std::vector<std::string> &tokenNames) {
29
- if (tokenNames.empty()) {
30
- return EMPTY_VOCABULARY;
31
- }
32
-
33
- std::vector<std::string> literalNames = tokenNames;
34
- std::vector<std::string> symbolicNames = tokenNames;
35
- std::locale locale;
36
- for (size_t i = 0; i < tokenNames.size(); i++) {
37
- std::string tokenName = tokenNames[i];
38
- if (tokenName == "") {
39
- continue;
40
- }
41
-
42
- if (!tokenName.empty()) {
43
- char firstChar = tokenName[0];
44
- if (firstChar == '\'') {
45
- symbolicNames[i] = "";
46
- continue;
47
- } else if (std::isupper(firstChar, locale)) {
48
- literalNames[i] = "";
49
- continue;
50
- }
51
- }
52
-
53
- // wasn't a literal or symbolic name
54
- literalNames[i] = "";
55
- symbolicNames[i] = "";
56
- }
57
-
58
- return Vocabulary(literalNames, symbolicNames, tokenNames);
59
- }
60
-
61
- size_t Vocabulary::getMaxTokenType() const {
62
- return _maxTokenType;
63
- }
64
-
65
- std::string Vocabulary::getLiteralName(size_t tokenType) const {
25
+ std::string_view Vocabulary::getLiteralName(size_t tokenType) const {
66
26
  if (tokenType < _literalNames.size()) {
67
27
  return _literalNames[tokenType];
68
28
  }
@@ -70,7 +30,7 @@ std::string Vocabulary::getLiteralName(size_t tokenType) const {
70
30
  return "";
71
31
  }
72
32
 
73
- std::string Vocabulary::getSymbolicName(size_t tokenType) const {
33
+ std::string_view Vocabulary::getSymbolicName(size_t tokenType) const {
74
34
  if (tokenType == Token::EOF) {
75
35
  return "EOF";
76
36
  }
@@ -84,20 +44,20 @@ std::string Vocabulary::getSymbolicName(size_t tokenType) const {
84
44
 
85
45
  std::string Vocabulary::getDisplayName(size_t tokenType) const {
86
46
  if (tokenType < _displayNames.size()) {
87
- std::string displayName = _displayNames[tokenType];
47
+ std::string_view displayName = _displayNames[tokenType];
88
48
  if (!displayName.empty()) {
89
- return displayName;
49
+ return std::string(displayName);
90
50
  }
91
51
  }
92
52
 
93
- std::string literalName = getLiteralName(tokenType);
53
+ std::string_view literalName = getLiteralName(tokenType);
94
54
  if (!literalName.empty()) {
95
- return literalName;
55
+ return std::string(literalName);
96
56
  }
97
57
 
98
- std::string symbolicName = getSymbolicName(tokenType);
58
+ std::string_view symbolicName = getSymbolicName(tokenType);
99
59
  if (!symbolicName.empty()) {
100
- return symbolicName;
60
+ return std::string(symbolicName);
101
61
  }
102
62
 
103
63
  return std::to_string(tokenType);
@@ -12,21 +12,20 @@ namespace dfa {
12
12
 
13
13
  /// This class provides a default implementation of the <seealso cref="Vocabulary"/>
14
14
  /// interface.
15
- class ANTLR4CPP_PUBLIC Vocabulary {
15
+ class ANTLR4CPP_PUBLIC Vocabulary final {
16
16
  public:
17
- Vocabulary(Vocabulary const&) = default;
18
- virtual ~Vocabulary();
19
-
20
17
  /// Gets an empty <seealso cref="Vocabulary"/> instance.
21
18
  ///
22
19
  /// <para>
23
20
  /// No literal or symbol names are assigned to token types, so
24
21
  /// <seealso cref="#getDisplayName(int)"/> returns the numeric value for all tokens
25
22
  /// except <seealso cref="Token#EOF"/>.</para>
26
- static const Vocabulary EMPTY_VOCABULARY;
23
+ [[deprecated("Use the default constructor of Vocabulary instead.")]] static const Vocabulary EMPTY_VOCABULARY;
27
24
 
28
25
  Vocabulary() {}
29
26
 
27
+ Vocabulary(const Vocabulary&) = default;
28
+
30
29
  /// <summary>
31
30
  /// Constructs a new instance of <seealso cref="Vocabulary"/> from the specified
32
31
  /// literal and symbolic token names.
@@ -38,7 +37,7 @@ namespace dfa {
38
37
  /// </param>
39
38
  /// <seealso cref= #getLiteralName(int) </seealso>
40
39
  /// <seealso cref= #getSymbolicName(int) </seealso>
41
- Vocabulary(const std::vector<std::string> &literalNames, const std::vector<std::string> &symbolicNames);
40
+ Vocabulary(std::vector<std::string> literalNames, std::vector<std::string> symbolicNames);
42
41
 
43
42
  /// <summary>
44
43
  /// Constructs a new instance of <seealso cref="Vocabulary"/> from the specified
@@ -56,29 +55,14 @@ namespace dfa {
56
55
  /// <seealso cref= #getLiteralName(int) </seealso>
57
56
  /// <seealso cref= #getSymbolicName(int) </seealso>
58
57
  /// <seealso cref= #getDisplayName(int) </seealso>
59
- Vocabulary(const std::vector<std::string> &literalNames, const std::vector<std::string> &symbolicNames,
60
- const std::vector<std::string> &displayNames);
61
-
62
- /// <summary>
63
- /// Returns a <seealso cref="Vocabulary"/> instance from the specified set of token
64
- /// names. This method acts as a compatibility layer for the single
65
- /// {@code tokenNames} array generated by previous releases of ANTLR.
66
- ///
67
- /// <para>The resulting vocabulary instance returns {@code null} for
68
- /// <seealso cref="#getLiteralName(int)"/> and <seealso cref="#getSymbolicName(int)"/>, and the
69
- /// value from {@code tokenNames} for the display names.</para>
70
- /// </summary>
71
- /// <param name="tokenNames"> The token names, or {@code null} if no token names are
72
- /// available. </param>
73
- /// <returns> A <seealso cref="Vocabulary"/> instance which uses {@code tokenNames} for
74
- /// the display names of tokens. </returns>
75
- static Vocabulary fromTokenNames(const std::vector<std::string> &tokenNames);
58
+ Vocabulary(std::vector<std::string> literalNames, std::vector<std::string> symbolicNames,
59
+ std::vector<std::string> displayNames);
76
60
 
77
61
  /// <summary>
78
62
  /// Returns the highest token type value. It can be used to iterate from
79
63
  /// zero to that number, inclusively, thus querying all stored entries. </summary>
80
64
  /// <returns> the highest token type value </returns>
81
- virtual size_t getMaxTokenType() const;
65
+ constexpr size_t getMaxTokenType() const { return _maxTokenType; }
82
66
 
83
67
  /// <summary>
84
68
  /// Gets the string literal associated with a token type. The string returned
@@ -115,7 +99,7 @@ namespace dfa {
115
99
  /// </param>
116
100
  /// <returns> The string literal associated with the specified token type, or
117
101
  /// {@code null} if no string literal is associated with the type. </returns>
118
- virtual std::string getLiteralName(size_t tokenType) const;
102
+ std::string_view getLiteralName(size_t tokenType) const;
119
103
 
120
104
  /// <summary>
121
105
  /// Gets the symbolic name associated with a token type. The string returned
@@ -159,7 +143,7 @@ namespace dfa {
159
143
  /// </param>
160
144
  /// <returns> The symbolic name associated with the specified token type, or
161
145
  /// {@code null} if no symbolic name is associated with the type. </returns>
162
- virtual std::string getSymbolicName(size_t tokenType) const;
146
+ std::string_view getSymbolicName(size_t tokenType) const;
163
147
 
164
148
  /// <summary>
165
149
  /// Gets the display name of a token type.
@@ -180,7 +164,7 @@ namespace dfa {
180
164
  /// </param>
181
165
  /// <returns> The display name of the token type, for use in error reporting or
182
166
  /// other user-visible messages which reference specific token types. </returns>
183
- virtual std::string getDisplayName(size_t tokenType) const;
167
+ std::string getDisplayName(size_t tokenType) const;
184
168
 
185
169
  private:
186
170
  std::vector<std::string> const _literalNames;
@@ -6,36 +6,34 @@
6
6
  #pragma once
7
7
 
8
8
  #include <algorithm>
9
- #include <assert.h>
9
+ #include <any>
10
10
  #include <atomic>
11
- #include <codecvt>
12
- #include <chrono>
11
+ #include <bitset>
12
+ #include <cassert>
13
+ #include <climits>
14
+ #include <cstddef>
15
+ #include <cstdint>
16
+ #include <cstdlib>
17
+ #include <exception>
13
18
  #include <fstream>
14
19
  #include <iostream>
15
20
  #include <iterator>
16
21
  #include <limits>
17
- #include <limits.h>
18
- #include <list>
19
22
  #include <map>
20
23
  #include <memory>
24
+ #include <mutex>
21
25
  #include <set>
22
- #include <stdarg.h>
23
- #include <stdint.h>
24
- #include <stdlib.h>
26
+ #include <shared_mutex>
25
27
  #include <sstream>
26
28
  #include <stack>
27
29
  #include <string>
30
+ #include <string_view>
28
31
  #include <typeinfo>
29
32
  #include <type_traits>
30
33
  #include <unordered_map>
31
34
  #include <unordered_set>
32
35
  #include <utility>
33
36
  #include <vector>
34
- #include <mutex>
35
- #include <exception>
36
- #include <bitset>
37
- #include <condition_variable>
38
- #include <functional>
39
37
 
40
38
  // Defines for the Guid class and other platform dependent stuff.
41
39
  #ifdef _WIN32
@@ -49,25 +47,12 @@
49
47
  #endif
50
48
  #endif
51
49
 
52
- #define GUID_WINDOWS
53
-
54
50
  #ifdef _WIN64
55
51
  typedef __int64 ssize_t;
56
52
  #else
57
53
  typedef __int32 ssize_t;
58
54
  #endif
59
55
 
60
- #if _MSC_VER >= 1900 && _MSC_VER < 2000
61
- // VS 2015 has a known bug when using std::codecvt_utf8<char32_t>
62
- // so we have to temporarily use __int32 instead.
63
- // https://connect.microsoft.com/VisualStudio/feedback/details/1403302/unresolved-external-when-using-codecvt-utf8
64
- typedef std::basic_string<__int32> i32string;
65
-
66
- typedef i32string UTF32String;
67
- #else
68
- typedef std::u32string UTF32String;
69
- #endif
70
-
71
56
  #ifdef ANTLR4CPP_EXPORTS
72
57
  #define ANTLR4CPP_PUBLIC __declspec(dllexport)
73
58
  #else
@@ -78,26 +63,13 @@
78
63
  #endif
79
64
  #endif
80
65
 
81
- #if defined(_MSC_VER) && !defined(__clang__)
82
- // clang-cl should escape this to prevent [ignored-attributes].
83
- namespace std {
84
- class ANTLR4CPP_PUBLIC exception; // Prevents warning C4275 from MSVC.
85
- } // namespace std
86
- #endif
87
-
88
66
  #elif defined(__APPLE__)
89
- typedef std::u32string UTF32String;
90
-
91
- #define GUID_CFUUID
92
67
  #if __GNUC__ >= 4
93
68
  #define ANTLR4CPP_PUBLIC __attribute__ ((visibility ("default")))
94
69
  #else
95
70
  #define ANTLR4CPP_PUBLIC
96
71
  #endif
97
72
  #else
98
- typedef std::u32string UTF32String;
99
-
100
- #define GUID_LIBUUID
101
73
  #if __GNUC__ >= 6
102
74
  #define ANTLR4CPP_PUBLIC __attribute__ ((visibility ("default")))
103
75
  #else
@@ -105,27 +77,16 @@
105
77
  #endif
106
78
  #endif
107
79
 
108
- #include "support/guid.h"
109
- #include "support/Declarations.h"
80
+ #ifdef __has_builtin
81
+ #define ANTLR4CPP_HAVE_BUILTIN(x) __has_builtin(x)
82
+ #else
83
+ #define ANTLR4CPP_HAVE_BUILTIN(x) 0
84
+ #endif
110
85
 
111
- #if !defined(HAS_NOEXCEPT)
112
- #if defined(__clang__)
113
- #if __has_feature(cxx_noexcept)
114
- #define HAS_NOEXCEPT
115
- #endif
116
- #else
117
- #if defined(__GXX_EXPERIMENTAL_CXX0X__) && __GNUC__ * 10 + __GNUC_MINOR__ >= 46 || \
118
- defined(_MSC_FULL_VER) && _MSC_FULL_VER >= 190023026
119
- #define HAS_NOEXCEPT
120
- #endif
121
- #endif
86
+ #define ANTLR4CPP_INTERNAL_STRINGIFY(x) #x
87
+ #define ANTLR4CPP_STRINGIFY(x) ANTLR4CPP_INTERNAL_STRINGIFY(x)
122
88
 
123
- #ifdef HAS_NOEXCEPT
124
- #define NOEXCEPT noexcept
125
- #else
126
- #define NOEXCEPT
127
- #endif
128
- #endif
89
+ #include "support/Declarations.h"
129
90
 
130
91
  // We have to undefine this symbol as ANTLR will use this name for own members and even
131
92
  // generated functions. Because EOF is a global macro we cannot use e.g. a namespace scope to disambiguate.