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
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 6c1f03e9daca35f40998cf7614d0234cfcdb20af2347772ab40c2b3c70b01b53
4
+ data.tar.gz: 06512717a46166a61c5be2069e760e239b6d6b9347e5ed9a4855756996432508
5
+ SHA512:
6
+ metadata.gz: 968350bbc95800fb281648fb725b41985c4ca6a2474bab9ae8b87575596b97ab7acb6e1ee48cf7b82d63e785fa483cd6697a3f2c1927381961e6ce3851303f35
7
+ data.tar.gz: ef9144d50d7dcf9202a00feed0726f8cf9965efdade2b1d031a0e989ff34dd83d45f1f759ece2121e720b44ad3bc73efe840003ff49a1a3e099f62ac8ad060af
data/Gemfile ADDED
@@ -0,0 +1,12 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
4
+
5
+ group :development do
6
+ gem 'pry-byebug'
7
+ gem 'antlr4-native', '~> 2.0'
8
+ end
9
+
10
+ group :development, :test do
11
+ gem 'rake'
12
+ end
data/Rakefile ADDED
@@ -0,0 +1,28 @@
1
+ require 'bundler'
2
+
3
+ require 'antlr4-native'
4
+ require 'etc'
5
+
6
+ def ruby_installer?
7
+ Object.const_defined?(:RubyInstaller)
8
+ end
9
+
10
+ Bundler::GemHelper.install_tasks
11
+
12
+ task :generate do
13
+ generator = Antlr4Native::Generator.new(
14
+ grammar_files: ["./DIDLexer.g4", "./DIDParser.g4"],
15
+ output_dir: 'ext/',
16
+ parser_root_method: 'actor'
17
+ )
18
+
19
+ generator.generate
20
+ end
21
+
22
+ task :compile do
23
+ Dir.chdir(File.join(%w(ext did_parser))) do
24
+ load 'extconf.rb'
25
+ RubyInstaller::Runtime.enable_msys_apps if ruby_installer?
26
+ exec "make -j #{Etc.nprocessors}"
27
+ end
28
+ end
@@ -0,0 +1,31 @@
1
+ $:.unshift File.join(File.dirname(__FILE__), 'lib')
2
+ require 'did_parser/version'
3
+
4
+ Gem::Specification.new do |s|
5
+ s.name = 'did_parser'
6
+ s.version = ::DIDParser::VERSION
7
+ s.authors = ['Terry Tu']
8
+ s.email = ['tuminfei1981@gmail.com']
9
+ s.homepage = 'https://github.com/tuminfei/did-parser-rb'
10
+
11
+ s.description = s.summary = 'A DID parser for Ruby'
12
+
13
+ s.platform = Gem::Platform::RUBY
14
+
15
+ s.add_dependency 'rice', '~> 4.0'
16
+
17
+ s.extensions = File.join(*%w(ext did_parser extconf.rb))
18
+
19
+ s.require_path = 'lib'
20
+ s.files = Dir[
21
+ '{lib,spec}/**/*',
22
+ 'ext/did_parser/*.{cpp,h}',
23
+ 'ext/did_parser/extconf.rb',
24
+ 'ext/did_parser/antlrgen/*',
25
+ 'ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/**/*.{cpp,h}',
26
+ 'Gemfile',
27
+ 'README.md',
28
+ 'Rakefile',
29
+ 'did_parser.gemspec'
30
+ ]
31
+ end
@@ -0,0 +1,10 @@
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 "ANTLRErrorListener.h"
7
+
8
+ antlr4::ANTLRErrorListener::~ANTLRErrorListener()
9
+ {
10
+ }
@@ -0,0 +1,167 @@
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 "RecognitionException.h"
9
+
10
+ namespace antlrcpp {
11
+ class BitSet;
12
+ }
13
+
14
+ namespace antlr4 {
15
+
16
+ /// How to emit recognition errors (an interface in Java).
17
+ class ANTLR4CPP_PUBLIC ANTLRErrorListener {
18
+ public:
19
+ virtual ~ANTLRErrorListener();
20
+
21
+ /// <summary>
22
+ /// Upon syntax error, notify any interested parties. This is not how to
23
+ /// recover from errors or compute error messages. <seealso cref="ANTLRErrorStrategy"/>
24
+ /// specifies how to recover from syntax errors and how to compute error
25
+ /// messages. This listener's job is simply to emit a computed message,
26
+ /// though it has enough information to create its own message in many cases.
27
+ /// <p/>
28
+ /// The <seealso cref="RecognitionException"/> is non-null for all syntax errors except
29
+ /// when we discover mismatched token errors that we can recover from
30
+ /// in-line, without returning from the surrounding rule (via the single
31
+ /// token insertion and deletion mechanism).
32
+ /// </summary>
33
+ /// <param name="recognizer">
34
+ /// What parser got the error. From this
35
+ /// object, you can access the context as well
36
+ /// as the input stream. </param>
37
+ /// <param name="offendingSymbol">
38
+ /// The offending token in the input token
39
+ /// stream, unless recognizer is a lexer (then it's null). If
40
+ /// no viable alternative error, {@code e} has token at which we
41
+ /// started production for the decision. </param>
42
+ /// <param name="line">
43
+ /// The line number in the input where the error occurred. </param>
44
+ /// <param name="charPositionInLine">
45
+ /// The character position within that line where the error occurred. </param>
46
+ /// <param name="msg">
47
+ /// The message to emit. </param>
48
+ /// <param name="e">
49
+ /// The exception generated by the parser that led to
50
+ /// the reporting of an error. It is null in the case where
51
+ /// the parser was able to recover in line without exiting the
52
+ /// surrounding rule. </param>
53
+ virtual void syntaxError(Recognizer *recognizer, Token *offendingSymbol, size_t line,
54
+ size_t charPositionInLine, const std::string &msg, std::exception_ptr e) = 0;
55
+
56
+ /**
57
+ * This method is called by the parser when a full-context prediction
58
+ * results in an ambiguity.
59
+ *
60
+ * <p>Each full-context prediction which does not result in a syntax error
61
+ * will call either {@link #reportContextSensitivity} or
62
+ * {@link #reportAmbiguity}.</p>
63
+ *
64
+ * <p>When {@code ambigAlts} is not null, it contains the set of potentially
65
+ * viable alternatives identified by the prediction algorithm. When
66
+ * {@code ambigAlts} is null, use {@link ATNConfigSet#getAlts} to obtain the
67
+ * represented alternatives from the {@code configs} argument.</p>
68
+ *
69
+ * <p>When {@code exact} is {@code true}, <em>all</em> of the potentially
70
+ * viable alternatives are truly viable, i.e. this is reporting an exact
71
+ * ambiguity. When {@code exact} is {@code false}, <em>at least two</em> of
72
+ * the potentially viable alternatives are viable for the current input, but
73
+ * the prediction algorithm terminated as soon as it determined that at
74
+ * least the <em>minimum</em> potentially viable alternative is truly
75
+ * viable.</p>
76
+ *
77
+ * <p>When the {@link PredictionMode#LL_EXACT_AMBIG_DETECTION} prediction
78
+ * mode is used, the parser is required to identify exact ambiguities so
79
+ * {@code exact} will always be {@code true}.</p>
80
+ *
81
+ * <p>This method is not used by lexers.</p>
82
+ *
83
+ * @param recognizer the parser instance
84
+ * @param dfa the DFA for the current decision
85
+ * @param startIndex the input index where the decision started
86
+ * @param stopIndex the input input where the ambiguity was identified
87
+ * @param exact {@code true} if the ambiguity is exactly known, otherwise
88
+ * {@code false}. This is always {@code true} when
89
+ * {@link PredictionMode#LL_EXACT_AMBIG_DETECTION} is used.
90
+ * @param ambigAlts the potentially ambiguous alternatives, or {@code null}
91
+ * to indicate that the potentially ambiguous alternatives are the complete
92
+ * set of represented alternatives in {@code configs}
93
+ * @param configs the ATN configuration set where the ambiguity was
94
+ * identified
95
+ */
96
+ virtual void reportAmbiguity(Parser *recognizer, const dfa::DFA &dfa, size_t startIndex, size_t stopIndex, bool exact,
97
+ const antlrcpp::BitSet &ambigAlts, atn::ATNConfigSet *configs) = 0;
98
+
99
+ /**
100
+ * This method is called when an SLL conflict occurs and the parser is about
101
+ * to use the full context information to make an LL decision.
102
+ *
103
+ * <p>If one or more configurations in {@code configs} contains a semantic
104
+ * predicate, the predicates are evaluated before this method is called. The
105
+ * subset of alternatives which are still viable after predicates are
106
+ * evaluated is reported in {@code conflictingAlts}.</p>
107
+ *
108
+ * <p>This method is not used by lexers.</p>
109
+ *
110
+ * @param recognizer the parser instance
111
+ * @param dfa the DFA for the current decision
112
+ * @param startIndex the input index where the decision started
113
+ * @param stopIndex the input index where the SLL conflict occurred
114
+ * @param conflictingAlts The specific conflicting alternatives. If this is
115
+ * {@code null}, the conflicting alternatives are all alternatives
116
+ * represented in {@code configs}. At the moment, conflictingAlts is non-null
117
+ * (for the reference implementation, but Sam's optimized version can see this
118
+ * as null).
119
+ * @param configs the ATN configuration set where the SLL conflict was
120
+ * detected
121
+ */
122
+ virtual void reportAttemptingFullContext(Parser *recognizer, const dfa::DFA &dfa, size_t startIndex, size_t stopIndex,
123
+ const antlrcpp::BitSet &conflictingAlts, atn::ATNConfigSet *configs) = 0;
124
+
125
+ /**
126
+ * This method is called by the parser when a full-context prediction has a
127
+ * unique result.
128
+ *
129
+ * <p>Each full-context prediction which does not result in a syntax error
130
+ * will call either {@link #reportContextSensitivity} or
131
+ * {@link #reportAmbiguity}.</p>
132
+ *
133
+ * <p>For prediction implementations that only evaluate full-context
134
+ * predictions when an SLL conflict is found (including the default
135
+ * {@link ParserATNSimulator} implementation), this method reports cases
136
+ * where SLL conflicts were resolved to unique full-context predictions,
137
+ * i.e. the decision was context-sensitive. This report does not necessarily
138
+ * indicate a problem, and it may appear even in completely unambiguous
139
+ * grammars.</p>
140
+ *
141
+ * <p>{@code configs} may have more than one represented alternative if the
142
+ * full-context prediction algorithm does not evaluate predicates before
143
+ * beginning the full-context prediction. In all cases, the final prediction
144
+ * is passed as the {@code prediction} argument.</p>
145
+ *
146
+ * <p>Note that the definition of "context sensitivity" in this method
147
+ * differs from the concept in {@link DecisionInfo#contextSensitivities}.
148
+ * This method reports all instances where an SLL conflict occurred but LL
149
+ * parsing produced a unique result, whether or not that unique result
150
+ * matches the minimum alternative in the SLL conflicting set.</p>
151
+ *
152
+ * <p>This method is not used by lexers.</p>
153
+ *
154
+ * @param recognizer the parser instance
155
+ * @param dfa the DFA for the current decision
156
+ * @param startIndex the input index where the decision started
157
+ * @param stopIndex the input index where the context sensitivity was
158
+ * finally determined
159
+ * @param prediction the unambiguous result of the full-context prediction
160
+ * @param configs the ATN configuration set where the unambiguous prediction
161
+ * was determined
162
+ */
163
+ virtual void reportContextSensitivity(Parser *recognizer, const dfa::DFA &dfa, size_t startIndex, size_t stopIndex,
164
+ size_t prediction, atn::ATNConfigSet *configs) = 0;
165
+ };
166
+
167
+ } // namespace antlr4
@@ -0,0 +1,10 @@
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 "ANTLRErrorStrategy.h"
7
+
8
+ antlr4::ANTLRErrorStrategy::~ANTLRErrorStrategy()
9
+ {
10
+ }
@@ -0,0 +1,121 @@
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 "Token.h"
9
+
10
+ namespace antlr4 {
11
+
12
+ /// <summary>
13
+ /// The interface for defining strategies to deal with syntax errors encountered
14
+ /// during a parse by ANTLR-generated parsers. We distinguish between three
15
+ /// different kinds of errors:
16
+ ///
17
+ /// <ul>
18
+ /// <li>The parser could not figure out which path to take in the ATN (none of
19
+ /// the available alternatives could possibly match)</li>
20
+ /// <li>The current input does not match what we were looking for</li>
21
+ /// <li>A predicate evaluated to false</li>
22
+ /// </ul>
23
+ ///
24
+ /// Implementations of this interface report syntax errors by calling
25
+ /// <seealso cref="Parser#notifyErrorListeners"/>.
26
+ /// <p/>
27
+ /// TODO: what to do about lexers
28
+ /// </summary>
29
+ class ANTLR4CPP_PUBLIC ANTLRErrorStrategy {
30
+ public:
31
+
32
+ /// <summary>
33
+ /// Reset the error handler state for the specified {@code recognizer}. </summary>
34
+ /// <param name="recognizer"> the parser instance </param>
35
+ virtual ~ANTLRErrorStrategy();
36
+
37
+ virtual void reset(Parser *recognizer) = 0;
38
+
39
+ /**
40
+ * This method is called when an unexpected symbol is encountered during an
41
+ * inline match operation, such as {@link Parser#match}. If the error
42
+ * strategy successfully recovers from the match failure, this method
43
+ * returns the {@link Token} instance which should be treated as the
44
+ * successful result of the match.
45
+ *
46
+ * <p>This method handles the consumption of any tokens - the caller should
47
+ * <b>not</b> call {@link Parser#consume} after a successful recovery.</p>
48
+ *
49
+ * <p>Note that the calling code will not report an error if this method
50
+ * returns successfully. The error strategy implementation is responsible
51
+ * for calling {@link Parser#notifyErrorListeners} as appropriate.</p>
52
+ *
53
+ * @param recognizer the parser instance
54
+ * @throws RecognitionException if the error strategy was not able to
55
+ * recover from the unexpected input symbol
56
+ */
57
+ virtual Token* recoverInline(Parser *recognizer) = 0;
58
+
59
+ /// <summary>
60
+ /// This method is called to recover from exception {@code e}. This method is
61
+ /// called after <seealso cref="#reportError"/> by the default exception handler
62
+ /// generated for a rule method.
63
+ /// </summary>
64
+ /// <seealso cref= #reportError
65
+ /// </seealso>
66
+ /// <param name="recognizer"> the parser instance </param>
67
+ /// <param name="e"> the recognition exception to recover from </param>
68
+ /// <exception cref="RecognitionException"> if the error strategy could not recover from
69
+ /// the recognition exception </exception>
70
+ virtual void recover(Parser *recognizer, std::exception_ptr e) = 0;
71
+
72
+ /// <summary>
73
+ /// This method provides the error handler with an opportunity to handle
74
+ /// syntactic or semantic errors in the input stream before they result in a
75
+ /// <seealso cref="RecognitionException"/>.
76
+ /// <p/>
77
+ /// The generated code currently contains calls to <seealso cref="#sync"/> after
78
+ /// entering the decision state of a closure block ({@code (...)*} or
79
+ /// {@code (...)+}).
80
+ /// <p/>
81
+ /// For an implementation based on Jim Idle's "magic sync" mechanism, see
82
+ /// <seealso cref="DefaultErrorStrategy#sync"/>.
83
+ /// </summary>
84
+ /// <seealso cref= DefaultErrorStrategy#sync
85
+ /// </seealso>
86
+ /// <param name="recognizer"> the parser instance </param>
87
+ /// <exception cref="RecognitionException"> if an error is detected by the error
88
+ /// strategy but cannot be automatically recovered at the current state in
89
+ /// the parsing process </exception>
90
+ virtual void sync(Parser *recognizer) = 0;
91
+
92
+ /// <summary>
93
+ /// Tests whether or not {@code recognizer} is in the process of recovering
94
+ /// from an error. In error recovery mode, <seealso cref="Parser#consume"/> adds
95
+ /// symbols to the parse tree by calling
96
+ /// {@link Parser#createErrorNode(ParserRuleContext, Token)} then
97
+ /// {@link ParserRuleContext#addErrorNode(ErrorNode)} instead of
98
+ /// {@link Parser#createTerminalNode(ParserRuleContext, Token)}.
99
+ /// </summary>
100
+ /// <param name="recognizer"> the parser instance </param>
101
+ /// <returns> {@code true} if the parser is currently recovering from a parse
102
+ /// error, otherwise {@code false} </returns>
103
+ virtual bool inErrorRecoveryMode(Parser *recognizer) = 0;
104
+
105
+ /// <summary>
106
+ /// This method is called by when the parser successfully matches an input
107
+ /// symbol.
108
+ /// </summary>
109
+ /// <param name="recognizer"> the parser instance </param>
110
+ virtual void reportMatch(Parser *recognizer) = 0;
111
+
112
+ /// <summary>
113
+ /// Report any kind of <seealso cref="RecognitionException"/>. This method is called by
114
+ /// the default exception handler generated for a rule method.
115
+ /// </summary>
116
+ /// <param name="recognizer"> the parser instance </param>
117
+ /// <param name="e"> the recognition exception to report </param>
118
+ virtual void reportError(Parser *recognizer, const RecognitionException &e) = 0;
119
+ };
120
+
121
+ } // namespace antlr4
@@ -0,0 +1,23 @@
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 "ANTLRFileStream.h"
7
+
8
+ using namespace antlr4;
9
+
10
+ void ANTLRFileStream::loadFromFile(const std::string &fileName) {
11
+ _fileName = fileName;
12
+ if (_fileName.empty()) {
13
+ return;
14
+ }
15
+
16
+ std::ifstream stream(fileName, std::ios::binary);
17
+
18
+ ANTLRInputStream::load(stream);
19
+ }
20
+
21
+ std::string ANTLRFileStream::getSourceName() const {
22
+ return _fileName;
23
+ }
@@ -0,0 +1,30 @@
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 "ANTLRInputStream.h"
9
+
10
+ namespace antlr4 {
11
+
12
+ /// This is an ANTLRInputStream that is loaded from a file all at once
13
+ /// when you construct the object (or call load()).
14
+ // TODO: this class needs testing.
15
+ class ANTLR4CPP_PUBLIC ANTLRFileStream : public ANTLRInputStream {
16
+ public:
17
+ ANTLRFileStream() = default;
18
+ ANTLRFileStream(const std::string &) = delete;
19
+ ANTLRFileStream(const char *data, size_t length) = delete;
20
+ ANTLRFileStream(std::istream &stream) = delete;
21
+
22
+ // Assumes a file name encoded in UTF-8 and file content in the same encoding (with or w/o BOM).
23
+ virtual void loadFromFile(const std::string &fileName);
24
+ virtual std::string getSourceName() const override;
25
+
26
+ private:
27
+ std::string _fileName; // UTF-8 encoded file name.
28
+ };
29
+
30
+ } // namespace antlr4
@@ -0,0 +1,180 @@
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 <string.h>
7
+
8
+ #include "Exceptions.h"
9
+ #include "misc/Interval.h"
10
+ #include "IntStream.h"
11
+
12
+ #include "support/Utf8.h"
13
+ #include "support/CPPUtils.h"
14
+
15
+ #include "ANTLRInputStream.h"
16
+
17
+ using namespace antlr4;
18
+ using namespace antlrcpp;
19
+
20
+ using misc::Interval;
21
+
22
+ ANTLRInputStream::ANTLRInputStream() {
23
+ InitializeInstanceFields();
24
+ }
25
+
26
+ ANTLRInputStream::ANTLRInputStream(std::string_view input): ANTLRInputStream() {
27
+ load(input.data(), input.length());
28
+ }
29
+
30
+ ANTLRInputStream::ANTLRInputStream(const char *data, size_t length) {
31
+ load(data, length);
32
+ }
33
+
34
+ ANTLRInputStream::ANTLRInputStream(std::istream &stream): ANTLRInputStream() {
35
+ load(stream);
36
+ }
37
+
38
+ void ANTLRInputStream::load(const std::string &input, bool lenient) {
39
+ load(input.data(), input.size(), lenient);
40
+ }
41
+
42
+ void ANTLRInputStream::load(const char *data, size_t length, bool lenient) {
43
+ // Remove the UTF-8 BOM if present.
44
+ const char *bom = "\xef\xbb\xbf";
45
+ if (length >= 3 && strncmp(data, bom, 3) == 0) {
46
+ data += 3;
47
+ length -= 3;
48
+ }
49
+ if (lenient) {
50
+ _data = Utf8::lenientDecode(std::string_view(data, length));
51
+ } else {
52
+ auto maybe_utf32 = Utf8::strictDecode(std::string_view(data, length));
53
+ if (!maybe_utf32.has_value()) {
54
+ throw IllegalArgumentException("UTF-8 string contains an illegal byte sequence");
55
+ }
56
+ _data = std::move(maybe_utf32).value();
57
+ }
58
+ p = 0;
59
+ }
60
+
61
+ void ANTLRInputStream::load(std::istream &stream, bool lenient) {
62
+ if (!stream.good() || stream.eof()) // No fail, bad or EOF.
63
+ return;
64
+
65
+ _data.clear();
66
+
67
+ std::string s((std::istreambuf_iterator<char>(stream)), std::istreambuf_iterator<char>());
68
+ load(s.data(), s.length(), lenient);
69
+ }
70
+
71
+ void ANTLRInputStream::reset() {
72
+ p = 0;
73
+ }
74
+
75
+ void ANTLRInputStream::consume() {
76
+ if (p >= _data.size()) {
77
+ assert(LA(1) == IntStream::EOF);
78
+ throw IllegalStateException("cannot consume EOF");
79
+ }
80
+
81
+ if (p < _data.size()) {
82
+ p++;
83
+ }
84
+ }
85
+
86
+ size_t ANTLRInputStream::LA(ssize_t i) {
87
+ if (i == 0) {
88
+ return 0; // undefined
89
+ }
90
+
91
+ ssize_t position = static_cast<ssize_t>(p);
92
+ if (i < 0) {
93
+ i++; // e.g., translate LA(-1) to use offset i=0; then _data[p+0-1]
94
+ if ((position + i - 1) < 0) {
95
+ return IntStream::EOF; // invalid; no char before first char
96
+ }
97
+ }
98
+
99
+ if ((position + i - 1) >= static_cast<ssize_t>(_data.size())) {
100
+ return IntStream::EOF;
101
+ }
102
+
103
+ return _data[static_cast<size_t>((position + i - 1))];
104
+ }
105
+
106
+ size_t ANTLRInputStream::LT(ssize_t i) {
107
+ return LA(i);
108
+ }
109
+
110
+ size_t ANTLRInputStream::index() {
111
+ return p;
112
+ }
113
+
114
+ size_t ANTLRInputStream::size() {
115
+ return _data.size();
116
+ }
117
+
118
+ // Mark/release do nothing. We have entire buffer.
119
+ ssize_t ANTLRInputStream::mark() {
120
+ return -1;
121
+ }
122
+
123
+ void ANTLRInputStream::release(ssize_t /* marker */) {
124
+ }
125
+
126
+ void ANTLRInputStream::seek(size_t index) {
127
+ if (index <= p) {
128
+ p = index; // just jump; don't update stream state (line, ...)
129
+ return;
130
+ }
131
+ // seek forward, consume until p hits index or n (whichever comes first)
132
+ index = std::min(index, _data.size());
133
+ while (p < index) {
134
+ consume();
135
+ }
136
+ }
137
+
138
+ std::string ANTLRInputStream::getText(const Interval &interval) {
139
+ if (interval.a < 0 || interval.b < 0) {
140
+ return "";
141
+ }
142
+
143
+ size_t start = static_cast<size_t>(interval.a);
144
+ size_t stop = static_cast<size_t>(interval.b);
145
+
146
+
147
+ if (stop >= _data.size()) {
148
+ stop = _data.size() - 1;
149
+ }
150
+
151
+ size_t count = stop - start + 1;
152
+ if (start >= _data.size()) {
153
+ return "";
154
+ }
155
+
156
+ auto maybeUtf8 = Utf8::strictEncode(std::u32string_view(_data).substr(start, count));
157
+ if (!maybeUtf8.has_value()) {
158
+ throw IllegalArgumentException("Input stream contains invalid Unicode code points");
159
+ }
160
+ return std::move(maybeUtf8).value();
161
+ }
162
+
163
+ std::string ANTLRInputStream::getSourceName() const {
164
+ if (name.empty()) {
165
+ return IntStream::UNKNOWN_SOURCE_NAME;
166
+ }
167
+ return name;
168
+ }
169
+
170
+ std::string ANTLRInputStream::toString() const {
171
+ auto maybeUtf8 = Utf8::strictEncode(_data);
172
+ if (!maybeUtf8.has_value()) {
173
+ throw IllegalArgumentException("Input stream contains invalid Unicode code points");
174
+ }
175
+ return std::move(maybeUtf8).value();
176
+ }
177
+
178
+ void ANTLRInputStream::InitializeInstanceFields() {
179
+ p = 0;
180
+ }