expressir 0.2.4 → 0.2.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (361) hide show
  1. checksums.yaml +4 -4
  2. data/.cross_rubies +30 -0
  3. data/.github/workflows/rake.yml +14 -15
  4. data/.github/workflows/release.yml +26 -17
  5. data/.gitignore +3 -1
  6. data/Gemfile +0 -2
  7. data/Rakefile +2 -17
  8. data/expressir.gemspec +10 -5
  9. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/CMakeLists.txt +118 -0
  10. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlr4cpp-vs2013.vcxproj +637 -0
  11. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlr4cpp-vs2013.vcxproj.filters +984 -0
  12. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlr4cpp-vs2015.vcxproj +652 -0
  13. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlr4cpp-vs2015.vcxproj.filters +990 -0
  14. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlr4cpp-vs2017.vcxproj +652 -0
  15. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlr4cpp-vs2017.vcxproj.filters +990 -0
  16. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlr4cpp-vs2019.vcxproj +652 -0
  17. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlr4cpp-vs2019.vcxproj.filters +990 -0
  18. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlrcpp-ios/Info.plist +26 -0
  19. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlrcpp-ios/antlrcpp_ios.h +17 -0
  20. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlrcpp.xcodeproj/project.pbxproj +3024 -0
  21. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlrcpp.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
  22. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlrcpp.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
  23. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlrcpp.xcodeproj/xcshareddata/xcschemes/antlr4.xcscheme +76 -0
  24. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlrcpp.xcodeproj/xcshareddata/xcschemes/antlr4_ios.xcscheme +80 -0
  25. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlrcpp.xcodeproj/xcshareddata/xcschemes/antlr4_static.xcscheme +80 -0
  26. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ANTLRErrorListener.cpp +10 -0
  27. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ANTLRErrorListener.h +167 -0
  28. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ANTLRErrorStrategy.cpp +10 -0
  29. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ANTLRErrorStrategy.h +121 -0
  30. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ANTLRFileStream.cpp +34 -0
  31. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ANTLRFileStream.h +27 -0
  32. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ANTLRInputStream.cpp +155 -0
  33. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ANTLRInputStream.h +69 -0
  34. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/BailErrorStrategy.cpp +61 -0
  35. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/BailErrorStrategy.h +59 -0
  36. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/BaseErrorListener.cpp +25 -0
  37. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/BaseErrorListener.h +36 -0
  38. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/BufferedTokenStream.cpp +414 -0
  39. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/BufferedTokenStream.h +200 -0
  40. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/CharStream.cpp +11 -0
  41. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/CharStream.h +37 -0
  42. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/CommonToken.cpp +195 -0
  43. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/CommonToken.h +158 -0
  44. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/CommonTokenFactory.cpp +39 -0
  45. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/CommonTokenFactory.h +74 -0
  46. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/CommonTokenStream.cpp +78 -0
  47. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/CommonTokenStream.h +79 -0
  48. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ConsoleErrorListener.cpp +15 -0
  49. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ConsoleErrorListener.h +35 -0
  50. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/DefaultErrorStrategy.cpp +333 -0
  51. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/DefaultErrorStrategy.h +466 -0
  52. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/DiagnosticErrorListener.cpp +84 -0
  53. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/DiagnosticErrorListener.h +80 -0
  54. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/Exceptions.cpp +64 -0
  55. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/Exceptions.h +99 -0
  56. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/FailedPredicateException.cpp +51 -0
  57. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/FailedPredicateException.h +32 -0
  58. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/InputMismatchException.cpp +18 -0
  59. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/InputMismatchException.h +24 -0
  60. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/IntStream.cpp +12 -0
  61. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/IntStream.h +218 -0
  62. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/InterpreterRuleContext.cpp +19 -0
  63. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/InterpreterRuleContext.h +45 -0
  64. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/Lexer.cpp +295 -0
  65. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/Lexer.h +196 -0
  66. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/LexerInterpreter.cpp +75 -0
  67. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/LexerInterpreter.h +52 -0
  68. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/LexerNoViableAltException.cpp +36 -0
  69. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/LexerNoViableAltException.h +31 -0
  70. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ListTokenSource.cpp +92 -0
  71. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ListTokenSource.h +88 -0
  72. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/NoViableAltException.cpp +46 -0
  73. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/NoViableAltException.h +42 -0
  74. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/Parser.cpp +648 -0
  75. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/Parser.h +467 -0
  76. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ParserInterpreter.cpp +306 -0
  77. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ParserInterpreter.h +179 -0
  78. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ParserRuleContext.cpp +141 -0
  79. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ParserRuleContext.h +147 -0
  80. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ProxyErrorListener.cpp +53 -0
  81. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ProxyErrorListener.h +38 -0
  82. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/RecognitionException.cpp +66 -0
  83. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/RecognitionException.h +98 -0
  84. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/Recognizer.cpp +167 -0
  85. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/Recognizer.h +164 -0
  86. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/RuleContext.cpp +143 -0
  87. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/RuleContext.h +137 -0
  88. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/RuleContextWithAltNum.cpp +27 -0
  89. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/RuleContextWithAltNum.h +32 -0
  90. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/RuntimeMetaData.cpp +53 -0
  91. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/RuntimeMetaData.h +155 -0
  92. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/Token.cpp +9 -0
  93. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/Token.h +92 -0
  94. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/TokenFactory.h +30 -0
  95. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/TokenSource.cpp +9 -0
  96. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/TokenSource.h +85 -0
  97. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/TokenStream.cpp +11 -0
  98. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/TokenStream.h +137 -0
  99. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/TokenStreamRewriter.cpp +425 -0
  100. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/TokenStreamRewriter.h +293 -0
  101. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/UnbufferedCharStream.cpp +211 -0
  102. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/UnbufferedCharStream.h +123 -0
  103. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/UnbufferedTokenStream.cpp +270 -0
  104. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/UnbufferedTokenStream.h +115 -0
  105. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/Vocabulary.cpp +104 -0
  106. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/Vocabulary.h +193 -0
  107. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/WritableToken.cpp +9 -0
  108. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/WritableToken.h +23 -0
  109. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/antlr4-common.h +137 -0
  110. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/antlr4-runtime.h +167 -0
  111. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATN.cpp +209 -0
  112. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATN.h +112 -0
  113. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNConfig.cpp +113 -0
  114. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNConfig.h +148 -0
  115. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNConfigSet.cpp +228 -0
  116. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNConfigSet.h +110 -0
  117. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNDeserializationOptions.cpp +64 -0
  118. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNDeserializationOptions.h +50 -0
  119. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNDeserializer.cpp +758 -0
  120. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNDeserializer.h +85 -0
  121. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNSerializer.cpp +621 -0
  122. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNSerializer.h +61 -0
  123. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNSimulator.cpp +63 -0
  124. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNSimulator.h +87 -0
  125. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNState.cpp +72 -0
  126. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNState.h +133 -0
  127. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNType.h +20 -0
  128. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/AbstractPredicateTransition.cpp +14 -0
  129. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/AbstractPredicateTransition.h +24 -0
  130. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ActionTransition.cpp +33 -0
  131. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ActionTransition.h +33 -0
  132. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/AmbiguityInfo.cpp +16 -0
  133. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/AmbiguityInfo.h +68 -0
  134. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ArrayPredictionContext.cpp +82 -0
  135. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ArrayPredictionContext.h +43 -0
  136. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/AtomTransition.cpp +31 -0
  137. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/AtomTransition.h +30 -0
  138. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/BasicBlockStartState.cpp +12 -0
  139. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/BasicBlockStartState.h +22 -0
  140. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/BasicState.cpp +12 -0
  141. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/BasicState.h +21 -0
  142. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/BlockEndState.cpp +15 -0
  143. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/BlockEndState.h +24 -0
  144. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/BlockStartState.cpp +9 -0
  145. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/BlockStartState.h +21 -0
  146. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ContextSensitivityInfo.cpp +14 -0
  147. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ContextSensitivityInfo.h +47 -0
  148. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/DecisionEventInfo.cpp +14 -0
  149. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/DecisionEventInfo.h +70 -0
  150. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/DecisionInfo.cpp +25 -0
  151. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/DecisionInfo.h +227 -0
  152. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/DecisionState.cpp +17 -0
  153. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/DecisionState.h +30 -0
  154. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/EmptyPredictionContext.cpp +35 -0
  155. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/EmptyPredictionContext.h +27 -0
  156. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/EpsilonTransition.cpp +35 -0
  157. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/EpsilonTransition.h +39 -0
  158. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ErrorInfo.cpp +15 -0
  159. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ErrorInfo.h +43 -0
  160. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LL1Analyzer.cpp +158 -0
  161. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LL1Analyzer.h +109 -0
  162. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerATNConfig.cpp +84 -0
  163. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerATNConfig.h +44 -0
  164. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerATNSimulator.cpp +628 -0
  165. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerATNSimulator.h +210 -0
  166. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerAction.cpp +9 -0
  167. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerAction.h +66 -0
  168. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerActionExecutor.cpp +107 -0
  169. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerActionExecutor.h +115 -0
  170. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerActionType.h +55 -0
  171. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerChannelAction.cpp +55 -0
  172. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerChannelAction.h +63 -0
  173. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerCustomAction.cpp +62 -0
  174. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerCustomAction.h +87 -0
  175. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerIndexedCustomAction.cpp +63 -0
  176. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerIndexedCustomAction.h +82 -0
  177. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerModeAction.cpp +56 -0
  178. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerModeAction.h +61 -0
  179. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerMoreAction.cpp +47 -0
  180. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerMoreAction.h +57 -0
  181. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerPopModeAction.cpp +47 -0
  182. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerPopModeAction.h +57 -0
  183. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerPushModeAction.cpp +56 -0
  184. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerPushModeAction.h +61 -0
  185. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerSkipAction.cpp +47 -0
  186. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerSkipAction.h +55 -0
  187. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerTypeAction.cpp +56 -0
  188. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerTypeAction.h +55 -0
  189. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LookaheadEventInfo.cpp +16 -0
  190. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LookaheadEventInfo.h +42 -0
  191. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LoopEndState.cpp +12 -0
  192. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LoopEndState.h +22 -0
  193. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/Makefile +67 -0
  194. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/NotSetTransition.cpp +27 -0
  195. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/NotSetTransition.h +25 -0
  196. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/OrderedATNConfigSet.cpp +12 -0
  197. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/OrderedATNConfigSet.h +20 -0
  198. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ParseInfo.cpp +102 -0
  199. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ParseInfo.h +102 -0
  200. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ParserATNSimulator.cpp +1366 -0
  201. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ParserATNSimulator.h +904 -0
  202. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PlusBlockStartState.cpp +12 -0
  203. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PlusBlockStartState.h +25 -0
  204. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PlusLoopbackState.cpp +12 -0
  205. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PlusLoopbackState.h +22 -0
  206. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PrecedencePredicateTransition.cpp +32 -0
  207. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PrecedencePredicateTransition.h +29 -0
  208. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredicateEvalInfo.cpp +17 -0
  209. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredicateEvalInfo.h +62 -0
  210. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredicateTransition.cpp +34 -0
  211. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredicateTransition.h +39 -0
  212. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredictionContext.cpp +662 -0
  213. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredictionContext.h +254 -0
  214. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredictionMode.cpp +201 -0
  215. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredictionMode.h +436 -0
  216. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ProfilingATNSimulator.cpp +179 -0
  217. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ProfilingATNSimulator.h +60 -0
  218. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/RangeTransition.cpp +30 -0
  219. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/RangeTransition.h +29 -0
  220. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/RuleStartState.cpp +16 -0
  221. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/RuleStartState.h +25 -0
  222. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/RuleStopState.cpp +12 -0
  223. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/RuleStopState.h +25 -0
  224. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/RuleTransition.cpp +37 -0
  225. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/RuleTransition.h +40 -0
  226. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/SemanticContext.cpp +377 -0
  227. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/SemanticContext.h +222 -0
  228. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/SetTransition.cpp +32 -0
  229. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/SetTransition.h +30 -0
  230. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/SingletonPredictionContext.cpp +81 -0
  231. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/SingletonPredictionContext.h +36 -0
  232. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/StarBlockStartState.cpp +12 -0
  233. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/StarBlockStartState.h +21 -0
  234. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/StarLoopEntryState.cpp +15 -0
  235. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/StarLoopEntryState.h +35 -0
  236. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/StarLoopbackState.cpp +19 -0
  237. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/StarLoopbackState.h +21 -0
  238. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/TokensStartState.cpp +12 -0
  239. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/TokensStartState.h +21 -0
  240. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/Transition.cpp +44 -0
  241. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/Transition.h +76 -0
  242. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/WildcardTransition.cpp +25 -0
  243. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/WildcardTransition.h +25 -0
  244. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/dfa/DFA.cpp +127 -0
  245. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/dfa/DFA.h +91 -0
  246. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/dfa/DFASerializer.cpp +67 -0
  247. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/dfa/DFASerializer.h +32 -0
  248. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/dfa/DFAState.cpp +100 -0
  249. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/dfa/DFAState.h +144 -0
  250. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/dfa/LexerDFASerializer.cpp +20 -0
  251. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/dfa/LexerDFASerializer.h +23 -0
  252. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/misc/InterpreterDataReader.cpp +124 -0
  253. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/misc/InterpreterDataReader.h +31 -0
  254. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/misc/Interval.cpp +89 -0
  255. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/misc/Interval.h +84 -0
  256. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/misc/IntervalSet.cpp +521 -0
  257. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/misc/IntervalSet.h +198 -0
  258. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/misc/MurmurHash.cpp +134 -0
  259. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/misc/MurmurHash.h +76 -0
  260. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/misc/Predicate.cpp +4 -0
  261. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/misc/Predicate.h +21 -0
  262. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/Any.cpp +13 -0
  263. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/Any.h +170 -0
  264. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/Arrays.cpp +43 -0
  265. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/Arrays.h +110 -0
  266. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/BitSet.h +76 -0
  267. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/CPPUtils.cpp +248 -0
  268. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/CPPUtils.h +78 -0
  269. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/Declarations.h +163 -0
  270. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/StringUtils.cpp +36 -0
  271. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/StringUtils.h +54 -0
  272. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/guid.cpp +303 -0
  273. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/guid.h +112 -0
  274. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/AbstractParseTreeVisitor.h +128 -0
  275. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ErrorNode.cpp +9 -0
  276. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ErrorNode.h +19 -0
  277. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ErrorNodeImpl.cpp +23 -0
  278. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ErrorNodeImpl.h +33 -0
  279. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/IterativeParseTreeWalker.cpp +71 -0
  280. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/IterativeParseTreeWalker.h +53 -0
  281. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ParseTree.cpp +15 -0
  282. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ParseTree.h +102 -0
  283. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ParseTreeListener.cpp +9 -0
  284. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ParseTreeListener.h +39 -0
  285. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ParseTreeProperty.h +50 -0
  286. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ParseTreeVisitor.cpp +9 -0
  287. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ParseTreeVisitor.h +57 -0
  288. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ParseTreeWalker.cpp +49 -0
  289. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ParseTreeWalker.h +31 -0
  290. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/TerminalNode.cpp +9 -0
  291. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/TerminalNode.h +32 -0
  292. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/TerminalNodeImpl.cpp +57 -0
  293. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/TerminalNodeImpl.h +33 -0
  294. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/Trees.cpp +241 -0
  295. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/Trees.h +78 -0
  296. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/pattern/Chunk.cpp +9 -0
  297. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/pattern/Chunk.h +44 -0
  298. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/pattern/ParseTreeMatch.cpp +69 -0
  299. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/pattern/ParseTreeMatch.h +132 -0
  300. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/pattern/ParseTreePattern.cpp +64 -0
  301. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/pattern/ParseTreePattern.h +105 -0
  302. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/pattern/ParseTreePatternMatcher.cpp +371 -0
  303. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/pattern/ParseTreePatternMatcher.h +185 -0
  304. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/pattern/RuleTagToken.cpp +77 -0
  305. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/pattern/RuleTagToken.h +117 -0
  306. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/pattern/TagChunk.cpp +39 -0
  307. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/pattern/TagChunk.h +86 -0
  308. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/pattern/TextChunk.cpp +28 -0
  309. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/pattern/TextChunk.h +51 -0
  310. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/pattern/TokenTagToken.cpp +36 -0
  311. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/pattern/TokenTagToken.h +80 -0
  312. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPath.cpp +154 -0
  313. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPath.h +86 -0
  314. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathElement.cpp +31 -0
  315. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathElement.h +40 -0
  316. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathLexer.cpp +173 -0
  317. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathLexer.g4 +64 -0
  318. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathLexer.h +56 -0
  319. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathLexer.tokens +12 -0
  320. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathLexerErrorListener.cpp +13 -0
  321. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathLexerErrorListener.h +22 -0
  322. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathRuleAnywhereElement.cpp +20 -0
  323. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathRuleAnywhereElement.h +27 -0
  324. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathRuleElement.cpp +30 -0
  325. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathRuleElement.h +26 -0
  326. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathTokenAnywhereElement.cpp +20 -0
  327. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathTokenAnywhereElement.h +25 -0
  328. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathTokenElement.cpp +33 -0
  329. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathTokenElement.h +26 -0
  330. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathWildcardAnywhereElement.cpp +23 -0
  331. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathWildcardAnywhereElement.h +23 -0
  332. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathWildcardElement.cpp +24 -0
  333. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathWildcardElement.h +23 -0
  334. data/ext/express-parser/express_parser.cpp +12 -10
  335. data/ext/express-parser/extconf.rb +48 -25
  336. data/lib/expressir/express_exp/formatter.rb +3 -7
  337. data/lib/expressir/express_exp/parser.rb +20 -2
  338. data/lib/expressir/express_exp/visitor.rb +106 -55
  339. data/lib/expressir/model.rb +1 -0
  340. data/lib/expressir/model/entity.rb +3 -0
  341. data/lib/expressir/model/expressions/query_expression.rb +2 -2
  342. data/lib/expressir/model/identifier.rb +2 -0
  343. data/lib/expressir/model/informal_proposition.rb +11 -0
  344. data/lib/expressir/model/rule.rb +3 -0
  345. data/lib/expressir/model/schema.rb +2 -0
  346. data/lib/expressir/model/scope.rb +52 -3
  347. data/lib/expressir/model/type.rb +8 -0
  348. data/lib/expressir/version.rb +1 -1
  349. data/original/examples/syntax/remark.exp +64 -20
  350. data/original/examples/syntax/remark_formatted.exp +63 -19
  351. data/original/examples/syntax/source.exp +16 -0
  352. data/original/examples/syntax/syntax.exp +6 -1
  353. data/original/examples/syntax/syntax_formatted.exp +13 -0
  354. data/rakelib/cross-ruby.rake +308 -0
  355. data/spec/expressir/express_exp/head_source_spec.rb +41 -0
  356. data/spec/expressir/express_exp/parse_multiple_spec.rb +32 -0
  357. data/spec/expressir/express_exp/parse_remark_spec.rb +119 -53
  358. data/spec/expressir/express_exp/parse_syntax_spec.rb +47 -2
  359. data/spec/expressir/express_exp/source_spec.rb +32 -0
  360. data/spec/expressir/model/find_spec.rb +19 -6
  361. metadata +369 -23
@@ -0,0 +1,466 @@
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 "ANTLRErrorStrategy.h"
9
+ #include "misc/IntervalSet.h"
10
+
11
+ namespace antlr4 {
12
+
13
+ /**
14
+ * This is the default implementation of {@link ANTLRErrorStrategy} used for
15
+ * error reporting and recovery in ANTLR parsers.
16
+ */
17
+ class ANTLR4CPP_PUBLIC DefaultErrorStrategy : public ANTLRErrorStrategy {
18
+ public:
19
+ DefaultErrorStrategy();
20
+ DefaultErrorStrategy(DefaultErrorStrategy const& other) = delete;
21
+ virtual ~DefaultErrorStrategy();
22
+
23
+ DefaultErrorStrategy& operator = (DefaultErrorStrategy const& other) = delete;
24
+
25
+ protected:
26
+ /**
27
+ * Indicates whether the error strategy is currently "recovering from an
28
+ * error". This is used to suppress reporting multiple error messages while
29
+ * attempting to recover from a detected syntax error.
30
+ *
31
+ * @see #inErrorRecoveryMode
32
+ */
33
+ bool errorRecoveryMode;
34
+
35
+ /** The index into the input stream where the last error occurred.
36
+ * This is used to prevent infinite loops where an error is found
37
+ * but no token is consumed during recovery...another error is found,
38
+ * ad nauseum. This is a failsafe mechanism to guarantee that at least
39
+ * one token/tree node is consumed for two errors.
40
+ */
41
+ int lastErrorIndex;
42
+
43
+ misc::IntervalSet lastErrorStates;
44
+
45
+ /// <summary>
46
+ /// {@inheritDoc}
47
+ /// <p/>
48
+ /// The default implementation simply calls <seealso cref="#endErrorCondition"/> to
49
+ /// ensure that the handler is not in error recovery mode.
50
+ /// </summary>
51
+ public:
52
+ virtual void reset(Parser *recognizer) override;
53
+
54
+ /// <summary>
55
+ /// This method is called to enter error recovery mode when a recognition
56
+ /// exception is reported.
57
+ /// </summary>
58
+ /// <param name="recognizer"> the parser instance </param>
59
+ protected:
60
+ virtual void beginErrorCondition(Parser *recognizer);
61
+
62
+ /// <summary>
63
+ /// {@inheritDoc}
64
+ /// </summary>
65
+ public:
66
+ virtual bool inErrorRecoveryMode(Parser *recognizer) override;
67
+
68
+ /// <summary>
69
+ /// This method is called to leave error recovery mode after recovering from
70
+ /// a recognition exception.
71
+ /// </summary>
72
+ /// <param name="recognizer"> </param>
73
+ protected:
74
+ virtual void endErrorCondition(Parser *recognizer);
75
+
76
+ /// <summary>
77
+ /// {@inheritDoc}
78
+ /// <p/>
79
+ /// The default implementation simply calls <seealso cref="#endErrorCondition"/>.
80
+ /// </summary>
81
+ public:
82
+ virtual void reportMatch(Parser *recognizer) override;
83
+
84
+ /// {@inheritDoc}
85
+ /// <p/>
86
+ /// The default implementation returns immediately if the handler is already
87
+ /// in error recovery mode. Otherwise, it calls <seealso cref="#beginErrorCondition"/>
88
+ /// and dispatches the reporting task based on the runtime type of {@code e}
89
+ /// according to the following table.
90
+ ///
91
+ /// <ul>
92
+ /// <li><seealso cref="NoViableAltException"/>: Dispatches the call to
93
+ /// <seealso cref="#reportNoViableAlternative"/></li>
94
+ /// <li><seealso cref="InputMismatchException"/>: Dispatches the call to
95
+ /// <seealso cref="#reportInputMismatch"/></li>
96
+ /// <li><seealso cref="FailedPredicateException"/>: Dispatches the call to
97
+ /// <seealso cref="#reportFailedPredicate"/></li>
98
+ /// <li>All other types: calls <seealso cref="Parser#notifyErrorListeners"/> to report
99
+ /// the exception</li>
100
+ /// </ul>
101
+ virtual void reportError(Parser *recognizer, const RecognitionException &e) override;
102
+
103
+ /// <summary>
104
+ /// {@inheritDoc}
105
+ /// <p/>
106
+ /// The default implementation resynchronizes the parser by consuming tokens
107
+ /// until we find one in the resynchronization set--loosely the set of tokens
108
+ /// that can follow the current rule.
109
+ /// </summary>
110
+ virtual void recover(Parser *recognizer, std::exception_ptr e) override;
111
+
112
+ /**
113
+ * The default implementation of {@link ANTLRErrorStrategy#sync} makes sure
114
+ * that the current lookahead symbol is consistent with what were expecting
115
+ * at this point in the ATN. You can call this anytime but ANTLR only
116
+ * generates code to check before subrules/loops and each iteration.
117
+ *
118
+ * <p>Implements Jim Idle's magic sync mechanism in closures and optional
119
+ * subrules. E.g.,</p>
120
+ *
121
+ * <pre>
122
+ * a : sync ( stuff sync )* ;
123
+ * sync : {consume to what can follow sync} ;
124
+ * </pre>
125
+ *
126
+ * At the start of a sub rule upon error, {@link #sync} performs single
127
+ * token deletion, if possible. If it can't do that, it bails on the current
128
+ * rule and uses the default error recovery, which consumes until the
129
+ * resynchronization set of the current rule.
130
+ *
131
+ * <p>If the sub rule is optional ({@code (...)?}, {@code (...)*}, or block
132
+ * with an empty alternative), then the expected set includes what follows
133
+ * the subrule.</p>
134
+ *
135
+ * <p>During loop iteration, it consumes until it sees a token that can start a
136
+ * sub rule or what follows loop. Yes, that is pretty aggressive. We opt to
137
+ * stay in the loop as long as possible.</p>
138
+ *
139
+ * <p><strong>ORIGINS</strong></p>
140
+ *
141
+ * <p>Previous versions of ANTLR did a poor job of their recovery within loops.
142
+ * A single mismatch token or missing token would force the parser to bail
143
+ * out of the entire rules surrounding the loop. So, for rule</p>
144
+ *
145
+ * <pre>
146
+ * classDef : 'class' ID '{' member* '}'
147
+ * </pre>
148
+ *
149
+ * input with an extra token between members would force the parser to
150
+ * consume until it found the next class definition rather than the next
151
+ * member definition of the current class.
152
+ *
153
+ * <p>This functionality cost a little bit of effort because the parser has to
154
+ * compare token set at the start of the loop and at each iteration. If for
155
+ * some reason speed is suffering for you, you can turn off this
156
+ * functionality by simply overriding this method as a blank { }.</p>
157
+ */
158
+ virtual void sync(Parser *recognizer) override;
159
+
160
+ /// <summary>
161
+ /// This is called by <seealso cref="#reportError"/> when the exception is a
162
+ /// <seealso cref="NoViableAltException"/>.
163
+ /// </summary>
164
+ /// <seealso cref= #reportError
165
+ /// </seealso>
166
+ /// <param name="recognizer"> the parser instance </param>
167
+ /// <param name="e"> the recognition exception </param>
168
+ protected:
169
+ virtual void reportNoViableAlternative(Parser *recognizer, const NoViableAltException &e);
170
+
171
+ /// <summary>
172
+ /// This is called by <seealso cref="#reportError"/> when the exception is an
173
+ /// <seealso cref="InputMismatchException"/>.
174
+ /// </summary>
175
+ /// <seealso cref= #reportError
176
+ /// </seealso>
177
+ /// <param name="recognizer"> the parser instance </param>
178
+ /// <param name="e"> the recognition exception </param>
179
+ virtual void reportInputMismatch(Parser *recognizer, const InputMismatchException &e);
180
+
181
+ /// <summary>
182
+ /// This is called by <seealso cref="#reportError"/> when the exception is a
183
+ /// <seealso cref="FailedPredicateException"/>.
184
+ /// </summary>
185
+ /// <seealso cref= #reportError
186
+ /// </seealso>
187
+ /// <param name="recognizer"> the parser instance </param>
188
+ /// <param name="e"> the recognition exception </param>
189
+ virtual void reportFailedPredicate(Parser *recognizer, const FailedPredicateException &e);
190
+
191
+ /**
192
+ * This method is called to report a syntax error which requires the removal
193
+ * of a token from the input stream. At the time this method is called, the
194
+ * erroneous symbol is current {@code LT(1)} symbol and has not yet been
195
+ * removed from the input stream. When this method returns,
196
+ * {@code recognizer} is in error recovery mode.
197
+ *
198
+ * <p>This method is called when {@link #singleTokenDeletion} identifies
199
+ * single-token deletion as a viable recovery strategy for a mismatched
200
+ * input error.</p>
201
+ *
202
+ * <p>The default implementation simply returns if the handler is already in
203
+ * error recovery mode. Otherwise, it calls {@link #beginErrorCondition} to
204
+ * enter error recovery mode, followed by calling
205
+ * {@link Parser#notifyErrorListeners}.</p>
206
+ *
207
+ * @param recognizer the parser instance
208
+ */
209
+ virtual void reportUnwantedToken(Parser *recognizer);
210
+
211
+ /**
212
+ * This method is called to report a syntax error which requires the
213
+ * insertion of a missing token into the input stream. At the time this
214
+ * method is called, the missing token has not yet been inserted. When this
215
+ * method returns, {@code recognizer} is in error recovery mode.
216
+ *
217
+ * <p>This method is called when {@link #singleTokenInsertion} identifies
218
+ * single-token insertion as a viable recovery strategy for a mismatched
219
+ * input error.</p>
220
+ *
221
+ * <p>The default implementation simply returns if the handler is already in
222
+ * error recovery mode. Otherwise, it calls {@link #beginErrorCondition} to
223
+ * enter error recovery mode, followed by calling
224
+ * {@link Parser#notifyErrorListeners}.</p>
225
+ *
226
+ * @param recognizer the parser instance
227
+ */
228
+ virtual void reportMissingToken(Parser *recognizer);
229
+
230
+ public:
231
+ /**
232
+ * {@inheritDoc}
233
+ *
234
+ * <p>The default implementation attempts to recover from the mismatched input
235
+ * by using single token insertion and deletion as described below. If the
236
+ * recovery attempt fails, this method throws an
237
+ * {@link InputMismatchException}.</p>
238
+ *
239
+ * <p><strong>EXTRA TOKEN</strong> (single token deletion)</p>
240
+ *
241
+ * <p>{@code LA(1)} is not what we are looking for. If {@code LA(2)} has the
242
+ * right token, however, then assume {@code LA(1)} is some extra spurious
243
+ * token and delete it. Then consume and return the next token (which was
244
+ * the {@code LA(2)} token) as the successful result of the match operation.</p>
245
+ *
246
+ * <p>This recovery strategy is implemented by {@link #singleTokenDeletion}.</p>
247
+ *
248
+ * <p><strong>MISSING TOKEN</strong> (single token insertion)</p>
249
+ *
250
+ * <p>If current token (at {@code LA(1)}) is consistent with what could come
251
+ * after the expected {@code LA(1)} token, then assume the token is missing
252
+ * and use the parser's {@link TokenFactory} to create it on the fly. The
253
+ * "insertion" is performed by returning the created token as the successful
254
+ * result of the match operation.</p>
255
+ *
256
+ * <p>This recovery strategy is implemented by {@link #singleTokenInsertion}.</p>
257
+ *
258
+ * <p><strong>EXAMPLE</strong></p>
259
+ *
260
+ * <p>For example, Input {@code i=(3;} is clearly missing the {@code ')'}. When
261
+ * the parser returns from the nested call to {@code expr}, it will have
262
+ * call chain:</p>
263
+ *
264
+ * <pre>
265
+ * stat &rarr; expr &rarr; atom
266
+ * </pre>
267
+ *
268
+ * and it will be trying to match the {@code ')'} at this point in the
269
+ * derivation:
270
+ *
271
+ * <pre>
272
+ * =&gt; ID '=' '(' INT ')' ('+' atom)* ';'
273
+ * ^
274
+ * </pre>
275
+ *
276
+ * The attempt to match {@code ')'} will fail when it sees {@code ';'} and
277
+ * call {@link #recoverInline}. To recover, it sees that {@code LA(1)==';'}
278
+ * is in the set of tokens that can follow the {@code ')'} token reference
279
+ * in rule {@code atom}. It can assume that you forgot the {@code ')'}.
280
+ */
281
+ virtual Token* recoverInline(Parser *recognizer) override;
282
+
283
+ /// <summary>
284
+ /// This method implements the single-token insertion inline error recovery
285
+ /// strategy. It is called by <seealso cref="#recoverInline"/> if the single-token
286
+ /// deletion strategy fails to recover from the mismatched input. If this
287
+ /// method returns {@code true}, {@code recognizer} will be in error recovery
288
+ /// mode.
289
+ /// <p/>
290
+ /// This method determines whether or not single-token insertion is viable by
291
+ /// checking if the {@code LA(1)} input symbol could be successfully matched
292
+ /// if it were instead the {@code LA(2)} symbol. If this method returns
293
+ /// {@code true}, the caller is responsible for creating and inserting a
294
+ /// token with the correct type to produce this behavior.
295
+ /// </summary>
296
+ /// <param name="recognizer"> the parser instance </param>
297
+ /// <returns> {@code true} if single-token insertion is a viable recovery
298
+ /// strategy for the current mismatched input, otherwise {@code false} </returns>
299
+ protected:
300
+ virtual bool singleTokenInsertion(Parser *recognizer);
301
+
302
+ /// <summary>
303
+ /// This method implements the single-token deletion inline error recovery
304
+ /// strategy. It is called by <seealso cref="#recoverInline"/> to attempt to recover
305
+ /// from mismatched input. If this method returns null, the parser and error
306
+ /// handler state will not have changed. If this method returns non-null,
307
+ /// {@code recognizer} will <em>not</em> be in error recovery mode since the
308
+ /// returned token was a successful match.
309
+ /// <p/>
310
+ /// If the single-token deletion is successful, this method calls
311
+ /// <seealso cref="#reportUnwantedToken"/> to report the error, followed by
312
+ /// <seealso cref="Parser#consume"/> to actually "delete" the extraneous token. Then,
313
+ /// before returning <seealso cref="#reportMatch"/> is called to signal a successful
314
+ /// match.
315
+ /// </summary>
316
+ /// <param name="recognizer"> the parser instance </param>
317
+ /// <returns> the successfully matched <seealso cref="Token"/> instance if single-token
318
+ /// deletion successfully recovers from the mismatched input, otherwise
319
+ /// {@code null} </returns>
320
+ virtual Token* singleTokenDeletion(Parser *recognizer);
321
+
322
+ /// <summary>
323
+ /// Conjure up a missing token during error recovery.
324
+ ///
325
+ /// The recognizer attempts to recover from single missing
326
+ /// symbols. But, actions might refer to that missing symbol.
327
+ /// For example, x=ID {f($x);}. The action clearly assumes
328
+ /// that there has been an identifier matched previously and that
329
+ /// $x points at that token. If that token is missing, but
330
+ /// the next token in the stream is what we want we assume that
331
+ /// this token is missing and we keep going. Because we
332
+ /// have to return some token to replace the missing token,
333
+ /// we have to conjure one up. This method gives the user control
334
+ /// over the tokens returned for missing tokens. Mostly,
335
+ /// you will want to create something special for identifier
336
+ /// tokens. For literals such as '{' and ',', the default
337
+ /// action in the parser or tree parser works. It simply creates
338
+ /// a CommonToken of the appropriate type. The text will be the token.
339
+ /// If you change what tokens must be created by the lexer,
340
+ /// override this method to create the appropriate tokens.
341
+ /// </summary>
342
+ virtual Token* getMissingSymbol(Parser *recognizer);
343
+
344
+ virtual misc::IntervalSet getExpectedTokens(Parser *recognizer);
345
+
346
+ /// <summary>
347
+ /// How should a token be displayed in an error message? The default
348
+ /// is to display just the text, but during development you might
349
+ /// want to have a lot of information spit out. Override in that case
350
+ /// to use t.toString() (which, for CommonToken, dumps everything about
351
+ /// the token). This is better than forcing you to override a method in
352
+ /// your token objects because you don't have to go modify your lexer
353
+ /// so that it creates a new class.
354
+ /// </summary>
355
+ virtual std::string getTokenErrorDisplay(Token *t);
356
+
357
+ virtual std::string getSymbolText(Token *symbol);
358
+
359
+ virtual size_t getSymbolType(Token *symbol);
360
+
361
+ virtual std::string escapeWSAndQuote(const std::string &s) const;
362
+
363
+ /* Compute the error recovery set for the current rule. During
364
+ * rule invocation, the parser pushes the set of tokens that can
365
+ * follow that rule reference on the stack; this amounts to
366
+ * computing FIRST of what follows the rule reference in the
367
+ * enclosing rule. See LinearApproximator.FIRST().
368
+ * This local follow set only includes tokens
369
+ * from within the rule; i.e., the FIRST computation done by
370
+ * ANTLR stops at the end of a rule.
371
+ *
372
+ * EXAMPLE
373
+ *
374
+ * When you find a "no viable alt exception", the input is not
375
+ * consistent with any of the alternatives for rule r. The best
376
+ * thing to do is to consume tokens until you see something that
377
+ * can legally follow a call to r *or* any rule that called r.
378
+ * You don't want the exact set of viable next tokens because the
379
+ * input might just be missing a token--you might consume the
380
+ * rest of the input looking for one of the missing tokens.
381
+ *
382
+ * Consider grammar:
383
+ *
384
+ * a : '[' b ']'
385
+ * | '(' b ')'
386
+ * ;
387
+ * b : c '^' INT ;
388
+ * c : ID
389
+ * | INT
390
+ * ;
391
+ *
392
+ * At each rule invocation, the set of tokens that could follow
393
+ * that rule is pushed on a stack. Here are the various
394
+ * context-sensitive follow sets:
395
+ *
396
+ * FOLLOW(b1_in_a) = FIRST(']') = ']'
397
+ * FOLLOW(b2_in_a) = FIRST(')') = ')'
398
+ * FOLLOW(c_in_b) = FIRST('^') = '^'
399
+ *
400
+ * Upon erroneous input "[]", the call chain is
401
+ *
402
+ * a -> b -> c
403
+ *
404
+ * and, hence, the follow context stack is:
405
+ *
406
+ * depth follow set start of rule execution
407
+ * 0 <EOF> a (from main())
408
+ * 1 ']' b
409
+ * 2 '^' c
410
+ *
411
+ * Notice that ')' is not included, because b would have to have
412
+ * been called from a different context in rule a for ')' to be
413
+ * included.
414
+ *
415
+ * For error recovery, we cannot consider FOLLOW(c)
416
+ * (context-sensitive or otherwise). We need the combined set of
417
+ * all context-sensitive FOLLOW sets--the set of all tokens that
418
+ * could follow any reference in the call chain. We need to
419
+ * resync to one of those tokens. Note that FOLLOW(c)='^' and if
420
+ * we resync'd to that token, we'd consume until EOF. We need to
421
+ * sync to context-sensitive FOLLOWs for a, b, and c: {']','^'}.
422
+ * In this case, for input "[]", LA(1) is ']' and in the set, so we would
423
+ * not consume anything. After printing an error, rule c would
424
+ * return normally. Rule b would not find the required '^' though.
425
+ * At this point, it gets a mismatched token error and throws an
426
+ * exception (since LA(1) is not in the viable following token
427
+ * set). The rule exception handler tries to recover, but finds
428
+ * the same recovery set and doesn't consume anything. Rule b
429
+ * exits normally returning to rule a. Now it finds the ']' (and
430
+ * with the successful match exits errorRecovery mode).
431
+ *
432
+ * So, you can see that the parser walks up the call chain looking
433
+ * for the token that was a member of the recovery set.
434
+ *
435
+ * Errors are not generated in errorRecovery mode.
436
+ *
437
+ * ANTLR's error recovery mechanism is based upon original ideas:
438
+ *
439
+ * "Algorithms + Data Structures = Programs" by Niklaus Wirth
440
+ *
441
+ * and
442
+ *
443
+ * "A note on error recovery in recursive descent parsers":
444
+ * http://portal.acm.org/citation.cfm?id=947902.947905
445
+ *
446
+ * Later, Josef Grosch had some good ideas:
447
+ *
448
+ * "Efficient and Comfortable Error Recovery in Recursive Descent
449
+ * Parsers":
450
+ * ftp://www.cocolab.com/products/cocktail/doca4.ps/ell.ps.zip
451
+ *
452
+ * Like Grosch I implement context-sensitive FOLLOW sets that are combined
453
+ * at run-time upon error to avoid overhead during parsing.
454
+ */
455
+ virtual misc::IntervalSet getErrorRecoverySet(Parser *recognizer);
456
+
457
+ /// <summary>
458
+ /// Consume tokens until one matches the given token set. </summary>
459
+ virtual void consumeUntil(Parser *recognizer, const misc::IntervalSet &set);
460
+
461
+ private:
462
+ std::vector<std::unique_ptr<Token>> _errorSymbols; // Temporarily created token.
463
+ void InitializeInstanceFields();
464
+ };
465
+
466
+ } // namespace antlr4