expressir 1.2.3 → 1.2.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (328) hide show
  1. checksums.yaml +4 -4
  2. data/.cross_rubies +0 -6
  3. data/.github/workflows/rake.yml +223 -31
  4. data/.gitignore +7 -1
  5. data/.gitmodules +3 -0
  6. data/.rubocop.yml +13 -4
  7. data/README.adoc +8 -0
  8. data/Rakefile +4 -1
  9. data/bin/console +0 -1
  10. data/bin/rspec +3 -3
  11. data/exe/expressir +4 -2
  12. data/exe/format +1 -1
  13. data/exe/format-test +25 -25
  14. data/exe/generate-parser +16 -13
  15. data/expressir.gemspec +11 -9
  16. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/CMakeLists.txt +44 -9
  17. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlr4cpp-vs2013.vcxproj +11 -5
  18. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlr4cpp-vs2013.vcxproj.filters +0 -3
  19. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlr4cpp-vs2015.vcxproj +11 -4
  20. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlr4cpp-vs2015.vcxproj.filters +0 -3
  21. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlr4cpp-vs2017.vcxproj +11 -4
  22. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlr4cpp-vs2017.vcxproj.filters +0 -3
  23. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlr4cpp-vs2019.vcxproj +19 -4
  24. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlr4cpp-vs2019.vcxproj.filters +0 -3
  25. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlrcpp.xcodeproj/project.pbxproj +51 -35
  26. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlrcpp.xcodeproj/xcshareddata/xcschemes/antlr4.xcscheme +1 -1
  27. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlrcpp.xcodeproj/xcshareddata/xcschemes/antlr4_ios.xcscheme +1 -5
  28. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlrcpp.xcodeproj/xcshareddata/xcschemes/antlr4_static.xcscheme +1 -5
  29. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ANTLRFileStream.cpp +1 -12
  30. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ANTLRFileStream.h +9 -6
  31. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ANTLRInputStream.cpp +43 -18
  32. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ANTLRInputStream.h +16 -6
  33. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/CommonToken.cpp +2 -4
  34. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/CommonTokenFactory.cpp +1 -1
  35. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/CommonTokenFactory.h +1 -1
  36. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/DefaultErrorStrategy.cpp +16 -13
  37. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/Exceptions.cpp +2 -2
  38. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/Exceptions.h +2 -2
  39. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/FailedPredicateException.cpp +5 -4
  40. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/FailedPredicateException.h +1 -1
  41. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/IntStream.h +1 -1
  42. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/Lexer.cpp +2 -3
  43. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/Lexer.h +9 -9
  44. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/LexerInterpreter.cpp +0 -15
  45. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/LexerInterpreter.h +1 -7
  46. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ListTokenSource.cpp +2 -2
  47. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ListTokenSource.h +2 -2
  48. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/Parser.cpp +51 -31
  49. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/Parser.h +1 -7
  50. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ParserInterpreter.cpp +27 -39
  51. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ParserInterpreter.h +1 -7
  52. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ParserRuleContext.cpp +20 -23
  53. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ParserRuleContext.h +21 -21
  54. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ProxyErrorListener.cpp +4 -4
  55. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/RecognitionException.cpp +0 -1
  56. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/Recognizer.cpp +16 -27
  57. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/Recognizer.h +12 -17
  58. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/RuleContext.cpp +4 -3
  59. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/RuleContext.h +5 -1
  60. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/RuntimeMetaData.cpp +2 -1
  61. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/Token.h +7 -7
  62. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/TokenSource.h +1 -1
  63. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/TokenStreamRewriter.cpp +6 -6
  64. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/TokenStreamRewriter.h +4 -2
  65. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/UnbufferedCharStream.cpp +15 -18
  66. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/UnbufferedCharStream.h +12 -18
  67. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/Version.h +42 -0
  68. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/Vocabulary.cpp +13 -53
  69. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/Vocabulary.h +11 -27
  70. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/antlr4-common.h +19 -58
  71. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/antlr4-runtime.h +7 -5
  72. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATN.cpp +6 -57
  73. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATN.h +35 -15
  74. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNConfig.cpp +29 -36
  75. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNConfig.h +36 -27
  76. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNConfigSet.cpp +58 -54
  77. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNConfigSet.h +77 -31
  78. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNDeserializationOptions.cpp +22 -32
  79. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNDeserializationOptions.h +22 -24
  80. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNDeserializer.cpp +335 -464
  81. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNDeserializer.h +9 -62
  82. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNSimulator.cpp +9 -39
  83. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNSimulator.h +6 -22
  84. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNState.cpp +10 -26
  85. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNState.h +42 -36
  86. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNStateType.cpp +33 -0
  87. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNStateType.h +36 -0
  88. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ActionTransition.cpp +2 -6
  89. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ActionTransition.h +4 -2
  90. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ArrayPredictionContext.cpp +49 -22
  91. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ArrayPredictionContext.h +20 -12
  92. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/AtomTransition.cpp +1 -5
  93. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/AtomTransition.h +5 -2
  94. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/BasicBlockStartState.h +4 -2
  95. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/BasicState.h +4 -2
  96. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/BlockEndState.h +5 -3
  97. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/BlockStartState.h +10 -1
  98. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/DecisionInfo.h +1 -1
  99. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/DecisionState.cpp +0 -5
  100. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/DecisionState.h +12 -8
  101. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/EpsilonTransition.cpp +2 -6
  102. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/EpsilonTransition.h +6 -3
  103. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LL1Analyzer.cpp +139 -108
  104. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LL1Analyzer.h +10 -43
  105. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerATNConfig.cpp +16 -33
  106. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerATNConfig.h +12 -12
  107. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerATNSimulator.cpp +69 -82
  108. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerATNSimulator.h +17 -28
  109. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerAction.cpp +12 -6
  110. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerAction.h +45 -11
  111. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerActionExecutor.cpp +48 -44
  112. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerActionExecutor.h +31 -18
  113. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerActionType.h +3 -1
  114. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerChannelAction.cpp +14 -26
  115. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerChannelAction.h +12 -16
  116. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerCustomAction.cpp +15 -32
  117. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerCustomAction.h +12 -24
  118. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerIndexedCustomAction.cpp +23 -29
  119. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerIndexedCustomAction.h +13 -19
  120. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerModeAction.cpp +13 -26
  121. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerModeAction.h +12 -16
  122. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerMoreAction.cpp +6 -17
  123. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerMoreAction.h +12 -16
  124. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerPopModeAction.cpp +6 -17
  125. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerPopModeAction.h +12 -16
  126. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerPushModeAction.cpp +13 -26
  127. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerPushModeAction.h +12 -16
  128. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerSkipAction.cpp +6 -17
  129. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerSkipAction.h +11 -15
  130. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerTypeAction.cpp +13 -26
  131. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerTypeAction.h +13 -17
  132. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LoopEndState.h +5 -1
  133. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/NotSetTransition.cpp +1 -6
  134. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/NotSetTransition.h +4 -2
  135. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/OrderedATNConfigSet.cpp +6 -2
  136. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/OrderedATNConfigSet.h +8 -3
  137. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ParserATNSimulator.cpp +169 -152
  138. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ParserATNSimulator.h +26 -19
  139. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ParserATNSimulatorOptions.h +50 -0
  140. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PlusBlockStartState.h +5 -1
  141. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PlusLoopbackState.h +5 -2
  142. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PrecedencePredicateTransition.cpp +2 -11
  143. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PrecedencePredicateTransition.h +15 -9
  144. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredicateEvalInfo.cpp +2 -2
  145. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredicateEvalInfo.h +2 -2
  146. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredicateTransition.cpp +4 -14
  147. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredicateTransition.h +22 -11
  148. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredictionContext.cpp +255 -338
  149. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredictionContext.h +87 -116
  150. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredictionContextCache.cpp +56 -0
  151. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredictionContextCache.h +64 -0
  152. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredictionContextMergeCache.cpp +167 -0
  153. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredictionContextMergeCache.h +101 -0
  154. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredictionContextMergeCacheOptions.h +71 -0
  155. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredictionContextType.h +21 -0
  156. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredictionMode.cpp +18 -17
  157. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredictionMode.h +1 -1
  158. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ProfilingATNSimulator.cpp +2 -2
  159. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ProfilingATNSimulator.h +2 -2
  160. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/RangeTransition.cpp +1 -5
  161. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/RangeTransition.h +4 -2
  162. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/RuleStartState.h +4 -3
  163. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/RuleStopState.h +4 -2
  164. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/RuleTransition.cpp +1 -5
  165. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/RuleTransition.h +5 -3
  166. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/SemanticContext.cpp +197 -156
  167. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/SemanticContext.h +92 -81
  168. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/SemanticContextType.h +23 -0
  169. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/SerializedATNView.h +101 -0
  170. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/SetTransition.cpp +2 -6
  171. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/SetTransition.h +11 -3
  172. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/SingletonPredictionContext.cpp +39 -34
  173. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/SingletonPredictionContext.h +17 -10
  174. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/StarBlockStartState.h +5 -2
  175. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/StarLoopEntryState.h +4 -2
  176. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/StarLoopbackState.cpp +6 -6
  177. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/StarLoopbackState.h +6 -2
  178. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/TokensStartState.h +5 -2
  179. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/Transition.cpp +1 -9
  180. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/Transition.h +11 -22
  181. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/TransitionType.cpp +27 -0
  182. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/TransitionType.h +33 -0
  183. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/WildcardTransition.cpp +1 -5
  184. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/WildcardTransition.h +4 -2
  185. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/dfa/DFA.cpp +11 -23
  186. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/dfa/DFA.h +20 -15
  187. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/dfa/DFASerializer.cpp +2 -9
  188. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/dfa/DFASerializer.h +4 -4
  189. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/dfa/DFAState.cpp +9 -50
  190. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/dfa/DFAState.h +57 -48
  191. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/dfa/LexerDFASerializer.cpp +1 -4
  192. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/dfa/LexerDFASerializer.h +3 -4
  193. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/misc/InterpreterDataReader.cpp +2 -2
  194. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/misc/InterpreterDataReader.h +3 -1
  195. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/misc/Interval.cpp +1 -29
  196. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/misc/Interval.h +10 -10
  197. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/misc/IntervalSet.cpp +15 -28
  198. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/misc/IntervalSet.h +1 -9
  199. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/misc/MurmurHash.cpp +54 -68
  200. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/misc/MurmurHash.h +35 -9
  201. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/Any.cpp +0 -5
  202. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/Any.h +1 -155
  203. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/Arrays.cpp +2 -2
  204. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/Arrays.h +39 -0
  205. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/BitSet.h +1 -1
  206. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/CPPUtils.cpp +13 -54
  207. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/CPPUtils.h +16 -29
  208. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/Casts.h +34 -0
  209. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/Declarations.h +0 -2
  210. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/StringUtils.cpp +25 -23
  211. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/StringUtils.h +2 -40
  212. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/Unicode.h +28 -0
  213. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/Utf8.cpp +242 -0
  214. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/Utf8.h +54 -0
  215. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/AbstractParseTreeVisitor.h +13 -12
  216. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ErrorNode.h +7 -2
  217. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ErrorNodeImpl.cpp +36 -5
  218. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ErrorNodeImpl.h +14 -4
  219. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/IterativeParseTreeWalker.cpp +14 -19
  220. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ParseTree.cpp +0 -3
  221. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ParseTree.h +14 -5
  222. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ParseTreeType.h +22 -0
  223. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ParseTreeVisitor.h +4 -4
  224. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ParseTreeWalker.cpp +8 -9
  225. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ParseTreeWalker.h +30 -6
  226. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/TerminalNode.h +10 -2
  227. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/TerminalNodeImpl.cpp +2 -5
  228. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/TerminalNodeImpl.h +4 -5
  229. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/Trees.cpp +1 -1
  230. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/pattern/ParseTreePattern.cpp +1 -1
  231. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/pattern/ParseTreePatternMatcher.cpp +1 -2
  232. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPath.cpp +1 -1
  233. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathLexer.cpp +128 -119
  234. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathLexer.h +18 -27
  235. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathRuleElement.cpp +1 -1
  236. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathTokenElement.cpp +1 -1
  237. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/tests/Utf8Test.cpp +110 -0
  238. data/ext/express-parser/antlrgen/Express.interp +1 -1
  239. data/ext/express-parser/antlrgen/ExpressBaseListener.cpp +1 -1
  240. data/ext/express-parser/antlrgen/ExpressBaseListener.h +1 -1
  241. data/ext/express-parser/antlrgen/ExpressBaseVisitor.cpp +1 -1
  242. data/ext/express-parser/antlrgen/ExpressBaseVisitor.h +200 -200
  243. data/ext/express-parser/antlrgen/ExpressLexer.cpp +645 -1129
  244. data/ext/express-parser/antlrgen/ExpressLexer.h +20 -27
  245. data/ext/express-parser/antlrgen/ExpressLexer.interp +1 -1
  246. data/ext/express-parser/antlrgen/ExpressListener.cpp +1 -1
  247. data/ext/express-parser/antlrgen/ExpressListener.h +1 -1
  248. data/ext/express-parser/antlrgen/ExpressParser.cpp +1754 -1447
  249. data/ext/express-parser/antlrgen/ExpressParser.h +219 -223
  250. data/ext/express-parser/antlrgen/ExpressVisitor.cpp +1 -1
  251. data/ext/express-parser/antlrgen/ExpressVisitor.h +200 -200
  252. data/ext/express-parser/express_parser.cpp +165 -101
  253. data/ext/express-parser/extconf.rb +14 -14
  254. data/lib/expressir/config.rb +1 -1
  255. data/lib/expressir/express/parser.rb +17 -15
  256. data/lib/expressir/express/visitor.rb +7 -3
  257. data/lib/expressir/model.rb +78 -78
  258. data/lib/expressir/version.rb +1 -1
  259. data/rakelib/antlr4-native.rake +161 -0
  260. data/rakelib/cross-ruby.rake +213 -162
  261. data/spec/acceptance/version_spec.rb +17 -2
  262. data/spec/expressir/express/cache_spec.rb +23 -5
  263. data/spec/expressir/express/formatter_spec.rb +54 -8
  264. data/spec/expressir/express/parser_spec.rb +47 -11
  265. data/spec/expressir/model/model_element_spec.rb +198 -146
  266. data/spec/spec_helper.rb +7 -0
  267. metadata +79 -91
  268. data/demo.rb +0 -18
  269. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNSerializer.cpp +0 -621
  270. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNSerializer.h +0 -61
  271. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/AbstractPredicateTransition.cpp +0 -14
  272. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/AbstractPredicateTransition.h +0 -24
  273. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/BasicBlockStartState.cpp +0 -12
  274. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/BasicState.cpp +0 -12
  275. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/BlockEndState.cpp +0 -15
  276. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/BlockStartState.cpp +0 -9
  277. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/EmptyPredictionContext.cpp +0 -35
  278. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/EmptyPredictionContext.h +0 -27
  279. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LoopEndState.cpp +0 -12
  280. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/Makefile +0 -67
  281. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PlusBlockStartState.cpp +0 -12
  282. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PlusLoopbackState.cpp +0 -12
  283. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/RuleStartState.cpp +0 -16
  284. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/RuleStopState.cpp +0 -12
  285. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/StarBlockStartState.cpp +0 -12
  286. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/StarLoopEntryState.cpp +0 -15
  287. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/TokensStartState.cpp +0 -12
  288. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/guid.cpp +0 -303
  289. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/guid.h +0 -112
  290. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ErrorNode.cpp +0 -9
  291. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/TerminalNode.cpp +0 -9
  292. data/original/examples/ap233/ap233e1_arm_lf_stepmod-2010-11-12.exp +0 -9589
  293. data/original/examples/ap233/ap233e1_arm_lf_stepmod-2010-11-12.owl +0 -36619
  294. data/original/examples/ap233/ap233e1_arm_lf_stepmod-2010-11-12.xml +0 -13294
  295. data/original/examples/employment/eclipse/.project +0 -17
  296. data/original/examples/employment/eclipse/Export/Employment.png +0 -0
  297. data/original/examples/employment/eclipse/Express/employment_schema.exp +0 -33
  298. data/original/examples/employment/eclipse/Express/employment_schema.xmi +0 -77
  299. data/original/examples/employment/eclipse/Express/employment_schema.xml +0 -93
  300. data/original/examples/employment/eclipse/Models/Employment.uml +0 -4
  301. data/original/examples/employment/eclipse/Models/Employment.umldi +0 -240
  302. data/original/examples/employment/eclipse/readme.txt +0 -7
  303. data/original/examples/employment/employment_schema.exp +0 -33
  304. data/original/examples/employment/employment_schema.rb +0 -232
  305. data/original/examples/employment/employment_schema.xml +0 -93
  306. data/original/examples/employment/employment_schema___module.rb +0 -46
  307. data/original/examples/employment/employment_schema___p28attr.rb +0 -126
  308. data/original/examples/employment/employment_schema___p28inst.rb +0 -26
  309. data/original/examples/employment/example_employment_data.xml +0 -1
  310. data/original/examples/employment/example_employment_data_copy.xml +0 -1
  311. data/original/examples/employment/example_employment_reader.rb +0 -30
  312. data/original/examples/employment/example_employment_writer.rb +0 -51
  313. data/original/examples/plcs/ap239e1_arm_lf_dexlib_2010-01-06.exp +0 -3710
  314. data/original/examples/plcs/ap239e1_arm_lf_dexlib_2010-01-06.owl +0 -35880
  315. data/original/examples/plcs/ap239e1_arm_lf_dexlib_2010-01-06.xmi +0 -15357
  316. data/original/examples/plcs/ap239e1_arm_lf_dexlib_2010-01-06.xml +0 -9468
  317. data/original/examples/plcs/ap239e2_arm_lf_stepmod-2010-01-25.exp +0 -8404
  318. data/original/examples/plcs/ap239e2_arm_lf_stepmod-2010-01-25.owl +0 -43147
  319. data/original/examples/plcs/ap239e2_arm_lf_stepmod-2010-01-25.xmi +0 -18341
  320. data/original/examples/plcs/ap239e2_arm_lf_stepmod-2010-01-25.xml +0 -11632
  321. data/original/exp2ruby.rb +0 -525
  322. data/original/expsm.rb +0 -34
  323. data/original/mapping_owl.rb +0 -1018
  324. data/original/mapping_sysml.rb +0 -2281
  325. data/original/mapping_uml2.rb +0 -599
  326. data/original/mapping_uml2_eclipse.rb +0 -433
  327. data/original/reeper.rb +0 -134
  328. data/spec/expressr_spec.rb +0 -5
@@ -0,0 +1,22 @@
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 <cstddef>
9
+
10
+ #include "antlr4-common.h"
11
+
12
+ namespace antlr4 {
13
+ namespace tree {
14
+
15
+ enum class ParseTreeType : size_t {
16
+ TERMINAL = 1,
17
+ ERROR = 2,
18
+ RULE = 3,
19
+ };
20
+
21
+ } // namespace tree
22
+ } // namespace antlr4
@@ -27,7 +27,7 @@ namespace tree {
27
27
  /// </summary>
28
28
  /// <param name="tree"> The <seealso cref="ParseTree"/> to visit. </param>
29
29
  /// <returns> The result of visiting the parse tree. </returns>
30
- virtual antlrcpp::Any visit(ParseTree *tree) = 0;
30
+ virtual std::any visit(ParseTree *tree) = 0;
31
31
 
32
32
  /// <summary>
33
33
  /// Visit the children of a node, and return a user-defined result of the
@@ -35,21 +35,21 @@ namespace tree {
35
35
  /// </summary>
36
36
  /// <param name="node"> The <seealso cref="ParseTree"/> whose children should be visited. </param>
37
37
  /// <returns> The result of visiting the children of the node. </returns>
38
- virtual antlrcpp::Any visitChildren(ParseTree *node) = 0;
38
+ virtual std::any visitChildren(ParseTree *node) = 0;
39
39
 
40
40
  /// <summary>
41
41
  /// Visit a terminal node, and return a user-defined result of the operation.
42
42
  /// </summary>
43
43
  /// <param name="node"> The <seealso cref="TerminalNode"/> to visit. </param>
44
44
  /// <returns> The result of visiting the node. </returns>
45
- virtual antlrcpp::Any visitTerminal(TerminalNode *node) = 0;
45
+ virtual std::any visitTerminal(TerminalNode *node) = 0;
46
46
 
47
47
  /// <summary>
48
48
  /// Visit an error node, and return a user-defined result of the operation.
49
49
  /// </summary>
50
50
  /// <param name="node"> The <seealso cref="ErrorNode"/> to visit. </param>
51
51
  /// <returns> The result of visiting the node. </returns>
52
- virtual antlrcpp::Any visitErrorNode(ErrorNode *node) = 0;
52
+ virtual std::any visitErrorNode(ErrorNode *node) = 0;
53
53
 
54
54
  };
55
55
 
@@ -7,6 +7,7 @@
7
7
  #include "ParserRuleContext.h"
8
8
  #include "tree/ParseTreeListener.h"
9
9
  #include "support/CPPUtils.h"
10
+ #include "support/Casts.h"
10
11
 
11
12
  #include "tree/IterativeParseTreeWalker.h"
12
13
  #include "tree/ParseTreeWalker.h"
@@ -17,15 +18,13 @@ using namespace antlrcpp;
17
18
  static IterativeParseTreeWalker defaultWalker;
18
19
  ParseTreeWalker &ParseTreeWalker::DEFAULT = defaultWalker;
19
20
 
20
- ParseTreeWalker::~ParseTreeWalker() {
21
- }
22
-
23
21
  void ParseTreeWalker::walk(ParseTreeListener *listener, ParseTree *t) const {
24
- if (is<ErrorNode *>(t)) {
25
- listener->visitErrorNode(dynamic_cast<ErrorNode *>(t));
22
+ if (ErrorNode::is(*t)) {
23
+ listener->visitErrorNode(downCast<ErrorNode*>(t));
26
24
  return;
27
- } else if (is<TerminalNode *>(t)) {
28
- listener->visitTerminal(dynamic_cast<TerminalNode *>(t));
25
+ }
26
+ if (TerminalNode::is(*t)) {
27
+ listener->visitTerminal(downCast<TerminalNode*>(t));
29
28
  return;
30
29
  }
31
30
 
@@ -37,13 +36,13 @@ void ParseTreeWalker::walk(ParseTreeListener *listener, ParseTree *t) const {
37
36
  }
38
37
 
39
38
  void ParseTreeWalker::enterRule(ParseTreeListener *listener, ParseTree *r) const {
40
- ParserRuleContext *ctx = dynamic_cast<ParserRuleContext *>(r);
39
+ auto *ctx = downCast<ParserRuleContext*>(r);
41
40
  listener->enterEveryRule(ctx);
42
41
  ctx->enterRule(listener);
43
42
  }
44
43
 
45
44
  void ParseTreeWalker::exitRule(ParseTreeListener *listener, ParseTree *r) const {
46
- ParserRuleContext *ctx = dynamic_cast<ParserRuleContext *>(r);
45
+ auto *ctx = downCast<ParserRuleContext*>(r);
47
46
  ctx->exitRule(listener);
48
47
  listener->exitEveryRule(ctx);
49
48
  }
@@ -14,16 +14,40 @@ namespace tree {
14
14
  public:
15
15
  static ParseTreeWalker &DEFAULT;
16
16
 
17
- virtual ~ParseTreeWalker();
18
-
17
+ virtual ~ParseTreeWalker() = default;
18
+
19
+ /**
20
+ * <summary>
21
+ * Performs a walk on the given parse tree starting at the root and going down recursively
22
+ * with depth-first search. On each node, <seealso cref="ParseTreeWalker#enterRule"/> is called before
23
+ * recursively walking down into child nodes, then
24
+ * <seealso cref="ParseTreeWalker#exitRule"/> is called after the recursive call to wind up.
25
+ * </summary>
26
+ * <param name='listener'> The listener used by the walker to process grammar rules </param>
27
+ * <param name='t'> The parse tree to be walked on </param>
28
+ */
19
29
  virtual void walk(ParseTreeListener *listener, ParseTree *t) const;
20
30
 
21
31
  protected:
22
- /// The discovery of a rule node, involves sending two events: the generic
23
- /// <seealso cref="ParseTreeListener#enterEveryRule"/> and a
24
- /// <seealso cref="RuleContext"/>-specific event. First we trigger the generic and then
25
- /// the rule specific. We do them in reverse order upon finishing the node.
32
+
33
+ /**
34
+ * <summary>
35
+ * Enters a grammar rule by first triggering the generic event <seealso cref="ParseTreeListener#enterEveryRule"/>
36
+ * then by triggering the event specific to the given parse tree node
37
+ * </summary>
38
+ * <param name='listener'> The listener responding to the trigger events </param>
39
+ * <param name='r'> The grammar rule containing the rule context </param>
40
+ */
26
41
  virtual void enterRule(ParseTreeListener *listener, ParseTree *r) const;
42
+
43
+ /**
44
+ * <summary>
45
+ * Exits a grammar rule by first triggering the event specific to the given parse tree node
46
+ * then by triggering the generic event <seealso cref="ParseTreeListener#exitEveryRule"/>
47
+ * </summary>
48
+ * <param name='listener'> The listener responding to the trigger events </param>
49
+ * <param name='r'> The grammar rule containing the rule context </param>
50
+ */
27
51
  virtual void exitRule(ParseTreeListener *listener, ParseTree *r) const;
28
52
  };
29
53
 
@@ -12,9 +12,14 @@ namespace tree {
12
12
 
13
13
  class ANTLR4CPP_PUBLIC TerminalNode : public ParseTree {
14
14
  public:
15
- ~TerminalNode() override;
15
+ static bool is(const tree::ParseTree &parseTree) {
16
+ const auto treeType = parseTree.getTreeType();
17
+ return treeType == ParseTreeType::TERMINAL || treeType == ParseTreeType::ERROR;
18
+ }
16
19
 
17
- virtual Token* getSymbol() = 0;
20
+ static bool is(const tree::ParseTree *parseTree) { return parseTree != nullptr && is(*parseTree); }
21
+
22
+ virtual Token* getSymbol() const = 0;
18
23
 
19
24
  /** Set the parent for this leaf node.
20
25
  *
@@ -26,6 +31,9 @@ namespace tree {
26
31
  * @since 4.7
27
32
  */
28
33
  virtual void setParent(RuleContext *parent) = 0;
34
+
35
+ protected:
36
+ using ParseTree::ParseTree;
29
37
  };
30
38
 
31
39
  } // namespace tree
@@ -13,10 +13,7 @@
13
13
  using namespace antlr4;
14
14
  using namespace antlr4::tree;
15
15
 
16
- TerminalNodeImpl::TerminalNodeImpl(Token *symbol_) : symbol(symbol_) {
17
- }
18
-
19
- Token* TerminalNodeImpl::getSymbol() {
16
+ Token* TerminalNodeImpl::getSymbol() const {
20
17
  return symbol;
21
18
  }
22
19
 
@@ -33,7 +30,7 @@ misc::Interval TerminalNodeImpl::getSourceInterval() {
33
30
  return misc::Interval(tokenIndex, tokenIndex);
34
31
  }
35
32
 
36
- antlrcpp::Any TerminalNodeImpl::accept(ParseTreeVisitor *visitor) {
33
+ std::any TerminalNodeImpl::accept(ParseTreeVisitor *visitor) {
37
34
  return visitor->visitTerminal(this);
38
35
  }
39
36
 
@@ -10,23 +10,22 @@
10
10
  namespace antlr4 {
11
11
  namespace tree {
12
12
 
13
- class ANTLR4CPP_PUBLIC TerminalNodeImpl : public virtual TerminalNode {
13
+ class ANTLR4CPP_PUBLIC TerminalNodeImpl : public TerminalNode {
14
14
  public:
15
15
  Token *symbol;
16
16
 
17
- TerminalNodeImpl(Token *symbol);
17
+ explicit TerminalNodeImpl(Token *symbol) : TerminalNode(ParseTreeType::TERMINAL), symbol(symbol) {}
18
18
 
19
- virtual Token* getSymbol() override;
19
+ virtual Token* getSymbol() const override;
20
20
  virtual void setParent(RuleContext *parent) override;
21
21
  virtual misc::Interval getSourceInterval() override;
22
22
 
23
- virtual antlrcpp::Any accept(ParseTreeVisitor *visitor) override;
23
+ virtual std::any accept(ParseTreeVisitor *visitor) override;
24
24
 
25
25
  virtual std::string getText() override;
26
26
  virtual std::string toStringTree(Parser *parser, bool pretty = false) override;
27
27
  virtual std::string toString() override;
28
28
  virtual std::string toStringTree(bool pretty = false) override;
29
-
30
29
  };
31
30
 
32
31
  } // namespace tree
@@ -192,7 +192,7 @@ std::vector<ParseTree *> Trees::getDescendants(ParseTree *t) {
192
192
  std::size_t n = t->children.size();
193
193
  for (size_t i = 0 ; i < n ; i++) {
194
194
  auto descentants = getDescendants(t->children[i]);
195
- for (auto entry: descentants) {
195
+ for (auto *entry: descentants) {
196
196
  nodes.push_back(entry);
197
197
  }
198
198
  }
@@ -37,7 +37,7 @@ std::vector<ParseTreeMatch> ParseTreePattern::findAll(ParseTree *tree, const std
37
37
  xpath::XPath finder(_matcher->getParser(), xpath);
38
38
  std::vector<ParseTree *> subtrees = finder.evaluate(tree);
39
39
  std::vector<ParseTreeMatch> matches;
40
- for (auto t : subtrees) {
40
+ for (auto *t : subtrees) {
41
41
  ParseTreeMatch aMatch = match(t);
42
42
  if (aMatch.succeeded()) {
43
43
  matches.push_back(aMatch);
@@ -21,7 +21,6 @@
21
21
  #include "ANTLRInputStream.h"
22
22
  #include "support/Arrays.h"
23
23
  #include "Exceptions.h"
24
- #include "support/StringUtils.h"
25
24
  #include "support/CPPUtils.h"
26
25
 
27
26
  #include "tree/pattern/ParseTreePatternMatcher.h"
@@ -109,7 +108,7 @@ ParseTreePattern ParseTreePatternMatcher::compile(const std::string &pattern, in
109
108
  throw e;
110
109
  #else
111
110
  } catch (std::exception & /*e*/) {
112
- std::throw_with_nested((const char*)"Cannot invoke start rule"); // Wrap any other exception. We should however probably use one of the ANTLR exceptions here.
111
+ std::throw_with_nested(RuntimeException("Cannot invoke start rule")); // Wrap any other exception.
113
112
  #endif
114
113
  }
115
114
 
@@ -137,7 +137,7 @@ std::vector<ParseTree *> XPath::evaluate(ParseTree *t) {
137
137
 
138
138
  while (i < elements.size()) {
139
139
  std::vector<ParseTree *> next;
140
- for (auto node : work) {
140
+ for (auto *node : work) {
141
141
  if (!node->children.empty()) {
142
142
  // only try to match next element if it has children
143
143
  // e.g., //func/*/stat might have a token node for which
@@ -1,11 +1,125 @@
1
+
2
+ // Generated from XPathLexer.g4 by ANTLR 4.9.3
3
+
4
+
1
5
  #include "XPathLexer.h"
2
6
 
3
7
 
4
8
  using namespace antlr4;
5
9
 
10
+ namespace {
11
+
12
+ struct XPathLexerStaticData final {
13
+ XPathLexerStaticData(std::vector<std::string> ruleNames,
14
+ std::vector<std::string> channelNames,
15
+ std::vector<std::string> modeNames,
16
+ std::vector<std::string> literalNames,
17
+ std::vector<std::string> symbolicNames)
18
+ : ruleNames(std::move(ruleNames)), channelNames(std::move(channelNames)),
19
+ modeNames(std::move(modeNames)), literalNames(std::move(literalNames)),
20
+ symbolicNames(std::move(symbolicNames)),
21
+ vocabulary(this->literalNames, this->symbolicNames) {}
22
+
23
+ XPathLexerStaticData(const XPathLexerStaticData&) = delete;
24
+ XPathLexerStaticData(XPathLexerStaticData&&) = delete;
25
+ XPathLexerStaticData& operator=(const XPathLexerStaticData&) = delete;
26
+ XPathLexerStaticData& operator=(XPathLexerStaticData&&) = delete;
27
+
28
+ std::vector<antlr4::dfa::DFA> decisionToDFA;
29
+ antlr4::atn::PredictionContextCache sharedContextCache;
30
+ const std::vector<std::string> ruleNames;
31
+ const std::vector<std::string> channelNames;
32
+ const std::vector<std::string> modeNames;
33
+ const std::vector<std::string> literalNames;
34
+ const std::vector<std::string> symbolicNames;
35
+ const antlr4::dfa::Vocabulary vocabulary;
36
+ antlr4::atn::SerializedATNView serializedATN;
37
+ std::unique_ptr<antlr4::atn::ATN> atn;
38
+ };
39
+
40
+ std::once_flag xpathLexerOnceFlag;
41
+ XPathLexerStaticData *xpathLexerStaticData = nullptr;
42
+
43
+ void xpathLexerInitialize() {
44
+ assert(xpathLexerStaticData == nullptr);
45
+ auto staticData = std::make_unique<XPathLexerStaticData>(
46
+ std::vector<std::string>{
47
+ "ANYWHERE", "ROOT", "WILDCARD", "BANG", "ID", "NameChar", "NameStartChar",
48
+ "STRING"
49
+ },
50
+ std::vector<std::string>{
51
+ "DEFAULT_TOKEN_CHANNEL", "HIDDEN"
52
+ },
53
+ std::vector<std::string>{
54
+ "DEFAULT_MODE"
55
+ },
56
+ std::vector<std::string>{
57
+ "", "", "", "'//'", "'/'", "'*'", "'!'"
58
+ },
59
+ std::vector<std::string>{
60
+ "", "TOKEN_REF", "RULE_REF", "ANYWHERE", "ROOT", "WILDCARD", "BANG", "ID",
61
+ "STRING"
62
+ }
63
+ );
64
+ static const int32_t serializedATNSegment[] = {
65
+ 0x4, 0x0, 0x8, 0x32, 0x6, -1, 0x2, 0x0, 0x7, 0x0, 0x2, 0x1, 0x7,
66
+ 0x1, 0x2, 0x2, 0x7, 0x2, 0x2, 0x3, 0x7, 0x3, 0x2, 0x4, 0x7, 0x4,
67
+ 0x2, 0x5, 0x7, 0x5, 0x2, 0x6, 0x7, 0x6, 0x2, 0x7, 0x7, 0x7, 0x1,
68
+ 0x0, 0x1, 0x0, 0x1, 0x0, 0x1, 0x1, 0x1, 0x1, 0x1, 0x2, 0x1, 0x2,
69
+ 0x1, 0x3, 0x1, 0x3, 0x1, 0x4, 0x1, 0x4, 0x5, 0x4, 0x1d, 0x8, 0x4,
70
+ 0xa, 0x4, 0xc, 0x4, 0x20, 0x9, 0x4, 0x1, 0x4, 0x1, 0x4, 0x1, 0x5,
71
+ 0x1, 0x5, 0x3, 0x5, 0x26, 0x8, 0x5, 0x1, 0x6, 0x1, 0x6, 0x1, 0x7,
72
+ 0x1, 0x7, 0x5, 0x7, 0x2c, 0x8, 0x7, 0xa, 0x7, 0xc, 0x7, 0x2f, 0x9,
73
+ 0x7, 0x1, 0x7, 0x1, 0x7, 0x1, 0x2d, 0x0, 0x8, 0x1, 0x3, 0x3, 0x4,
74
+ 0x5, 0x5, 0x7, 0x6, 0x9, 0x7, 0xb, 0x0, 0xd, 0x0, 0xf, 0x8, 0x1,
75
+ 0x0, 0x2, 0x5, 0x0, 0x30, 0x39, 0x5f, 0x5f, 0xb7, 0xb7, 0x300, 0x36f,
76
+ 0x203f, 0x2040, 0xd, 0x0, 0x41, 0x5a, 0x61, 0x7a, 0xc0, 0xd6, 0xd8,
77
+ 0xf6, 0xf8, 0x2ff, 0x370, 0x37d, 0x37f, 0x1fff, 0x200c, 0x200d, 0x2070,
78
+ 0x218f, 0x2c00, 0x2fef, 0x3001, 0xd7ff, 0xf900, 0xfdcf, 0xfdf0, -1,
79
+ 0x0, 0x32, 0x0, 0x1, 0x1, 0x0, 0x0, 0x0, 0x0, 0x3, 0x1, 0x0, 0x0,
80
+ 0x0, 0x0, 0x5, 0x1, 0x0, 0x0, 0x0, 0x0, 0x7, 0x1, 0x0, 0x0, 0x0,
81
+ 0x0, 0x9, 0x1, 0x0, 0x0, 0x0, 0x0, 0xf, 0x1, 0x0, 0x0, 0x0, 0x1,
82
+ 0x11, 0x1, 0x0, 0x0, 0x0, 0x3, 0x14, 0x1, 0x0, 0x0, 0x0, 0x5, 0x16,
83
+ 0x1, 0x0, 0x0, 0x0, 0x7, 0x18, 0x1, 0x0, 0x0, 0x0, 0x9, 0x1a, 0x1,
84
+ 0x0, 0x0, 0x0, 0xb, 0x25, 0x1, 0x0, 0x0, 0x0, 0xd, 0x27, 0x1, 0x0,
85
+ 0x0, 0x0, 0xf, 0x29, 0x1, 0x0, 0x0, 0x0, 0x11, 0x12, 0x5, 0x2f, 0x0,
86
+ 0x0, 0x12, 0x13, 0x5, 0x2f, 0x0, 0x0, 0x13, 0x2, 0x1, 0x0, 0x0, 0x0,
87
+ 0x14, 0x15, 0x5, 0x2f, 0x0, 0x0, 0x15, 0x4, 0x1, 0x0, 0x0, 0x0, 0x16,
88
+ 0x17, 0x5, 0x2a, 0x0, 0x0, 0x17, 0x6, 0x1, 0x0, 0x0, 0x0, 0x18, 0x19,
89
+ 0x5, 0x21, 0x0, 0x0, 0x19, 0x8, 0x1, 0x0, 0x0, 0x0, 0x1a, 0x1e, 0x3,
90
+ 0xd, 0x6, 0x0, 0x1b, 0x1d, 0x3, 0xb, 0x5, 0x0, 0x1c, 0x1b, 0x1, 0x0,
91
+ 0x0, 0x0, 0x1d, 0x20, 0x1, 0x0, 0x0, 0x0, 0x1e, 0x1c, 0x1, 0x0, 0x0,
92
+ 0x0, 0x1e, 0x1f, 0x1, 0x0, 0x0, 0x0, 0x1f, 0x21, 0x1, 0x0, 0x0, 0x0,
93
+ 0x20, 0x1e, 0x1, 0x0, 0x0, 0x0, 0x21, 0x22, 0x6, 0x4, 0x0, 0x0, 0x22,
94
+ 0xa, 0x1, 0x0, 0x0, 0x0, 0x23, 0x26, 0x3, 0xd, 0x6, 0x0, 0x24, 0x26,
95
+ 0x7, 0x0, 0x0, 0x0, 0x25, 0x23, 0x1, 0x0, 0x0, 0x0, 0x25, 0x24, 0x1,
96
+ 0x0, 0x0, 0x0, 0x26, 0xc, 0x1, 0x0, 0x0, 0x0, 0x27, 0x28, 0x7, 0x1,
97
+ 0x0, 0x0, 0x28, 0xe, 0x1, 0x0, 0x0, 0x0, 0x29, 0x2d, 0x5, 0x27, 0x0,
98
+ 0x0, 0x2a, 0x2c, 0x9, 0x0, 0x0, 0x0, 0x2b, 0x2a, 0x1, 0x0, 0x0, 0x0,
99
+ 0x2c, 0x2f, 0x1, 0x0, 0x0, 0x0, 0x2d, 0x2e, 0x1, 0x0, 0x0, 0x0, 0x2d,
100
+ 0x2b, 0x1, 0x0, 0x0, 0x0, 0x2e, 0x30, 0x1, 0x0, 0x0, 0x0, 0x2f, 0x2d,
101
+ 0x1, 0x0, 0x0, 0x0, 0x30, 0x31, 0x5, 0x27, 0x0, 0x0, 0x31, 0x10,
102
+ 0x1, 0x0, 0x0, 0x0, 0x4, 0x0, 0x1e, 0x25, 0x2d, 0x1, 0x1, 0x4, 0x0,
103
+ };
104
+
105
+ staticData->serializedATN = antlr4::atn::SerializedATNView(serializedATNSegment, sizeof(serializedATNSegment) / sizeof(serializedATNSegment[0]));
106
+
107
+ atn::ATNDeserializer deserializer;
108
+ staticData->atn = deserializer.deserialize(staticData->serializedATN);
109
+
110
+ size_t count = staticData->atn->getNumberOfDecisions();
111
+ staticData->decisionToDFA.reserve(count);
112
+ for (size_t i = 0; i < count; i++) {
113
+ staticData->decisionToDFA.emplace_back(staticData->atn->getDecisionState(i), i);
114
+ }
115
+ xpathLexerStaticData = staticData.release();
116
+ }
117
+
118
+ }
6
119
 
7
120
  XPathLexer::XPathLexer(CharStream *input) : Lexer(input) {
8
- _interpreter = new atn::LexerATNSimulator(this, _atn, _decisionToDFA, _sharedContextCache);
121
+ XPathLexer::initialize();
122
+ _interpreter = new atn::LexerATNSimulator(this, *xpathLexerStaticData->atn, xpathLexerStaticData->decisionToDFA, xpathLexerStaticData->sharedContextCache);
9
123
  }
10
124
 
11
125
  XPathLexer::~XPathLexer() {
@@ -17,46 +131,41 @@ std::string XPathLexer::getGrammarFileName() const {
17
131
  }
18
132
 
19
133
  const std::vector<std::string>& XPathLexer::getRuleNames() const {
20
- return _ruleNames;
134
+ return xpathLexerStaticData->ruleNames;
21
135
  }
22
136
 
23
137
  const std::vector<std::string>& XPathLexer::getChannelNames() const {
24
- return _channelNames;
138
+ return xpathLexerStaticData->channelNames;
25
139
  }
26
140
 
27
141
  const std::vector<std::string>& XPathLexer::getModeNames() const {
28
- return _modeNames;
29
- }
30
-
31
- const std::vector<std::string>& XPathLexer::getTokenNames() const {
32
- return _tokenNames;
142
+ return xpathLexerStaticData->modeNames;
33
143
  }
34
144
 
35
- dfa::Vocabulary& XPathLexer::getVocabulary() const {
36
- return _vocabulary;
145
+ const dfa::Vocabulary& XPathLexer::getVocabulary() const {
146
+ return xpathLexerStaticData->vocabulary;
37
147
  }
38
148
 
39
- const std::vector<uint16_t> XPathLexer::getSerializedATN() const {
40
- return _serializedATN;
149
+ antlr4::atn::SerializedATNView XPathLexer::getSerializedATN() const {
150
+ return xpathLexerStaticData->serializedATN;
41
151
  }
42
152
 
43
153
  const atn::ATN& XPathLexer::getATN() const {
44
- return _atn;
154
+ return *xpathLexerStaticData->atn;
45
155
  }
46
156
 
47
-
48
157
  void XPathLexer::action(RuleContext *context, size_t ruleIndex, size_t actionIndex) {
49
158
  switch (ruleIndex) {
50
- case 4: IDAction(dynamic_cast<antlr4::RuleContext *>(context), actionIndex); break;
159
+ case 4: IDAction(antlrcpp::downCast<antlr4::RuleContext *>(context), actionIndex); break;
51
160
 
52
161
  default:
53
162
  break;
54
163
  }
55
164
  }
56
165
 
57
- void XPathLexer::IDAction(antlr4::RuleContext * /*context*/, size_t actionIndex) {
166
+ void XPathLexer::IDAction(antlr4::RuleContext *context, size_t actionIndex) {
58
167
  switch (actionIndex) {
59
- case 0:
168
+ case 0:
60
169
  if (isupper(getText()[0]))
61
170
  setType(TOKEN_REF);
62
171
  else
@@ -68,106 +177,6 @@ void XPathLexer::IDAction(antlr4::RuleContext * /*context*/, size_t actionIndex)
68
177
  }
69
178
  }
70
179
 
71
-
72
-
73
- // Static vars and initialization.
74
- std::vector<dfa::DFA> XPathLexer::_decisionToDFA;
75
- atn::PredictionContextCache XPathLexer::_sharedContextCache;
76
-
77
- // We own the ATN which in turn owns the ATN states.
78
- atn::ATN XPathLexer::_atn;
79
- std::vector<uint16_t> XPathLexer::_serializedATN;
80
-
81
- std::vector<std::string> XPathLexer::_ruleNames = {
82
- "ANYWHERE", "ROOT", "WILDCARD", "BANG", "ID", "NameChar", "NameStartChar",
83
- "STRING"
84
- };
85
-
86
- std::vector<std::string> XPathLexer::_channelNames = {
87
- "DEFAULT_TOKEN_CHANNEL", "HIDDEN"
88
- };
89
-
90
- std::vector<std::string> XPathLexer::_modeNames = {
91
- "DEFAULT_MODE"
92
- };
93
-
94
- std::vector<std::string> XPathLexer::_literalNames = {
95
- "", "", "", "'//'", "'/'", "'*'", "'!'"
96
- };
97
-
98
- std::vector<std::string> XPathLexer::_symbolicNames = {
99
- "", "TOKEN_REF", "RULE_REF", "ANYWHERE", "ROOT", "WILDCARD", "BANG", "ID",
100
- "STRING"
101
- };
102
-
103
- dfa::Vocabulary XPathLexer::_vocabulary(_literalNames, _symbolicNames);
104
-
105
- std::vector<std::string> XPathLexer::_tokenNames;
106
-
107
- XPathLexer::Initializer::Initializer() {
108
- // This code could be in a static initializer lambda, but VS doesn't allow access to private class members from there.
109
- for (size_t i = 0; i < _symbolicNames.size(); ++i) {
110
- std::string name = _vocabulary.getLiteralName(i);
111
- if (name.empty()) {
112
- name = _vocabulary.getSymbolicName(i);
113
- }
114
-
115
- if (name.empty()) {
116
- _tokenNames.push_back("<INVALID>");
117
- } else {
118
- _tokenNames.push_back(name);
119
- }
120
- }
121
-
122
- _serializedATN = {
123
- 0x3, 0x430, 0xd6d1, 0x8206, 0xad2d, 0x4417, 0xaef1, 0x8d80, 0xaadd,
124
- 0x2, 0xa, 0x34, 0x8, 0x1, 0x4, 0x2, 0x9, 0x2, 0x4, 0x3, 0x9, 0x3, 0x4,
125
- 0x4, 0x9, 0x4, 0x4, 0x5, 0x9, 0x5, 0x4, 0x6, 0x9, 0x6, 0x4, 0x7, 0x9,
126
- 0x7, 0x4, 0x8, 0x9, 0x8, 0x4, 0x9, 0x9, 0x9, 0x3, 0x2, 0x3, 0x2, 0x3,
127
- 0x2, 0x3, 0x3, 0x3, 0x3, 0x3, 0x4, 0x3, 0x4, 0x3, 0x5, 0x3, 0x5, 0x3,
128
- 0x6, 0x3, 0x6, 0x7, 0x6, 0x1f, 0xa, 0x6, 0xc, 0x6, 0xe, 0x6, 0x22, 0xb,
129
- 0x6, 0x3, 0x6, 0x3, 0x6, 0x3, 0x7, 0x3, 0x7, 0x5, 0x7, 0x28, 0xa, 0x7,
130
- 0x3, 0x8, 0x3, 0x8, 0x3, 0x9, 0x3, 0x9, 0x7, 0x9, 0x2e, 0xa, 0x9, 0xc,
131
- 0x9, 0xe, 0x9, 0x31, 0xb, 0x9, 0x3, 0x9, 0x3, 0x9, 0x3, 0x2f, 0x2, 0xa,
132
- 0x3, 0x5, 0x5, 0x6, 0x7, 0x7, 0x9, 0x8, 0xb, 0x9, 0xd, 0x2, 0xf, 0x2,
133
- 0x11, 0xa, 0x3, 0x2, 0x4, 0x7, 0x2, 0x32, 0x3b, 0x61, 0x61, 0xb9, 0xb9,
134
- 0x302, 0x371, 0x2041, 0x2042, 0xf, 0x2, 0x43, 0x5c, 0x63, 0x7c, 0xc2,
135
- 0xd8, 0xda, 0xf8, 0xfa, 0x301, 0x372, 0x37f, 0x381, 0x2001, 0x200e,
136
- 0x200f, 0x2072, 0x2191, 0x2c02, 0x2ff1, 0x3003, 0xd801, 0xf902, 0xfdd1,
137
- 0xfdf2, 0x1, 0x34, 0x2, 0x3, 0x3, 0x2, 0x2, 0x2, 0x2, 0x5, 0x3, 0x2,
138
- 0x2, 0x2, 0x2, 0x7, 0x3, 0x2, 0x2, 0x2, 0x2, 0x9, 0x3, 0x2, 0x2, 0x2,
139
- 0x2, 0xb, 0x3, 0x2, 0x2, 0x2, 0x2, 0x11, 0x3, 0x2, 0x2, 0x2, 0x3, 0x13,
140
- 0x3, 0x2, 0x2, 0x2, 0x5, 0x16, 0x3, 0x2, 0x2, 0x2, 0x7, 0x18, 0x3, 0x2,
141
- 0x2, 0x2, 0x9, 0x1a, 0x3, 0x2, 0x2, 0x2, 0xb, 0x1c, 0x3, 0x2, 0x2, 0x2,
142
- 0xd, 0x27, 0x3, 0x2, 0x2, 0x2, 0xf, 0x29, 0x3, 0x2, 0x2, 0x2, 0x11,
143
- 0x2b, 0x3, 0x2, 0x2, 0x2, 0x13, 0x14, 0x7, 0x31, 0x2, 0x2, 0x14, 0x15,
144
- 0x7, 0x31, 0x2, 0x2, 0x15, 0x4, 0x3, 0x2, 0x2, 0x2, 0x16, 0x17, 0x7,
145
- 0x31, 0x2, 0x2, 0x17, 0x6, 0x3, 0x2, 0x2, 0x2, 0x18, 0x19, 0x7, 0x2c,
146
- 0x2, 0x2, 0x19, 0x8, 0x3, 0x2, 0x2, 0x2, 0x1a, 0x1b, 0x7, 0x23, 0x2,
147
- 0x2, 0x1b, 0xa, 0x3, 0x2, 0x2, 0x2, 0x1c, 0x20, 0x5, 0xf, 0x8, 0x2,
148
- 0x1d, 0x1f, 0x5, 0xd, 0x7, 0x2, 0x1e, 0x1d, 0x3, 0x2, 0x2, 0x2, 0x1f,
149
- 0x22, 0x3, 0x2, 0x2, 0x2, 0x20, 0x1e, 0x3, 0x2, 0x2, 0x2, 0x20, 0x21,
150
- 0x3, 0x2, 0x2, 0x2, 0x21, 0x23, 0x3, 0x2, 0x2, 0x2, 0x22, 0x20, 0x3,
151
- 0x2, 0x2, 0x2, 0x23, 0x24, 0x8, 0x6, 0x2, 0x2, 0x24, 0xc, 0x3, 0x2,
152
- 0x2, 0x2, 0x25, 0x28, 0x5, 0xf, 0x8, 0x2, 0x26, 0x28, 0x9, 0x2, 0x2,
153
- 0x2, 0x27, 0x25, 0x3, 0x2, 0x2, 0x2, 0x27, 0x26, 0x3, 0x2, 0x2, 0x2,
154
- 0x28, 0xe, 0x3, 0x2, 0x2, 0x2, 0x29, 0x2a, 0x9, 0x3, 0x2, 0x2, 0x2a,
155
- 0x10, 0x3, 0x2, 0x2, 0x2, 0x2b, 0x2f, 0x7, 0x29, 0x2, 0x2, 0x2c, 0x2e,
156
- 0xb, 0x2, 0x2, 0x2, 0x2d, 0x2c, 0x3, 0x2, 0x2, 0x2, 0x2e, 0x31, 0x3,
157
- 0x2, 0x2, 0x2, 0x2f, 0x30, 0x3, 0x2, 0x2, 0x2, 0x2f, 0x2d, 0x3, 0x2,
158
- 0x2, 0x2, 0x30, 0x32, 0x3, 0x2, 0x2, 0x2, 0x31, 0x2f, 0x3, 0x2, 0x2,
159
- 0x2, 0x32, 0x33, 0x7, 0x29, 0x2, 0x2, 0x33, 0x12, 0x3, 0x2, 0x2, 0x2,
160
- 0x6, 0x2, 0x20, 0x27, 0x2f, 0x3, 0x3, 0x6, 0x2,
161
- };
162
-
163
- atn::ATNDeserializer deserializer;
164
- _atn = deserializer.deserialize(_serializedATN);
165
-
166
- size_t count = _atn.getNumberOfDecisions();
167
- _decisionToDFA.reserve(count);
168
- for (size_t i = 0; i < count; i++) {
169
- _decisionToDFA.emplace_back(_atn.getDecisionState(i), i);
170
- }
180
+ void XPathLexer::initialize() {
181
+ std::call_once(xpathLexerOnceFlag, xpathLexerInitialize);
171
182
  }
172
-
173
- XPathLexer::Initializer XPathLexer::_init;
@@ -1,56 +1,47 @@
1
- #pragma once
2
1
 
2
+ // Generated from XPathLexer.g4 by ANTLR 4.9.3
3
3
 
4
- #include "antlr4-runtime.h"
4
+ #pragma once
5
5
 
6
6
 
7
+ #include "antlr4-runtime.h"
7
8
 
8
9
 
9
10
  class XPathLexer : public antlr4::Lexer {
10
11
  public:
11
12
  enum {
12
- TOKEN_REF = 1, RULE_REF = 2, ANYWHERE = 3, ROOT = 4, WILDCARD = 5, BANG = 6,
13
+ TOKEN_REF = 1, RULE_REF = 2, ANYWHERE = 3, ROOT = 4, WILDCARD = 5, BANG = 6,
13
14
  ID = 7, STRING = 8
14
15
  };
15
16
 
16
- XPathLexer(antlr4::CharStream *input);
17
- ~XPathLexer();
17
+ explicit XPathLexer(antlr4::CharStream *input);
18
+
19
+ ~XPathLexer() override;
18
20
 
19
21
  virtual std::string getGrammarFileName() const override;
22
+
20
23
  virtual const std::vector<std::string>& getRuleNames() const override;
21
24
 
22
25
  virtual const std::vector<std::string>& getChannelNames() const override;
26
+
23
27
  virtual const std::vector<std::string>& getModeNames() const override;
24
- virtual const std::vector<std::string>& getTokenNames() const override; // deprecated, use vocabulary instead
25
- virtual antlr4::dfa::Vocabulary& getVocabulary() const override;
26
28
 
27
- virtual const std::vector<uint16_t> getSerializedATN() const override;
28
- virtual const antlr4::atn::ATN& getATN() const override;
29
+ virtual const antlr4::dfa::Vocabulary& getVocabulary() const override;
29
30
 
30
- virtual void action(antlr4::RuleContext *context, size_t ruleIndex, size_t actionIndex) override;
31
- private:
32
- static std::vector<antlr4::dfa::DFA> _decisionToDFA;
33
- static antlr4::atn::PredictionContextCache _sharedContextCache;
34
- static std::vector<std::string> _ruleNames;
35
- static std::vector<std::string> _tokenNames;
36
- static std::vector<std::string> _channelNames;
37
- static std::vector<std::string> _modeNames;
31
+ virtual antlr4::atn::SerializedATNView getSerializedATN() const override;
38
32
 
39
- static std::vector<std::string> _literalNames;
40
- static std::vector<std::string> _symbolicNames;
41
- static antlr4::dfa::Vocabulary _vocabulary;
42
- static antlr4::atn::ATN _atn;
43
- static std::vector<uint16_t> _serializedATN;
33
+ virtual const antlr4::atn::ATN& getATN() const override;
44
34
 
35
+ virtual void action(antlr4::RuleContext *context, size_t ruleIndex, size_t actionIndex) override;
45
36
 
37
+ // By default the static state used to implement the lexer is lazily initialized during the first
38
+ // call to the constructor. You can call this function if you wish to initialize the static state
39
+ // ahead of time.
40
+ static void initialize();
41
+ private:
46
42
  // Individual action functions triggered by action() above.
47
43
  void IDAction(antlr4::RuleContext *context, size_t actionIndex);
48
44
 
49
45
  // Individual semantic predicate functions triggered by sempred() above.
50
-
51
- struct Initializer {
52
- Initializer();
53
- };
54
- static Initializer _init;
55
46
  };
56
47
 
@@ -18,7 +18,7 @@ XPathRuleElement::XPathRuleElement(const std::string &ruleName, size_t ruleIndex
18
18
  std::vector<ParseTree *> XPathRuleElement::evaluate(ParseTree *t) {
19
19
  // return all children of t that match nodeName
20
20
  std::vector<ParseTree *> nodes;
21
- for (auto c : t->children) {
21
+ for (auto *c : t->children) {
22
22
  if (antlrcpp::is<ParserRuleContext *>(c)) {
23
23
  ParserRuleContext *ctx = dynamic_cast<ParserRuleContext *>(c);
24
24
  if ((ctx->getRuleIndex() == _ruleIndex && !_invert) || (ctx->getRuleIndex() != _ruleIndex && _invert)) {
@@ -21,7 +21,7 @@ XPathTokenElement::XPathTokenElement(const std::string &tokenName, size_t tokenT
21
21
  std::vector<ParseTree *> XPathTokenElement::evaluate(ParseTree *t) {
22
22
  // return all children of t that match nodeName
23
23
  std::vector<ParseTree *> nodes;
24
- for (auto c : t->children) {
24
+ for (auto *c : t->children) {
25
25
  if (antlrcpp::is<TerminalNode *>(c)) {
26
26
  TerminalNode *tnode = dynamic_cast<TerminalNode *>(c);
27
27
  if ((tnode->getSymbol()->getType() == _tokenType && !_invert) || (tnode->getSymbol()->getType() != _tokenType && _invert)) {