did_parser 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (327) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +12 -0
  3. data/Rakefile +28 -0
  4. data/did_parser.gemspec +31 -0
  5. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/ANTLRErrorListener.cpp +10 -0
  6. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/ANTLRErrorListener.h +167 -0
  7. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/ANTLRErrorStrategy.cpp +10 -0
  8. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/ANTLRErrorStrategy.h +121 -0
  9. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/ANTLRFileStream.cpp +23 -0
  10. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/ANTLRFileStream.h +30 -0
  11. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/ANTLRInputStream.cpp +180 -0
  12. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/ANTLRInputStream.h +79 -0
  13. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/BailErrorStrategy.cpp +61 -0
  14. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/BailErrorStrategy.h +59 -0
  15. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/BaseErrorListener.cpp +25 -0
  16. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/BaseErrorListener.h +36 -0
  17. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/BufferedTokenStream.cpp +414 -0
  18. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/BufferedTokenStream.h +200 -0
  19. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/CharStream.cpp +11 -0
  20. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/CharStream.h +37 -0
  21. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/CommonToken.cpp +193 -0
  22. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/CommonToken.h +158 -0
  23. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/CommonTokenFactory.cpp +39 -0
  24. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/CommonTokenFactory.h +74 -0
  25. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/CommonTokenStream.cpp +78 -0
  26. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/CommonTokenStream.h +79 -0
  27. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/ConsoleErrorListener.cpp +15 -0
  28. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/ConsoleErrorListener.h +35 -0
  29. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/DefaultErrorStrategy.cpp +336 -0
  30. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/DefaultErrorStrategy.h +466 -0
  31. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/DiagnosticErrorListener.cpp +84 -0
  32. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/DiagnosticErrorListener.h +80 -0
  33. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/Exceptions.cpp +64 -0
  34. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/Exceptions.h +99 -0
  35. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/FailedPredicateException.cpp +52 -0
  36. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/FailedPredicateException.h +32 -0
  37. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/InputMismatchException.cpp +18 -0
  38. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/InputMismatchException.h +24 -0
  39. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/IntStream.cpp +12 -0
  40. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/IntStream.h +218 -0
  41. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/InterpreterRuleContext.cpp +19 -0
  42. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/InterpreterRuleContext.h +45 -0
  43. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/Lexer.cpp +294 -0
  44. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/Lexer.h +196 -0
  45. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/LexerInterpreter.cpp +60 -0
  46. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/LexerInterpreter.h +46 -0
  47. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/LexerNoViableAltException.cpp +36 -0
  48. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/LexerNoViableAltException.h +31 -0
  49. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/ListTokenSource.cpp +92 -0
  50. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/ListTokenSource.h +88 -0
  51. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/NoViableAltException.cpp +46 -0
  52. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/NoViableAltException.h +42 -0
  53. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/Parser.cpp +668 -0
  54. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/Parser.h +461 -0
  55. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/ParserInterpreter.cpp +294 -0
  56. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/ParserInterpreter.h +173 -0
  57. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/ParserRuleContext.cpp +138 -0
  58. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/ParserRuleContext.h +147 -0
  59. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/ProxyErrorListener.cpp +53 -0
  60. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/ProxyErrorListener.h +38 -0
  61. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/RecognitionException.cpp +65 -0
  62. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/RecognitionException.h +98 -0
  63. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/Recognizer.cpp +156 -0
  64. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/Recognizer.h +159 -0
  65. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/RuleContext.cpp +144 -0
  66. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/RuleContext.h +141 -0
  67. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/RuleContextWithAltNum.cpp +27 -0
  68. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/RuleContextWithAltNum.h +32 -0
  69. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/RuntimeMetaData.cpp +54 -0
  70. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/RuntimeMetaData.h +155 -0
  71. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/Token.cpp +9 -0
  72. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/Token.h +92 -0
  73. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/TokenFactory.h +30 -0
  74. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/TokenSource.cpp +9 -0
  75. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/TokenSource.h +85 -0
  76. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/TokenStream.cpp +11 -0
  77. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/TokenStream.h +137 -0
  78. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/TokenStreamRewriter.cpp +425 -0
  79. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/TokenStreamRewriter.h +295 -0
  80. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/UnbufferedCharStream.cpp +208 -0
  81. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/UnbufferedCharStream.h +117 -0
  82. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/UnbufferedTokenStream.cpp +270 -0
  83. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/UnbufferedTokenStream.h +115 -0
  84. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/Version.h +42 -0
  85. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/Vocabulary.cpp +64 -0
  86. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/Vocabulary.h +177 -0
  87. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/WritableToken.cpp +9 -0
  88. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/WritableToken.h +23 -0
  89. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/antlr4-common.h +98 -0
  90. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/antlr4-runtime.h +169 -0
  91. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATN.cpp +158 -0
  92. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATN.h +132 -0
  93. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNConfig.cpp +106 -0
  94. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNConfig.h +157 -0
  95. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNConfigSet.cpp +232 -0
  96. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNConfigSet.h +156 -0
  97. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNDeserializationOptions.cpp +54 -0
  98. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNDeserializationOptions.h +48 -0
  99. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNDeserializer.cpp +629 -0
  100. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNDeserializer.h +32 -0
  101. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNSimulator.cpp +33 -0
  102. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNSimulator.h +71 -0
  103. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNState.cpp +56 -0
  104. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNState.h +139 -0
  105. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNStateType.cpp +33 -0
  106. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNStateType.h +36 -0
  107. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNType.h +20 -0
  108. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ActionTransition.cpp +29 -0
  109. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ActionTransition.h +35 -0
  110. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/AmbiguityInfo.cpp +16 -0
  111. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/AmbiguityInfo.h +68 -0
  112. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ArrayPredictionContext.cpp +109 -0
  113. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ArrayPredictionContext.h +51 -0
  114. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/AtomTransition.cpp +27 -0
  115. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/AtomTransition.h +33 -0
  116. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/BasicBlockStartState.h +24 -0
  117. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/BasicState.h +23 -0
  118. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/BlockEndState.h +26 -0
  119. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/BlockStartState.h +30 -0
  120. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ContextSensitivityInfo.cpp +14 -0
  121. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ContextSensitivityInfo.h +47 -0
  122. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/DecisionEventInfo.cpp +14 -0
  123. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/DecisionEventInfo.h +70 -0
  124. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/DecisionInfo.cpp +25 -0
  125. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/DecisionInfo.h +227 -0
  126. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/DecisionState.cpp +12 -0
  127. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/DecisionState.h +34 -0
  128. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/EpsilonTransition.cpp +31 -0
  129. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/EpsilonTransition.h +42 -0
  130. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ErrorInfo.cpp +15 -0
  131. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ErrorInfo.h +43 -0
  132. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LL1Analyzer.cpp +189 -0
  133. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LL1Analyzer.h +76 -0
  134. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerATNConfig.cpp +67 -0
  135. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerATNConfig.h +44 -0
  136. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerATNSimulator.cpp +615 -0
  137. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerATNSimulator.h +199 -0
  138. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerAction.cpp +15 -0
  139. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerAction.h +100 -0
  140. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerActionExecutor.cpp +111 -0
  141. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerActionExecutor.h +128 -0
  142. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerActionType.h +57 -0
  143. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerChannelAction.cpp +43 -0
  144. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerChannelAction.h +59 -0
  145. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerCustomAction.cpp +45 -0
  146. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerCustomAction.h +75 -0
  147. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerIndexedCustomAction.cpp +57 -0
  148. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerIndexedCustomAction.h +76 -0
  149. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerModeAction.cpp +43 -0
  150. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerModeAction.h +57 -0
  151. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerMoreAction.cpp +36 -0
  152. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerMoreAction.h +53 -0
  153. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerPopModeAction.cpp +36 -0
  154. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerPopModeAction.h +53 -0
  155. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerPushModeAction.cpp +43 -0
  156. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerPushModeAction.h +57 -0
  157. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerSkipAction.cpp +36 -0
  158. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerSkipAction.h +51 -0
  159. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerTypeAction.cpp +43 -0
  160. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerTypeAction.h +51 -0
  161. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LookaheadEventInfo.cpp +16 -0
  162. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LookaheadEventInfo.h +42 -0
  163. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LoopEndState.h +26 -0
  164. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/NotSetTransition.cpp +22 -0
  165. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/NotSetTransition.h +27 -0
  166. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/OrderedATNConfigSet.cpp +16 -0
  167. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/OrderedATNConfigSet.h +25 -0
  168. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ParseInfo.cpp +102 -0
  169. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ParseInfo.h +102 -0
  170. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ParserATNSimulator.cpp +1383 -0
  171. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ParserATNSimulator.h +911 -0
  172. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ParserATNSimulatorOptions.h +50 -0
  173. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PlusBlockStartState.h +29 -0
  174. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PlusLoopbackState.h +25 -0
  175. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PrecedencePredicateTransition.cpp +23 -0
  176. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PrecedencePredicateTransition.h +35 -0
  177. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredicateEvalInfo.cpp +17 -0
  178. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredicateEvalInfo.h +62 -0
  179. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredicateTransition.cpp +24 -0
  180. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredicateTransition.h +50 -0
  181. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredictionContext.cpp +579 -0
  182. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredictionContext.h +225 -0
  183. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredictionContextCache.cpp +56 -0
  184. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredictionContextCache.h +64 -0
  185. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredictionContextMergeCache.cpp +167 -0
  186. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredictionContextMergeCache.h +101 -0
  187. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredictionContextMergeCacheOptions.h +71 -0
  188. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredictionContextType.h +21 -0
  189. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredictionMode.cpp +202 -0
  190. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredictionMode.h +436 -0
  191. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ProfilingATNSimulator.cpp +179 -0
  192. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ProfilingATNSimulator.h +60 -0
  193. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/RangeTransition.cpp +26 -0
  194. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/RangeTransition.h +31 -0
  195. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/RuleStartState.h +26 -0
  196. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/RuleStopState.h +27 -0
  197. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/RuleTransition.cpp +33 -0
  198. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/RuleTransition.h +42 -0
  199. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/SemanticContext.cpp +418 -0
  200. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/SemanticContext.h +233 -0
  201. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/SemanticContextType.h +23 -0
  202. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/SerializedATNView.h +101 -0
  203. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/SetTransition.cpp +28 -0
  204. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/SetTransition.h +38 -0
  205. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/SingletonPredictionContext.cpp +86 -0
  206. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/SingletonPredictionContext.h +43 -0
  207. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/StarBlockStartState.h +24 -0
  208. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/StarLoopEntryState.h +37 -0
  209. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/StarLoopbackState.cpp +19 -0
  210. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/StarLoopbackState.h +25 -0
  211. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/TokensStartState.h +24 -0
  212. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/Transition.cpp +36 -0
  213. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/Transition.h +65 -0
  214. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/TransitionType.cpp +27 -0
  215. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/TransitionType.h +33 -0
  216. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/WildcardTransition.cpp +21 -0
  217. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/WildcardTransition.h +27 -0
  218. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/dfa/DFA.cpp +115 -0
  219. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/dfa/DFA.h +96 -0
  220. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/dfa/DFASerializer.cpp +60 -0
  221. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/dfa/DFASerializer.h +32 -0
  222. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/dfa/DFAState.cpp +59 -0
  223. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/dfa/DFAState.h +153 -0
  224. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/dfa/LexerDFASerializer.cpp +17 -0
  225. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/dfa/LexerDFASerializer.h +22 -0
  226. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/misc/InterpreterDataReader.cpp +124 -0
  227. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/misc/InterpreterDataReader.h +33 -0
  228. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/misc/Interval.cpp +61 -0
  229. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/misc/Interval.h +84 -0
  230. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/misc/IntervalSet.cpp +508 -0
  231. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/misc/IntervalSet.h +190 -0
  232. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/misc/MurmurHash.cpp +120 -0
  233. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/misc/MurmurHash.h +102 -0
  234. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/misc/Predicate.cpp +4 -0
  235. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/misc/Predicate.h +21 -0
  236. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/support/Any.cpp +8 -0
  237. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/support/Any.h +16 -0
  238. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/support/Arrays.cpp +43 -0
  239. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/support/Arrays.h +149 -0
  240. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/support/BitSet.h +76 -0
  241. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/support/CPPUtils.cpp +207 -0
  242. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/support/CPPUtils.h +65 -0
  243. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/support/Casts.h +34 -0
  244. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/support/Declarations.h +161 -0
  245. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/support/StringUtils.cpp +38 -0
  246. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/support/StringUtils.h +16 -0
  247. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/support/Unicode.h +28 -0
  248. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/support/Utf8.cpp +242 -0
  249. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/support/Utf8.h +54 -0
  250. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/AbstractParseTreeVisitor.h +129 -0
  251. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ErrorNode.h +24 -0
  252. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ErrorNodeImpl.cpp +54 -0
  253. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ErrorNodeImpl.h +43 -0
  254. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/IterativeParseTreeWalker.cpp +66 -0
  255. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/IterativeParseTreeWalker.h +53 -0
  256. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ParseTree.cpp +12 -0
  257. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ParseTree.h +111 -0
  258. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ParseTreeListener.cpp +9 -0
  259. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ParseTreeListener.h +39 -0
  260. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ParseTreeProperty.h +50 -0
  261. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ParseTreeType.h +22 -0
  262. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ParseTreeVisitor.cpp +9 -0
  263. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ParseTreeVisitor.h +57 -0
  264. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ParseTreeWalker.cpp +48 -0
  265. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ParseTreeWalker.h +55 -0
  266. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/TerminalNode.h +40 -0
  267. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/TerminalNodeImpl.cpp +54 -0
  268. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/TerminalNodeImpl.h +32 -0
  269. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/Trees.cpp +241 -0
  270. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/Trees.h +78 -0
  271. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/pattern/Chunk.cpp +9 -0
  272. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/pattern/Chunk.h +44 -0
  273. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/pattern/ParseTreeMatch.cpp +69 -0
  274. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/pattern/ParseTreeMatch.h +132 -0
  275. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/pattern/ParseTreePattern.cpp +64 -0
  276. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/pattern/ParseTreePattern.h +105 -0
  277. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/pattern/ParseTreePatternMatcher.cpp +370 -0
  278. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/pattern/ParseTreePatternMatcher.h +185 -0
  279. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/pattern/RuleTagToken.cpp +77 -0
  280. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/pattern/RuleTagToken.h +117 -0
  281. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/pattern/TagChunk.cpp +39 -0
  282. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/pattern/TagChunk.h +86 -0
  283. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/pattern/TextChunk.cpp +28 -0
  284. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/pattern/TextChunk.h +51 -0
  285. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/pattern/TokenTagToken.cpp +36 -0
  286. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/pattern/TokenTagToken.h +80 -0
  287. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPath.cpp +154 -0
  288. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPath.h +86 -0
  289. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathElement.cpp +31 -0
  290. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathElement.h +40 -0
  291. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathLexer.cpp +182 -0
  292. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathLexer.h +47 -0
  293. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathLexerErrorListener.cpp +13 -0
  294. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathLexerErrorListener.h +22 -0
  295. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathRuleAnywhereElement.cpp +20 -0
  296. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathRuleAnywhereElement.h +27 -0
  297. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathRuleElement.cpp +30 -0
  298. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathRuleElement.h +26 -0
  299. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathTokenAnywhereElement.cpp +20 -0
  300. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathTokenAnywhereElement.h +25 -0
  301. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathTokenElement.cpp +33 -0
  302. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathTokenElement.h +26 -0
  303. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathWildcardAnywhereElement.cpp +23 -0
  304. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathWildcardAnywhereElement.h +23 -0
  305. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathWildcardElement.cpp +24 -0
  306. data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathWildcardElement.h +23 -0
  307. data/ext/did_parser/antlrgen/DIDLexer.cpp +225 -0
  308. data/ext/did_parser/antlrgen/DIDLexer.h +52 -0
  309. data/ext/did_parser/antlrgen/DIDLexer.interp +93 -0
  310. data/ext/did_parser/antlrgen/DIDLexer.tokens +42 -0
  311. data/ext/did_parser/antlrgen/DIDParser.cpp +2042 -0
  312. data/ext/did_parser/antlrgen/DIDParser.h +537 -0
  313. data/ext/did_parser/antlrgen/DIDParser.interp +74 -0
  314. data/ext/did_parser/antlrgen/DIDParser.tokens +42 -0
  315. data/ext/did_parser/antlrgen/DIDParserBaseListener.cpp +7 -0
  316. data/ext/did_parser/antlrgen/DIDParserBaseListener.h +104 -0
  317. data/ext/did_parser/antlrgen/DIDParserBaseVisitor.cpp +7 -0
  318. data/ext/did_parser/antlrgen/DIDParserBaseVisitor.h +124 -0
  319. data/ext/did_parser/antlrgen/DIDParserListener.cpp +7 -0
  320. data/ext/did_parser/antlrgen/DIDParserListener.h +97 -0
  321. data/ext/did_parser/antlrgen/DIDParserVisitor.cpp +7 -0
  322. data/ext/did_parser/antlrgen/DIDParserVisitor.h +76 -0
  323. data/ext/did_parser/did_parser.cpp +2996 -0
  324. data/ext/did_parser/extconf.rb +38 -0
  325. data/lib/did_parser/version.rb +3 -0
  326. data/lib/did_parser.rb +2 -0
  327. metadata +382 -0
@@ -0,0 +1,190 @@
1
+ /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
2
+ * Use of this file is governed by the BSD 3-clause license that
3
+ * can be found in the LICENSE.txt file in the project root.
4
+ */
5
+
6
+ #pragma once
7
+
8
+ #include "misc/Interval.h"
9
+ #include "Exceptions.h"
10
+
11
+ namespace antlr4 {
12
+ namespace misc {
13
+
14
+ /**
15
+ * This class implements the {@link IntSet} backed by a sorted array of
16
+ * non-overlapping intervals. It is particularly efficient for representing
17
+ * large collections of numbers, where the majority of elements appear as part
18
+ * of a sequential range of numbers that are all part of the set. For example,
19
+ * the set { 1, 2, 3, 4, 7, 8 } may be represented as { [1, 4], [7, 8] }.
20
+ *
21
+ * <p>
22
+ * This class is able to represent sets containing any combination of values in
23
+ * the range {@link Integer#MIN_VALUE} to {@link Integer#MAX_VALUE}
24
+ * (inclusive).</p>
25
+ */
26
+ class ANTLR4CPP_PUBLIC IntervalSet final {
27
+ public:
28
+ static IntervalSet const COMPLETE_CHAR_SET;
29
+ static IntervalSet const EMPTY_SET;
30
+
31
+ private:
32
+ /// The list of sorted, disjoint intervals.
33
+ std::vector<Interval> _intervals;
34
+
35
+ explicit IntervalSet(std::vector<Interval>&& intervals);
36
+
37
+ public:
38
+ IntervalSet();
39
+ IntervalSet(IntervalSet const& set);
40
+ IntervalSet(IntervalSet&& set);
41
+
42
+ template<typename T1, typename... T_NEXT>
43
+ IntervalSet(int, T1 t1, T_NEXT&&... next) : IntervalSet() {
44
+ // The first int argument is an ignored count for compatibility
45
+ // with the previous varargs based interface.
46
+ addItems(t1, std::forward<T_NEXT>(next)...);
47
+ }
48
+
49
+ IntervalSet& operator=(IntervalSet const& set);
50
+ IntervalSet& operator=(IntervalSet&& set);
51
+
52
+ /// Create a set with a single element, el.
53
+ static IntervalSet of(ssize_t a);
54
+
55
+ /// Create a set with all ints within range [a..b] (inclusive)
56
+ static IntervalSet of(ssize_t a, ssize_t b);
57
+
58
+ void clear();
59
+
60
+ /// Add a single element to the set. An isolated element is stored
61
+ /// as a range el..el.
62
+ void add(ssize_t el);
63
+
64
+ /// Add interval; i.e., add all integers from a to b to set.
65
+ /// If b<a, do nothing.
66
+ /// Keep list in sorted order (by left range value).
67
+ /// If overlap, combine ranges. For example,
68
+ /// If this is {1..5, 10..20}, adding 6..7 yields
69
+ /// {1..5, 6..7, 10..20}. Adding 4..8 yields {1..8, 10..20}.
70
+ void add(ssize_t a, ssize_t b);
71
+
72
+ /// combine all sets in the array returned the or'd value
73
+ static IntervalSet Or(const std::vector<IntervalSet> &sets);
74
+
75
+ // Copy on write so we can cache a..a intervals and sets of that.
76
+ void add(const Interval &addition);
77
+ IntervalSet& addAll(const IntervalSet &set);
78
+
79
+ template<typename T1, typename... T_NEXT>
80
+ void addItems(T1 t1, T_NEXT&&... next) {
81
+ add(t1);
82
+ addItems(std::forward<T_NEXT>(next)...);
83
+ }
84
+
85
+ IntervalSet complement(ssize_t minElement, ssize_t maxElement) const;
86
+
87
+ /// Given the set of possible values (rather than, say UNICODE or MAXINT),
88
+ /// return a new set containing all elements in vocabulary, but not in
89
+ /// this. The computation is (vocabulary - this).
90
+ ///
91
+ /// 'this' is assumed to be either a subset or equal to vocabulary.
92
+ IntervalSet complement(const IntervalSet &vocabulary) const;
93
+
94
+ /// Compute this-other via this&~other.
95
+ /// Return a new set containing all elements in this but not in other.
96
+ /// other is assumed to be a subset of this;
97
+ /// anything that is in other but not in this will be ignored.
98
+ IntervalSet subtract(const IntervalSet &other) const;
99
+
100
+ /**
101
+ * Compute the set difference between two interval sets. The specific
102
+ * operation is {@code left - right}. If either of the input sets is
103
+ * {@code null}, it is treated as though it was an empty set.
104
+ */
105
+ static IntervalSet subtract(const IntervalSet &left, const IntervalSet &right);
106
+
107
+ IntervalSet Or(const IntervalSet &a) const;
108
+
109
+ /// Return a new set with the intersection of this set with other. Because
110
+ /// the intervals are sorted, we can use an iterator for each list and
111
+ /// just walk them together. This is roughly O(min(n,m)) for interval
112
+ /// list lengths n and m.
113
+ IntervalSet And(const IntervalSet &other) const;
114
+
115
+ /// Is el in any range of this set?
116
+ bool contains(size_t el) const; // For mapping of e.g. Token::EOF to -1 etc.
117
+ bool contains(ssize_t el) const;
118
+
119
+ /// return true if this set has no members
120
+ bool isEmpty() const;
121
+
122
+ /// If this set is a single integer, return it otherwise Token.INVALID_TYPE.
123
+ ssize_t getSingleElement() const;
124
+
125
+ /**
126
+ * Returns the maximum value contained in the set.
127
+ *
128
+ * @return the maximum value contained in the set. If the set is empty, this
129
+ * method returns {@link Token#INVALID_TYPE}.
130
+ */
131
+ ssize_t getMaxElement() const;
132
+
133
+ /**
134
+ * Returns the minimum value contained in the set.
135
+ *
136
+ * @return the minimum value contained in the set. If the set is empty, this
137
+ * method returns {@link Token#INVALID_TYPE}.
138
+ */
139
+ ssize_t getMinElement() const;
140
+
141
+ /// <summary>
142
+ /// Return a list of Interval objects. </summary>
143
+ std::vector<Interval> const& getIntervals() const;
144
+
145
+ size_t hashCode() const;
146
+
147
+ /// Are two IntervalSets equal? Because all intervals are sorted
148
+ /// and disjoint, equals is a simple linear walk over both lists
149
+ /// to make sure they are the same.
150
+ bool operator == (const IntervalSet &other) const;
151
+ std::string toString() const;
152
+ std::string toString(bool elemAreChar) const;
153
+
154
+ std::string toString(const dfa::Vocabulary &vocabulary) const;
155
+
156
+ protected:
157
+ std::string elementName(const dfa::Vocabulary &vocabulary, ssize_t a) const;
158
+
159
+ public:
160
+ size_t size() const;
161
+ std::vector<ssize_t> toList() const;
162
+ std::set<ssize_t> toSet() const;
163
+
164
+ /// Get the ith element of ordered set. Used only by RandomPhrase so
165
+ /// don't bother to implement if you're not doing that for a new
166
+ /// ANTLR code gen target.
167
+ ssize_t get(size_t i) const;
168
+ void remove(size_t el); // For mapping of e.g. Token::EOF to -1 etc.
169
+ void remove(ssize_t el);
170
+
171
+ private:
172
+ void addItems() { /* No-op */ }
173
+ };
174
+
175
+ } // namespace atn
176
+ } // namespace antlr4
177
+
178
+ // Hash function for IntervalSet.
179
+
180
+ namespace std {
181
+ using antlr4::misc::IntervalSet;
182
+
183
+ template <> struct hash<IntervalSet>
184
+ {
185
+ size_t operator() (const IntervalSet &x) const
186
+ {
187
+ return x.hashCode();
188
+ }
189
+ };
190
+ }
@@ -0,0 +1,120 @@
1
+ /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
2
+ * Use of this file is governed by the BSD 3-clause license that
3
+ * can be found in the LICENSE.txt file in the project root.
4
+ */
5
+
6
+ #include <cstddef>
7
+ #include <cstdint>
8
+ #include <cstring>
9
+
10
+ #include "misc/MurmurHash.h"
11
+
12
+ using namespace antlr4::misc;
13
+
14
+ // A variation of the MurmurHash3 implementation (https://github.com/aappleby/smhasher/blob/master/src/MurmurHash3.cpp)
15
+ // Here we unrolled the loop used there into individual calls to update(), as we usually hash object fields
16
+ // instead of entire buffers.
17
+
18
+ // Platform-specific functions and macros
19
+
20
+ // Microsoft Visual Studio
21
+
22
+ #if defined(_MSC_VER)
23
+
24
+ #include <stdlib.h>
25
+
26
+ #define ROTL32(x,y) _rotl(x,y)
27
+ #define ROTL64(x,y) _rotl64(x,y)
28
+
29
+ #elif ANTLR4CPP_HAVE_BUILTIN(__builtin_rotateleft32) && ANTLR4CPP_HAVE_BUILTIN(__builtin_rotateleft64)
30
+
31
+ #define ROTL32(x, y) __builtin_rotateleft32(x, y)
32
+ #define ROTL64(x, y) __builtin_rotateleft64(x, y)
33
+
34
+ #else // defined(_MSC_VER)
35
+
36
+ // Other compilers
37
+
38
+ namespace {
39
+
40
+ constexpr uint32_t ROTL32(uint32_t x, int r) {
41
+ return (x << r) | (x >> (32 - r));
42
+ }
43
+ constexpr uint64_t ROTL64(uint64_t x, int r) {
44
+ return (x << r) | (x >> (64 - r));
45
+ }
46
+
47
+ }
48
+
49
+ #endif // !defined(_MSC_VER)
50
+
51
+ #if SIZE_MAX == UINT64_MAX
52
+
53
+ size_t MurmurHash::update(size_t hash, size_t value) {
54
+ size_t k1 = value;
55
+ k1 *= UINT64_C(0x87c37b91114253d5);
56
+ k1 = ROTL64(k1, 31);
57
+ k1 *= UINT64_C(0x4cf5ad432745937f);
58
+
59
+ hash ^= k1;
60
+ hash = ROTL64(hash, 27);
61
+ hash = hash * 5 + UINT64_C(0x52dce729);
62
+
63
+ return hash;
64
+ }
65
+
66
+ size_t MurmurHash::update(size_t hash, const void *data, size_t size) {
67
+ size_t value;
68
+ const uint8_t *bytes = static_cast<const uint8_t*>(data);
69
+ while (size >= sizeof(size_t)) {
70
+ std::memcpy(&value, bytes, sizeof(size_t));
71
+ hash = update(hash, value);
72
+ bytes += sizeof(size_t);
73
+ size -= sizeof(size_t);
74
+ }
75
+ if (size != 0) {
76
+ value = 0;
77
+ std::memcpy(&value, bytes, size);
78
+ hash = update(hash, value);
79
+ }
80
+ return hash;
81
+ }
82
+
83
+ size_t MurmurHash::finish(size_t hash, size_t entryCount) {
84
+ hash ^= entryCount * 8;
85
+ hash ^= hash >> 33;
86
+ hash *= UINT64_C(0xff51afd7ed558ccd);
87
+ hash ^= hash >> 33;
88
+ hash *= UINT64_C(0xc4ceb9fe1a85ec53);
89
+ hash ^= hash >> 33;
90
+ return hash;
91
+ }
92
+
93
+ #elif SIZE_MAX == UINT32_MAX
94
+
95
+ size_t MurmurHash::update(size_t hash, size_t value) {
96
+ size_t k1 = value;
97
+ k1 *= UINT32_C(0xCC9E2D51);
98
+ k1 = ROTL32(k1, 15);
99
+ k1 *= UINT32_C(0x1B873593);
100
+
101
+ hash ^= k1;
102
+ hash = ROTL32(hash, 13);
103
+ hash = hash * 5 + UINT32_C(0xE6546B64);
104
+
105
+ return hash;
106
+ }
107
+
108
+ size_t MurmurHash::finish(size_t hash, size_t entryCount) {
109
+ hash ^= entryCount * 4;
110
+ hash ^= hash >> 16;
111
+ hash *= UINT32_C(0x85EBCA6B);
112
+ hash ^= hash >> 13;
113
+ hash *= UINT32_C(0xC2B2AE35);
114
+ hash ^= hash >> 16;
115
+ return hash;
116
+ }
117
+
118
+ #else
119
+ #error "Expected sizeof(size_t) to be 4 or 8."
120
+ #endif
@@ -0,0 +1,102 @@
1
+ /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
2
+ * Use of this file is governed by the BSD 3-clause license that
3
+ * can be found in the LICENSE.txt file in the project root.
4
+ */
5
+
6
+ #pragma once
7
+
8
+ #include <cstdint>
9
+ #include <type_traits>
10
+
11
+ #include "antlr4-common.h"
12
+
13
+ namespace antlr4 {
14
+ namespace misc {
15
+
16
+ class ANTLR4CPP_PUBLIC MurmurHash final {
17
+ private:
18
+ static constexpr size_t DEFAULT_SEED = 0;
19
+
20
+ /// Initialize the hash using the default seed value.
21
+ /// Returns the intermediate hash value.
22
+ public:
23
+ static size_t initialize() { return initialize(DEFAULT_SEED); }
24
+
25
+ /// Initialize the hash using the specified seed.
26
+ static size_t initialize(size_t seed) { return seed; }
27
+
28
+ /// Update the intermediate hash value for the next input {@code value}.
29
+ /// <param name="hash"> the intermediate hash value </param>
30
+ /// <param name="value"> the value to add to the current hash </param>
31
+ /// Returns the updated intermediate hash value.
32
+ static size_t update(size_t hash, size_t value);
33
+
34
+ /**
35
+ * Update the intermediate hash value for the next input {@code value}.
36
+ *
37
+ * @param hash the intermediate hash value
38
+ * @param value the value to add to the current hash
39
+ * @return the updated intermediate hash value
40
+ */
41
+ template <class T>
42
+ static size_t update(size_t hash, Ref<T> const& value) {
43
+ return update(hash, value != nullptr ? value->hashCode() : 0);
44
+ }
45
+
46
+ template <class T>
47
+ static size_t update(size_t hash, T *value) {
48
+ return update(hash, value != nullptr ? value->hashCode() : 0);
49
+ }
50
+
51
+ static size_t update(size_t hash, const void *data, size_t size);
52
+
53
+ template <typename T>
54
+ static size_t update(size_t hash, const T *data, size_t size) {
55
+ return update(hash, static_cast<const void*>(data), size * sizeof(std::remove_reference_t<T>));
56
+ }
57
+
58
+ /// <summary>
59
+ /// Apply the final computation steps to the intermediate value {@code hash}
60
+ /// to form the final result of the MurmurHash 3 hash function.
61
+ /// </summary>
62
+ /// <param name="hash"> the intermediate hash value </param>
63
+ /// <param name="entryCount"> the number of calls to update() before calling finish() </param>
64
+ /// <returns> the final hash result </returns>
65
+ static size_t finish(size_t hash, size_t entryCount);
66
+
67
+ /// Utility function to compute the hash code of an array using the MurmurHash3 algorithm.
68
+ ///
69
+ /// @param <T> the array element type </param>
70
+ /// <param name="data"> the array data </param>
71
+ /// <param name="seed"> the seed for the MurmurHash algorithm </param>
72
+ /// <returns> the hash code of the data </returns>
73
+ template<typename T> // where T is C array type
74
+ static size_t hashCode(const std::vector<Ref<T>> &data, size_t seed = DEFAULT_SEED) {
75
+ size_t hash = initialize(seed);
76
+ for (auto &entry : data) {
77
+ hash = update(hash, entry);
78
+ }
79
+ return finish(hash, data.size());
80
+ }
81
+
82
+ static size_t hashCode(const void *data, size_t size, size_t seed = DEFAULT_SEED) {
83
+ size_t hash = initialize(seed);
84
+ hash = update(hash, data, size);
85
+ return finish(hash, size);
86
+ }
87
+
88
+ template <typename T>
89
+ static size_t hashCode(const T *data, size_t size, size_t seed = DEFAULT_SEED) {
90
+ return hashCode(static_cast<const void*>(data), size * sizeof(std::remove_reference_t<T>), seed);
91
+ }
92
+
93
+ private:
94
+ MurmurHash() = delete;
95
+
96
+ MurmurHash(const MurmurHash&) = delete;
97
+
98
+ MurmurHash& operator=(const MurmurHash&) = delete;
99
+ };
100
+
101
+ } // namespace atn
102
+ } // namespace antlr4
@@ -0,0 +1,4 @@
1
+ #include "misc/Predicate.h"
2
+
3
+ antlr4::misc::Predicate::~Predicate() {
4
+ }
@@ -0,0 +1,21 @@
1
+ /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
2
+ * Use of this file is governed by the BSD 3-clause license that
3
+ * can be found in the LICENSE.txt file in the project root.
4
+ */
5
+
6
+ #pragma once
7
+
8
+ #include "antlr4-common.h"
9
+
10
+ namespace antlr4 {
11
+ namespace misc {
12
+
13
+ class ANTLR4CPP_PUBLIC Predicate {
14
+ public:
15
+ virtual ~Predicate();
16
+
17
+ virtual bool test(tree::ParseTree *t) = 0;
18
+ };
19
+
20
+ } // namespace tree
21
+ } // namespace antlr4
@@ -0,0 +1,8 @@
1
+ /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
2
+ * Use of this file is governed by the BSD 3-clause license that
3
+ * can be found in the LICENSE.txt file in the project root.
4
+ */
5
+
6
+ #include "Any.h"
7
+
8
+ using namespace antlrcpp;
@@ -0,0 +1,16 @@
1
+ /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
2
+ * Use of this file is governed by the BSD 3-clause license that
3
+ * can be found in the LICENSE.txt file in the project root.
4
+ */
5
+
6
+ // A standard C++ class loosely modeled after boost::Any.
7
+
8
+ #pragma once
9
+
10
+ #include "antlr4-common.h"
11
+
12
+ namespace antlrcpp {
13
+
14
+ using Any = std::any;
15
+
16
+ } // namespace antlrcpp
@@ -0,0 +1,43 @@
1
+ /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
2
+ * Use of this file is governed by the BSD 3-clause license that
3
+ * can be found in the LICENSE.txt file in the project root.
4
+ */
5
+
6
+ #include "tree/ParseTree.h"
7
+ #include "Exceptions.h"
8
+
9
+ #include "support/Arrays.h"
10
+
11
+ using namespace antlrcpp;
12
+
13
+ std::string Arrays::listToString(const std::vector<std::string> &list, const std::string &separator)
14
+ {
15
+ std::stringstream ss;
16
+ bool firstEntry = true;
17
+
18
+ ss << '[';
19
+ for (const auto &entry : list) {
20
+ ss << entry;
21
+ if (firstEntry) {
22
+ ss << separator;
23
+ firstEntry = false;
24
+ }
25
+ }
26
+
27
+ ss << ']';
28
+ return ss.str();
29
+ }
30
+
31
+ template <>
32
+ std::string Arrays::toString(const std::vector<antlr4::tree::ParseTree*> &source) {
33
+ std::string result = "[";
34
+ bool firstEntry = true;
35
+ for (auto *value : source) {
36
+ result += value->toStringTree();
37
+ if (firstEntry) {
38
+ result += ", ";
39
+ firstEntry = false;
40
+ }
41
+ }
42
+ return result + "]";
43
+ }
@@ -0,0 +1,149 @@
1
+ /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
2
+ * Use of this file is governed by the BSD 3-clause license that
3
+ * can be found in the LICENSE.txt file in the project root.
4
+ */
5
+
6
+ #pragma once
7
+
8
+ #include "antlr4-common.h"
9
+
10
+ namespace antlrcpp {
11
+
12
+ class ANTLR4CPP_PUBLIC Arrays {
13
+ public:
14
+
15
+ static std::string listToString(const std::vector<std::string> &list, const std::string &separator);
16
+
17
+ template <typename T>
18
+ static bool equals(const std::vector<T> &a, const std::vector<T> &b) {
19
+ if (a.size() != b.size())
20
+ return false;
21
+
22
+ for (size_t i = 0; i < a.size(); ++i)
23
+ if (!(a[i] == b[i]))
24
+ return false;
25
+
26
+ return true;
27
+ }
28
+
29
+ template <typename T>
30
+ static bool equals(const std::vector<T *> &a, const std::vector<T *> &b) {
31
+ if (a.size() != b.size())
32
+ return false;
33
+
34
+ for (size_t i = 0; i < a.size(); ++i) {
35
+ if (!a[i] && !b[i])
36
+ continue;
37
+ if (!a[i] || !b[i])
38
+ return false;
39
+ if (a[i] == b[i])
40
+ continue;
41
+
42
+ if (!(*a[i] == *b[i]))
43
+ return false;
44
+ }
45
+
46
+ return true;
47
+ }
48
+
49
+ template <typename T>
50
+ static bool equals(const std::vector<Ref<T>> &a, const std::vector<Ref<T>> &b) {
51
+ if (a.size() != b.size())
52
+ return false;
53
+
54
+ for (size_t i = 0; i < a.size(); ++i) {
55
+ if (!a[i] && !b[i])
56
+ continue;
57
+ if (!a[i] || !b[i])
58
+ return false;
59
+ if (a[i] == b[i])
60
+ continue;
61
+
62
+ if (!(*a[i] == *b[i]))
63
+ return false;
64
+ }
65
+
66
+ return true;
67
+ }
68
+
69
+ template <typename T>
70
+ static bool equals(const std::vector<std::unique_ptr<T>> &a, const std::vector<std::unique_ptr<T>> &b) {
71
+ if (a.size() != b.size())
72
+ return false;
73
+
74
+ for (size_t i = 0; i < a.size(); ++i) {
75
+ if (!a[i] && !b[i])
76
+ continue;
77
+ if (!a[i] || !b[i])
78
+ return false;
79
+ if (a[i] == b[i])
80
+ continue;
81
+
82
+ if (!(*a[i] == *b[i]))
83
+ return false;
84
+ }
85
+
86
+ return true;
87
+ }
88
+
89
+ template <typename T>
90
+ static std::string toString(const std::vector<T> &source) {
91
+ std::string result = "[";
92
+ bool firstEntry = true;
93
+ for (auto &value : source) {
94
+ result += value.toString();
95
+ if (firstEntry) {
96
+ result += ", ";
97
+ firstEntry = false;
98
+ }
99
+ }
100
+ return result + "]";
101
+ }
102
+
103
+ template <typename T>
104
+ static std::string toString(const std::vector<Ref<T>> &source) {
105
+ std::string result = "[";
106
+ bool firstEntry = true;
107
+ for (auto &value : source) {
108
+ result += value->toString();
109
+ if (firstEntry) {
110
+ result += ", ";
111
+ firstEntry = false;
112
+ }
113
+ }
114
+ return result + "]";
115
+ }
116
+
117
+ template <typename T>
118
+ static std::string toString(const std::vector<std::unique_ptr<T>> &source) {
119
+ std::string result = "[";
120
+ bool firstEntry = true;
121
+ for (auto &value : source) {
122
+ result += value->toString();
123
+ if (firstEntry) {
124
+ result += ", ";
125
+ firstEntry = false;
126
+ }
127
+ }
128
+ return result + "]";
129
+ }
130
+
131
+ template <typename T>
132
+ static std::string toString(const std::vector<T *> &source) {
133
+ std::string result = "[";
134
+ bool firstEntry = true;
135
+ for (auto value : source) {
136
+ result += value->toString();
137
+ if (firstEntry) {
138
+ result += ", ";
139
+ firstEntry = false;
140
+ }
141
+ }
142
+ return result + "]";
143
+ }
144
+
145
+ };
146
+
147
+ template <>
148
+ std::string Arrays::toString(const std::vector<antlr4::tree::ParseTree *> &source);
149
+ }