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
@@ -3,12 +3,11 @@
3
3
  archiveVersion = 1;
4
4
  classes = {
5
5
  };
6
- objectVersion = 46;
6
+ objectVersion = 54;
7
7
  objects = {
8
8
 
9
9
  /* Begin PBXBuildFile section */
10
10
  270C67F31CDB4F1E00116E17 /* antlrcpp_ios.h in Headers */ = {isa = PBXBuildFile; fileRef = 270C67F21CDB4F1E00116E17 /* antlrcpp_ios.h */; settings = {ATTRIBUTES = (Public, ); }; };
11
- 270C69E01CDB536A00116E17 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 270C69DF1CDB536A00116E17 /* CoreFoundation.framework */; };
12
11
  276566E01DA93BFB000869BE /* ParseTree.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 276566DF1DA93BFB000869BE /* ParseTree.cpp */; };
13
12
  276566E11DA93BFB000869BE /* ParseTree.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 276566DF1DA93BFB000869BE /* ParseTree.cpp */; };
14
13
  276566E21DA93BFB000869BE /* ParseTree.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 276566DF1DA93BFB000869BE /* ParseTree.cpp */; };
@@ -645,12 +644,12 @@
645
644
  276E5FBC1CDB57AA003FF4B4 /* Declarations.h in Headers */ = {isa = PBXBuildFile; fileRef = 276E5CEA1CDB57AA003FF4B4 /* Declarations.h */; };
646
645
  276E5FBD1CDB57AA003FF4B4 /* Declarations.h in Headers */ = {isa = PBXBuildFile; fileRef = 276E5CEA1CDB57AA003FF4B4 /* Declarations.h */; };
647
646
  276E5FBE1CDB57AA003FF4B4 /* Declarations.h in Headers */ = {isa = PBXBuildFile; fileRef = 276E5CEA1CDB57AA003FF4B4 /* Declarations.h */; settings = {ATTRIBUTES = (Public, ); }; };
648
- 276E5FBF1CDB57AA003FF4B4 /* guid.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 276E5CEB1CDB57AA003FF4B4 /* guid.cpp */; };
649
- 276E5FC01CDB57AA003FF4B4 /* guid.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 276E5CEB1CDB57AA003FF4B4 /* guid.cpp */; };
650
- 276E5FC11CDB57AA003FF4B4 /* guid.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 276E5CEB1CDB57AA003FF4B4 /* guid.cpp */; };
651
- 276E5FC21CDB57AA003FF4B4 /* guid.h in Headers */ = {isa = PBXBuildFile; fileRef = 276E5CEC1CDB57AA003FF4B4 /* guid.h */; };
652
- 276E5FC31CDB57AA003FF4B4 /* guid.h in Headers */ = {isa = PBXBuildFile; fileRef = 276E5CEC1CDB57AA003FF4B4 /* guid.h */; };
653
- 276E5FC41CDB57AA003FF4B4 /* guid.h in Headers */ = {isa = PBXBuildFile; fileRef = 276E5CEC1CDB57AA003FF4B4 /* guid.h */; settings = {ATTRIBUTES = (Public, ); }; };
647
+ 276E5FBF1CDB57AA003FF4B4 /* Guid.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 276E5CEB1CDB57AA003FF4B4 /* Guid.cpp */; };
648
+ 276E5FC01CDB57AA003FF4B4 /* Guid.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 276E5CEB1CDB57AA003FF4B4 /* Guid.cpp */; };
649
+ 276E5FC11CDB57AA003FF4B4 /* Guid.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 276E5CEB1CDB57AA003FF4B4 /* Guid.cpp */; };
650
+ 276E5FC21CDB57AA003FF4B4 /* Guid.h in Headers */ = {isa = PBXBuildFile; fileRef = 276E5CEC1CDB57AA003FF4B4 /* Guid.h */; };
651
+ 276E5FC31CDB57AA003FF4B4 /* Guid.h in Headers */ = {isa = PBXBuildFile; fileRef = 276E5CEC1CDB57AA003FF4B4 /* Guid.h */; };
652
+ 276E5FC41CDB57AA003FF4B4 /* Guid.h in Headers */ = {isa = PBXBuildFile; fileRef = 276E5CEC1CDB57AA003FF4B4 /* Guid.h */; settings = {ATTRIBUTES = (Public, ); }; };
654
653
  276E5FC51CDB57AA003FF4B4 /* StringUtils.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 276E5CED1CDB57AA003FF4B4 /* StringUtils.cpp */; };
655
654
  276E5FC61CDB57AA003FF4B4 /* StringUtils.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 276E5CED1CDB57AA003FF4B4 /* StringUtils.cpp */; };
656
655
  276E5FC71CDB57AA003FF4B4 /* StringUtils.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 276E5CED1CDB57AA003FF4B4 /* StringUtils.cpp */; };
@@ -927,7 +926,6 @@
927
926
  270C67F01CDB4F1E00116E17 /* antlr4_ios.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = antlr4_ios.framework; sourceTree = BUILT_PRODUCTS_DIR; };
928
927
  270C67F21CDB4F1E00116E17 /* antlrcpp_ios.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = antlrcpp_ios.h; sourceTree = "<group>"; wrapsLines = 0; };
929
928
  270C67F41CDB4F1E00116E17 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
930
- 270C69DF1CDB536A00116E17 /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.3.sdk/System/Library/Frameworks/CoreFoundation.framework; sourceTree = DEVELOPER_DIR; };
931
929
  276566DF1DA93BFB000869BE /* ParseTree.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ParseTree.cpp; sourceTree = "<group>"; };
932
930
  276E5C0C1CDB57AA003FF4B4 /* ANTLRErrorListener.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ANTLRErrorListener.h; sourceTree = "<group>"; wrapsLines = 0; };
933
931
  276E5C0D1CDB57AA003FF4B4 /* ANTLRErrorStrategy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ANTLRErrorStrategy.h; sourceTree = "<group>"; };
@@ -1140,8 +1138,8 @@
1140
1138
  276E5CE81CDB57AA003FF4B4 /* CPPUtils.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CPPUtils.cpp; sourceTree = "<group>"; wrapsLines = 0; };
1141
1139
  276E5CE91CDB57AA003FF4B4 /* CPPUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = CPPUtils.h; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
1142
1140
  276E5CEA1CDB57AA003FF4B4 /* Declarations.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Declarations.h; sourceTree = "<group>"; };
1143
- 276E5CEB1CDB57AA003FF4B4 /* guid.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = guid.cpp; sourceTree = "<group>"; };
1144
- 276E5CEC1CDB57AA003FF4B4 /* guid.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = guid.h; sourceTree = "<group>"; };
1141
+ 276E5CEB1CDB57AA003FF4B4 /* Guid.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Guid.cpp; sourceTree = "<group>"; };
1142
+ 276E5CEC1CDB57AA003FF4B4 /* Guid.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Guid.h; sourceTree = "<group>"; };
1145
1143
  276E5CED1CDB57AA003FF4B4 /* StringUtils.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StringUtils.cpp; sourceTree = "<group>"; };
1146
1144
  276E5CEE1CDB57AA003FF4B4 /* StringUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StringUtils.h; sourceTree = "<group>"; };
1147
1145
  276E5CF01CDB57AA003FF4B4 /* Token.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Token.h; sourceTree = "<group>"; };
@@ -1242,7 +1240,6 @@
1242
1240
  isa = PBXFrameworksBuildPhase;
1243
1241
  buildActionMask = 2147483647;
1244
1242
  files = (
1245
- 270C69E01CDB536A00116E17 /* CoreFoundation.framework in Frameworks */,
1246
1243
  );
1247
1244
  runOnlyForDeploymentPostprocessing = 0;
1248
1245
  };
@@ -1553,8 +1550,8 @@
1553
1550
  276E5CE81CDB57AA003FF4B4 /* CPPUtils.cpp */,
1554
1551
  276E5CE91CDB57AA003FF4B4 /* CPPUtils.h */,
1555
1552
  276E5CEA1CDB57AA003FF4B4 /* Declarations.h */,
1556
- 276E5CEB1CDB57AA003FF4B4 /* guid.cpp */,
1557
- 276E5CEC1CDB57AA003FF4B4 /* guid.h */,
1553
+ 276E5CEB1CDB57AA003FF4B4 /* Guid.cpp */,
1554
+ 276E5CEC1CDB57AA003FF4B4 /* Guid.h */,
1558
1555
  276E5CED1CDB57AA003FF4B4 /* StringUtils.cpp */,
1559
1556
  276E5CEE1CDB57AA003FF4B4 /* StringUtils.h */,
1560
1557
  );
@@ -1618,7 +1615,6 @@
1618
1615
  27874F221CCBB34200AF1C53 /* Linked Frameworks */ = {
1619
1616
  isa = PBXGroup;
1620
1617
  children = (
1621
- 270C69DF1CDB536A00116E17 /* CoreFoundation.framework */,
1622
1618
  27874F1D1CCB7A0700AF1C53 /* CoreFoundation.framework */,
1623
1619
  );
1624
1620
  name = "Linked Frameworks";
@@ -1767,7 +1763,7 @@
1767
1763
  276E5F581CDB57AA003FF4B4 /* LexerNoViableAltException.h in Headers */,
1768
1764
  276E5D811CDB57AA003FF4B4 /* ATNSimulator.h in Headers */,
1769
1765
  27DB44B61D0463CC007E790B /* XPathLexer.h in Headers */,
1770
- 276E5FC41CDB57AA003FF4B4 /* guid.h in Headers */,
1766
+ 276E5FC41CDB57AA003FF4B4 /* Guid.h in Headers */,
1771
1767
  276E602D1CDB57AA003FF4B4 /* TagChunk.h in Headers */,
1772
1768
  276E5E951CDB57AA003FF4B4 /* RuleStopState.h in Headers */,
1773
1769
  276E5F761CDB57AA003FF4B4 /* Predicate.h in Headers */,
@@ -1934,7 +1930,7 @@
1934
1930
  276E60141CDB57AA003FF4B4 /* ParseTreeMatch.h in Headers */,
1935
1931
  276E5F571CDB57AA003FF4B4 /* LexerNoViableAltException.h in Headers */,
1936
1932
  276E5D801CDB57AA003FF4B4 /* ATNSimulator.h in Headers */,
1937
- 276E5FC31CDB57AA003FF4B4 /* guid.h in Headers */,
1933
+ 276E5FC31CDB57AA003FF4B4 /* Guid.h in Headers */,
1938
1934
  276E602C1CDB57AA003FF4B4 /* TagChunk.h in Headers */,
1939
1935
  276E5E941CDB57AA003FF4B4 /* RuleStopState.h in Headers */,
1940
1936
  276E5F751CDB57AA003FF4B4 /* Predicate.h in Headers */,
@@ -2092,7 +2088,7 @@
2092
2088
  276E60131CDB57AA003FF4B4 /* ParseTreeMatch.h in Headers */,
2093
2089
  276E5F561CDB57AA003FF4B4 /* LexerNoViableAltException.h in Headers */,
2094
2090
  276E5D7F1CDB57AA003FF4B4 /* ATNSimulator.h in Headers */,
2095
- 276E5FC21CDB57AA003FF4B4 /* guid.h in Headers */,
2091
+ 276E5FC21CDB57AA003FF4B4 /* Guid.h in Headers */,
2096
2092
  276E602B1CDB57AA003FF4B4 /* TagChunk.h in Headers */,
2097
2093
  276E5E931CDB57AA003FF4B4 /* RuleStopState.h in Headers */,
2098
2094
  276E5F741CDB57AA003FF4B4 /* Predicate.h in Headers */,
@@ -2226,7 +2222,7 @@
2226
2222
  37D727A21867AF1E007B6D10 /* Project object */ = {
2227
2223
  isa = PBXProject;
2228
2224
  attributes = {
2229
- LastUpgradeCheck = 1030;
2225
+ LastUpgradeCheck = 1240;
2230
2226
  ORGANIZATIONNAME = ANTLR;
2231
2227
  TargetAttributes = {
2232
2228
  270C67EF1CDB4F1E00116E17 = {
@@ -2238,7 +2234,7 @@
2238
2234
  };
2239
2235
  };
2240
2236
  buildConfigurationList = 37D727A51867AF1E007B6D10 /* Build configuration list for PBXProject "antlrcpp" */;
2241
- compatibilityVersion = "Xcode 3.2";
2237
+ compatibilityVersion = "Xcode 12.0";
2242
2238
  developmentRegion = en;
2243
2239
  hasScannedForEncodings = 0;
2244
2240
  knownRegions = (
@@ -2368,7 +2364,7 @@
2368
2364
  276E5E861CDB57AA003FF4B4 /* RangeTransition.cpp in Sources */,
2369
2365
  276E5D7E1CDB57AA003FF4B4 /* ATNSimulator.cpp in Sources */,
2370
2366
  276E5D9C1CDB57AA003FF4B4 /* BasicState.cpp in Sources */,
2371
- 276E5FC11CDB57AA003FF4B4 /* guid.cpp in Sources */,
2367
+ 276E5FC11CDB57AA003FF4B4 /* Guid.cpp in Sources */,
2372
2368
  276E5E801CDB57AA003FF4B4 /* ProfilingATNSimulator.cpp in Sources */,
2373
2369
  2793DCA91F08095F00A84290 /* ANTLRErrorStrategy.cpp in Sources */,
2374
2370
  276E5F401CDB57AA003FF4B4 /* IntStream.cpp in Sources */,
@@ -2522,7 +2518,7 @@
2522
2518
  276E5E851CDB57AA003FF4B4 /* RangeTransition.cpp in Sources */,
2523
2519
  276E5D7D1CDB57AA003FF4B4 /* ATNSimulator.cpp in Sources */,
2524
2520
  276E5D9B1CDB57AA003FF4B4 /* BasicState.cpp in Sources */,
2525
- 276E5FC01CDB57AA003FF4B4 /* guid.cpp in Sources */,
2521
+ 276E5FC01CDB57AA003FF4B4 /* Guid.cpp in Sources */,
2526
2522
  276E5E7F1CDB57AA003FF4B4 /* ProfilingATNSimulator.cpp in Sources */,
2527
2523
  2793DCA81F08095F00A84290 /* ANTLRErrorStrategy.cpp in Sources */,
2528
2524
  276E5F3F1CDB57AA003FF4B4 /* IntStream.cpp in Sources */,
@@ -2676,7 +2672,7 @@
2676
2672
  276E5E841CDB57AA003FF4B4 /* RangeTransition.cpp in Sources */,
2677
2673
  276E5D7C1CDB57AA003FF4B4 /* ATNSimulator.cpp in Sources */,
2678
2674
  276E5D9A1CDB57AA003FF4B4 /* BasicState.cpp in Sources */,
2679
- 276E5FBF1CDB57AA003FF4B4 /* guid.cpp in Sources */,
2675
+ 276E5FBF1CDB57AA003FF4B4 /* Guid.cpp in Sources */,
2680
2676
  276E5E7E1CDB57AA003FF4B4 /* ProfilingATNSimulator.cpp in Sources */,
2681
2677
  2793DCA71F08095F00A84290 /* ANTLRErrorStrategy.cpp in Sources */,
2682
2678
  276E5F3E1CDB57AA003FF4B4 /* IntStream.cpp in Sources */,
@@ -2737,6 +2733,7 @@
2737
2733
  isa = XCBuildConfiguration;
2738
2734
  buildSettings = {
2739
2735
  CLANG_ANALYZER_NONNULL = YES;
2736
+ CLANG_CXX_LANGUAGE_STANDARD = "c++17";
2740
2737
  CLANG_ENABLE_MODULES = YES;
2741
2738
  CLANG_WARN_UNREACHABLE_CODE = YES;
2742
2739
  "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
@@ -2751,8 +2748,12 @@
2751
2748
  GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
2752
2749
  INFOPLIST_FILE = "antlrcpp-ios/Info.plist";
2753
2750
  INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
2754
- IPHONEOS_DEPLOYMENT_TARGET = 9.3;
2755
- LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
2751
+ IPHONEOS_DEPLOYMENT_TARGET = 12.0;
2752
+ LD_RUNPATH_SEARCH_PATHS = (
2753
+ "$(inherited)",
2754
+ "@executable_path/Frameworks",
2755
+ "@loader_path/Frameworks",
2756
+ );
2756
2757
  MTL_ENABLE_DEBUG_INFO = YES;
2757
2758
  PRODUCT_BUNDLE_IDENTIFIER = "org.antlr.v4.runtime.antlrcpp-ios";
2758
2759
  PRODUCT_NAME = "$(TARGET_NAME)";
@@ -2768,6 +2769,7 @@
2768
2769
  isa = XCBuildConfiguration;
2769
2770
  buildSettings = {
2770
2771
  CLANG_ANALYZER_NONNULL = YES;
2772
+ CLANG_CXX_LANGUAGE_STANDARD = "c++17";
2771
2773
  CLANG_ENABLE_MODULES = YES;
2772
2774
  CLANG_WARN_UNREACHABLE_CODE = YES;
2773
2775
  "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
@@ -2782,8 +2784,12 @@
2782
2784
  GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
2783
2785
  INFOPLIST_FILE = "antlrcpp-ios/Info.plist";
2784
2786
  INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
2785
- IPHONEOS_DEPLOYMENT_TARGET = 9.3;
2786
- LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
2787
+ IPHONEOS_DEPLOYMENT_TARGET = 12.0;
2788
+ LD_RUNPATH_SEARCH_PATHS = (
2789
+ "$(inherited)",
2790
+ "@executable_path/Frameworks",
2791
+ "@loader_path/Frameworks",
2792
+ );
2787
2793
  MTL_ENABLE_DEBUG_INFO = NO;
2788
2794
  PRODUCT_BUNDLE_IDENTIFIER = "org.antlr.v4.runtime.antlrcpp-ios";
2789
2795
  PRODUCT_NAME = "$(TARGET_NAME)";
@@ -2799,6 +2805,7 @@
2799
2805
  37C1471F1B4D5A04008EDDDB /* Debug */ = {
2800
2806
  isa = XCBuildConfiguration;
2801
2807
  buildSettings = {
2808
+ CLANG_CXX_LANGUAGE_STANDARD = "c++17";
2802
2809
  CLANG_ENABLE_MODULES = YES;
2803
2810
  CLANG_WARN_UNREACHABLE_CODE = YES;
2804
2811
  COMBINE_HIDPI_IMAGES = YES;
@@ -2821,6 +2828,7 @@
2821
2828
  37C147201B4D5A04008EDDDB /* Release */ = {
2822
2829
  isa = XCBuildConfiguration;
2823
2830
  buildSettings = {
2831
+ CLANG_CXX_LANGUAGE_STANDARD = "c++17";
2824
2832
  CLANG_ENABLE_MODULES = YES;
2825
2833
  CLANG_WARN_UNREACHABLE_CODE = YES;
2826
2834
  COMBINE_HIDPI_IMAGES = YES;
@@ -2841,8 +2849,7 @@
2841
2849
  buildSettings = {
2842
2850
  ALWAYS_SEARCH_USER_PATHS = NO;
2843
2851
  CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
2844
- CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
2845
- CLANG_CXX_LIBRARY = "libc++";
2852
+ CLANG_CXX_LANGUAGE_STANDARD = "c++17";
2846
2853
  CLANG_ENABLE_OBJC_ARC = YES;
2847
2854
  CLANG_WARN_ASSIGN_ENUM = YES;
2848
2855
  CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
@@ -2857,6 +2864,7 @@
2857
2864
  CLANG_WARN_INT_CONVERSION = YES;
2858
2865
  CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
2859
2866
  CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
2867
+ CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
2860
2868
  CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
2861
2869
  CLANG_WARN_STRICT_PROTOTYPES = YES;
2862
2870
  CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = YES;
@@ -2889,8 +2897,12 @@
2889
2897
  GCC_WARN_UNUSED_LABEL = YES;
2890
2898
  GCC_WARN_UNUSED_PARAMETER = YES;
2891
2899
  GCC_WARN_UNUSED_VARIABLE = YES;
2892
- HEADER_SEARCH_PATHS = src/;
2893
- MACOSX_DEPLOYMENT_TARGET = 10.9;
2900
+ HEADER_SEARCH_PATHS = (
2901
+ src/,
2902
+ thirdparty/utfcpp/source/,
2903
+ thirdparty/utfcpp/source/utf8/,
2904
+ );
2905
+ MACOSX_DEPLOYMENT_TARGET = 11.1;
2894
2906
  ONLY_ACTIVE_ARCH = YES;
2895
2907
  SDKROOT = macosx;
2896
2908
  };
@@ -2901,8 +2913,7 @@
2901
2913
  buildSettings = {
2902
2914
  ALWAYS_SEARCH_USER_PATHS = NO;
2903
2915
  CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
2904
- CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
2905
- CLANG_CXX_LIBRARY = "libc++";
2916
+ CLANG_CXX_LANGUAGE_STANDARD = "c++17";
2906
2917
  CLANG_ENABLE_OBJC_ARC = YES;
2907
2918
  CLANG_WARN_ASSIGN_ENUM = YES;
2908
2919
  CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
@@ -2917,6 +2928,7 @@
2917
2928
  CLANG_WARN_INT_CONVERSION = YES;
2918
2929
  CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
2919
2930
  CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
2931
+ CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
2920
2932
  CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
2921
2933
  CLANG_WARN_STRICT_PROTOTYPES = YES;
2922
2934
  CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = YES;
@@ -2945,8 +2957,12 @@
2945
2957
  GCC_WARN_UNUSED_LABEL = YES;
2946
2958
  GCC_WARN_UNUSED_PARAMETER = YES;
2947
2959
  GCC_WARN_UNUSED_VARIABLE = YES;
2948
- HEADER_SEARCH_PATHS = src/;
2949
- MACOSX_DEPLOYMENT_TARGET = 10.9;
2960
+ HEADER_SEARCH_PATHS = (
2961
+ src/,
2962
+ thirdparty/utfcpp/source/,
2963
+ thirdparty/utfcpp/source/utf8/,
2964
+ );
2965
+ MACOSX_DEPLOYMENT_TARGET = 11.1;
2950
2966
  SDKROOT = macosx;
2951
2967
  };
2952
2968
  name = Release;
@@ -1,6 +1,6 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
2
  <Scheme
3
- LastUpgradeVersion = "1030"
3
+ LastUpgradeVersion = "1240"
4
4
  version = "1.3">
5
5
  <BuildAction
6
6
  parallelizeBuildables = "YES"
@@ -1,6 +1,6 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
2
  <Scheme
3
- LastUpgradeVersion = "1030"
3
+ LastUpgradeVersion = "1240"
4
4
  version = "1.3">
5
5
  <BuildAction
6
6
  parallelizeBuildables = "YES"
@@ -29,8 +29,6 @@
29
29
  shouldUseLaunchSchemeArgsEnv = "YES">
30
30
  <Testables>
31
31
  </Testables>
32
- <AdditionalOptions>
33
- </AdditionalOptions>
34
32
  </TestAction>
35
33
  <LaunchAction
36
34
  buildConfiguration = "Debug"
@@ -51,8 +49,6 @@
51
49
  ReferencedContainer = "container:antlrcpp.xcodeproj">
52
50
  </BuildableReference>
53
51
  </MacroExpansion>
54
- <AdditionalOptions>
55
- </AdditionalOptions>
56
52
  </LaunchAction>
57
53
  <ProfileAction
58
54
  buildConfiguration = "Release"
@@ -1,6 +1,6 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
2
  <Scheme
3
- LastUpgradeVersion = "1030"
3
+ LastUpgradeVersion = "1240"
4
4
  version = "1.3">
5
5
  <BuildAction
6
6
  parallelizeBuildables = "YES"
@@ -29,8 +29,6 @@
29
29
  shouldUseLaunchSchemeArgsEnv = "YES">
30
30
  <Testables>
31
31
  </Testables>
32
- <AdditionalOptions>
33
- </AdditionalOptions>
34
32
  </TestAction>
35
33
  <LaunchAction
36
34
  buildConfiguration = "Debug"
@@ -51,8 +49,6 @@
51
49
  ReferencedContainer = "container:antlrcpp.xcodeproj">
52
50
  </BuildableReference>
53
51
  </MacroExpansion>
54
- <AdditionalOptions>
55
- </AdditionalOptions>
56
52
  </LaunchAction>
57
53
  <ProfileAction
58
54
  buildConfiguration = "Release"
@@ -1,30 +1,19 @@
1
- /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
1
+ /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
2
2
  * Use of this file is governed by the BSD 3-clause license that
3
3
  * can be found in the LICENSE.txt file in the project root.
4
4
  */
5
5
 
6
- #include "support/StringUtils.h"
7
-
8
6
  #include "ANTLRFileStream.h"
9
7
 
10
8
  using namespace antlr4;
11
9
 
12
- ANTLRFileStream::ANTLRFileStream(const std::string &fileName) {
13
- _fileName = fileName;
14
- loadFromFile(fileName);
15
- }
16
-
17
10
  void ANTLRFileStream::loadFromFile(const std::string &fileName) {
18
11
  _fileName = fileName;
19
12
  if (_fileName.empty()) {
20
13
  return;
21
14
  }
22
15
 
23
- #ifdef _MSC_VER
24
- std::ifstream stream(antlrcpp::s2ws(fileName), std::ios::binary);
25
- #else
26
16
  std::ifstream stream(fileName, std::ios::binary);
27
- #endif
28
17
 
29
18
  ANTLRInputStream::load(stream);
30
19
  }
@@ -1,4 +1,4 @@
1
- /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
1
+ /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
2
2
  * Use of this file is governed by the BSD 3-clause license that
3
3
  * can be found in the LICENSE.txt file in the project root.
4
4
  */
@@ -13,15 +13,18 @@ namespace antlr4 {
13
13
  /// when you construct the object (or call load()).
14
14
  // TODO: this class needs testing.
15
15
  class ANTLR4CPP_PUBLIC ANTLRFileStream : public ANTLRInputStream {
16
- protected:
17
- std::string _fileName; // UTF-8 encoded file name.
18
-
19
16
  public:
20
- // Assumes a file name encoded in UTF-8 and file content in the same encoding (with or w/o BOM).
21
- ANTLRFileStream(const std::string &fileName);
17
+ ANTLRFileStream() = default;
18
+ ANTLRFileStream(const std::string &) = delete;
19
+ ANTLRFileStream(const char *data, size_t length) = delete;
20
+ ANTLRFileStream(std::istream &stream) = delete;
22
21
 
22
+ // Assumes a file name encoded in UTF-8 and file content in the same encoding (with or w/o BOM).
23
23
  virtual void loadFromFile(const std::string &fileName);
24
24
  virtual std::string getSourceName() const override;
25
+
26
+ private:
27
+ std::string _fileName; // UTF-8 encoded file name.
25
28
  };
26
29
 
27
30
  } // namespace antlr4
@@ -1,13 +1,15 @@
1
- /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
1
+ /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
2
2
  * Use of this file is governed by the BSD 3-clause license that
3
3
  * can be found in the LICENSE.txt file in the project root.
4
4
  */
5
5
 
6
+ #include <string.h>
7
+
6
8
  #include "Exceptions.h"
7
9
  #include "misc/Interval.h"
8
10
  #include "IntStream.h"
9
11
 
10
- #include "support/StringUtils.h"
12
+ #include "support/Utf8.h"
11
13
  #include "support/CPPUtils.h"
12
14
 
13
15
  #include "ANTLRInputStream.h"
@@ -17,38 +19,53 @@ using namespace antlrcpp;
17
19
 
18
20
  using misc::Interval;
19
21
 
20
- ANTLRInputStream::ANTLRInputStream(const std::string &input) {
22
+ ANTLRInputStream::ANTLRInputStream() {
21
23
  InitializeInstanceFields();
22
- load(input);
23
24
  }
24
25
 
25
- ANTLRInputStream::ANTLRInputStream(const char data_[], size_t numberOfActualCharsInArray)
26
- : ANTLRInputStream(std::string(data_, numberOfActualCharsInArray)) {
26
+ ANTLRInputStream::ANTLRInputStream(std::string_view input): ANTLRInputStream() {
27
+ load(input.data(), input.length());
27
28
  }
28
29
 
29
- ANTLRInputStream::ANTLRInputStream(std::istream &stream) {
30
- InitializeInstanceFields();
30
+ ANTLRInputStream::ANTLRInputStream(const char *data, size_t length) {
31
+ load(data, length);
32
+ }
33
+
34
+ ANTLRInputStream::ANTLRInputStream(std::istream &stream): ANTLRInputStream() {
31
35
  load(stream);
32
36
  }
33
37
 
34
- void ANTLRInputStream::load(const std::string &input) {
38
+ void ANTLRInputStream::load(const std::string &input, bool lenient) {
39
+ load(input.data(), input.size(), lenient);
40
+ }
41
+
42
+ void ANTLRInputStream::load(const char *data, size_t length, bool lenient) {
35
43
  // Remove the UTF-8 BOM if present.
36
- const char bom[4] = "\xef\xbb\xbf";
37
- if (input.compare(0, 3, bom, 3) == 0)
38
- _data = antlrcpp::utf8_to_utf32(input.data() + 3, input.data() + input.size());
39
- else
40
- _data = antlrcpp::utf8_to_utf32(input.data(), input.data() + input.size());
44
+ const char *bom = "\xef\xbb\xbf";
45
+ if (length >= 3 && strncmp(data, bom, 3) == 0) {
46
+ data += 3;
47
+ length -= 3;
48
+ }
49
+ if (lenient) {
50
+ _data = Utf8::lenientDecode(std::string_view(data, length));
51
+ } else {
52
+ auto maybe_utf32 = Utf8::strictDecode(std::string_view(data, length));
53
+ if (!maybe_utf32.has_value()) {
54
+ throw IllegalArgumentException("UTF-8 string contains an illegal byte sequence");
55
+ }
56
+ _data = std::move(maybe_utf32).value();
57
+ }
41
58
  p = 0;
42
59
  }
43
60
 
44
- void ANTLRInputStream::load(std::istream &stream) {
61
+ void ANTLRInputStream::load(std::istream &stream, bool lenient) {
45
62
  if (!stream.good() || stream.eof()) // No fail, bad or EOF.
46
63
  return;
47
64
 
48
65
  _data.clear();
49
66
 
50
67
  std::string s((std::istreambuf_iterator<char>(stream)), std::istreambuf_iterator<char>());
51
- load(s);
68
+ load(s.data(), s.length(), lenient);
52
69
  }
53
70
 
54
71
  void ANTLRInputStream::reset() {
@@ -136,7 +153,11 @@ std::string ANTLRInputStream::getText(const Interval &interval) {
136
153
  return "";
137
154
  }
138
155
 
139
- return antlrcpp::utf32_to_utf8(_data.substr(start, count));
156
+ auto maybeUtf8 = Utf8::strictEncode(std::u32string_view(_data).substr(start, count));
157
+ if (!maybeUtf8.has_value()) {
158
+ throw IllegalArgumentException("Input stream contains invalid Unicode code points");
159
+ }
160
+ return std::move(maybeUtf8).value();
140
161
  }
141
162
 
142
163
  std::string ANTLRInputStream::getSourceName() const {
@@ -147,7 +168,11 @@ std::string ANTLRInputStream::getSourceName() const {
147
168
  }
148
169
 
149
170
  std::string ANTLRInputStream::toString() const {
150
- return antlrcpp::utf32_to_utf8(_data);
171
+ auto maybeUtf8 = Utf8::strictEncode(_data);
172
+ if (!maybeUtf8.has_value()) {
173
+ throw IllegalArgumentException("Input stream contains invalid Unicode code points");
174
+ }
175
+ return std::move(maybeUtf8).value();
151
176
  }
152
177
 
153
178
  void ANTLRInputStream::InitializeInstanceFields() {
@@ -1,10 +1,12 @@
1
- /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
1
+ /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
2
2
  * Use of this file is governed by the BSD 3-clause license that
3
3
  * can be found in the LICENSE.txt file in the project root.
4
4
  */
5
5
 
6
6
  #pragma once
7
7
 
8
+ #include <string_view>
9
+
8
10
  #include "CharStream.h"
9
11
 
10
12
  namespace antlr4 {
@@ -16,7 +18,7 @@ namespace antlr4 {
16
18
  protected:
17
19
  /// The data being scanned.
18
20
  // UTF-32
19
- UTF32String _data;
21
+ std::u32string _data;
20
22
 
21
23
  /// 0..n-1 index into string of next char </summary>
22
24
  size_t p;
@@ -25,12 +27,20 @@ namespace antlr4 {
25
27
  /// What is name or source of this char stream?
26
28
  std::string name;
27
29
 
28
- ANTLRInputStream(const std::string &input = "");
29
- ANTLRInputStream(const char data_[], size_t numberOfActualCharsInArray);
30
+ ANTLRInputStream();
31
+
32
+ ANTLRInputStream(std::string_view input);
33
+
34
+ ANTLRInputStream(const char *data, size_t length);
30
35
  ANTLRInputStream(std::istream &stream);
31
36
 
32
- virtual void load(const std::string &input);
33
- virtual void load(std::istream &stream);
37
+ virtual void load(const std::string &input, bool lenient);
38
+ virtual void load(const char *data, size_t length, bool lenient);
39
+ virtual void load(std::istream &stream, bool lenient);
40
+
41
+ virtual void load(const std::string &input) { load(input, false); }
42
+ virtual void load(const char *data, size_t length) { load(data, length, false); }
43
+ virtual void load(std::istream &stream) { load(stream, false); }
34
44
 
35
45
  /// Reset the stream so that it's in the same state it was
36
46
  /// when the object was created *except* the data array is not
@@ -10,8 +10,8 @@
10
10
 
11
11
  #include "misc/Interval.h"
12
12
 
13
- #include "support/StringUtils.h"
14
13
  #include "support/CPPUtils.h"
14
+ #include "support/StringUtils.h"
15
15
 
16
16
  #include "CommonToken.h"
17
17
 
@@ -165,9 +165,7 @@ std::string CommonToken::toString(Recognizer *r) const {
165
165
  }
166
166
  std::string txt = getText();
167
167
  if (!txt.empty()) {
168
- antlrcpp::replaceAll(txt, "\n", "\\n");
169
- antlrcpp::replaceAll(txt, "\r", "\\r");
170
- antlrcpp::replaceAll(txt, "\t", "\\t");
168
+ txt = antlrcpp::escapeWhitespace(txt);
171
169
  } else {
172
170
  txt = "<no text>";
173
171
  }
@@ -11,7 +11,7 @@
11
11
 
12
12
  using namespace antlr4;
13
13
 
14
- const Ref<TokenFactory<CommonToken>> CommonTokenFactory::DEFAULT = std::make_shared<CommonTokenFactory>();
14
+ const std::unique_ptr<TokenFactory<CommonToken>> CommonTokenFactory::DEFAULT(new CommonTokenFactory);
15
15
 
16
16
  CommonTokenFactory::CommonTokenFactory(bool copyText_) : copyText(copyText_) {
17
17
  }
@@ -22,7 +22,7 @@ namespace antlr4 {
22
22
  * This token factory does not explicitly copy token text when constructing
23
23
  * tokens.</p>
24
24
  */
25
- static const Ref<TokenFactory<CommonToken>> DEFAULT;
25
+ static const std::unique_ptr<TokenFactory<CommonToken>> DEFAULT;
26
26
 
27
27
  protected:
28
28
  /**