dirwatch 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (534) hide show
  1. checksums.yaml +4 -4
  2. data/lib/dirwatch/templates/mac/latex.yml +1 -1
  3. data/lib/dirwatch/version.rb +1 -1
  4. data/vendor/bundle/ruby/2.5.0/cache/ast-2.4.0.gem +0 -0
  5. data/vendor/bundle/ruby/2.5.0/cache/parser-2.5.1.2.gem +0 -0
  6. data/vendor/bundle/ruby/2.5.0/cache/powerpack-0.1.2.gem +0 -0
  7. data/vendor/bundle/ruby/2.5.0/cache/rake-12.3.1.gem +0 -0
  8. data/vendor/bundle/ruby/2.5.0/cache/rspec-3.8.0.gem +0 -0
  9. data/vendor/bundle/ruby/2.5.0/cache/rspec-core-3.8.0.gem +0 -0
  10. data/vendor/bundle/ruby/2.5.0/cache/rspec-expectations-3.8.1.gem +0 -0
  11. data/vendor/bundle/ruby/2.5.0/cache/rspec-mocks-3.8.0.gem +0 -0
  12. data/vendor/bundle/ruby/2.5.0/cache/rspec-support-3.8.0.gem +0 -0
  13. data/vendor/bundle/ruby/2.5.0/cache/ruby-progressbar-1.10.0.gem +0 -0
  14. data/vendor/bundle/ruby/2.5.0/cache/unicode-display_width-1.4.0.gem +0 -0
  15. data/vendor/bundle/ruby/2.5.0/gems/ast-2.4.0/CHANGELOG.md +9 -0
  16. data/vendor/bundle/ruby/2.5.0/gems/ast-2.4.0/Gemfile +4 -0
  17. data/vendor/bundle/ruby/2.5.0/gems/ast-2.4.0/LICENSE.MIT +20 -0
  18. data/vendor/bundle/ruby/2.5.0/gems/ast-2.4.0/README.YARD.md +12 -0
  19. data/vendor/bundle/ruby/2.5.0/gems/ast-2.4.0/README.md +23 -0
  20. data/vendor/bundle/ruby/2.5.0/gems/ast-2.4.0/Rakefile +19 -0
  21. data/vendor/bundle/ruby/2.5.0/gems/ast-2.4.0/ast.gemspec +29 -0
  22. data/vendor/bundle/ruby/2.5.0/gems/ast-2.4.0/lib/ast.rb +17 -0
  23. data/vendor/bundle/ruby/2.5.0/gems/ast-2.4.0/lib/ast/node.rb +258 -0
  24. data/vendor/bundle/ruby/2.5.0/gems/ast-2.4.0/lib/ast/processor.rb +12 -0
  25. data/vendor/bundle/ruby/2.5.0/gems/ast-2.4.0/lib/ast/processor/mixin.rb +288 -0
  26. data/vendor/bundle/ruby/2.5.0/gems/ast-2.4.0/lib/ast/sexp.rb +30 -0
  27. data/vendor/bundle/ruby/2.5.0/gems/ast-2.4.0/test/helper.rb +17 -0
  28. data/vendor/bundle/ruby/2.5.0/gems/ast-2.4.0/test/test_ast.rb +271 -0
  29. data/vendor/bundle/ruby/2.5.0/gems/parser-2.5.1.2/CHANGELOG.md +927 -0
  30. data/vendor/bundle/ruby/2.5.0/gems/parser-2.5.1.2/CONTRIBUTING.md +17 -0
  31. data/vendor/bundle/ruby/2.5.0/gems/parser-2.5.1.2/Gemfile +10 -0
  32. data/vendor/bundle/ruby/2.5.0/gems/parser-2.5.1.2/LICENSE.txt +25 -0
  33. data/vendor/bundle/ruby/2.5.0/gems/parser-2.5.1.2/README.md +301 -0
  34. data/vendor/bundle/ruby/2.5.0/gems/parser-2.5.1.2/Rakefile +165 -0
  35. data/vendor/bundle/ruby/2.5.0/gems/parser-2.5.1.2/bin/ruby-parse +7 -0
  36. data/vendor/bundle/ruby/2.5.0/gems/parser-2.5.1.2/bin/ruby-rewrite +7 -0
  37. data/vendor/bundle/ruby/2.5.0/gems/parser-2.5.1.2/doc/AST_FORMAT.md +1735 -0
  38. data/vendor/bundle/ruby/2.5.0/gems/parser-2.5.1.2/doc/CUSTOMIZATION.md +37 -0
  39. data/vendor/bundle/ruby/2.5.0/gems/parser-2.5.1.2/doc/INTERNALS.md +21 -0
  40. data/vendor/bundle/ruby/2.5.0/gems/parser-2.5.1.2/doc/css/common.css +68 -0
  41. data/vendor/bundle/ruby/2.5.0/gems/parser-2.5.1.2/lib/gauntlet_parser.rb +123 -0
  42. data/vendor/bundle/ruby/2.5.0/gems/parser-2.5.1.2/lib/parser.rb +81 -0
  43. data/vendor/bundle/ruby/2.5.0/gems/parser-2.5.1.2/lib/parser/all.rb +11 -0
  44. data/vendor/bundle/ruby/2.5.0/gems/parser-2.5.1.2/lib/parser/ast/node.rb +40 -0
  45. data/vendor/bundle/ruby/2.5.0/gems/parser-2.5.1.2/lib/parser/ast/processor.rb +241 -0
  46. data/vendor/bundle/ruby/2.5.0/gems/parser-2.5.1.2/lib/parser/base.rb +267 -0
  47. data/vendor/bundle/ruby/2.5.0/gems/parser-2.5.1.2/lib/parser/builders/default.rb +1677 -0
  48. data/vendor/bundle/ruby/2.5.0/gems/parser-2.5.1.2/lib/parser/clobbering_error.rb +13 -0
  49. data/vendor/bundle/ruby/2.5.0/gems/parser-2.5.1.2/lib/parser/color.rb +32 -0
  50. data/vendor/bundle/ruby/2.5.0/gems/parser-2.5.1.2/lib/parser/context.rb +51 -0
  51. data/vendor/bundle/ruby/2.5.0/gems/parser-2.5.1.2/lib/parser/current.rb +83 -0
  52. data/vendor/bundle/ruby/2.5.0/gems/parser-2.5.1.2/lib/parser/deprecation.rb +13 -0
  53. data/vendor/bundle/ruby/2.5.0/gems/parser-2.5.1.2/lib/parser/diagnostic.rb +163 -0
  54. data/vendor/bundle/ruby/2.5.0/gems/parser-2.5.1.2/lib/parser/diagnostic/engine.rb +105 -0
  55. data/vendor/bundle/ruby/2.5.0/gems/parser-2.5.1.2/lib/parser/lexer.rb +23093 -0
  56. data/vendor/bundle/ruby/2.5.0/gems/parser-2.5.1.2/lib/parser/lexer.rl +2382 -0
  57. data/vendor/bundle/ruby/2.5.0/gems/parser-2.5.1.2/lib/parser/lexer/dedenter.rb +79 -0
  58. data/vendor/bundle/ruby/2.5.0/gems/parser-2.5.1.2/lib/parser/lexer/explanation.rb +55 -0
  59. data/vendor/bundle/ruby/2.5.0/gems/parser-2.5.1.2/lib/parser/lexer/literal.rb +265 -0
  60. data/vendor/bundle/ruby/2.5.0/gems/parser-2.5.1.2/lib/parser/lexer/stack_state.rb +49 -0
  61. data/vendor/bundle/ruby/2.5.0/gems/parser-2.5.1.2/lib/parser/macruby.rb +6122 -0
  62. data/vendor/bundle/ruby/2.5.0/gems/parser-2.5.1.2/lib/parser/macruby.y +2198 -0
  63. data/vendor/bundle/ruby/2.5.0/gems/parser-2.5.1.2/lib/parser/messages.rb +84 -0
  64. data/vendor/bundle/ruby/2.5.0/gems/parser-2.5.1.2/lib/parser/meta.rb +29 -0
  65. data/vendor/bundle/ruby/2.5.0/gems/parser-2.5.1.2/lib/parser/rewriter.rb +105 -0
  66. data/vendor/bundle/ruby/2.5.0/gems/parser-2.5.1.2/lib/parser/ruby18.rb +5654 -0
  67. data/vendor/bundle/ruby/2.5.0/gems/parser-2.5.1.2/lib/parser/ruby18.y +1934 -0
  68. data/vendor/bundle/ruby/2.5.0/gems/parser-2.5.1.2/lib/parser/ruby19.rb +6077 -0
  69. data/vendor/bundle/ruby/2.5.0/gems/parser-2.5.1.2/lib/parser/ruby19.y +2175 -0
  70. data/vendor/bundle/ruby/2.5.0/gems/parser-2.5.1.2/lib/parser/ruby20.rb +6512 -0
  71. data/vendor/bundle/ruby/2.5.0/gems/parser-2.5.1.2/lib/parser/ruby20.y +2353 -0
  72. data/vendor/bundle/ruby/2.5.0/gems/parser-2.5.1.2/lib/parser/ruby21.rb +6572 -0
  73. data/vendor/bundle/ruby/2.5.0/gems/parser-2.5.1.2/lib/parser/ruby21.y +2357 -0
  74. data/vendor/bundle/ruby/2.5.0/gems/parser-2.5.1.2/lib/parser/ruby22.rb +6600 -0
  75. data/vendor/bundle/ruby/2.5.0/gems/parser-2.5.1.2/lib/parser/ruby22.y +2364 -0
  76. data/vendor/bundle/ruby/2.5.0/gems/parser-2.5.1.2/lib/parser/ruby23.rb +6628 -0
  77. data/vendor/bundle/ruby/2.5.0/gems/parser-2.5.1.2/lib/parser/ruby23.y +2370 -0
  78. data/vendor/bundle/ruby/2.5.0/gems/parser-2.5.1.2/lib/parser/ruby24.rb +6695 -0
  79. data/vendor/bundle/ruby/2.5.0/gems/parser-2.5.1.2/lib/parser/ruby24.y +2408 -0
  80. data/vendor/bundle/ruby/2.5.0/gems/parser-2.5.1.2/lib/parser/ruby25.rb +6661 -0
  81. data/vendor/bundle/ruby/2.5.0/gems/parser-2.5.1.2/lib/parser/ruby25.y +2405 -0
  82. data/vendor/bundle/ruby/2.5.0/gems/parser-2.5.1.2/lib/parser/ruby26.rb +6674 -0
  83. data/vendor/bundle/ruby/2.5.0/gems/parser-2.5.1.2/lib/parser/ruby26.y +2413 -0
  84. data/vendor/bundle/ruby/2.5.0/gems/parser-2.5.1.2/lib/parser/rubymotion.rb +6083 -0
  85. data/vendor/bundle/ruby/2.5.0/gems/parser-2.5.1.2/lib/parser/rubymotion.y +2182 -0
  86. data/vendor/bundle/ruby/2.5.0/gems/parser-2.5.1.2/lib/parser/runner.rb +248 -0
  87. data/vendor/bundle/ruby/2.5.0/gems/parser-2.5.1.2/lib/parser/runner/ruby_parse.rb +157 -0
  88. data/vendor/bundle/ruby/2.5.0/gems/parser-2.5.1.2/lib/parser/runner/ruby_rewrite.rb +101 -0
  89. data/vendor/bundle/ruby/2.5.0/gems/parser-2.5.1.2/lib/parser/source/buffer.rb +330 -0
  90. data/vendor/bundle/ruby/2.5.0/gems/parser-2.5.1.2/lib/parser/source/comment.rb +121 -0
  91. data/vendor/bundle/ruby/2.5.0/gems/parser-2.5.1.2/lib/parser/source/comment/associator.rb +210 -0
  92. data/vendor/bundle/ruby/2.5.0/gems/parser-2.5.1.2/lib/parser/source/map.rb +186 -0
  93. data/vendor/bundle/ruby/2.5.0/gems/parser-2.5.1.2/lib/parser/source/map/collection.rb +18 -0
  94. data/vendor/bundle/ruby/2.5.0/gems/parser-2.5.1.2/lib/parser/source/map/condition.rb +21 -0
  95. data/vendor/bundle/ruby/2.5.0/gems/parser-2.5.1.2/lib/parser/source/map/constant.rb +32 -0
  96. data/vendor/bundle/ruby/2.5.0/gems/parser-2.5.1.2/lib/parser/source/map/definition.rb +23 -0
  97. data/vendor/bundle/ruby/2.5.0/gems/parser-2.5.1.2/lib/parser/source/map/for.rb +19 -0
  98. data/vendor/bundle/ruby/2.5.0/gems/parser-2.5.1.2/lib/parser/source/map/heredoc.rb +19 -0
  99. data/vendor/bundle/ruby/2.5.0/gems/parser-2.5.1.2/lib/parser/source/map/index.rb +33 -0
  100. data/vendor/bundle/ruby/2.5.0/gems/parser-2.5.1.2/lib/parser/source/map/keyword.rb +20 -0
  101. data/vendor/bundle/ruby/2.5.0/gems/parser-2.5.1.2/lib/parser/source/map/objc_kwarg.rb +19 -0
  102. data/vendor/bundle/ruby/2.5.0/gems/parser-2.5.1.2/lib/parser/source/map/operator.rb +17 -0
  103. data/vendor/bundle/ruby/2.5.0/gems/parser-2.5.1.2/lib/parser/source/map/rescue_body.rb +21 -0
  104. data/vendor/bundle/ruby/2.5.0/gems/parser-2.5.1.2/lib/parser/source/map/send.rb +36 -0
  105. data/vendor/bundle/ruby/2.5.0/gems/parser-2.5.1.2/lib/parser/source/map/ternary.rb +18 -0
  106. data/vendor/bundle/ruby/2.5.0/gems/parser-2.5.1.2/lib/parser/source/map/variable.rb +31 -0
  107. data/vendor/bundle/ruby/2.5.0/gems/parser-2.5.1.2/lib/parser/source/range.rb +310 -0
  108. data/vendor/bundle/ruby/2.5.0/gems/parser-2.5.1.2/lib/parser/source/rewriter.rb +513 -0
  109. data/vendor/bundle/ruby/2.5.0/gems/parser-2.5.1.2/lib/parser/source/rewriter/action.rb +44 -0
  110. data/vendor/bundle/ruby/2.5.0/gems/parser-2.5.1.2/lib/parser/source/tree_rewriter.rb +301 -0
  111. data/vendor/bundle/ruby/2.5.0/gems/parser-2.5.1.2/lib/parser/source/tree_rewriter/action.rb +133 -0
  112. data/vendor/bundle/ruby/2.5.0/gems/parser-2.5.1.2/lib/parser/static_environment.rb +46 -0
  113. data/vendor/bundle/ruby/2.5.0/gems/parser-2.5.1.2/lib/parser/syntax_error.rb +21 -0
  114. data/vendor/bundle/ruby/2.5.0/gems/parser-2.5.1.2/lib/parser/tree_rewriter.rb +133 -0
  115. data/vendor/bundle/ruby/2.5.0/gems/parser-2.5.1.2/lib/parser/version.rb +5 -0
  116. data/vendor/bundle/ruby/2.5.0/gems/parser-2.5.1.2/parser.gemspec +51 -0
  117. data/vendor/bundle/ruby/2.5.0/gems/parser-2.5.1.2/test/bug_163/fixtures/input.rb +5 -0
  118. data/vendor/bundle/ruby/2.5.0/gems/parser-2.5.1.2/test/bug_163/fixtures/output.rb +5 -0
  119. data/vendor/bundle/ruby/2.5.0/gems/parser-2.5.1.2/test/bug_163/rewriter.rb +20 -0
  120. data/vendor/bundle/ruby/2.5.0/gems/parser-2.5.1.2/test/helper.rb +52 -0
  121. data/vendor/bundle/ruby/2.5.0/gems/parser-2.5.1.2/test/parse_helper.rb +315 -0
  122. data/vendor/bundle/ruby/2.5.0/gems/parser-2.5.1.2/test/racc_coverage_helper.rb +133 -0
  123. data/vendor/bundle/ruby/2.5.0/gems/parser-2.5.1.2/test/test_base.rb +31 -0
  124. data/vendor/bundle/ruby/2.5.0/gems/parser-2.5.1.2/test/test_current.rb +27 -0
  125. data/vendor/bundle/ruby/2.5.0/gems/parser-2.5.1.2/test/test_diagnostic.rb +96 -0
  126. data/vendor/bundle/ruby/2.5.0/gems/parser-2.5.1.2/test/test_diagnostic_engine.rb +62 -0
  127. data/vendor/bundle/ruby/2.5.0/gems/parser-2.5.1.2/test/test_encoding.rb +99 -0
  128. data/vendor/bundle/ruby/2.5.0/gems/parser-2.5.1.2/test/test_lexer.rb +3537 -0
  129. data/vendor/bundle/ruby/2.5.0/gems/parser-2.5.1.2/test/test_lexer_stack_state.rb +78 -0
  130. data/vendor/bundle/ruby/2.5.0/gems/parser-2.5.1.2/test/test_parse_helper.rb +80 -0
  131. data/vendor/bundle/ruby/2.5.0/gems/parser-2.5.1.2/test/test_parser.rb +7038 -0
  132. data/vendor/bundle/ruby/2.5.0/gems/parser-2.5.1.2/test/test_runner_rewrite.rb +47 -0
  133. data/vendor/bundle/ruby/2.5.0/gems/parser-2.5.1.2/test/test_source_buffer.rb +162 -0
  134. data/vendor/bundle/ruby/2.5.0/gems/parser-2.5.1.2/test/test_source_comment.rb +36 -0
  135. data/vendor/bundle/ruby/2.5.0/gems/parser-2.5.1.2/test/test_source_comment_associator.rb +367 -0
  136. data/vendor/bundle/ruby/2.5.0/gems/parser-2.5.1.2/test/test_source_map.rb +15 -0
  137. data/vendor/bundle/ruby/2.5.0/gems/parser-2.5.1.2/test/test_source_range.rb +172 -0
  138. data/vendor/bundle/ruby/2.5.0/gems/parser-2.5.1.2/test/test_source_rewriter.rb +541 -0
  139. data/vendor/bundle/ruby/2.5.0/gems/parser-2.5.1.2/test/test_source_rewriter_action.rb +46 -0
  140. data/vendor/bundle/ruby/2.5.0/gems/parser-2.5.1.2/test/test_source_tree_rewriter.rb +173 -0
  141. data/vendor/bundle/ruby/2.5.0/gems/parser-2.5.1.2/test/test_static_environment.rb +45 -0
  142. data/vendor/bundle/ruby/2.5.0/gems/parser-2.5.1.2/test/using_tree_rewriter/fixtures/input.rb +3 -0
  143. data/vendor/bundle/ruby/2.5.0/gems/parser-2.5.1.2/test/using_tree_rewriter/fixtures/output.rb +3 -0
  144. data/vendor/bundle/ruby/2.5.0/gems/parser-2.5.1.2/test/using_tree_rewriter/using_tree_rewriter.rb +9 -0
  145. data/vendor/bundle/ruby/2.5.0/gems/powerpack-0.1.2/CHANGELOG.md +46 -0
  146. data/vendor/bundle/ruby/2.5.0/gems/powerpack-0.1.2/CONTRIBUTING.md +62 -0
  147. data/vendor/bundle/ruby/2.5.0/gems/powerpack-0.1.2/Gemfile +4 -0
  148. data/vendor/bundle/ruby/2.5.0/gems/powerpack-0.1.2/LICENSE.txt +22 -0
  149. data/vendor/bundle/ruby/2.5.0/gems/powerpack-0.1.2/README.md +99 -0
  150. data/vendor/bundle/ruby/2.5.0/gems/powerpack-0.1.2/Rakefile +12 -0
  151. data/vendor/bundle/ruby/2.5.0/gems/powerpack-0.1.2/lib/powerpack.rb +11 -0
  152. data/vendor/bundle/ruby/2.5.0/gems/powerpack-0.1.2/lib/powerpack/array.rb +2 -0
  153. data/vendor/bundle/ruby/2.5.0/gems/powerpack-0.1.2/lib/powerpack/array/butfirst.rb +15 -0
  154. data/vendor/bundle/ruby/2.5.0/gems/powerpack-0.1.2/lib/powerpack/array/butlast.rb +15 -0
  155. data/vendor/bundle/ruby/2.5.0/gems/powerpack-0.1.2/lib/powerpack/enumerable.rb +9 -0
  156. data/vendor/bundle/ruby/2.5.0/gems/powerpack-0.1.2/lib/powerpack/enumerable/average.rb +20 -0
  157. data/vendor/bundle/ruby/2.5.0/gems/powerpack-0.1.2/lib/powerpack/enumerable/drop_last.rb +20 -0
  158. data/vendor/bundle/ruby/2.5.0/gems/powerpack-0.1.2/lib/powerpack/enumerable/drop_last_while.rb +21 -0
  159. data/vendor/bundle/ruby/2.5.0/gems/powerpack-0.1.2/lib/powerpack/enumerable/exactly.rb +43 -0
  160. data/vendor/bundle/ruby/2.5.0/gems/powerpack-0.1.2/lib/powerpack/enumerable/frequencies.rb +17 -0
  161. data/vendor/bundle/ruby/2.5.0/gems/powerpack-0.1.2/lib/powerpack/enumerable/several.rb +37 -0
  162. data/vendor/bundle/ruby/2.5.0/gems/powerpack-0.1.2/lib/powerpack/enumerable/sum.rb +25 -0
  163. data/vendor/bundle/ruby/2.5.0/gems/powerpack-0.1.2/lib/powerpack/enumerable/take_last.rb +20 -0
  164. data/vendor/bundle/ruby/2.5.0/gems/powerpack-0.1.2/lib/powerpack/enumerable/take_last_while.rb +17 -0
  165. data/vendor/bundle/ruby/2.5.0/gems/powerpack-0.1.2/lib/powerpack/hash.rb +1 -0
  166. data/vendor/bundle/ruby/2.5.0/gems/powerpack-0.1.2/lib/powerpack/hash/symbolize_keys.rb +14 -0
  167. data/vendor/bundle/ruby/2.5.0/gems/powerpack-0.1.2/lib/powerpack/numeric.rb +3 -0
  168. data/vendor/bundle/ruby/2.5.0/gems/powerpack-0.1.2/lib/powerpack/numeric/neg.rb +19 -0
  169. data/vendor/bundle/ruby/2.5.0/gems/powerpack-0.1.2/lib/powerpack/numeric/pos.rb +19 -0
  170. data/vendor/bundle/ruby/2.5.0/gems/powerpack-0.1.2/lib/powerpack/numeric/scale.rb +44 -0
  171. data/vendor/bundle/ruby/2.5.0/gems/powerpack-0.1.2/lib/powerpack/string.rb +9 -0
  172. data/vendor/bundle/ruby/2.5.0/gems/powerpack-0.1.2/lib/powerpack/string/ascii_only.rb +42 -0
  173. data/vendor/bundle/ruby/2.5.0/gems/powerpack-0.1.2/lib/powerpack/string/blank.rb +20 -0
  174. data/vendor/bundle/ruby/2.5.0/gems/powerpack-0.1.2/lib/powerpack/string/format.rb +20 -0
  175. data/vendor/bundle/ruby/2.5.0/gems/powerpack-0.1.2/lib/powerpack/string/remove.rb +17 -0
  176. data/vendor/bundle/ruby/2.5.0/gems/powerpack-0.1.2/lib/powerpack/string/remove_prefix.rb +24 -0
  177. data/vendor/bundle/ruby/2.5.0/gems/powerpack-0.1.2/lib/powerpack/string/remove_suffix.rb +24 -0
  178. data/vendor/bundle/ruby/2.5.0/gems/powerpack-0.1.2/lib/powerpack/string/squish.rb +27 -0
  179. data/vendor/bundle/ruby/2.5.0/gems/powerpack-0.1.2/lib/powerpack/string/strip_indent.rb +22 -0
  180. data/vendor/bundle/ruby/2.5.0/gems/powerpack-0.1.2/lib/powerpack/string/strip_margin.rb +21 -0
  181. data/vendor/bundle/ruby/2.5.0/gems/powerpack-0.1.2/lib/powerpack/version.rb +3 -0
  182. data/vendor/bundle/ruby/2.5.0/gems/powerpack-0.1.2/powerpack.gemspec +24 -0
  183. data/vendor/bundle/ruby/2.5.0/gems/powerpack-0.1.2/spec/powerpack/array/butfirst_spec.rb +11 -0
  184. data/vendor/bundle/ruby/2.5.0/gems/powerpack-0.1.2/spec/powerpack/array/butlast_spec.rb +11 -0
  185. data/vendor/bundle/ruby/2.5.0/gems/powerpack-0.1.2/spec/powerpack/enumerable/average_spec.rb +19 -0
  186. data/vendor/bundle/ruby/2.5.0/gems/powerpack-0.1.2/spec/powerpack/enumerable/drop_last_spec.rb +15 -0
  187. data/vendor/bundle/ruby/2.5.0/gems/powerpack-0.1.2/spec/powerpack/enumerable/drop_last_while_spec.rb +7 -0
  188. data/vendor/bundle/ruby/2.5.0/gems/powerpack-0.1.2/spec/powerpack/enumerable/exactly_spec.rb +39 -0
  189. data/vendor/bundle/ruby/2.5.0/gems/powerpack-0.1.2/spec/powerpack/enumerable/frequencies_spec.rb +20 -0
  190. data/vendor/bundle/ruby/2.5.0/gems/powerpack-0.1.2/spec/powerpack/enumerable/several_spec.rb +27 -0
  191. data/vendor/bundle/ruby/2.5.0/gems/powerpack-0.1.2/spec/powerpack/enumerable/sum_spec.rb +29 -0
  192. data/vendor/bundle/ruby/2.5.0/gems/powerpack-0.1.2/spec/powerpack/enumerable/take_last_spec.rb +15 -0
  193. data/vendor/bundle/ruby/2.5.0/gems/powerpack-0.1.2/spec/powerpack/enumerable/take_last_while_spec.rb +7 -0
  194. data/vendor/bundle/ruby/2.5.0/gems/powerpack-0.1.2/spec/powerpack/hash/symbolize_keys_spec.rb +15 -0
  195. data/vendor/bundle/ruby/2.5.0/gems/powerpack-0.1.2/spec/powerpack/numeric/neg_spec.rb +24 -0
  196. data/vendor/bundle/ruby/2.5.0/gems/powerpack-0.1.2/spec/powerpack/numeric/pos_spec.rb +24 -0
  197. data/vendor/bundle/ruby/2.5.0/gems/powerpack-0.1.2/spec/powerpack/numeric/scale_spec.rb +139 -0
  198. data/vendor/bundle/ruby/2.5.0/gems/powerpack-0.1.2/spec/powerpack/string/ascii_only_spec.rb +45 -0
  199. data/vendor/bundle/ruby/2.5.0/gems/powerpack-0.1.2/spec/powerpack/string/blank_spec.rb +15 -0
  200. data/vendor/bundle/ruby/2.5.0/gems/powerpack-0.1.2/spec/powerpack/string/format_spec.rb +12 -0
  201. data/vendor/bundle/ruby/2.5.0/gems/powerpack-0.1.2/spec/powerpack/string/remove_prefix_spec.rb +21 -0
  202. data/vendor/bundle/ruby/2.5.0/gems/powerpack-0.1.2/spec/powerpack/string/remove_spec.rb +13 -0
  203. data/vendor/bundle/ruby/2.5.0/gems/powerpack-0.1.2/spec/powerpack/string/remove_suffix_spec.rb +21 -0
  204. data/vendor/bundle/ruby/2.5.0/gems/powerpack-0.1.2/spec/powerpack/string/squish_spec.rb +21 -0
  205. data/vendor/bundle/ruby/2.5.0/gems/powerpack-0.1.2/spec/powerpack/string/strip_indent_spec.rb +13 -0
  206. data/vendor/bundle/ruby/2.5.0/gems/powerpack-0.1.2/spec/powerpack/string/strip_margin_spec.rb +26 -0
  207. data/vendor/bundle/ruby/2.5.0/gems/powerpack-0.1.2/spec/spec_helper.rb +15 -0
  208. data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.1/CONTRIBUTING.rdoc +36 -0
  209. data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.1/Gemfile +3 -0
  210. data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.1/History.rdoc +2317 -0
  211. data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.1/MIT-LICENSE +21 -0
  212. data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.1/README.rdoc +156 -0
  213. data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.1/Rakefile +41 -0
  214. data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.1/bin/console +7 -0
  215. data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.1/bin/setup +6 -0
  216. data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.1/doc/command_line_usage.rdoc +158 -0
  217. data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.1/doc/example/Rakefile1 +38 -0
  218. data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.1/doc/example/Rakefile2 +35 -0
  219. data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.1/doc/example/a.c +6 -0
  220. data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.1/doc/example/b.c +6 -0
  221. data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.1/doc/example/main.c +11 -0
  222. data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.1/doc/glossary.rdoc +42 -0
  223. data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.1/doc/jamis.rb +592 -0
  224. data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.1/doc/proto_rake.rdoc +127 -0
  225. data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.1/doc/rake.1 +156 -0
  226. data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.1/doc/rakefile.rdoc +622 -0
  227. data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.1/doc/rational.rdoc +151 -0
  228. data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.1/exe/rake +27 -0
  229. data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.1/lib/rake.rb +71 -0
  230. data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.1/lib/rake/application.rb +824 -0
  231. data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.1/lib/rake/backtrace.rb +24 -0
  232. data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.1/lib/rake/clean.rb +78 -0
  233. data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.1/lib/rake/cloneable.rb +17 -0
  234. data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.1/lib/rake/cpu_counter.rb +107 -0
  235. data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.1/lib/rake/default_loader.rb +15 -0
  236. data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.1/lib/rake/dsl_definition.rb +195 -0
  237. data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.1/lib/rake/early_time.rb +22 -0
  238. data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.1/lib/rake/ext/core.rb +26 -0
  239. data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.1/lib/rake/ext/string.rb +176 -0
  240. data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.1/lib/rake/file_creation_task.rb +25 -0
  241. data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.1/lib/rake/file_list.rb +435 -0
  242. data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.1/lib/rake/file_task.rb +54 -0
  243. data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.1/lib/rake/file_utils.rb +137 -0
  244. data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.1/lib/rake/file_utils_ext.rb +145 -0
  245. data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.1/lib/rake/invocation_chain.rb +57 -0
  246. data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.1/lib/rake/invocation_exception_mixin.rb +17 -0
  247. data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.1/lib/rake/late_time.rb +18 -0
  248. data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.1/lib/rake/linked_list.rb +112 -0
  249. data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.1/lib/rake/loaders/makefile.rb +54 -0
  250. data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.1/lib/rake/multi_task.rb +14 -0
  251. data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.1/lib/rake/name_space.rb +38 -0
  252. data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.1/lib/rake/packagetask.rb +211 -0
  253. data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.1/lib/rake/phony.rb +16 -0
  254. data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.1/lib/rake/private_reader.rb +21 -0
  255. data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.1/lib/rake/promise.rb +100 -0
  256. data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.1/lib/rake/pseudo_status.rb +30 -0
  257. data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.1/lib/rake/rake_module.rb +67 -0
  258. data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.1/lib/rake/rake_test_loader.rb +27 -0
  259. data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.1/lib/rake/rule_recursion_overflow_error.rb +20 -0
  260. data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.1/lib/rake/scope.rb +43 -0
  261. data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.1/lib/rake/task.rb +411 -0
  262. data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.1/lib/rake/task_argument_error.rb +8 -0
  263. data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.1/lib/rake/task_arguments.rb +109 -0
  264. data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.1/lib/rake/task_manager.rb +323 -0
  265. data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.1/lib/rake/tasklib.rb +12 -0
  266. data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.1/lib/rake/testtask.rb +224 -0
  267. data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.1/lib/rake/thread_history_display.rb +49 -0
  268. data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.1/lib/rake/thread_pool.rb +163 -0
  269. data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.1/lib/rake/trace_output.rb +23 -0
  270. data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.1/lib/rake/version.rb +10 -0
  271. data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.1/lib/rake/win32.rb +51 -0
  272. data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.1/rake.gemspec +42 -0
  273. data/vendor/bundle/ruby/2.5.0/gems/rspec-3.8.0/LICENSE.md +27 -0
  274. data/vendor/bundle/ruby/2.5.0/gems/rspec-3.8.0/README.md +43 -0
  275. data/vendor/bundle/ruby/2.5.0/gems/rspec-3.8.0/lib/rspec.rb +3 -0
  276. data/vendor/bundle/ruby/2.5.0/gems/rspec-3.8.0/lib/rspec/version.rb +5 -0
  277. data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.8.0/Changelog.md +2221 -0
  278. data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.8.0/LICENSE.md +26 -0
  279. data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.8.0/README.md +384 -0
  280. data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.8.0/exe/rspec +4 -0
  281. data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.8.0/lib/rspec/autorun.rb +3 -0
  282. data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.8.0/lib/rspec/core.rb +185 -0
  283. data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.8.0/lib/rspec/core/backtrace_formatter.rb +65 -0
  284. data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.8.0/lib/rspec/core/bisect/coordinator.rb +62 -0
  285. data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.8.0/lib/rspec/core/bisect/example_minimizer.rb +173 -0
  286. data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.8.0/lib/rspec/core/bisect/fork_runner.rb +134 -0
  287. data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.8.0/lib/rspec/core/bisect/server.rb +61 -0
  288. data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.8.0/lib/rspec/core/bisect/shell_command.rb +126 -0
  289. data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.8.0/lib/rspec/core/bisect/shell_runner.rb +73 -0
  290. data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.8.0/lib/rspec/core/bisect/utilities.rb +58 -0
  291. data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.8.0/lib/rspec/core/configuration.rb +2289 -0
  292. data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.8.0/lib/rspec/core/configuration_options.rb +233 -0
  293. data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.8.0/lib/rspec/core/drb.rb +113 -0
  294. data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.8.0/lib/rspec/core/dsl.rb +98 -0
  295. data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.8.0/lib/rspec/core/example.rb +653 -0
  296. data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.8.0/lib/rspec/core/example_group.rb +885 -0
  297. data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.8.0/lib/rspec/core/example_status_persister.rb +235 -0
  298. data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.8.0/lib/rspec/core/filter_manager.rb +231 -0
  299. data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.8.0/lib/rspec/core/flat_map.rb +20 -0
  300. data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.8.0/lib/rspec/core/formatters.rb +269 -0
  301. data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.8.0/lib/rspec/core/formatters/base_bisect_formatter.rb +45 -0
  302. data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.8.0/lib/rspec/core/formatters/base_formatter.rb +70 -0
  303. data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.8.0/lib/rspec/core/formatters/base_text_formatter.rb +75 -0
  304. data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.8.0/lib/rspec/core/formatters/bisect_drb_formatter.rb +29 -0
  305. data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.8.0/lib/rspec/core/formatters/bisect_progress_formatter.rb +157 -0
  306. data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.8.0/lib/rspec/core/formatters/console_codes.rb +68 -0
  307. data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.8.0/lib/rspec/core/formatters/deprecation_formatter.rb +223 -0
  308. data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.8.0/lib/rspec/core/formatters/documentation_formatter.rb +70 -0
  309. data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.8.0/lib/rspec/core/formatters/exception_presenter.rb +497 -0
  310. data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.8.0/lib/rspec/core/formatters/fallback_message_formatter.rb +28 -0
  311. data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.8.0/lib/rspec/core/formatters/helpers.rb +110 -0
  312. data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.8.0/lib/rspec/core/formatters/html_formatter.rb +153 -0
  313. data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.8.0/lib/rspec/core/formatters/html_printer.rb +414 -0
  314. data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.8.0/lib/rspec/core/formatters/html_snippet_extractor.rb +120 -0
  315. data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.8.0/lib/rspec/core/formatters/json_formatter.rb +102 -0
  316. data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.8.0/lib/rspec/core/formatters/profile_formatter.rb +68 -0
  317. data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.8.0/lib/rspec/core/formatters/progress_formatter.rb +29 -0
  318. data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.8.0/lib/rspec/core/formatters/protocol.rb +182 -0
  319. data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.8.0/lib/rspec/core/formatters/snippet_extractor.rb +134 -0
  320. data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.8.0/lib/rspec/core/formatters/syntax_highlighter.rb +91 -0
  321. data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.8.0/lib/rspec/core/hooks.rb +624 -0
  322. data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.8.0/lib/rspec/core/invocations.rb +87 -0
  323. data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.8.0/lib/rspec/core/memoized_helpers.rb +535 -0
  324. data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.8.0/lib/rspec/core/metadata.rb +499 -0
  325. data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.8.0/lib/rspec/core/metadata_filter.rb +255 -0
  326. data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.8.0/lib/rspec/core/minitest_assertions_adapter.rb +31 -0
  327. data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.8.0/lib/rspec/core/mocking_adapters/flexmock.rb +31 -0
  328. data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.8.0/lib/rspec/core/mocking_adapters/mocha.rb +57 -0
  329. data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.8.0/lib/rspec/core/mocking_adapters/null.rb +14 -0
  330. data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.8.0/lib/rspec/core/mocking_adapters/rr.rb +31 -0
  331. data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.8.0/lib/rspec/core/mocking_adapters/rspec.rb +32 -0
  332. data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.8.0/lib/rspec/core/notifications.rb +521 -0
  333. data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.8.0/lib/rspec/core/option_parser.rb +309 -0
  334. data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.8.0/lib/rspec/core/ordering.rb +158 -0
  335. data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.8.0/lib/rspec/core/output_wrapper.rb +29 -0
  336. data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.8.0/lib/rspec/core/pending.rb +165 -0
  337. data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.8.0/lib/rspec/core/profiler.rb +34 -0
  338. data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.8.0/lib/rspec/core/project_initializer.rb +48 -0
  339. data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.8.0/lib/rspec/core/project_initializer/spec/spec_helper.rb +100 -0
  340. data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.8.0/lib/rspec/core/rake_task.rb +168 -0
  341. data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.8.0/lib/rspec/core/reporter.rb +257 -0
  342. data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.8.0/lib/rspec/core/ruby_project.rb +53 -0
  343. data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.8.0/lib/rspec/core/runner.rb +199 -0
  344. data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.8.0/lib/rspec/core/sandbox.rb +37 -0
  345. data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.8.0/lib/rspec/core/set.rb +54 -0
  346. data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.8.0/lib/rspec/core/shared_context.rb +55 -0
  347. data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.8.0/lib/rspec/core/shared_example_group.rb +269 -0
  348. data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.8.0/lib/rspec/core/shell_escape.rb +49 -0
  349. data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.8.0/lib/rspec/core/test_unit_assertions_adapter.rb +30 -0
  350. data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.8.0/lib/rspec/core/version.rb +9 -0
  351. data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.8.0/lib/rspec/core/warnings.rb +40 -0
  352. data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.8.0/lib/rspec/core/world.rb +275 -0
  353. data/vendor/bundle/ruby/2.5.0/gems/rspec-expectations-3.8.1/Changelog.md +1110 -0
  354. data/vendor/bundle/ruby/2.5.0/gems/rspec-expectations-3.8.1/LICENSE.md +25 -0
  355. data/vendor/bundle/ruby/2.5.0/gems/rspec-expectations-3.8.1/README.md +305 -0
  356. data/vendor/bundle/ruby/2.5.0/gems/rspec-expectations-3.8.1/lib/rspec/expectations.rb +82 -0
  357. data/vendor/bundle/ruby/2.5.0/gems/rspec-expectations-3.8.1/lib/rspec/expectations/block_snippet_extractor.rb +253 -0
  358. data/vendor/bundle/ruby/2.5.0/gems/rspec-expectations-3.8.1/lib/rspec/expectations/configuration.rb +215 -0
  359. data/vendor/bundle/ruby/2.5.0/gems/rspec-expectations-3.8.1/lib/rspec/expectations/expectation_target.rb +127 -0
  360. data/vendor/bundle/ruby/2.5.0/gems/rspec-expectations-3.8.1/lib/rspec/expectations/fail_with.rb +39 -0
  361. data/vendor/bundle/ruby/2.5.0/gems/rspec-expectations-3.8.1/lib/rspec/expectations/failure_aggregator.rb +194 -0
  362. data/vendor/bundle/ruby/2.5.0/gems/rspec-expectations-3.8.1/lib/rspec/expectations/handler.rb +170 -0
  363. data/vendor/bundle/ruby/2.5.0/gems/rspec-expectations-3.8.1/lib/rspec/expectations/minitest_integration.rb +58 -0
  364. data/vendor/bundle/ruby/2.5.0/gems/rspec-expectations-3.8.1/lib/rspec/expectations/syntax.rb +132 -0
  365. data/vendor/bundle/ruby/2.5.0/gems/rspec-expectations-3.8.1/lib/rspec/expectations/version.rb +8 -0
  366. data/vendor/bundle/ruby/2.5.0/gems/rspec-expectations-3.8.1/lib/rspec/matchers.rb +1034 -0
  367. data/vendor/bundle/ruby/2.5.0/gems/rspec-expectations-3.8.1/lib/rspec/matchers/aliased_matcher.rb +116 -0
  368. data/vendor/bundle/ruby/2.5.0/gems/rspec-expectations-3.8.1/lib/rspec/matchers/built_in.rb +52 -0
  369. data/vendor/bundle/ruby/2.5.0/gems/rspec-expectations-3.8.1/lib/rspec/matchers/built_in/all.rb +85 -0
  370. data/vendor/bundle/ruby/2.5.0/gems/rspec-expectations-3.8.1/lib/rspec/matchers/built_in/base_matcher.rb +193 -0
  371. data/vendor/bundle/ruby/2.5.0/gems/rspec-expectations-3.8.1/lib/rspec/matchers/built_in/be.rb +288 -0
  372. data/vendor/bundle/ruby/2.5.0/gems/rspec-expectations-3.8.1/lib/rspec/matchers/built_in/be_between.rb +77 -0
  373. data/vendor/bundle/ruby/2.5.0/gems/rspec-expectations-3.8.1/lib/rspec/matchers/built_in/be_instance_of.rb +22 -0
  374. data/vendor/bundle/ruby/2.5.0/gems/rspec-expectations-3.8.1/lib/rspec/matchers/built_in/be_kind_of.rb +16 -0
  375. data/vendor/bundle/ruby/2.5.0/gems/rspec-expectations-3.8.1/lib/rspec/matchers/built_in/be_within.rb +72 -0
  376. data/vendor/bundle/ruby/2.5.0/gems/rspec-expectations-3.8.1/lib/rspec/matchers/built_in/change.rb +426 -0
  377. data/vendor/bundle/ruby/2.5.0/gems/rspec-expectations-3.8.1/lib/rspec/matchers/built_in/compound.rb +271 -0
  378. data/vendor/bundle/ruby/2.5.0/gems/rspec-expectations-3.8.1/lib/rspec/matchers/built_in/contain_exactly.rb +302 -0
  379. data/vendor/bundle/ruby/2.5.0/gems/rspec-expectations-3.8.1/lib/rspec/matchers/built_in/cover.rb +24 -0
  380. data/vendor/bundle/ruby/2.5.0/gems/rspec-expectations-3.8.1/lib/rspec/matchers/built_in/eq.rb +40 -0
  381. data/vendor/bundle/ruby/2.5.0/gems/rspec-expectations-3.8.1/lib/rspec/matchers/built_in/eql.rb +34 -0
  382. data/vendor/bundle/ruby/2.5.0/gems/rspec-expectations-3.8.1/lib/rspec/matchers/built_in/equal.rb +81 -0
  383. data/vendor/bundle/ruby/2.5.0/gems/rspec-expectations-3.8.1/lib/rspec/matchers/built_in/exist.rb +90 -0
  384. data/vendor/bundle/ruby/2.5.0/gems/rspec-expectations-3.8.1/lib/rspec/matchers/built_in/has.rb +103 -0
  385. data/vendor/bundle/ruby/2.5.0/gems/rspec-expectations-3.8.1/lib/rspec/matchers/built_in/have_attributes.rb +114 -0
  386. data/vendor/bundle/ruby/2.5.0/gems/rspec-expectations-3.8.1/lib/rspec/matchers/built_in/include.rb +149 -0
  387. data/vendor/bundle/ruby/2.5.0/gems/rspec-expectations-3.8.1/lib/rspec/matchers/built_in/match.rb +106 -0
  388. data/vendor/bundle/ruby/2.5.0/gems/rspec-expectations-3.8.1/lib/rspec/matchers/built_in/operators.rb +128 -0
  389. data/vendor/bundle/ruby/2.5.0/gems/rspec-expectations-3.8.1/lib/rspec/matchers/built_in/output.rb +200 -0
  390. data/vendor/bundle/ruby/2.5.0/gems/rspec-expectations-3.8.1/lib/rspec/matchers/built_in/raise_error.rb +230 -0
  391. data/vendor/bundle/ruby/2.5.0/gems/rspec-expectations-3.8.1/lib/rspec/matchers/built_in/respond_to.rb +165 -0
  392. data/vendor/bundle/ruby/2.5.0/gems/rspec-expectations-3.8.1/lib/rspec/matchers/built_in/satisfy.rb +60 -0
  393. data/vendor/bundle/ruby/2.5.0/gems/rspec-expectations-3.8.1/lib/rspec/matchers/built_in/start_or_end_with.rb +94 -0
  394. data/vendor/bundle/ruby/2.5.0/gems/rspec-expectations-3.8.1/lib/rspec/matchers/built_in/throw_symbol.rb +132 -0
  395. data/vendor/bundle/ruby/2.5.0/gems/rspec-expectations-3.8.1/lib/rspec/matchers/built_in/yield.rb +432 -0
  396. data/vendor/bundle/ruby/2.5.0/gems/rspec-expectations-3.8.1/lib/rspec/matchers/composable.rb +171 -0
  397. data/vendor/bundle/ruby/2.5.0/gems/rspec-expectations-3.8.1/lib/rspec/matchers/dsl.rb +527 -0
  398. data/vendor/bundle/ruby/2.5.0/gems/rspec-expectations-3.8.1/lib/rspec/matchers/english_phrasing.rb +58 -0
  399. data/vendor/bundle/ruby/2.5.0/gems/rspec-expectations-3.8.1/lib/rspec/matchers/expecteds_for_multiple_diffs.rb +73 -0
  400. data/vendor/bundle/ruby/2.5.0/gems/rspec-expectations-3.8.1/lib/rspec/matchers/fail_matchers.rb +42 -0
  401. data/vendor/bundle/ruby/2.5.0/gems/rspec-expectations-3.8.1/lib/rspec/matchers/generated_descriptions.rb +41 -0
  402. data/vendor/bundle/ruby/2.5.0/gems/rspec-expectations-3.8.1/lib/rspec/matchers/matcher_delegator.rb +35 -0
  403. data/vendor/bundle/ruby/2.5.0/gems/rspec-expectations-3.8.1/lib/rspec/matchers/matcher_protocol.rb +99 -0
  404. data/vendor/bundle/ruby/2.5.0/gems/rspec-mocks-3.8.0/Changelog.md +1100 -0
  405. data/vendor/bundle/ruby/2.5.0/gems/rspec-mocks-3.8.0/LICENSE.md +25 -0
  406. data/vendor/bundle/ruby/2.5.0/gems/rspec-mocks-3.8.0/README.md +460 -0
  407. data/vendor/bundle/ruby/2.5.0/gems/rspec-mocks-3.8.0/lib/rspec/mocks.rb +130 -0
  408. data/vendor/bundle/ruby/2.5.0/gems/rspec-mocks-3.8.0/lib/rspec/mocks/any_instance.rb +11 -0
  409. data/vendor/bundle/ruby/2.5.0/gems/rspec-mocks-3.8.0/lib/rspec/mocks/any_instance/chain.rb +110 -0
  410. data/vendor/bundle/ruby/2.5.0/gems/rspec-mocks-3.8.0/lib/rspec/mocks/any_instance/error_generator.rb +31 -0
  411. data/vendor/bundle/ruby/2.5.0/gems/rspec-mocks-3.8.0/lib/rspec/mocks/any_instance/expect_chain_chain.rb +31 -0
  412. data/vendor/bundle/ruby/2.5.0/gems/rspec-mocks-3.8.0/lib/rspec/mocks/any_instance/expectation_chain.rb +50 -0
  413. data/vendor/bundle/ruby/2.5.0/gems/rspec-mocks-3.8.0/lib/rspec/mocks/any_instance/message_chains.rb +83 -0
  414. data/vendor/bundle/ruby/2.5.0/gems/rspec-mocks-3.8.0/lib/rspec/mocks/any_instance/proxy.rb +116 -0
  415. data/vendor/bundle/ruby/2.5.0/gems/rspec-mocks-3.8.0/lib/rspec/mocks/any_instance/recorder.rb +289 -0
  416. data/vendor/bundle/ruby/2.5.0/gems/rspec-mocks-3.8.0/lib/rspec/mocks/any_instance/stub_chain.rb +51 -0
  417. data/vendor/bundle/ruby/2.5.0/gems/rspec-mocks-3.8.0/lib/rspec/mocks/any_instance/stub_chain_chain.rb +23 -0
  418. data/vendor/bundle/ruby/2.5.0/gems/rspec-mocks-3.8.0/lib/rspec/mocks/argument_list_matcher.rb +100 -0
  419. data/vendor/bundle/ruby/2.5.0/gems/rspec-mocks-3.8.0/lib/rspec/mocks/argument_matchers.rb +320 -0
  420. data/vendor/bundle/ruby/2.5.0/gems/rspec-mocks-3.8.0/lib/rspec/mocks/configuration.rb +212 -0
  421. data/vendor/bundle/ruby/2.5.0/gems/rspec-mocks-3.8.0/lib/rspec/mocks/error_generator.rb +369 -0
  422. data/vendor/bundle/ruby/2.5.0/gems/rspec-mocks-3.8.0/lib/rspec/mocks/example_methods.rb +434 -0
  423. data/vendor/bundle/ruby/2.5.0/gems/rspec-mocks-3.8.0/lib/rspec/mocks/instance_method_stasher.rb +146 -0
  424. data/vendor/bundle/ruby/2.5.0/gems/rspec-mocks-3.8.0/lib/rspec/mocks/marshal_extension.rb +41 -0
  425. data/vendor/bundle/ruby/2.5.0/gems/rspec-mocks-3.8.0/lib/rspec/mocks/matchers/expectation_customization.rb +20 -0
  426. data/vendor/bundle/ruby/2.5.0/gems/rspec-mocks-3.8.0/lib/rspec/mocks/matchers/have_received.rb +134 -0
  427. data/vendor/bundle/ruby/2.5.0/gems/rspec-mocks-3.8.0/lib/rspec/mocks/matchers/receive.rb +132 -0
  428. data/vendor/bundle/ruby/2.5.0/gems/rspec-mocks-3.8.0/lib/rspec/mocks/matchers/receive_message_chain.rb +82 -0
  429. data/vendor/bundle/ruby/2.5.0/gems/rspec-mocks-3.8.0/lib/rspec/mocks/matchers/receive_messages.rb +77 -0
  430. data/vendor/bundle/ruby/2.5.0/gems/rspec-mocks-3.8.0/lib/rspec/mocks/message_chain.rb +87 -0
  431. data/vendor/bundle/ruby/2.5.0/gems/rspec-mocks-3.8.0/lib/rspec/mocks/message_expectation.rb +741 -0
  432. data/vendor/bundle/ruby/2.5.0/gems/rspec-mocks-3.8.0/lib/rspec/mocks/method_double.rb +287 -0
  433. data/vendor/bundle/ruby/2.5.0/gems/rspec-mocks-3.8.0/lib/rspec/mocks/method_reference.rb +202 -0
  434. data/vendor/bundle/ruby/2.5.0/gems/rspec-mocks-3.8.0/lib/rspec/mocks/minitest_integration.rb +68 -0
  435. data/vendor/bundle/ruby/2.5.0/gems/rspec-mocks-3.8.0/lib/rspec/mocks/mutate_const.rb +339 -0
  436. data/vendor/bundle/ruby/2.5.0/gems/rspec-mocks-3.8.0/lib/rspec/mocks/object_reference.rb +149 -0
  437. data/vendor/bundle/ruby/2.5.0/gems/rspec-mocks-3.8.0/lib/rspec/mocks/order_group.rb +81 -0
  438. data/vendor/bundle/ruby/2.5.0/gems/rspec-mocks-3.8.0/lib/rspec/mocks/proxy.rb +485 -0
  439. data/vendor/bundle/ruby/2.5.0/gems/rspec-mocks-3.8.0/lib/rspec/mocks/space.rb +238 -0
  440. data/vendor/bundle/ruby/2.5.0/gems/rspec-mocks-3.8.0/lib/rspec/mocks/standalone.rb +3 -0
  441. data/vendor/bundle/ruby/2.5.0/gems/rspec-mocks-3.8.0/lib/rspec/mocks/syntax.rb +325 -0
  442. data/vendor/bundle/ruby/2.5.0/gems/rspec-mocks-3.8.0/lib/rspec/mocks/targets.rb +124 -0
  443. data/vendor/bundle/ruby/2.5.0/gems/rspec-mocks-3.8.0/lib/rspec/mocks/test_double.rb +171 -0
  444. data/vendor/bundle/ruby/2.5.0/gems/rspec-mocks-3.8.0/lib/rspec/mocks/verifying_double.rb +129 -0
  445. data/vendor/bundle/ruby/2.5.0/gems/rspec-mocks-3.8.0/lib/rspec/mocks/verifying_message_expectation.rb +54 -0
  446. data/vendor/bundle/ruby/2.5.0/gems/rspec-mocks-3.8.0/lib/rspec/mocks/verifying_proxy.rb +220 -0
  447. data/vendor/bundle/ruby/2.5.0/gems/rspec-mocks-3.8.0/lib/rspec/mocks/version.rb +9 -0
  448. data/vendor/bundle/ruby/2.5.0/gems/rspec-support-3.8.0/Changelog.md +242 -0
  449. data/vendor/bundle/ruby/2.5.0/gems/rspec-support-3.8.0/LICENSE.md +23 -0
  450. data/vendor/bundle/ruby/2.5.0/gems/rspec-support-3.8.0/README.md +40 -0
  451. data/vendor/bundle/ruby/2.5.0/gems/rspec-support-3.8.0/lib/rspec/support.rb +149 -0
  452. data/vendor/bundle/ruby/2.5.0/gems/rspec-support-3.8.0/lib/rspec/support/caller_filter.rb +83 -0
  453. data/vendor/bundle/ruby/2.5.0/gems/rspec-support-3.8.0/lib/rspec/support/comparable_version.rb +46 -0
  454. data/vendor/bundle/ruby/2.5.0/gems/rspec-support-3.8.0/lib/rspec/support/differ.rb +215 -0
  455. data/vendor/bundle/ruby/2.5.0/gems/rspec-support-3.8.0/lib/rspec/support/directory_maker.rb +63 -0
  456. data/vendor/bundle/ruby/2.5.0/gems/rspec-support-3.8.0/lib/rspec/support/encoded_string.rb +165 -0
  457. data/vendor/bundle/ruby/2.5.0/gems/rspec-support-3.8.0/lib/rspec/support/fuzzy_matcher.rb +48 -0
  458. data/vendor/bundle/ruby/2.5.0/gems/rspec-support-3.8.0/lib/rspec/support/hunk_generator.rb +47 -0
  459. data/vendor/bundle/ruby/2.5.0/gems/rspec-support-3.8.0/lib/rspec/support/matcher_definition.rb +42 -0
  460. data/vendor/bundle/ruby/2.5.0/gems/rspec-support-3.8.0/lib/rspec/support/method_signature_verifier.rb +426 -0
  461. data/vendor/bundle/ruby/2.5.0/gems/rspec-support-3.8.0/lib/rspec/support/mutex.rb +73 -0
  462. data/vendor/bundle/ruby/2.5.0/gems/rspec-support-3.8.0/lib/rspec/support/object_formatter.rb +275 -0
  463. data/vendor/bundle/ruby/2.5.0/gems/rspec-support-3.8.0/lib/rspec/support/recursive_const_methods.rb +76 -0
  464. data/vendor/bundle/ruby/2.5.0/gems/rspec-support-3.8.0/lib/rspec/support/reentrant_mutex.rb +53 -0
  465. data/vendor/bundle/ruby/2.5.0/gems/rspec-support-3.8.0/lib/rspec/support/ruby_features.rb +176 -0
  466. data/vendor/bundle/ruby/2.5.0/gems/rspec-support-3.8.0/lib/rspec/support/source.rb +75 -0
  467. data/vendor/bundle/ruby/2.5.0/gems/rspec-support-3.8.0/lib/rspec/support/source/location.rb +21 -0
  468. data/vendor/bundle/ruby/2.5.0/gems/rspec-support-3.8.0/lib/rspec/support/source/node.rb +110 -0
  469. data/vendor/bundle/ruby/2.5.0/gems/rspec-support-3.8.0/lib/rspec/support/source/token.rb +87 -0
  470. data/vendor/bundle/ruby/2.5.0/gems/rspec-support-3.8.0/lib/rspec/support/spec.rb +81 -0
  471. data/vendor/bundle/ruby/2.5.0/gems/rspec-support-3.8.0/lib/rspec/support/spec/deprecation_helpers.rb +64 -0
  472. data/vendor/bundle/ruby/2.5.0/gems/rspec-support-3.8.0/lib/rspec/support/spec/formatting_support.rb +9 -0
  473. data/vendor/bundle/ruby/2.5.0/gems/rspec-support-3.8.0/lib/rspec/support/spec/in_sub_process.rb +69 -0
  474. data/vendor/bundle/ruby/2.5.0/gems/rspec-support-3.8.0/lib/rspec/support/spec/library_wide_checks.rb +150 -0
  475. data/vendor/bundle/ruby/2.5.0/gems/rspec-support-3.8.0/lib/rspec/support/spec/shell_out.rb +84 -0
  476. data/vendor/bundle/ruby/2.5.0/gems/rspec-support-3.8.0/lib/rspec/support/spec/stderr_splitter.rb +63 -0
  477. data/vendor/bundle/ruby/2.5.0/gems/rspec-support-3.8.0/lib/rspec/support/spec/string_matcher.rb +46 -0
  478. data/vendor/bundle/ruby/2.5.0/gems/rspec-support-3.8.0/lib/rspec/support/spec/with_isolated_directory.rb +13 -0
  479. data/vendor/bundle/ruby/2.5.0/gems/rspec-support-3.8.0/lib/rspec/support/spec/with_isolated_stderr.rb +13 -0
  480. data/vendor/bundle/ruby/2.5.0/gems/rspec-support-3.8.0/lib/rspec/support/version.rb +7 -0
  481. data/vendor/bundle/ruby/2.5.0/gems/rspec-support-3.8.0/lib/rspec/support/warnings.rb +39 -0
  482. data/vendor/bundle/ruby/2.5.0/gems/ruby-progressbar-1.10.0/LICENSE.txt +19 -0
  483. data/vendor/bundle/ruby/2.5.0/gems/ruby-progressbar-1.10.0/README.md +38 -0
  484. data/vendor/bundle/ruby/2.5.0/gems/ruby-progressbar-1.10.0/Rakefile +2 -0
  485. data/vendor/bundle/ruby/2.5.0/gems/ruby-progressbar-1.10.0/lib/ruby-progressbar.rb +18 -0
  486. data/vendor/bundle/ruby/2.5.0/gems/ruby-progressbar-1.10.0/lib/ruby-progressbar/base.rb +183 -0
  487. data/vendor/bundle/ruby/2.5.0/gems/ruby-progressbar-1.10.0/lib/ruby-progressbar/calculators/length.rb +100 -0
  488. data/vendor/bundle/ruby/2.5.0/gems/ruby-progressbar-1.10.0/lib/ruby-progressbar/calculators/running_average.rb +9 -0
  489. data/vendor/bundle/ruby/2.5.0/gems/ruby-progressbar-1.10.0/lib/ruby-progressbar/components.rb +5 -0
  490. data/vendor/bundle/ruby/2.5.0/gems/ruby-progressbar-1.10.0/lib/ruby-progressbar/components/bar.rb +102 -0
  491. data/vendor/bundle/ruby/2.5.0/gems/ruby-progressbar-1.10.0/lib/ruby-progressbar/components/percentage.rb +29 -0
  492. data/vendor/bundle/ruby/2.5.0/gems/ruby-progressbar-1.10.0/lib/ruby-progressbar/components/rate.rb +43 -0
  493. data/vendor/bundle/ruby/2.5.0/gems/ruby-progressbar-1.10.0/lib/ruby-progressbar/components/time.rb +107 -0
  494. data/vendor/bundle/ruby/2.5.0/gems/ruby-progressbar-1.10.0/lib/ruby-progressbar/components/title.rb +13 -0
  495. data/vendor/bundle/ruby/2.5.0/gems/ruby-progressbar-1.10.0/lib/ruby-progressbar/errors/invalid_progress_error.rb +4 -0
  496. data/vendor/bundle/ruby/2.5.0/gems/ruby-progressbar-1.10.0/lib/ruby-progressbar/format.rb +3 -0
  497. data/vendor/bundle/ruby/2.5.0/gems/ruby-progressbar-1.10.0/lib/ruby-progressbar/format/formatter.rb +27 -0
  498. data/vendor/bundle/ruby/2.5.0/gems/ruby-progressbar-1.10.0/lib/ruby-progressbar/format/molecule.rb +60 -0
  499. data/vendor/bundle/ruby/2.5.0/gems/ruby-progressbar-1.10.0/lib/ruby-progressbar/format/string.rb +36 -0
  500. data/vendor/bundle/ruby/2.5.0/gems/ruby-progressbar-1.10.0/lib/ruby-progressbar/output.rb +68 -0
  501. data/vendor/bundle/ruby/2.5.0/gems/ruby-progressbar-1.10.0/lib/ruby-progressbar/outputs/non_tty.rb +47 -0
  502. data/vendor/bundle/ruby/2.5.0/gems/ruby-progressbar-1.10.0/lib/ruby-progressbar/outputs/null.rb +33 -0
  503. data/vendor/bundle/ruby/2.5.0/gems/ruby-progressbar-1.10.0/lib/ruby-progressbar/outputs/tty.rb +32 -0
  504. data/vendor/bundle/ruby/2.5.0/gems/ruby-progressbar-1.10.0/lib/ruby-progressbar/progress.rb +118 -0
  505. data/vendor/bundle/ruby/2.5.0/gems/ruby-progressbar-1.10.0/lib/ruby-progressbar/refinements.rb +1 -0
  506. data/vendor/bundle/ruby/2.5.0/gems/ruby-progressbar-1.10.0/lib/ruby-progressbar/refinements/enumerator.rb +23 -0
  507. data/vendor/bundle/ruby/2.5.0/gems/ruby-progressbar-1.10.0/lib/ruby-progressbar/throttle.rb +25 -0
  508. data/vendor/bundle/ruby/2.5.0/gems/ruby-progressbar-1.10.0/lib/ruby-progressbar/time.rb +32 -0
  509. data/vendor/bundle/ruby/2.5.0/gems/ruby-progressbar-1.10.0/lib/ruby-progressbar/timer.rb +72 -0
  510. data/vendor/bundle/ruby/2.5.0/gems/ruby-progressbar-1.10.0/lib/ruby-progressbar/version.rb +3 -0
  511. data/vendor/bundle/ruby/2.5.0/gems/unicode-display_width-1.4.0/CHANGELOG.md +113 -0
  512. data/vendor/bundle/ruby/2.5.0/gems/unicode-display_width-1.4.0/MIT-LICENSE.txt +22 -0
  513. data/vendor/bundle/ruby/2.5.0/gems/unicode-display_width-1.4.0/README.md +124 -0
  514. data/vendor/bundle/ruby/2.5.0/gems/unicode-display_width-1.4.0/Rakefile +64 -0
  515. data/vendor/bundle/ruby/2.5.0/gems/unicode-display_width-1.4.0/data/display_width.marshal.gz +0 -0
  516. data/vendor/bundle/ruby/2.5.0/gems/unicode-display_width-1.4.0/lib/unicode/display_width.rb +51 -0
  517. data/vendor/bundle/ruby/2.5.0/gems/unicode-display_width-1.4.0/lib/unicode/display_width/constants.rb +8 -0
  518. data/vendor/bundle/ruby/2.5.0/gems/unicode-display_width-1.4.0/lib/unicode/display_width/index.rb +12 -0
  519. data/vendor/bundle/ruby/2.5.0/gems/unicode-display_width-1.4.0/lib/unicode/display_width/no_string_ext.rb +7 -0
  520. data/vendor/bundle/ruby/2.5.0/gems/unicode-display_width-1.4.0/lib/unicode/display_width/string_ext.rb +17 -0
  521. data/vendor/bundle/ruby/2.5.0/gems/unicode-display_width-1.4.0/spec/display_width_spec.rb +156 -0
  522. data/vendor/bundle/ruby/2.5.0/gems/unicode-display_width-1.4.0/unicode-display_width.gemspec +18 -0
  523. data/vendor/bundle/ruby/2.5.0/specifications/ast-2.4.0.gemspec +59 -0
  524. data/vendor/bundle/ruby/2.5.0/specifications/parser-2.5.1.2.gemspec +62 -0
  525. data/vendor/bundle/ruby/2.5.0/specifications/powerpack-0.1.2.gemspec +41 -0
  526. data/vendor/bundle/ruby/2.5.0/specifications/rake-12.3.1.gemspec +49 -0
  527. data/vendor/bundle/ruby/2.5.0/specifications/rspec-3.8.0.gemspec +42 -0
  528. data/vendor/bundle/ruby/2.5.0/specifications/rspec-core-3.8.0.gemspec +62 -0
  529. data/vendor/bundle/ruby/2.5.0/specifications/rspec-expectations-3.8.1.gemspec +50 -0
  530. data/vendor/bundle/ruby/2.5.0/specifications/rspec-mocks-3.8.0.gemspec +50 -0
  531. data/vendor/bundle/ruby/2.5.0/specifications/rspec-support-3.8.0.gemspec +41 -0
  532. data/vendor/bundle/ruby/2.5.0/specifications/ruby-progressbar-1.10.0.gemspec +46 -0
  533. data/vendor/bundle/ruby/2.5.0/specifications/unicode-display_width-1.4.0.gemspec +38 -0
  534. metadata +532 -2
@@ -0,0 +1,3537 @@
1
+ # encoding: ascii-8bit
2
+ # frozen_string_literal: true
3
+
4
+ require 'helper'
5
+ require 'complex'
6
+
7
+ class TestLexer < Minitest::Test
8
+ def setup_lexer(version)
9
+ @lex = Parser::Lexer.new(version)
10
+
11
+ @lex.comments = []
12
+ @lex.diagnostics = Parser::Diagnostic::Engine.new
13
+ @lex.diagnostics.all_errors_are_fatal = true
14
+ # @lex.diagnostics.consumer = lambda { |diag| $stderr.puts "", diag.render }
15
+ end
16
+
17
+ def setup
18
+ setup_lexer 18
19
+ end
20
+
21
+ #
22
+ # Tools
23
+ #
24
+
25
+ def utf(str)
26
+ str.dup.force_encoding(Encoding::UTF_8)
27
+ end
28
+
29
+ #
30
+ # Additional matchers
31
+ #
32
+
33
+ def refute_scanned(s, *args)
34
+ assert_raises Parser::SyntaxError do
35
+ assert_scanned(s, *args)
36
+ end
37
+ end
38
+
39
+ def assert_escape(expected, input)
40
+ source_buffer = Parser::Source::Buffer.new('(assert_escape)')
41
+
42
+ source_buffer.source = "\"\\#{input}\"".encode(input.encoding)
43
+
44
+ @lex.reset
45
+ @lex.source_buffer = source_buffer
46
+
47
+ lex_token, (lex_value, *) = @lex.advance
48
+
49
+ lex_value.force_encoding(Encoding::BINARY)
50
+
51
+ assert_equal [:tSTRING, expected],
52
+ [lex_token, lex_value],
53
+ source_buffer.source
54
+ end
55
+
56
+ def refute_escape(input)
57
+ err = assert_raises Parser::SyntaxError do
58
+ @lex.state = :expr_beg
59
+ assert_scanned "%Q[\\#{input}]"
60
+ end
61
+ assert_equal :fatal, err.diagnostic.level
62
+ end
63
+
64
+ def assert_lex_fname(name, type, range)
65
+ begin_pos, end_pos = range
66
+ assert_scanned("def #{name} ",
67
+ :kDEF, 'def', [0, 3],
68
+ type, name, [begin_pos + 4, end_pos + 4])
69
+
70
+ assert_equal :expr_endfn, @lex.state
71
+ end
72
+
73
+ def assert_scanned(input, *args)
74
+ source_buffer = Parser::Source::Buffer.new('(assert_scanned)')
75
+ source_buffer.source = input
76
+
77
+ @lex.reset(false)
78
+ @lex.source_buffer = source_buffer
79
+
80
+ until args.empty? do
81
+ token, value, (begin_pos, end_pos) = args.shift(3)
82
+
83
+ lex_token, (lex_value, lex_range) = @lex.advance
84
+ assert lex_token, 'no more tokens'
85
+ assert_operator [lex_token, lex_value], :eql?, [token, value], input
86
+ assert_equal begin_pos, lex_range.begin_pos
87
+ assert_equal end_pos, lex_range.end_pos
88
+ end
89
+
90
+ lex_token, (lex_value, *) = @lex.advance
91
+ refute lex_token, "must be empty, but had #{[lex_token, lex_value].inspect}"
92
+ end
93
+
94
+ #
95
+ # Tests
96
+ #
97
+
98
+ def test_read_escape
99
+ assert_escape "\\", "\\"
100
+ assert_escape "\n", "n"
101
+ assert_escape "\t", "t"
102
+ assert_escape "\r", "r"
103
+ assert_escape "\f", "f"
104
+ assert_escape "\13", "v"
105
+ assert_escape "\0", "0"
106
+ assert_escape "\07", "a"
107
+ assert_escape "\007", "a"
108
+ assert_escape "\033", "e"
109
+ assert_escape "\377", "377"
110
+ assert_escape "\377", "xff"
111
+ assert_escape "\010", "b"
112
+ assert_escape " ", "s"
113
+ assert_escape "q", "q" # plain vanilla escape
114
+ end
115
+
116
+ def test_read_escape_c
117
+ assert_escape "\030", "C-x"
118
+ assert_escape "\030", "cx"
119
+ assert_escape "\230", 'C-\M-x'
120
+ assert_escape "\230", 'c\M-x'
121
+
122
+ assert_escape "\177", "C-?"
123
+ assert_escape "\177", "c?"
124
+ assert_escape "\r", "cM"
125
+ end
126
+
127
+ def test_read_escape_m
128
+ assert_escape "\370", "M-x"
129
+ assert_escape "\230", 'M-\C-x'
130
+ assert_escape "\230", 'M-\cx'
131
+ end
132
+
133
+ def test_read_escape_errors
134
+ refute_escape ""
135
+
136
+ refute_escape "M"
137
+ refute_escape "M-"
138
+ refute_escape "Mx"
139
+
140
+ refute_escape "Cx"
141
+ refute_escape "C"
142
+ refute_escape "C-"
143
+
144
+ refute_escape "c"
145
+
146
+ refute_escape "x"
147
+ end
148
+
149
+ def test_read_escape_unicode__19
150
+ assert_escape "\x09", 'u{9}'
151
+ assert_escape "\x31", 'u{31}'
152
+ assert_escape "\x09\x01", 'u{9 1}'
153
+
154
+ assert_escape "\xc4\xa3", utf('u0123')
155
+ assert_escape "\xc4\xa3\xc3\xb0\xeb\x84\xa3", utf('u{123 f0 B123}')
156
+ end
157
+
158
+ def test_read_escape_unicode_bad__19
159
+ refute_escape 'u123'
160
+ refute_escape 'u{}'
161
+ refute_escape 'u{123 f0h}'
162
+ refute_escape 'u{123 f0'
163
+ end
164
+
165
+ def test_ambiguous_uminus
166
+ assert_scanned("m -3",
167
+ :tIDENTIFIER, "m", [0, 1],
168
+ :tUNARY_NUM, "-", [2, 3],
169
+ :tINTEGER, 3, [3, 4])
170
+ end
171
+
172
+ def test_ambiguous_uplus
173
+ assert_scanned("m +3",
174
+ :tIDENTIFIER, "m", [0, 1],
175
+ :tUNARY_NUM, "+", [2, 3],
176
+ :tINTEGER, 3, [3, 4])
177
+ end
178
+
179
+ def test_and
180
+ assert_scanned "&", :tAMPER, "&", [0, 1]
181
+ end
182
+
183
+ def test_and2
184
+ @lex.state = :expr_end
185
+
186
+ assert_scanned "&&", :tANDOP, "&&", [0, 2]
187
+ end
188
+
189
+ def test_and2_equals
190
+ @lex.state = :expr_end
191
+
192
+ assert_scanned "&&=", :tOP_ASGN, "&&", [0, 3]
193
+ end
194
+
195
+ def test_and_arg
196
+ @lex.state = :expr_arg
197
+
198
+ assert_scanned(" &y",
199
+ :tAMPER, "&", [1, 2],
200
+ :tIDENTIFIER, "y", [2, 3])
201
+ end
202
+
203
+ def test_and_equals
204
+ @lex.state = :expr_end
205
+
206
+ assert_scanned "&=", :tOP_ASGN, "&", [0, 2]
207
+ end
208
+
209
+ def test_and_expr
210
+ @lex.state = :expr_arg
211
+
212
+ assert_scanned("x & y",
213
+ :tIDENTIFIER, "x", [0, 1],
214
+ :tAMPER2, "&", [2, 3],
215
+ :tIDENTIFIER, "y", [4, 5])
216
+ end
217
+
218
+ def test_and_meth
219
+ assert_lex_fname "&", :tAMPER2, [0, 1]
220
+ end
221
+
222
+ def test_and_dot_arg
223
+ @lex.state = :expr_arg
224
+
225
+ assert_scanned "&.", :tANDDOT, "&.", [0, 2]
226
+ end
227
+
228
+ def test_and_dot_cmdarg
229
+ @lex.state = :expr_cmdarg
230
+
231
+ assert_scanned "&.", :tANDDOT, "&.", [0, 2]
232
+ end
233
+
234
+ def test_assoc
235
+ assert_scanned "=>", :tASSOC, "=>", [0, 2]
236
+ end
237
+
238
+ def test_label__18
239
+ assert_scanned("{a:b",
240
+ :tLBRACE, "{", [0, 1],
241
+ :tIDENTIFIER, "a", [1, 2],
242
+ :tSYMBOL, "b", [2, 4])
243
+ end
244
+
245
+ def test_label_in_params__18
246
+ assert_scanned("foo(a:b",
247
+ :tIDENTIFIER, "foo", [0, 3],
248
+ :tLPAREN2, "(", [3, 4],
249
+ :tIDENTIFIER, "a", [4, 5],
250
+ :tSYMBOL, "b", [5, 7])
251
+ end
252
+
253
+ def test_label__19
254
+ setup_lexer 19
255
+
256
+ assert_scanned("{a:b",
257
+ :tLBRACE, "{", [0, 1],
258
+ :tLABEL, "a", [1, 3],
259
+ :tIDENTIFIER, "b", [3, 4])
260
+ end
261
+
262
+ def test_label_in_params__19
263
+ setup_lexer 19
264
+
265
+ assert_scanned("foo(a:b",
266
+ :tIDENTIFIER, "foo", [0, 3],
267
+ :tLPAREN2, "(", [3, 4],
268
+ :tLABEL, "a", [4, 6],
269
+ :tIDENTIFIER, "b", [6, 7])
270
+ end
271
+
272
+ def test_label_fid__19
273
+ setup_lexer 19
274
+
275
+ assert_scanned("{a?:true",
276
+ :tLBRACE, '{', [0, 1],
277
+ :tLABEL, 'a?', [1, 4],
278
+ :kTRUE, 'true', [4, 8])
279
+ end
280
+
281
+ def test_label__22
282
+ setup_lexer 22
283
+
284
+ assert_scanned("{'a':",
285
+ :tLBRACE, '{', [0, 1],
286
+ :tSTRING_BEG, "'", [1, 2],
287
+ :tSTRING_CONTENT, 'a', [2, 3],
288
+ :tLABEL_END, "'", [3, 5])
289
+ end
290
+
291
+ def test_label_nested__22
292
+ setup_lexer 22
293
+
294
+ assert_scanned("{'a\":':",
295
+ :tLBRACE, '{', [0, 1],
296
+ :tSTRING_BEG, "'", [1, 2],
297
+ :tSTRING_CONTENT, 'a":', [2, 5],
298
+ :tLABEL_END, "'", [5, 7])
299
+ end
300
+
301
+ def test_label_colon2__22
302
+ setup_lexer 22
303
+
304
+ assert_scanned("{'a'::",
305
+ :tLBRACE, '{', [0, 1],
306
+ :tSTRING, "a", [1, 4],
307
+ :tCOLON2, '::', [4, 6])
308
+ end
309
+
310
+ def test_pct_string_colon__22
311
+ setup_lexer 22
312
+
313
+ assert_scanned("{%'a':",
314
+ :tLBRACE, '{', [0, 1],
315
+ :tSTRING_BEG, "%'", [1, 3],
316
+ :tSTRING_CONTENT, 'a', [3, 4],
317
+ :tSTRING_END, "'", [4, 5],
318
+ :tCOLON, ':', [5, 6])
319
+ end
320
+
321
+ def test_command_start__19
322
+ setup_lexer 19
323
+
324
+ %w[case elsif for in until when while
325
+ if unless and or].each do |keyword|
326
+ token = "k#{keyword.upcase}".to_sym
327
+
328
+ @lex.reset
329
+ assert_scanned("#{keyword} a:b",
330
+ token, keyword, [0, keyword.length],
331
+ :tIDENTIFIER, "a", [keyword.length + 1, keyword.length + 2],
332
+ :tSYMBOL, "b", [keyword.length + 2, keyword.length + 4])
333
+ end
334
+ end
335
+
336
+ def test_mod_not_command_start__19
337
+ setup_lexer 19
338
+
339
+ %w[if unless while until rescue].each do |keyword|
340
+ token = "k#{keyword.upcase}_MOD".to_sym
341
+
342
+ @lex.state = :expr_end
343
+ assert_scanned("#{keyword} a:b",
344
+ token, keyword, [0, keyword.length],
345
+ :tLABEL, "a", [keyword.length + 1, keyword.length + 3],
346
+ :tIDENTIFIER, "b", [keyword.length + 3, keyword.length + 4])
347
+ end
348
+ end
349
+
350
+ def test_back_ref
351
+ assert_scanned("[$&, $`, $', $+]",
352
+ :tLBRACK, "[", [0, 1],
353
+ :tBACK_REF, "$&", [1, 3], :tCOMMA, ",", [3, 4],
354
+ :tBACK_REF, "$`", [5, 7], :tCOMMA, ",", [7, 8],
355
+ :tBACK_REF, "$'", [9, 11], :tCOMMA, ",", [11, 12],
356
+ :tBACK_REF, "$+", [13, 15],
357
+ :tRBRACK, "]", [15, 16])
358
+ end
359
+
360
+ def test_backslash
361
+ assert_scanned("1 \\\n+ 2",
362
+ :tINTEGER, 1, [0, 1],
363
+ :tPLUS, "+", [4, 5],
364
+ :tINTEGER, 2, [6, 7])
365
+ end
366
+
367
+ def test_backslash_bad
368
+ refute_scanned("1 \\ + 2",
369
+ :tINTEGER, 1, [0, 1])
370
+ end
371
+
372
+ def test_backtick
373
+ assert_scanned("`ls`",
374
+ :tXSTRING_BEG, "`", [0, 1],
375
+ :tSTRING_CONTENT, "ls", [1, 3],
376
+ :tSTRING_END, "`", [3, 4])
377
+ end
378
+
379
+ def test_backtick_cmdarg
380
+ @lex.state = :expr_dot
381
+ assert_scanned("\n`", :tBACK_REF2, "`", [1, 2]) # \n ensures expr_cmd
382
+
383
+ assert_equal :expr_arg, @lex.state
384
+ end
385
+
386
+ def test_backtick_dot
387
+ @lex.state = :expr_dot
388
+ assert_scanned("a.`(3)",
389
+ :tIDENTIFIER, "a", [0, 1],
390
+ :tDOT, ".", [1, 2],
391
+ :tBACK_REF2, "`", [2, 3],
392
+ :tLPAREN2, "(", [3, 4],
393
+ :tINTEGER, 3, [4, 5],
394
+ :tRPAREN, ")", [5, 6])
395
+ end
396
+
397
+ def test_backtick_method
398
+ @lex.state = :expr_fname
399
+ assert_scanned("`", :tBACK_REF2, "`", [0, 1])
400
+ assert_equal :expr_endfn, @lex.state
401
+ end
402
+
403
+ def test_bad_char
404
+ refute_scanned(" \010 ")
405
+ end
406
+
407
+ def test_bang
408
+ assert_scanned "!", :tBANG, "!", [0, 1]
409
+ end
410
+
411
+ def test_bang_equals
412
+ assert_scanned "!=", :tNEQ, "!=", [0, 2]
413
+ end
414
+
415
+ def test_bang_tilde
416
+ assert_scanned "!~", :tNMATCH, "!~", [0, 2]
417
+ end
418
+
419
+ def test_def_ubang
420
+ setup_lexer(20)
421
+
422
+ @lex.state = :expr_fname
423
+ assert_scanned '!@', :tBANG, '!@', [0, 2]
424
+ end
425
+
426
+ def test_carat
427
+ assert_scanned "^", :tCARET, "^", [0, 1]
428
+ end
429
+
430
+ def test_carat_equals
431
+ assert_scanned "^=", :tOP_ASGN, "^", [0, 2]
432
+ end
433
+
434
+ def test_colon2
435
+ assert_scanned("A::B",
436
+ :tCONSTANT, "A", [0, 1],
437
+ :tCOLON2, "::", [1, 3],
438
+ :tCONSTANT, "B", [3, 4])
439
+
440
+ @lex.state = :expr_arg
441
+ assert_scanned("::Array",
442
+ :tCOLON2, "::", [0, 2],
443
+ :tCONSTANT, "Array", [2, 7])
444
+ end
445
+
446
+ def test_colon3
447
+ assert_scanned("::Array",
448
+ :tCOLON3, "::", [0, 2],
449
+ :tCONSTANT, "Array", [2, 7])
450
+
451
+ @lex.state = :expr_arg
452
+ assert_scanned(" ::Array",
453
+ :tCOLON3, "::", [1, 3],
454
+ :tCONSTANT, "Array", [3, 8])
455
+ end
456
+
457
+ def test_comma
458
+ assert_scanned ",", :tCOMMA, ",", [0, 1]
459
+ end
460
+
461
+ def test_comment
462
+ assert_scanned("1 # one\n# two\n2",
463
+ :tINTEGER, 1, [0, 1],
464
+ :tNL, nil, [7, 8],
465
+ :tINTEGER, 2, [14, 15])
466
+
467
+ assert_equal 2, @lex.comments.length
468
+ assert_equal '# one', @lex.comments[0].text
469
+ assert_equal '# two', @lex.comments[1].text
470
+ end
471
+
472
+ def test_comment_expr_beg
473
+ assert_scanned("{#1\n}",
474
+ :tLBRACE, "{", [0, 1],
475
+ :tRCURLY, "}", [4, 5])
476
+ end
477
+
478
+ def test_comment_begin
479
+ assert_scanned("=begin\nblah\nblah\n=end\n42",
480
+ :tINTEGER, 42, [22, 24])
481
+ assert_equal 1, @lex.comments.length
482
+ assert_equal "=begin\nblah\nblah\n=end\n", @lex.comments[0].text
483
+ end
484
+
485
+ def test_comment_begin_bad
486
+ refute_scanned("=begin\nblah\nblah\n")
487
+ end
488
+
489
+ def test_comment_begin_not_comment
490
+ assert_scanned("beginfoo = 5\np x \\\n=beginfoo",
491
+ :tIDENTIFIER, "beginfoo", [0, 8],
492
+ :tEQL, "=", [9, 10],
493
+ :tINTEGER, 5, [11, 12],
494
+ :tNL, nil, [12, 13],
495
+ :tIDENTIFIER, "p", [13, 14],
496
+ :tIDENTIFIER, "x", [15, 16],
497
+ :tEQL, "=", [19, 20],
498
+ :tIDENTIFIER, "beginfoo", [20, 28])
499
+ end
500
+
501
+ def test_comment_begin_space
502
+ assert_scanned("=begin blah\nblah\n=end\n")
503
+
504
+ assert_equal 1, @lex.comments.length
505
+ assert_equal "=begin blah\nblah\n=end\n", @lex.comments[0].text
506
+ end
507
+
508
+ def test_comment_end_space_and_text
509
+ assert_scanned("=begin blah\nblah\n=end blab\n")
510
+
511
+ assert_equal 1, @lex.comments.length
512
+ assert_equal "=begin blah\nblah\n=end blab\n", @lex.comments[0].text
513
+ end
514
+
515
+ def test_comment_eos
516
+ assert_scanned("# comment")
517
+ end
518
+
519
+ def test_constant
520
+ assert_scanned("ArgumentError",
521
+ :tCONSTANT, "ArgumentError", [0, 13])
522
+ end
523
+
524
+ def test_constant_semi
525
+ assert_scanned("ArgumentError;",
526
+ :tCONSTANT, "ArgumentError", [0, 13],
527
+ :tSEMI, ";", [13, 14])
528
+ end
529
+
530
+ def test_cvar
531
+ assert_scanned "@@blah", :tCVAR, "@@blah", [0, 6]
532
+ end
533
+
534
+ def test_cvar_bad
535
+ refute_scanned "@@1"
536
+ end
537
+
538
+ def test_div
539
+ assert_scanned("a / 2",
540
+ :tIDENTIFIER, "a", [0, 1],
541
+ :tDIVIDE, "/", [2, 3],
542
+ :tINTEGER, 2, [4, 5])
543
+ end
544
+
545
+ def test_div_equals
546
+ assert_scanned("a /= 2",
547
+ :tIDENTIFIER, "a", [0, 1],
548
+ :tOP_ASGN, "/", [2, 4],
549
+ :tINTEGER, 2, [5, 6])
550
+ end
551
+
552
+ def test_do
553
+ assert_scanned("x do 42 end",
554
+ :tIDENTIFIER, "x", [0, 1],
555
+ :kDO, "do", [2, 4],
556
+ :tINTEGER, 42, [5, 7],
557
+ :kEND, "end", [8, 11])
558
+ end
559
+
560
+ def test_do_block
561
+ @lex.state = :expr_endarg
562
+
563
+ assert_scanned("do 42 end",
564
+ :kDO_BLOCK, "do", [0, 2],
565
+ :tINTEGER, 42, [3, 5],
566
+ :kEND, "end", [6, 9])
567
+ end
568
+
569
+ def test_do_cond
570
+ @lex.cond.push true
571
+
572
+ assert_scanned("x do 42 end",
573
+ :tIDENTIFIER, "x", [0, 1],
574
+ :kDO_COND, "do", [2, 4],
575
+ :tINTEGER, 42, [5, 7],
576
+ :kEND, "end", [8, 11])
577
+ end
578
+
579
+ def test_dot
580
+ assert_scanned ".", :tDOT, ".", [0, 1]
581
+ end
582
+
583
+ def test_dot2
584
+ assert_scanned "..", :tDOT2, "..", [0, 2]
585
+ end
586
+
587
+ def test_dot3
588
+ assert_scanned "...", :tDOT3, "...", [0, 3]
589
+ end
590
+
591
+ def test_equals
592
+ assert_scanned "=", :tEQL, "=", [0, 1]
593
+ end
594
+
595
+ def test_equals2
596
+ assert_scanned "==", :tEQ, "==", [0, 2]
597
+ end
598
+
599
+ def test_equals3
600
+ assert_scanned "===", :tEQQ, "===", [0, 3]
601
+ end
602
+
603
+ def test_equals_tilde
604
+ assert_scanned "=~", :tMATCH, "=~", [0, 2]
605
+ end
606
+
607
+ def test_float
608
+ assert_scanned "1.0", :tFLOAT, 1.0, [0, 3]
609
+ end
610
+
611
+ def test_float_bad_no_underscores
612
+ refute_scanned "1__0.0"
613
+ end
614
+
615
+ def test_float_bad_no_zero_leading
616
+ refute_scanned ".0"
617
+ end
618
+
619
+ def test_float_bad_trailing_underscore
620
+ refute_scanned "123_.0"
621
+ end
622
+
623
+ def test_float_call
624
+ assert_scanned("1.0.to_s",
625
+ :tFLOAT, 1.0, [0, 3],
626
+ :tDOT, ".", [3, 4],
627
+ :tIDENTIFIER, "to_s", [4, 8])
628
+ end
629
+
630
+ def test_float_dot_E
631
+ assert_scanned "1.0E10", :tFLOAT, 1.0e10, [0, 6]
632
+ end
633
+
634
+ def test_float_dot_E_neg
635
+ assert_scanned("-1.0E10",
636
+ :tUNARY_NUM, "-", [0, 1],
637
+ :tFLOAT, 1.0e10, [1, 7])
638
+ end
639
+
640
+ def test_float_dot_E_pos
641
+ assert_scanned("+1.0E10",
642
+ :tUNARY_NUM, "+", [0, 1],
643
+ :tFLOAT, 1.0e10, [1, 7])
644
+ end
645
+
646
+ def test_float_dot_e
647
+ assert_scanned "1.0e10", :tFLOAT, 1.0e10, [0, 6]
648
+ end
649
+
650
+ def test_float_dot_e_neg
651
+ assert_scanned("-1.0e10",
652
+ :tUNARY_NUM, "-", [0, 1],
653
+ :tFLOAT, 1.0e10, [1, 7])
654
+ end
655
+
656
+ def test_float_dot_e_pos
657
+ assert_scanned("+1.0e10",
658
+ :tUNARY_NUM, "+", [0, 1],
659
+ :tFLOAT, 1.0e10, [1, 7])
660
+ end
661
+
662
+ def test_float_e
663
+ assert_scanned "1e10", :tFLOAT, 1e10, [0, 4]
664
+ end
665
+
666
+ def test_float_e_bad_trailing_underscore
667
+ refute_scanned "123_e10"
668
+ end
669
+
670
+ def test_float_e_minus
671
+ assert_scanned "1e-10", :tFLOAT, 1e-10, [0, 5]
672
+ end
673
+
674
+ def test_float_e_neg
675
+ assert_scanned("-1e10",
676
+ :tUNARY_NUM, "-", [0, 1],
677
+ :tFLOAT, 1e10, [1, 5])
678
+ end
679
+
680
+ def test_float_e_neg_minus
681
+ assert_scanned("-1e-10",
682
+ :tUNARY_NUM, "-", [0, 1],
683
+ :tFLOAT, 1e-10, [1, 6])
684
+ end
685
+
686
+ def test_float_e_neg_plus
687
+ assert_scanned("-1e+10",
688
+ :tUNARY_NUM, "-", [0, 1],
689
+ :tFLOAT, 1e10, [1, 6])
690
+ end
691
+
692
+ def test_float_e_pos
693
+ assert_scanned("+1e10",
694
+ :tUNARY_NUM, "+", [0, 1],
695
+ :tFLOAT, 1e10, [1, 5])
696
+ end
697
+
698
+ def test_float_e_pos_minus
699
+ assert_scanned("+1e-10",
700
+ :tUNARY_NUM, "+", [0, 1],
701
+ :tFLOAT, 1e-10, [1, 6])
702
+ end
703
+
704
+ def test_float_e_pos_plus
705
+ assert_scanned("+1e+10",
706
+ :tUNARY_NUM, "+", [0, 1],
707
+ :tFLOAT, 1e10, [1, 6])
708
+ end
709
+
710
+ def test_float_e_plus
711
+ assert_scanned "1e+10", :tFLOAT, 1e10, [0, 5]
712
+ end
713
+
714
+ def test_float_e_zero
715
+ assert_scanned "0e0", :tFLOAT, 0e0, [0, 3]
716
+ end
717
+
718
+ def test_float_e_nothing
719
+ [18, 19, 20].each do |version|
720
+ setup_lexer version
721
+
722
+ refute_scanned "1end"
723
+ refute_scanned "1.1end"
724
+ end
725
+
726
+ setup_lexer 21
727
+
728
+ assert_scanned("1end",
729
+ :tINTEGER, 1, [0, 1],
730
+ :kEND, 'end', [1, 4])
731
+ assert_scanned("1.1end",
732
+ :tFLOAT, 1.1, [0, 3],
733
+ :kEND, 'end', [3, 6])
734
+ end
735
+
736
+ def test_float_neg
737
+ assert_scanned("-1.0",
738
+ :tUNARY_NUM, "-", [0, 1],
739
+ :tFLOAT, 1.0, [1, 4])
740
+ end
741
+
742
+ def test_float_pos
743
+ assert_scanned("+1.0",
744
+ :tUNARY_NUM, "+", [0, 1],
745
+ :tFLOAT, 1.0, [1, 4])
746
+ end
747
+
748
+ def test_ge
749
+ assert_scanned("a >= 2",
750
+ :tIDENTIFIER, "a", [0, 1],
751
+ :tGEQ, ">=", [2, 4],
752
+ :tINTEGER, 2, [5, 6])
753
+ end
754
+
755
+ def test_global
756
+ assert_scanned("$blah", :tGVAR, "$blah", [0, 5])
757
+ end
758
+
759
+ def test_global_backref
760
+ assert_scanned("$`", :tBACK_REF, "$`", [0, 2])
761
+ end
762
+
763
+ # This was removed in 2.1.
764
+ # def test_global_dash_nothing
765
+ # assert_scanned("$- ", :tGVAR, "$-")
766
+ # end
767
+
768
+ def test_global_dash_something
769
+ assert_scanned("$-x", :tGVAR, "$-x", [0, 3])
770
+ end
771
+
772
+ def test_global_number
773
+ assert_scanned("$10", :tNTH_REF, 10, [0, 3])
774
+ end
775
+
776
+ def test_global_other
777
+ assert_scanned("[$~, $*, $$, $?, $!, $@, $/, $\\, $;, $,, $., $=, $:, $<, $>, $\"]",
778
+ :tLBRACK, "[", [0, 1],
779
+ :tGVAR, "$~", [1, 3], :tCOMMA, ",", [3, 4],
780
+ :tGVAR, "$*", [5, 7], :tCOMMA, ",", [7, 8],
781
+ :tGVAR, "$$", [9, 11], :tCOMMA, ",", [11, 12],
782
+ :tGVAR, "$\?", [13, 15], :tCOMMA, ",", [15, 16],
783
+ :tGVAR, "$!", [17, 19], :tCOMMA, ",", [19, 20],
784
+ :tGVAR, "$@", [21, 23], :tCOMMA, ",", [23, 24],
785
+ :tGVAR, "$/", [25, 27], :tCOMMA, ",", [27, 28],
786
+ :tGVAR, "$\\", [29, 31], :tCOMMA, ",", [31, 32],
787
+ :tGVAR, "$;", [33, 35], :tCOMMA, ",", [35, 36],
788
+ :tGVAR, "$,", [37, 39], :tCOMMA, ",", [39, 40],
789
+ :tGVAR, "$.", [41, 43], :tCOMMA, ",", [43, 44],
790
+ :tGVAR, "$=", [45, 47], :tCOMMA, ",", [47, 48],
791
+ :tGVAR, "$:", [49, 51], :tCOMMA, ",", [51, 52],
792
+ :tGVAR, "$<", [53, 55], :tCOMMA, ",", [55, 56],
793
+ :tGVAR, "$>", [57, 59], :tCOMMA, ",", [59, 60],
794
+ :tGVAR, "$\"", [61, 63],
795
+ :tRBRACK, "]", [63, 64])
796
+ end
797
+
798
+ def test_global_underscore
799
+ assert_scanned("$_",
800
+ :tGVAR, "$_", [0, 2])
801
+ end
802
+
803
+ def test_global_weird
804
+ assert_scanned("$__blah",
805
+ :tGVAR, "$__blah", [0, 7])
806
+ end
807
+
808
+ def test_global_zero
809
+ assert_scanned("$0", :tGVAR, "$0", [0, 2])
810
+ end
811
+
812
+ def test_gt
813
+ assert_scanned("a > 2",
814
+ :tIDENTIFIER, "a", [0, 1],
815
+ :tGT, ">", [2, 3],
816
+ :tINTEGER, 2, [4, 5])
817
+ end
818
+
819
+ def test_heredoc_backtick
820
+ assert_scanned("a = <<`EOF`\n blah blah\nEOF\n",
821
+ :tIDENTIFIER, "a", [0, 1],
822
+ :tEQL, "=", [2, 3],
823
+ :tXSTRING_BEG, "<<`", [4, 11],
824
+ :tSTRING_CONTENT, " blah blah\n", [12, 24],
825
+ :tSTRING_END, "EOF", [24, 27],
826
+ :tNL, nil, [11, 12])
827
+ end
828
+
829
+ def test_heredoc_double
830
+ assert_scanned("a = <<\"EOF\"\n blah blah\nEOF\n",
831
+ :tIDENTIFIER, "a", [0, 1],
832
+ :tEQL, "=", [2, 3],
833
+ :tSTRING_BEG, "<<\"", [4, 11],
834
+ :tSTRING_CONTENT, " blah blah\n", [12, 24],
835
+ :tSTRING_END, "EOF", [24, 27],
836
+ :tNL, nil, [11, 12])
837
+ end
838
+
839
+ def test_heredoc_double_dash
840
+ assert_scanned("a = <<-\"EOF\"\n blah blah\n EOF\n",
841
+ :tIDENTIFIER, "a", [0, 1],
842
+ :tEQL, "=", [2, 3],
843
+ :tSTRING_BEG, "<<\"", [4, 12],
844
+ :tSTRING_CONTENT, " blah blah\n", [13, 25],
845
+ :tSTRING_END, "EOF", [25, 30],
846
+ :tNL, nil, [12, 13])
847
+ end
848
+
849
+ def test_heredoc_double_eos
850
+ refute_scanned("a = <<\"EOF\"\nblah",
851
+ :tIDENTIFIER, "a", [0, 1],
852
+ :tEQL, "=", [2, 3],
853
+ :tSTRING_BEG, "<<\"", [4, 7])
854
+ end
855
+
856
+ def test_heredoc_double_eos_nl
857
+ refute_scanned("a = <<\"EOF\"\nblah\n",
858
+ :tIDENTIFIER, "a", [0, 1],
859
+ :tEQL, "=", [2, 3],
860
+ :tSTRING_BEG, "<<\"", [4, 7])
861
+ end
862
+
863
+ def test_heredoc_double_interp
864
+ assert_scanned("a = <<\"EOF\"\n#x a \#@a b \#$b c \#{3} \nEOF\n",
865
+ :tIDENTIFIER, "a", [0, 1],
866
+ :tEQL, "=", [2, 3],
867
+ :tSTRING_BEG, "<<\"", [4, 11],
868
+ :tSTRING_CONTENT, "#x a ", [12, 17],
869
+ :tSTRING_DVAR, nil, [17, 18],
870
+ :tIVAR, "@a", [18, 20],
871
+ :tSTRING_CONTENT, " b ", [20, 23],
872
+ :tSTRING_DVAR, nil, [23, 24],
873
+ :tGVAR, "$b", [24, 26],
874
+ :tSTRING_CONTENT, " c ", [26, 29],
875
+ :tSTRING_DBEG, '#{', [29, 31],
876
+ :tINTEGER, 3, [31, 32],
877
+ :tRCURLY, "}", [32, 33],
878
+ :tSTRING_CONTENT, " \n", [33, 35],
879
+ :tSTRING_END, "EOF", [35, 38],
880
+ :tNL, nil, [11, 12])
881
+ end
882
+
883
+ def test_heredoc_empty
884
+ assert_scanned("<<\"\"\n\#{x}\nblah2\n\n",
885
+ :tSTRING_BEG, "<<\"", [0, 4],
886
+ :tSTRING_DBEG, "\#{", [5, 7],
887
+ :tIDENTIFIER, "x", [7, 8],
888
+ :tRCURLY, "}", [8, 9],
889
+ :tSTRING_CONTENT, "\n", [9, 10],
890
+ :tSTRING_CONTENT, "blah2\n", [10, 16],
891
+ :tSTRING_END, "", [16, 16],
892
+ :tNL, nil, [4, 5])
893
+ end
894
+
895
+ def test_heredoc_none
896
+ assert_scanned("a = <<EOF\nblah\nblah\nEOF",
897
+ :tIDENTIFIER, "a", [0, 1],
898
+ :tEQL, "=", [2, 3],
899
+ :tSTRING_BEG, "<<\"", [4, 9],
900
+ :tSTRING_CONTENT, "blah\n", [10, 15],
901
+ :tSTRING_CONTENT, "blah\n", [15, 20],
902
+ :tSTRING_END, "EOF", [20, 23],
903
+ :tNL, nil, [9, 10])
904
+ end
905
+
906
+ def test_heredoc_none_dash
907
+ assert_scanned("a = <<-EOF\nblah\nblah\n EOF",
908
+ :tIDENTIFIER, "a", [0, 1],
909
+ :tEQL, "=", [2, 3],
910
+ :tSTRING_BEG, "<<\"", [4, 10],
911
+ :tSTRING_CONTENT, "blah\n", [11, 16],
912
+ :tSTRING_CONTENT, "blah\n", [16, 21],
913
+ :tSTRING_END, "EOF", [21, 26],
914
+ :tNL, nil, [10, 11])
915
+ end
916
+
917
+ def test_heredoc_single
918
+ assert_scanned("a = <<'EOF'\n blah blah\nEOF\n",
919
+ :tIDENTIFIER, "a", [0, 1],
920
+ :tEQL, "=", [2, 3],
921
+ :tSTRING_BEG, "<<'", [4, 11],
922
+ :tSTRING_CONTENT, " blah blah\n", [12, 24],
923
+ :tSTRING_END, "EOF", [24, 27],
924
+ :tNL, nil, [11, 12])
925
+ end
926
+
927
+ def test_heredoc_single_bad_eos_body
928
+ refute_scanned("a = <<'EOF'\nblah",
929
+ :tIDENTIFIER, "a", [0, 1],
930
+ :tEQL, "=", [2, 3],
931
+ :tSTRING_BEG, "'", [6, 7])
932
+ end
933
+
934
+ def test_heredoc_single_dash
935
+ assert_scanned("a = <<-'EOF'\n blah blah\n EOF\n",
936
+ :tIDENTIFIER, "a", [0, 1],
937
+ :tEQL, "=", [2, 3],
938
+ :tSTRING_BEG, "<<'", [4, 12],
939
+ :tSTRING_CONTENT, " blah blah\n", [13, 25],
940
+ :tSTRING_END, "EOF", [25, 30],
941
+ :tNL, nil, [12, 13])
942
+ end
943
+
944
+ def test_heredoc_one_character
945
+ assert_scanned("a = <<E\nABCDEF\nE\n",
946
+ :tIDENTIFIER, "a", [0, 1],
947
+ :tEQL, "=", [2, 3],
948
+ :tSTRING_BEG, "<<\"", [4, 7],
949
+ :tSTRING_CONTENT, "ABCDEF\n", [8, 15],
950
+ :tSTRING_END, "E", [15, 16],
951
+ :tNL, nil, [7, 8])
952
+ end
953
+
954
+ def test_heredoc_cr
955
+ assert_scanned("a = <<E\r\r\nABCDEF\r\r\nE\r\r\r\n",
956
+ :tIDENTIFIER, "a", [0, 1],
957
+ :tEQL, "=", [2, 3],
958
+ :tSTRING_BEG, "<<\"", [4, 7],
959
+ :tSTRING_CONTENT, "ABCDEF\r\n", [9, 17],
960
+ :tSTRING_END, "E", [17, 20],
961
+ :tNL, nil, [8, 9])
962
+ end
963
+
964
+ def test_heredoc_with_identifier_ending_newline__19
965
+ setup_lexer 19
966
+ refute_scanned "<<\"EOS\n\"\n123\nEOS\n"
967
+ end
968
+
969
+ def test_heredoc_with_identifier_ending_newline__24
970
+ setup_lexer 24
971
+
972
+ assert_scanned("a = <<\"EOS\n\"\nABCDEF\nEOS\n",
973
+ :tIDENTIFIER, "a", [0, 1],
974
+ :tEQL, "=", [2, 3],
975
+ :tSTRING_BEG, "<<\"", [4, 12],
976
+ :tSTRING_CONTENT, "ABCDEF\n", [13, 20],
977
+ :tSTRING_END, "EOS", [20, 23],
978
+ :tNL, nil, [12, 13])
979
+ end
980
+
981
+ def test_heredoc_with_identifier_containing_newline_inside__19
982
+ setup_lexer 19
983
+ refute_scanned "<<\"EOS\nEOS\"\n123\nEOS\n"
984
+ end
985
+
986
+ def test_heredoc_with_identifier_containing_newline_inside__24
987
+ setup_lexer 24
988
+
989
+ refute_scanned "<<\"EOS\nEOS\"\n123\nEOS\n"
990
+ end
991
+
992
+ def test_identifier
993
+ assert_scanned("identifier",
994
+ :tIDENTIFIER, "identifier", [0, 10])
995
+ end
996
+
997
+ def test_identifier_bang
998
+ assert_scanned("identifier!",
999
+ :tFID, "identifier!", [0, 11])
1000
+
1001
+ assert_scanned("identifier!=",
1002
+ :tIDENTIFIER, "identifier", [0, 10],
1003
+ :tNEQ, "!=", [10, 12])
1004
+ end
1005
+
1006
+ def test_identifier_eh
1007
+ setup_lexer 19
1008
+
1009
+ assert_scanned("identifier?",
1010
+ :tFID, "identifier?", [0, 11])
1011
+
1012
+ assert_scanned("identifier?=",
1013
+ :tIDENTIFIER, "identifier", [0, 10],
1014
+ :tCHARACTER, "=", [10, 12])
1015
+ end
1016
+
1017
+ def test_identifier_cmp
1018
+ assert_lex_fname "<=>", :tCMP, [0, 3]
1019
+ end
1020
+
1021
+ def test_identifier_def
1022
+ assert_lex_fname "identifier", :tIDENTIFIER, [0, 10]
1023
+ end
1024
+
1025
+ def test_identifier_equals_arrow
1026
+ assert_scanned(":blah==>",
1027
+ :tSYMBOL, "blah=", [0, 6],
1028
+ :tASSOC, "=>", [6, 8])
1029
+ end
1030
+
1031
+ def test_identifier_equals3
1032
+ assert_scanned(":a===b",
1033
+ :tSYMBOL, "a", [0, 2],
1034
+ :tEQQ, "===", [2, 5],
1035
+ :tIDENTIFIER, "b", [5, 6])
1036
+ end
1037
+
1038
+ def test_identifier_equals_equals_arrow
1039
+ assert_scanned(":a==>b",
1040
+ :tSYMBOL, "a=", [0, 3],
1041
+ :tASSOC, "=>", [3, 5],
1042
+ :tIDENTIFIER, "b", [5, 6])
1043
+ end
1044
+
1045
+ def test_identifier_equals_caret
1046
+ assert_lex_fname "^", :tCARET, [0, 1]
1047
+ end
1048
+
1049
+ def test_identifier_equals_def
1050
+ assert_lex_fname "identifier=", :tIDENTIFIER, [0, 11]
1051
+ end
1052
+
1053
+ def test_identifier_equals_def2
1054
+ assert_lex_fname "==", :tEQ, [0, 2]
1055
+ end
1056
+
1057
+ def test_identifier_equals_expr
1058
+ @lex.state = :expr_dot
1059
+ assert_scanned("y = arg",
1060
+ :tIDENTIFIER, "y", [0, 1],
1061
+ :tEQL, "=", [2, 3],
1062
+ :tIDENTIFIER, "arg", [4, 7])
1063
+
1064
+ assert_equal :expr_arg, @lex.state
1065
+ end
1066
+
1067
+ def test_identifier_equals_or
1068
+ assert_lex_fname "|", :tPIPE, [0, 1]
1069
+ end
1070
+
1071
+ def test_identifier_equals_slash
1072
+ assert_lex_fname "/", :tDIVIDE, [0, 1]
1073
+ end
1074
+
1075
+ def test_identifier_equals_tilde
1076
+ @lex.state = :expr_fname
1077
+ assert_scanned("identifier=~",
1078
+ :tIDENTIFIER, "identifier=", [0, 11],
1079
+ :tTILDE, "~", [11, 12])
1080
+ end
1081
+
1082
+ def test_identifier_gt
1083
+ assert_lex_fname ">", :tGT, [0, 1]
1084
+ end
1085
+
1086
+ def test_identifier_le
1087
+ assert_lex_fname "<=", :tLEQ, [0, 2]
1088
+ end
1089
+
1090
+ def test_identifier_lt
1091
+ assert_lex_fname "<", :tLT, [0, 1]
1092
+ end
1093
+
1094
+ def test_identifier_tilde
1095
+ assert_lex_fname "~", :tTILDE, [0, 1]
1096
+ end
1097
+
1098
+ def test_identifier_defined?
1099
+ assert_lex_fname "defined?", :kDEFINED, [0, 8]
1100
+ end
1101
+
1102
+ def test_index
1103
+ assert_lex_fname "[]", :tAREF, [0, 2]
1104
+ end
1105
+
1106
+ def test_index_equals
1107
+ assert_lex_fname "[]=", :tASET, [0, 3]
1108
+ end
1109
+
1110
+ def test_integer
1111
+ assert_scanned "42", :tINTEGER, 42, [0, 2]
1112
+ end
1113
+
1114
+ def test_integer_bin
1115
+ assert_scanned "0b101010", :tINTEGER, 42, [0, 8]
1116
+ end
1117
+
1118
+ def test_integer_bin_bad_none
1119
+ refute_scanned "0b "
1120
+ end
1121
+
1122
+ def test_integer_bin_bad_underscores
1123
+ refute_scanned "0b10__01"
1124
+ end
1125
+
1126
+ def test_integer_dec
1127
+ assert_scanned "42", :tINTEGER, 42, [0, 2]
1128
+ end
1129
+
1130
+ def test_integer_dec_bad_underscores
1131
+ refute_scanned "42__24"
1132
+ end
1133
+
1134
+ def test_integer_dec_d
1135
+ assert_scanned "0d42", :tINTEGER, 42, [0, 4]
1136
+ end
1137
+
1138
+ def test_integer_dec_d_bad_none
1139
+ refute_scanned "0d"
1140
+ end
1141
+
1142
+ def test_integer_dec_d_bad_underscores
1143
+ refute_scanned "0d42__24"
1144
+ end
1145
+
1146
+ def test_question_eh_a__18
1147
+ setup_lexer 18
1148
+
1149
+ assert_scanned "?a", :tINTEGER, 97, [0, 2]
1150
+ end
1151
+
1152
+ def test_question_eh_a__19
1153
+ setup_lexer 19
1154
+
1155
+ assert_scanned '?a', :tCHARACTER, "a", [0, 2]
1156
+ end
1157
+
1158
+ def test_question_eh_escape_M_escape_C__18
1159
+ setup_lexer 18
1160
+
1161
+ assert_scanned '?\M-\C-a', :tINTEGER, 129, [0, 8]
1162
+ end
1163
+
1164
+ def test_question_eh_escape_M_escape_C__19
1165
+ setup_lexer 19
1166
+
1167
+ assert_scanned '?\M-\C-a', :tCHARACTER, "\M-\C-a", [0, 8]
1168
+ end
1169
+
1170
+ def test_question_eh_escape_u_1_digit
1171
+ setup_lexer 19
1172
+
1173
+ refute_scanned '?\\u1'
1174
+ end
1175
+
1176
+ def test_question_eh_escape_u_2_digits
1177
+ setup_lexer 19
1178
+
1179
+ refute_scanned '?\\u12'
1180
+ end
1181
+
1182
+ def test_question_eh_escape_u_3_digits
1183
+ setup_lexer 19
1184
+
1185
+ refute_scanned '?\\u123'
1186
+ end
1187
+
1188
+ def test_question_eh_escape_u_4_digits
1189
+ setup_lexer 19
1190
+ assert_scanned '?\\u0001', :tCHARACTER, "\u0001", [0, 7]
1191
+ end
1192
+
1193
+ def test_question_eh_single_unicode_point
1194
+ setup_lexer 19
1195
+ assert_scanned '?\\u{123}', :tCHARACTER, "\u0123", [0, 8]
1196
+
1197
+ setup_lexer 19
1198
+ assert_scanned '?\\u{a}', :tCHARACTER, "\n", [0, 6]
1199
+ end
1200
+
1201
+ def test_question_eh_multiple_unicode_points
1202
+ setup_lexer 19
1203
+ refute_scanned '?\\u{1 2 3}'
1204
+
1205
+ setup_lexer 19
1206
+ refute_scanned '?\\u{a b}'
1207
+ end
1208
+
1209
+ def test_question_eh_escape_u_unclosed_bracket
1210
+ setup_lexer 19
1211
+
1212
+ refute_scanned '?\\u{123'
1213
+ end
1214
+
1215
+ def test_question_eh_escape_space_around_unicode_point__19
1216
+ setup_lexer 19
1217
+ refute_scanned '"\\u{1 }"'
1218
+
1219
+ setup_lexer 19
1220
+ refute_scanned '"\\u{ 1}"'
1221
+
1222
+ setup_lexer 19
1223
+ refute_scanned '"\\u{ 1 }"'
1224
+
1225
+ setup_lexer 19
1226
+ refute_scanned '"\\u{1 2 }"'
1227
+
1228
+ setup_lexer 19
1229
+ refute_scanned '"\\u{ 1 2}"'
1230
+
1231
+ setup_lexer 19
1232
+ refute_scanned '"\\u{1 2}"'
1233
+ end
1234
+
1235
+ def test_question_eh_escape_space_around_unicode_point__24
1236
+ setup_lexer 24
1237
+ assert_scanned '"\\u{ 1}"', :tSTRING, "\u0001", [0, 8]
1238
+
1239
+ setup_lexer 24
1240
+ assert_scanned '"\\u{1 }"', :tSTRING, "\u0001", [0, 8]
1241
+
1242
+ setup_lexer 24
1243
+ assert_scanned '"\\u{ 1 }"', :tSTRING, "\u0001", [0, 9]
1244
+
1245
+ setup_lexer 24
1246
+ assert_scanned '"\\u{1 2 }"', :tSTRING, "\u0001\u0002", [0, 10]
1247
+
1248
+ setup_lexer 24
1249
+ assert_scanned '"\\u{ 1 2}"', :tSTRING, "\u0001\u0002", [0, 10]
1250
+
1251
+ setup_lexer 24
1252
+ assert_scanned '"\\u{1 2}"', :tSTRING, "\u0001\u0002", [0, 10]
1253
+ end
1254
+
1255
+ def test_integer_hex
1256
+ assert_scanned "0x2a", :tINTEGER, 42, [0, 4]
1257
+ end
1258
+
1259
+ def test_integer_hex_bad_none
1260
+ refute_scanned "0x "
1261
+ end
1262
+
1263
+ def test_integer_hex_bad_underscores
1264
+ refute_scanned "0xab__cd"
1265
+ end
1266
+
1267
+ def test_integer_oct
1268
+ assert_scanned "052", :tINTEGER, 42, [0, 3]
1269
+ end
1270
+
1271
+ def test_integer_oct_bad_range
1272
+ refute_scanned "08"
1273
+ end
1274
+
1275
+ def test_integer_oct_bad_underscores
1276
+ refute_scanned "01__23"
1277
+ end
1278
+
1279
+ def test_integer_oct_O
1280
+ assert_scanned "0O52", :tINTEGER, 42, [0, 4]
1281
+ end
1282
+
1283
+ def test_integer_oct_O_bad_range
1284
+ refute_scanned "0O1238"
1285
+ end
1286
+
1287
+ def test_integer_oct_O_bad_underscores
1288
+ refute_scanned "0O1__23"
1289
+ end
1290
+
1291
+ def test_integer_oct_O_not_bad_none
1292
+ assert_scanned "0O ", :tINTEGER, 0, [0, 2]
1293
+ end
1294
+
1295
+ def test_integer_oct_o
1296
+ assert_scanned "0o52", :tINTEGER, 42, [0, 4]
1297
+ end
1298
+
1299
+ def test_integer_oct_o_bad_range
1300
+ refute_scanned "0o1283"
1301
+ end
1302
+
1303
+ def test_integer_oct_o_bad_underscores
1304
+ refute_scanned "0o1__23"
1305
+ end
1306
+
1307
+ def test_integer_oct_o_not_bad_none
1308
+ assert_scanned "0o ", :tINTEGER, 0, [0, 2]
1309
+ end
1310
+
1311
+ def test_integer_trailing
1312
+ assert_scanned("1.to_s",
1313
+ :tINTEGER, 1, [0, 1],
1314
+ :tDOT, '.', [1, 2],
1315
+ :tIDENTIFIER, 'to_s', [2, 6])
1316
+ end
1317
+
1318
+ def test_integer_underscore
1319
+ assert_scanned "4_2", :tINTEGER, 42, [0, 3]
1320
+ end
1321
+
1322
+ def test_integer_underscore_bad
1323
+ refute_scanned "4__2"
1324
+ end
1325
+
1326
+ def test_integer_zero
1327
+ assert_scanned "0", :tINTEGER, 0, [0, 1]
1328
+ end
1329
+
1330
+ def test_ivar
1331
+ assert_scanned "@blah", :tIVAR, "@blah", [0, 5]
1332
+ end
1333
+
1334
+ def test_ivar_bad
1335
+ refute_scanned "@1"
1336
+ end
1337
+
1338
+ def test_ivar_bad_0_length
1339
+ refute_scanned "1+@\n", :tINTEGER, 1, [0, 1], :tPLUS, "+", [1, 2]
1340
+ end
1341
+
1342
+ def test_keyword_expr
1343
+ @lex.state = :expr_endarg
1344
+
1345
+ assert_scanned "if", :kIF_MOD, "if", [0, 2]
1346
+
1347
+ assert_equal :expr_beg, @lex.state
1348
+ end
1349
+
1350
+ def test_lt
1351
+ assert_scanned "<", :tLT, "<", [0, 1]
1352
+ end
1353
+
1354
+ def test_lt2
1355
+ assert_scanned("a <\< b",
1356
+ :tIDENTIFIER, "a", [0, 1],
1357
+ :tLSHFT, "<\<", [2, 4],
1358
+ :tIDENTIFIER, "b", [5, 6])
1359
+
1360
+ end
1361
+
1362
+ def test_lt2_equals
1363
+ assert_scanned("a <\<= b",
1364
+ :tIDENTIFIER, "a", [0, 1],
1365
+ :tOP_ASGN, "<\<", [2, 5],
1366
+ :tIDENTIFIER, "b", [6, 7])
1367
+ end
1368
+
1369
+ def test_lt_equals
1370
+ assert_scanned "<=", :tLEQ, "<=", [0, 2]
1371
+ end
1372
+
1373
+ def test_minus
1374
+ assert_scanned("1 - 2",
1375
+ :tINTEGER, 1, [0, 1],
1376
+ :tMINUS, "-", [2, 3],
1377
+ :tINTEGER, 2, [4, 5])
1378
+ end
1379
+
1380
+ def test_minus_equals
1381
+ @lex.state = :expr_end
1382
+
1383
+ assert_scanned "-=", :tOP_ASGN, "-", [0, 2]
1384
+ end
1385
+
1386
+ def test_minus_method
1387
+ @lex.state = :expr_fname
1388
+ assert_scanned "-", :tMINUS, "-", [0, 1]
1389
+ end
1390
+
1391
+ def test_minus_unary_method
1392
+ @lex.state = :expr_fname
1393
+ assert_scanned "-@", :tUMINUS, "-@", [0, 2]
1394
+ end
1395
+
1396
+ def test_minus_unary_number
1397
+ assert_scanned("-42",
1398
+ :tUNARY_NUM, "-", [0, 1],
1399
+ :tINTEGER, 42, [1, 3])
1400
+ end
1401
+
1402
+ def test_minus_unary_whitespace_number
1403
+ assert_scanned("- 42",
1404
+ :tUNARY_NUM, "-", [0, 1],
1405
+ :tINTEGER, 42, [2, 4])
1406
+ end
1407
+
1408
+ def test_nth_ref
1409
+ assert_scanned('[$1, $2, $3]',
1410
+ :tLBRACK, "[", [0, 1],
1411
+ :tNTH_REF, 1, [1, 3], :tCOMMA, ",", [3, 4],
1412
+ :tNTH_REF, 2, [5, 7], :tCOMMA, ",", [7, 8],
1413
+ :tNTH_REF, 3, [9, 11],
1414
+ :tRBRACK, "]", [11, 12])
1415
+ end
1416
+
1417
+ def test_open_bracket
1418
+ assert_scanned("(", :tLPAREN, "(", [0, 1])
1419
+ end
1420
+
1421
+ def test_open_bracket_cmdarg
1422
+ assert_scanned("m (", :tIDENTIFIER, "m", [0, 1],
1423
+ :tLPAREN_ARG, "(", [2, 3])
1424
+ end
1425
+
1426
+ def test_open_bracket_exprarg
1427
+ assert_scanned("m(", :tIDENTIFIER, "m", [0, 1],
1428
+ :tLPAREN2, "(", [1, 2])
1429
+ end
1430
+
1431
+ def test_open_curly_bracket
1432
+ assert_scanned("{",
1433
+ :tLBRACE, "{", [0, 1])
1434
+ end
1435
+
1436
+ def test_open_curly_bracket_arg
1437
+ assert_scanned("m { 3 }",
1438
+ :tIDENTIFIER, "m", [0, 1],
1439
+ :tLCURLY, "{", [2, 3],
1440
+ :tINTEGER, 3, [4, 5],
1441
+ :tRCURLY, "}", [6, 7])
1442
+ end
1443
+
1444
+ def test_open_curly_bracket_block
1445
+ @lex.state = :expr_endarg # seen m(3)
1446
+
1447
+ assert_scanned("{ 4 }",
1448
+ :tLBRACE_ARG, "{", [0, 1],
1449
+ :tINTEGER, 4, [2, 3],
1450
+ :tRCURLY, "}", [4, 5])
1451
+ end
1452
+
1453
+ def test_open_square_bracket_arg
1454
+ assert_scanned("m [ 3 ]",
1455
+ :tIDENTIFIER, "m", [0, 1],
1456
+ :tLBRACK, "[", [2, 3],
1457
+ :tINTEGER, 3, [4, 5],
1458
+ :tRBRACK, "]", [6, 7])
1459
+ end
1460
+
1461
+ def test_open_square_bracket_ary
1462
+ assert_scanned("[1, 2, 3]",
1463
+ :tLBRACK, "[", [0, 1],
1464
+ :tINTEGER, 1, [1, 2],
1465
+ :tCOMMA, ",", [2, 3],
1466
+ :tINTEGER, 2, [4, 5],
1467
+ :tCOMMA, ",", [5, 6],
1468
+ :tINTEGER, 3, [7, 8],
1469
+ :tRBRACK, "]", [8, 9])
1470
+ end
1471
+
1472
+ def test_open_square_bracket_meth
1473
+ assert_scanned("m[3]",
1474
+ :tIDENTIFIER, "m", [0, 1],
1475
+ :tLBRACK2, "[", [1, 2],
1476
+ :tINTEGER, 3, [2, 3],
1477
+ :tRBRACK, "]", [3, 4])
1478
+ end
1479
+
1480
+ def test_or
1481
+ assert_scanned "|", :tPIPE, "|", [0, 1]
1482
+ end
1483
+
1484
+ def test_or2
1485
+ assert_scanned "||", :tOROP, "||", [0, 2]
1486
+ end
1487
+
1488
+ def test_or2_equals
1489
+ assert_scanned "||=", :tOP_ASGN, "||", [0, 3]
1490
+ end
1491
+
1492
+ def test_or_equals
1493
+ assert_scanned "|=", :tOP_ASGN, "|", [0, 2]
1494
+ end
1495
+
1496
+ def test_percent
1497
+ assert_scanned("a % 2",
1498
+ :tIDENTIFIER, "a", [0, 1],
1499
+ :tPERCENT, "%", [2, 3],
1500
+ :tINTEGER, 2, [4, 5])
1501
+ end
1502
+
1503
+ def test_percent_equals
1504
+ assert_scanned("a %= 2",
1505
+ :tIDENTIFIER, "a", [0, 1],
1506
+ :tOP_ASGN, "%", [2, 4],
1507
+ :tINTEGER, 2, [5, 6])
1508
+ end
1509
+
1510
+ def test_plus
1511
+ assert_scanned("1 + 1",
1512
+ :tINTEGER, 1, [0, 1],
1513
+ :tPLUS, "+", [2, 3],
1514
+ :tINTEGER, 1, [4, 5])
1515
+ end
1516
+
1517
+ def test_plus_equals
1518
+ @lex.state = :expr_end
1519
+
1520
+ assert_scanned "+=", :tOP_ASGN, "+", [0, 2]
1521
+ end
1522
+
1523
+ def test_plus_method
1524
+ @lex.state = :expr_fname
1525
+ assert_scanned "+", :tPLUS, "+", [0, 1]
1526
+ end
1527
+
1528
+ def test_plus_unary_method
1529
+ @lex.state = :expr_fname
1530
+ assert_scanned "+@", :tUPLUS, "+@", [0, 2]
1531
+ end
1532
+
1533
+ def test_plus_unary_number
1534
+ assert_scanned("+42",
1535
+ :tUNARY_NUM, "+", [0, 1],
1536
+ :tINTEGER, 42, [1, 3])
1537
+ end
1538
+
1539
+ def test_plus_unary_whitespace_number
1540
+ assert_scanned("+ 42",
1541
+ :tUNARY_NUM, "+", [0, 1],
1542
+ :tINTEGER, 42, [2, 4])
1543
+ end
1544
+
1545
+ def test_numbers
1546
+ assert_scanned "0b10", :tINTEGER, 2, [0, 4]
1547
+ assert_scanned "0B10", :tINTEGER, 2, [0, 4]
1548
+
1549
+ assert_scanned "0d10", :tINTEGER, 10, [0, 4]
1550
+ assert_scanned "0D10", :tINTEGER, 10, [0, 4]
1551
+
1552
+ assert_scanned "0x10", :tINTEGER, 16, [0, 4]
1553
+ assert_scanned "0X10", :tINTEGER, 16, [0, 4]
1554
+
1555
+ assert_scanned "0o10", :tINTEGER, 8, [0, 4]
1556
+ assert_scanned "0O10", :tINTEGER, 8, [0, 4]
1557
+ assert_scanned "0o", :tINTEGER, 0, [0, 2]
1558
+ assert_scanned "0O", :tINTEGER, 0, [0, 2]
1559
+
1560
+ assert_scanned "0o", :tINTEGER, 0, [0, 2]
1561
+ assert_scanned "0O", :tINTEGER, 0, [0, 2]
1562
+
1563
+ assert_scanned "0777_333", :tINTEGER, 261851, [0, 8]
1564
+
1565
+ assert_scanned "0", :tINTEGER, 0, [0, 1]
1566
+
1567
+ refute_scanned "0x"
1568
+ refute_scanned "0X"
1569
+ refute_scanned "0b"
1570
+ refute_scanned "0B"
1571
+ refute_scanned "0d"
1572
+ refute_scanned "0D"
1573
+
1574
+ refute_scanned "08"
1575
+ refute_scanned "09"
1576
+ refute_scanned "0o8"
1577
+ refute_scanned "0o9"
1578
+ refute_scanned "0O8"
1579
+ refute_scanned "0O9"
1580
+
1581
+ refute_scanned "1_e1"
1582
+ refute_scanned "1_.1"
1583
+ refute_scanned "1__1"
1584
+
1585
+ refute_scanned "1end"
1586
+ refute_scanned "1.1end"
1587
+ end
1588
+
1589
+ def test_question__18
1590
+ setup_lexer 18
1591
+
1592
+ assert_scanned "?*", :tINTEGER, 42, [0, 2]
1593
+ end
1594
+
1595
+ def test_question__19
1596
+ setup_lexer 19
1597
+
1598
+ assert_scanned "?*", :tCHARACTER, "*", [0, 2]
1599
+ end
1600
+
1601
+ def test_question_bad_eos
1602
+ refute_scanned "?"
1603
+ end
1604
+
1605
+ def test_question_bad_ws
1606
+ assert_scanned "? ", :tEH, "?", [0, 1]
1607
+ assert_scanned "?\n", :tEH, "?", [0, 1]
1608
+ assert_scanned "?\t", :tEH, "?", [0, 1]
1609
+ assert_scanned "?\v", :tEH, "?", [0, 1]
1610
+ assert_scanned "?\r", :tEH, "?", [0, 1]
1611
+ assert_scanned "?\f", :tEH, "?", [0, 1]
1612
+ end
1613
+
1614
+ def test_question_ws_backslashed__18
1615
+ setup_lexer 18
1616
+
1617
+ @lex.state = :expr_beg
1618
+ assert_scanned "?\\ ", :tINTEGER, 32, [0, 3]
1619
+ @lex.state = :expr_beg
1620
+ assert_scanned "?\\n", :tINTEGER, 10, [0, 3]
1621
+ @lex.state = :expr_beg
1622
+ assert_scanned "?\\t", :tINTEGER, 9, [0, 3]
1623
+ @lex.state = :expr_beg
1624
+ assert_scanned "?\\v", :tINTEGER, 11, [0, 3]
1625
+ @lex.state = :expr_beg
1626
+ assert_scanned "?\\r", :tINTEGER, 13, [0, 3]
1627
+ @lex.state = :expr_beg
1628
+ assert_scanned "?\\f", :tINTEGER, 12, [0, 3]
1629
+ end
1630
+
1631
+ def test_question_ws_backslashed__19
1632
+ setup_lexer 19
1633
+
1634
+ @lex.state = :expr_beg
1635
+ assert_scanned "?\\ ", :tCHARACTER, " ", [0, 3]
1636
+ @lex.state = :expr_beg
1637
+ assert_scanned "?\\n", :tCHARACTER, "\n", [0, 3]
1638
+ @lex.state = :expr_beg
1639
+ assert_scanned "?\\t", :tCHARACTER, "\t", [0, 3]
1640
+ @lex.state = :expr_beg
1641
+ assert_scanned "?\\v", :tCHARACTER, "\v", [0, 3]
1642
+ @lex.state = :expr_beg
1643
+ assert_scanned "?\\r", :tCHARACTER, "\r", [0, 3]
1644
+ @lex.state = :expr_beg
1645
+ assert_scanned "?\\f", :tCHARACTER, "\f", [0, 3]
1646
+ end
1647
+
1648
+ def test_rbracket
1649
+ assert_scanned "]", :tRBRACK, "]", [0, 1]
1650
+ end
1651
+
1652
+ def test_rcurly
1653
+ assert_scanned "}", :tRCURLY, "}", [0, 1]
1654
+ end
1655
+
1656
+ def test_regexp
1657
+ assert_scanned("/regexp/",
1658
+ :tREGEXP_BEG, "/", [0, 1],
1659
+ :tSTRING_CONTENT, "regexp", [1, 7],
1660
+ :tSTRING_END, "/", [7, 8],
1661
+ :tREGEXP_OPT, "", [8, 8])
1662
+ end
1663
+
1664
+ def test_regexp_ambiguous
1665
+ assert_scanned("method /regexp/",
1666
+ :tIDENTIFIER, "method", [0, 6],
1667
+ :tREGEXP_BEG, "/", [7, 8],
1668
+ :tSTRING_CONTENT, "regexp", [8, 14],
1669
+ :tSTRING_END, "/", [14, 15],
1670
+ :tREGEXP_OPT, "", [15, 15])
1671
+ end
1672
+
1673
+ def test_regexp_bad
1674
+ refute_scanned("/.*/xyz",
1675
+ :tREGEXP_BEG, "/", [0, 1],
1676
+ :tSTRING_CONTENT, ".*", [1, 3],
1677
+ :tSTRING_END, "/", [3, 4])
1678
+ end
1679
+
1680
+ def test_regexp_escape_C
1681
+ assert_scanned('/regex\\C-x/',
1682
+ :tREGEXP_BEG, "/", [0, 1],
1683
+ :tSTRING_CONTENT, "regex\\C-x", [1, 10],
1684
+ :tSTRING_END, "/", [10, 11],
1685
+ :tREGEXP_OPT, "", [11, 11])
1686
+ end
1687
+
1688
+ def test_regexp_escape_C_M
1689
+ assert_scanned('/regex\\C-\\M-x/',
1690
+ :tREGEXP_BEG, "/", [0, 1],
1691
+ :tSTRING_CONTENT, "regex\\C-\\M-x", [1, 13],
1692
+ :tSTRING_END, "/", [13, 14],
1693
+ :tREGEXP_OPT, "", [14, 14])
1694
+ end
1695
+
1696
+ def test_regexp_escape_C_M_craaaazy
1697
+ assert_scanned("/regex\\C-\\\n\\M-x/",
1698
+ :tREGEXP_BEG, "/", [0, 1],
1699
+ :tSTRING_CONTENT, "regex\\C-\\M-x", [1, 15],
1700
+ :tSTRING_END, "/", [15, 16],
1701
+ :tREGEXP_OPT, "", [16, 16])
1702
+ end
1703
+
1704
+ def test_regexp_escape_C_bad_dash
1705
+ refute_scanned '/regex\\Cx/', :tREGEXP_BEG, "/", [0, 1]
1706
+ end
1707
+
1708
+ def test_regexp_escape_C_bad_dash_eos
1709
+ refute_scanned '/regex\\C-/', :tREGEXP_BEG, "/", [0, 1]
1710
+ end
1711
+
1712
+ def test_regexp_escape_C_bad_dash_eos2
1713
+ refute_scanned '/regex\\C-', :tREGEXP_BEG, "/", [0, 1]
1714
+ end
1715
+
1716
+ def test_regexp_escape_C_bad_eos
1717
+ refute_scanned '/regex\\C/', :tREGEXP_BEG, "/", [0, 1]
1718
+ end
1719
+
1720
+ def test_regexp_escape_C_bad_eos2
1721
+ refute_scanned '/regex\\c', :tREGEXP_BEG, "/", [0, 1]
1722
+ end
1723
+
1724
+ def test_regexp_escape_M
1725
+ assert_scanned('/regex\\M-x/',
1726
+ :tREGEXP_BEG, "/", [0, 1],
1727
+ :tSTRING_CONTENT, "regex\\M-x", [1, 10],
1728
+ :tSTRING_END, "/", [10, 11],
1729
+ :tREGEXP_OPT, "", [11, 11])
1730
+ end
1731
+
1732
+ def test_regexp_escape_M_C
1733
+ assert_scanned('/regex\\M-\\C-x/',
1734
+ :tREGEXP_BEG, "/", [0, 1],
1735
+ :tSTRING_CONTENT, "regex\\M-\\C-x", [1, 13],
1736
+ :tSTRING_END, "/", [13, 14],
1737
+ :tREGEXP_OPT, "", [14, 14])
1738
+ end
1739
+
1740
+ def test_regexp_escape_M_bad_dash
1741
+ refute_scanned '/regex\\Mx/', :tREGEXP_BEG, "/", [0, 1]
1742
+ end
1743
+
1744
+ def test_regexp_escape_M_bad_dash_eos
1745
+ refute_scanned '/regex\\M-/', :tREGEXP_BEG, "/", [0, 1]
1746
+ end
1747
+
1748
+ def test_regexp_escape_M_bad_dash_eos2
1749
+ refute_scanned '/regex\\M-', :tREGEXP_BEG, "/", [0, 1]
1750
+ end
1751
+
1752
+ def test_regexp_escape_M_bad_eos
1753
+ refute_scanned '/regex\\M/', :tREGEXP_BEG, "/", [0, 1]
1754
+ end
1755
+
1756
+ def test_regexp_escape_backslash_slash
1757
+ assert_scanned('/\\//',
1758
+ :tREGEXP_BEG, "/", [0, 1],
1759
+ :tSTRING_CONTENT, '/', [1, 3],
1760
+ :tSTRING_END, "/", [3, 4],
1761
+ :tREGEXP_OPT, "", [4, 4])
1762
+ end
1763
+
1764
+ def test_regexp_escape_backslash_terminator
1765
+ assert_scanned('%r%blah\\%blah%',
1766
+ :tREGEXP_BEG, "%r%", [0, 3],
1767
+ :tSTRING_CONTENT, "blah%blah", [3, 13],
1768
+ :tSTRING_END, "%", [13, 14],
1769
+ :tREGEXP_OPT, "", [14, 14])
1770
+ end
1771
+
1772
+ def test_regexp_escape_backslash_terminator_meta1
1773
+ assert_scanned('%r{blah\\}blah}',
1774
+ :tREGEXP_BEG, "%r{", [0, 3],
1775
+ :tSTRING_CONTENT, "blah\\}blah", [3, 13],
1776
+ :tSTRING_END, "}", [13, 14],
1777
+ :tREGEXP_OPT, "", [14, 14])
1778
+ end
1779
+
1780
+ def test_regexp_escape_backslash_terminator_meta2
1781
+ assert_scanned('%r/blah\\/blah/',
1782
+ :tREGEXP_BEG, "%r/", [0, 3],
1783
+ :tSTRING_CONTENT, "blah/blah", [3, 13],
1784
+ :tSTRING_END, "/", [13, 14],
1785
+ :tREGEXP_OPT, "", [14, 14])
1786
+ end
1787
+
1788
+ def test_regexp_escape_backslash_terminator_meta3
1789
+ assert_scanned('%r/blah\\%blah/',
1790
+ :tREGEXP_BEG, "%r/", [0, 3],
1791
+ :tSTRING_CONTENT, "blah\\%blah", [3, 13],
1792
+ :tSTRING_END, "/", [13, 14],
1793
+ :tREGEXP_OPT, "", [14, 14])
1794
+ end
1795
+
1796
+ def test_regexp_escape_bad_eos
1797
+ refute_scanned '/regex\\', :tREGEXP_BEG, "/", [0, 1]
1798
+ end
1799
+
1800
+ def test_regexp_escape_bs
1801
+ assert_scanned('/regex\\\\regex/',
1802
+ :tREGEXP_BEG, "/", [0, 1],
1803
+ :tSTRING_CONTENT, "regex\\\\regex", [1, 13],
1804
+ :tSTRING_END, "/", [13, 14],
1805
+ :tREGEXP_OPT, "", [14, 14])
1806
+ end
1807
+
1808
+ def test_regexp_escape_c
1809
+ assert_scanned('/regex\\cxxx/',
1810
+ :tREGEXP_BEG, "/", [0, 1],
1811
+ :tSTRING_CONTENT, "regex\\cxxx", [1, 11],
1812
+ :tSTRING_END, "/", [11, 12],
1813
+ :tREGEXP_OPT, "", [12, 12])
1814
+ end
1815
+
1816
+ def test_regexp_escape_c_backslash
1817
+ assert_scanned('/regex\\c\\n/',
1818
+ :tREGEXP_BEG, "/", [0, 1],
1819
+ :tSTRING_CONTENT, "regex\\c\\n", [1, 10],
1820
+ :tSTRING_END, "/", [10, 11],
1821
+ :tREGEXP_OPT, "", [11, 11])
1822
+ end
1823
+
1824
+ def test_regexp_escape_chars
1825
+ assert_scanned('/re\\tge\\nxp/',
1826
+ :tREGEXP_BEG, "/", [0, 1],
1827
+ :tSTRING_CONTENT, "re\\tge\\nxp", [1, 11],
1828
+ :tSTRING_END, "/", [11, 12],
1829
+ :tREGEXP_OPT, "", [12, 12])
1830
+ end
1831
+
1832
+ def test_regexp_escape_double_backslash
1833
+ assert_scanned('/[\\/\\\\]$/',
1834
+ :tREGEXP_BEG, "/", [0, 1],
1835
+ :tSTRING_CONTENT,'[/\\\\]$', [1, 8],
1836
+ :tSTRING_END, "/", [8, 9],
1837
+ :tREGEXP_OPT, "", [9, 9])
1838
+ end
1839
+
1840
+ def test_regexp_escape_hex
1841
+ assert_scanned('/regex\\x61xp/',
1842
+ :tREGEXP_BEG, "/", [0, 1],
1843
+ :tSTRING_CONTENT, "regex\\x61xp", [1, 12],
1844
+ :tSTRING_END, "/", [12, 13],
1845
+ :tREGEXP_OPT, "", [13, 13])
1846
+ end
1847
+
1848
+ def test_regexp_escape_hex_bad
1849
+ refute_scanned '/regex\\xzxp/', :tREGEXP_BEG, "/", [0, 1]
1850
+ end
1851
+
1852
+ def test_regexp_escape_hex_one
1853
+ assert_scanned('/^[\\xd\\xa]{2}/on',
1854
+ :tREGEXP_BEG, '/', [0, 1],
1855
+ :tSTRING_CONTENT, '^[\\xd\\xa]{2}', [1, 13],
1856
+ :tSTRING_END, "/", [13, 14],
1857
+ :tREGEXP_OPT, 'on', [14, 16])
1858
+ end
1859
+
1860
+ def test_regexp_escape_oct1
1861
+ assert_scanned('/regex\\0xp/',
1862
+ :tREGEXP_BEG, "/", [0, 1],
1863
+ :tSTRING_CONTENT, "regex\\0xp", [1, 10],
1864
+ :tSTRING_END, "/", [10, 11],
1865
+ :tREGEXP_OPT, "", [11, 11])
1866
+ end
1867
+
1868
+ def test_regexp_escape_oct2
1869
+ assert_scanned('/regex\\07xp/',
1870
+ :tREGEXP_BEG, "/", [0, 1],
1871
+ :tSTRING_CONTENT, "regex\\07xp", [1, 11],
1872
+ :tSTRING_END, "/", [11, 12],
1873
+ :tREGEXP_OPT, "", [12, 12])
1874
+ end
1875
+
1876
+ def test_regexp_escape_oct3
1877
+ assert_scanned('/regex\\10142/',
1878
+ :tREGEXP_BEG, "/", [0, 1],
1879
+ :tSTRING_CONTENT, "regex\\10142", [1, 12],
1880
+ :tSTRING_END, "/", [12, 13],
1881
+ :tREGEXP_OPT, "", [13, 13])
1882
+ end
1883
+
1884
+ def test_regexp_escape_return
1885
+ assert_scanned("/regex\\\nregex/",
1886
+ :tREGEXP_BEG, "/", [0, 1],
1887
+ :tSTRING_CONTENT, "regexregex", [1, 13],
1888
+ :tSTRING_END, "/", [13, 14],
1889
+ :tREGEXP_OPT, "", [14, 14])
1890
+ end
1891
+
1892
+ def test_regexp_escape_delimiter_meta
1893
+ assert_scanned("%r(\\))",
1894
+ :tREGEXP_BEG, "%r(", [0, 3],
1895
+ :tSTRING_CONTENT, "\\)", [3, 5],
1896
+ :tSTRING_END, ")", [5, 6],
1897
+ :tREGEXP_OPT, "", [6, 6])
1898
+ end
1899
+
1900
+ def test_regexp_escape_delimiter_nonmeta
1901
+ assert_scanned("%r'\\''",
1902
+ :tREGEXP_BEG, "%r'", [0, 3],
1903
+ :tSTRING_CONTENT, "'", [3, 5],
1904
+ :tSTRING_END, "'", [5, 6],
1905
+ :tREGEXP_OPT, "", [6, 6])
1906
+ end
1907
+
1908
+ def test_regexp_escape_other_meta
1909
+ assert_scanned("/\\.\\$\\*\\+\\.\\?\\|/",
1910
+ :tREGEXP_BEG, "/", [0, 1],
1911
+ :tSTRING_CONTENT, "\\.\\$\\*\\+\\.\\?\\|", [1, 15],
1912
+ :tSTRING_END, "/", [15, 16],
1913
+ :tREGEXP_OPT, "", [16, 16])
1914
+ end
1915
+
1916
+ def test_regexp_nm
1917
+ assert_scanned("/.*/nm",
1918
+ :tREGEXP_BEG, "/", [0, 1],
1919
+ :tSTRING_CONTENT, ".*", [1, 3],
1920
+ :tSTRING_END, "/", [3, 4],
1921
+ :tREGEXP_OPT, "nm", [4, 6])
1922
+ end
1923
+
1924
+ def test_rparen
1925
+ assert_scanned ")", :tRPAREN, ")", [0, 1]
1926
+ end
1927
+
1928
+ def test_rshft
1929
+ assert_scanned("a >> 2",
1930
+ :tIDENTIFIER, "a", [0, 1],
1931
+ :tRSHFT, ">>", [2, 4],
1932
+ :tINTEGER, 2, [5, 6])
1933
+ end
1934
+
1935
+ def test_rshft_equals
1936
+ assert_scanned("a >>= 2",
1937
+ :tIDENTIFIER, "a", [0, 1],
1938
+ :tOP_ASGN, ">>", [2, 5],
1939
+ :tINTEGER, 2, [6, 7])
1940
+ end
1941
+
1942
+ def test_star
1943
+ assert_scanned("a * ",
1944
+ :tIDENTIFIER, "a", [0, 1],
1945
+ :tSTAR2, "*", [2, 3])
1946
+
1947
+ assert_equal :expr_value, @lex.state
1948
+ end
1949
+
1950
+ def test_star2
1951
+ assert_scanned("a ** ",
1952
+ :tIDENTIFIER, "a", [0, 1],
1953
+ :tPOW, "**", [2, 4])
1954
+
1955
+ assert_equal :expr_value, @lex.state
1956
+ end
1957
+
1958
+ def test_star2_equals
1959
+ assert_scanned("a **= ",
1960
+ :tIDENTIFIER, "a", [0, 1],
1961
+ :tOP_ASGN, "**", [2, 5])
1962
+
1963
+ assert_equal :expr_beg, @lex.state
1964
+ end
1965
+
1966
+ def test_star2_beg
1967
+ assert_scanned("** ",
1968
+ :tDSTAR, "**", [0, 2])
1969
+
1970
+ assert_equal :expr_beg, @lex.state
1971
+ end
1972
+
1973
+ def test_star_arg
1974
+ @lex.state = :expr_arg
1975
+
1976
+ assert_scanned(" *a",
1977
+ :tSTAR, "*", [1, 2],
1978
+ :tIDENTIFIER, "a", [2, 3])
1979
+
1980
+ assert_equal :expr_arg, @lex.state
1981
+ end
1982
+
1983
+ def test_star_arg_beg
1984
+ @lex.state = :expr_beg
1985
+
1986
+ assert_scanned("*a",
1987
+ :tSTAR, "*", [0, 1],
1988
+ :tIDENTIFIER, "a", [1, 2])
1989
+
1990
+ assert_equal :expr_arg, @lex.state
1991
+ end
1992
+
1993
+ def test_star_arg_beg_fname
1994
+ @lex.state = :expr_fname
1995
+
1996
+ assert_scanned("*a",
1997
+ :tSTAR2, "*", [0, 1],
1998
+ :tIDENTIFIER, "a", [1, 2])
1999
+
2000
+ assert_equal :expr_arg, @lex.state
2001
+ end
2002
+
2003
+ def test_star_equals
2004
+ assert_scanned("a *= ",
2005
+ :tIDENTIFIER, "a", [0, 1],
2006
+ :tOP_ASGN, "*", [2, 4])
2007
+
2008
+ assert_equal :expr_beg, @lex.state
2009
+ end
2010
+
2011
+ def test_string_bad_eos
2012
+ refute_scanned('%',
2013
+ :tSTRING_BEG, '%', [0, 1])
2014
+ end
2015
+
2016
+ def test_string_bad_eos_quote
2017
+ refute_scanned('%{nest',
2018
+ :tSTRING_BEG, '%}', [0, 2])
2019
+ end
2020
+
2021
+ def test_string_double
2022
+ assert_scanned('"string"',
2023
+ :tSTRING, "string", [0, 8])
2024
+ end
2025
+
2026
+ def test_string_double_escape_C
2027
+ assert_scanned('"\\C-a"',
2028
+ :tSTRING, "\001", [0, 6])
2029
+ end
2030
+
2031
+ def test_string_double_escape_C_backslash
2032
+ assert_scanned('"\\C-\\\\"',
2033
+ :tSTRING, "\034", [0, 7])
2034
+ end
2035
+
2036
+ def test_string_double_escape_C_escape
2037
+ assert_scanned('"\\C-\\M-a"',
2038
+ :tSTRING, "\201", [0, 9])
2039
+ end
2040
+
2041
+ def test_string_double_escape_C_question
2042
+ assert_scanned('"\\C-?"',
2043
+ :tSTRING, "\177", [0, 6])
2044
+ end
2045
+
2046
+ def test_string_double_escape_M
2047
+ assert_scanned('"\\M-a"',
2048
+ :tSTRING, "\341", [0, 6])
2049
+ end
2050
+
2051
+ def test_string_double_escape_M_backslash
2052
+ assert_scanned('"\\M-\\\\"',
2053
+ :tSTRING, "\334", [0, 7])
2054
+ end
2055
+
2056
+ def test_string_double_escape_M_escape
2057
+ assert_scanned('"\\M-\\C-a"',
2058
+ :tSTRING, "\201", [0, 9])
2059
+ end
2060
+
2061
+ def test_string_double_escape_bs1
2062
+ assert_scanned('"a\\a\\a"',
2063
+ :tSTRING, "a\a\a", [0, 7])
2064
+ end
2065
+
2066
+ def test_string_double_escape_bs2
2067
+ assert_scanned('"a\\\\a"',
2068
+ :tSTRING, "a\\a", [0, 6])
2069
+ end
2070
+
2071
+ def test_string_double_escape_c
2072
+ assert_scanned('"\\ca"',
2073
+ :tSTRING, "\001", [0, 5])
2074
+ end
2075
+
2076
+ def test_string_double_escape_c_escape
2077
+ assert_scanned('"\\c\\M-a"',
2078
+ :tSTRING, "\201", [0, 8])
2079
+ end
2080
+
2081
+ def test_string_double_escape_c_question
2082
+ assert_scanned('"\\c?"',
2083
+ :tSTRING, "\177", [0, 5])
2084
+ end
2085
+
2086
+ def test_string_double_escape_chars
2087
+ assert_scanned('"s\\tri\\ng"',
2088
+ :tSTRING, "s\tri\ng", [0, 10])
2089
+ end
2090
+
2091
+ def test_string_double_escape_hex
2092
+ assert_scanned('"n = \\x61\\x62\\x63"',
2093
+ :tSTRING, "n = abc", [0, 18])
2094
+ end
2095
+
2096
+ def test_string_double_escape_octal
2097
+ assert_scanned('"n = \\101\\102\\103"',
2098
+ :tSTRING, "n = ABC", [0, 18])
2099
+ end
2100
+
2101
+ def test_string_double_escape_octal_wrap
2102
+ assert_scanned('"\\753"',
2103
+ :tSTRING, "\xEB", [0, 6])
2104
+ end
2105
+
2106
+ def test_string_double_interp
2107
+ assert_scanned("\"blah #x a \#@a b \#$b c \#{3} # \"",
2108
+ :tSTRING_BEG, "\"", [0, 1],
2109
+ :tSTRING_CONTENT, "blah #x a ", [1, 11],
2110
+ :tSTRING_DVAR, nil, [11, 12],
2111
+ :tIVAR, "@a", [12, 14],
2112
+ :tSTRING_CONTENT, " b ", [14, 17],
2113
+ :tSTRING_DVAR, nil, [17, 18],
2114
+ :tGVAR, "$b", [18, 20],
2115
+ :tSTRING_CONTENT, " c ", [20, 23],
2116
+ :tSTRING_DBEG, '#{', [23, 25],
2117
+ :tINTEGER, 3, [25, 26],
2118
+ :tRCURLY, "}", [26, 27],
2119
+ :tSTRING_CONTENT, " # ", [27, 30],
2120
+ :tSTRING_END, "\"", [30, 31])
2121
+ end
2122
+
2123
+ def test_string_double_interp_label
2124
+ assert_scanned('"#{foo:bar}"',
2125
+ :tSTRING_BEG, '"', [0, 1],
2126
+ :tSTRING_DBEG, '#{', [1, 3],
2127
+ :tIDENTIFIER, 'foo', [3, 6],
2128
+ :tSYMBOL, 'bar', [6, 10],
2129
+ :tRCURLY, '}', [10, 11],
2130
+ :tSTRING_END, '"', [11, 12])
2131
+ end
2132
+
2133
+ def test_string_double_nested_curlies
2134
+ assert_scanned('%{nest{one{two}one}nest}',
2135
+ :tSTRING_BEG, '%{', [0, 2],
2136
+ :tSTRING_CONTENT, "nest{one{two}one}nest", [2, 23],
2137
+ :tSTRING_END, '}', [23, 24])
2138
+ end
2139
+
2140
+ def test_string_double_no_interp
2141
+ assert_scanned("\"# blah\"", # pound first
2142
+ :tSTRING, "# blah", [0, 8])
2143
+
2144
+ assert_scanned("\"blah # blah\"", # pound not first
2145
+ :tSTRING, "blah # blah", [0, 13])
2146
+ end
2147
+
2148
+ def test_string_escape_x_single
2149
+ assert_scanned('"\\x0"',
2150
+ :tSTRING, "\000", [0, 5])
2151
+ end
2152
+
2153
+ def test_string_pct_Q
2154
+ assert_scanned("%Q[s1 s2]",
2155
+ :tSTRING_BEG, '%Q[', [0, 3],
2156
+ :tSTRING_CONTENT, "s1 s2", [3, 8],
2157
+ :tSTRING_END, ']', [8, 9])
2158
+ end
2159
+
2160
+ def test_string_pct_W
2161
+ assert_scanned("%W[s1 s2\ns3]",
2162
+ :tWORDS_BEG, "%W[", [0, 3],
2163
+ :tSTRING_CONTENT, "s1", [3, 5],
2164
+ :tSPACE, nil, [5, 6],
2165
+ :tSTRING_CONTENT, "s2", [6, 8],
2166
+ :tSPACE, nil, [8, 9],
2167
+ :tSTRING_CONTENT, "s3", [9, 11],
2168
+ :tSPACE, nil, [11, 11],
2169
+ :tSTRING_END, ']', [11, 12])
2170
+ end
2171
+
2172
+ def test_string_pct_W_bs_nl
2173
+ assert_scanned("%W[s1 \\\ns2]",
2174
+ :tWORDS_BEG, "%W[", [0, 3],
2175
+ :tSTRING_CONTENT, "s1", [3, 5],
2176
+ :tSPACE, nil, [5, 6],
2177
+ :tSTRING_CONTENT, "\ns2", [6, 10],
2178
+ :tSPACE, nil, [10, 10],
2179
+ :tSTRING_END, ']', [10, 11])
2180
+ end
2181
+
2182
+ def test_string_pct_W_interp
2183
+ assert_scanned('%W[#{1}#{2} #@a]',
2184
+ :tWORDS_BEG, '%W[', [0, 3],
2185
+ :tSTRING_DBEG, '#{', [3, 5],
2186
+ :tINTEGER, 1, [5, 6],
2187
+ :tRCURLY, '}', [6, 7],
2188
+ :tSTRING_DBEG, '#{', [7, 9],
2189
+ :tINTEGER, 2, [9, 10],
2190
+ :tRCURLY, '}', [10, 11],
2191
+ :tSPACE, nil, [11, 12],
2192
+ :tSTRING_DVAR, nil, [12, 13],
2193
+ :tIVAR, '@a', [13, 15],
2194
+ :tSPACE, nil, [15, 15],
2195
+ :tSTRING_END, ']', [15, 16])
2196
+ end
2197
+
2198
+ def test_string_pct_I
2199
+ assert_scanned("%I(s1 s2)",
2200
+ :tSYMBOLS_BEG, "%I(", [0, 3],
2201
+ :tSTRING_CONTENT, "s1", [3, 5],
2202
+ :tSPACE, nil, [5, 6],
2203
+ :tSTRING_CONTENT, "s2", [6, 8],
2204
+ :tSPACE, nil, [8, 8],
2205
+ :tSTRING_END, ')', [8, 9])
2206
+ end
2207
+
2208
+ def test_string_pct_angle
2209
+ assert_scanned("%<blah>",
2210
+ :tSTRING_BEG, '%<', [0, 2],
2211
+ :tSTRING_CONTENT, "blah", [2, 6],
2212
+ :tSTRING_END, '>', [6, 7])
2213
+ end
2214
+
2215
+ def test_string_pct_pct
2216
+ assert_scanned("%%blah%",
2217
+ :tSTRING_BEG, '%%', [0, 2],
2218
+ :tSTRING_CONTENT, "blah", [2, 6],
2219
+ :tSTRING_END, '%', [6, 7])
2220
+ end
2221
+
2222
+ def test_string_pct_w
2223
+ assert_scanned("%w[s1 s2 ]",
2224
+ :tQWORDS_BEG, "%w[", [0, 3],
2225
+ :tSTRING_CONTENT, "s1", [3, 5],
2226
+ :tSPACE, nil, [5, 6],
2227
+ :tSTRING_CONTENT, "s2", [6, 8],
2228
+ :tSPACE, nil, [8, 9],
2229
+ :tSTRING_END, "]", [9, 10])
2230
+ end
2231
+
2232
+ def test_string_pct_w_incomplete
2233
+ refute_scanned("%w[s1 ",
2234
+ :tQWORDS_BEG, "%w[", [0, 3],
2235
+ :tSTRING_CONTENT, "s1", [3, 5],
2236
+ :tSPACE, nil, [5, 6])
2237
+ end
2238
+
2239
+ def test_string_pct_w_bs_nl
2240
+ assert_scanned("%w[s1 \\\ns2]",
2241
+ :tQWORDS_BEG, "%w[", [0, 3],
2242
+ :tSTRING_CONTENT, "s1", [3, 5],
2243
+ :tSPACE, nil, [5, 6],
2244
+ :tSTRING_CONTENT, "\ns2", [6, 10],
2245
+ :tSPACE, nil, [10, 10],
2246
+ :tSTRING_END, ']', [10, 11])
2247
+ end
2248
+
2249
+ def test_string_pct_w_bs_sp
2250
+ assert_scanned("%w[s\\ 1 s\\ 2]",
2251
+ :tQWORDS_BEG, "%w[", [0, 3],
2252
+ :tSTRING_CONTENT, "s 1", [3, 7],
2253
+ :tSPACE, nil, [7, 8],
2254
+ :tSTRING_CONTENT, "s 2", [8, 12],
2255
+ :tSPACE, nil, [12, 12],
2256
+ :tSTRING_END, ']', [12, 13])
2257
+ end
2258
+
2259
+ def test_string_pct_w_tab
2260
+ assert_scanned("%w[abc\tdef]",
2261
+ :tQWORDS_BEG, "%w[", [0, 3],
2262
+ :tSTRING_CONTENT, "abc", [3, 6],
2263
+ :tSPACE, nil, [6, 7],
2264
+ :tSTRING_CONTENT, "def", [7, 10],
2265
+ :tSPACE, nil, [10, 10],
2266
+ :tSTRING_END, ']', [10, 11])
2267
+ end
2268
+
2269
+ def test_string_pct_i
2270
+ assert_scanned("%i(s1 s2)",
2271
+ :tQSYMBOLS_BEG, "%i(", [0, 3],
2272
+ :tSTRING_CONTENT, "s1", [3, 5],
2273
+ :tSPACE, nil, [5, 6],
2274
+ :tSTRING_CONTENT, "s2", [6, 8],
2275
+ :tSPACE, nil, [8, 8],
2276
+ :tSTRING_END, ')', [8, 9])
2277
+ end
2278
+
2279
+ def test_string_pct_backslash
2280
+ assert_scanned("%\\a\\",
2281
+ :tSTRING_BEG, "%\\", [0, 2],
2282
+ :tSTRING_CONTENT, "a", [2, 3],
2283
+ :tSTRING_END, "\\", [3, 4])
2284
+ end
2285
+
2286
+ def test_string_pct_w_backslash
2287
+ assert_scanned("%w\\s1 s2 \\",
2288
+ :tQWORDS_BEG, "%w\\", [0, 3],
2289
+ :tSTRING_CONTENT, "s1", [3, 5],
2290
+ :tSPACE, nil, [5, 6],
2291
+ :tSTRING_CONTENT, "s2", [6, 8],
2292
+ :tSPACE, nil, [8, 9],
2293
+ :tSTRING_END, "\\", [9, 10])
2294
+ end
2295
+
2296
+ def test_string_pct_w_backslash_nl
2297
+ assert_scanned("%w\\s1 s2 \\\n",
2298
+ :tQWORDS_BEG, "%w\\", [0, 3],
2299
+ :tSTRING_CONTENT, "s1", [3, 5],
2300
+ :tSPACE, nil, [5, 6],
2301
+ :tSTRING_CONTENT, "s2", [6, 8],
2302
+ :tSPACE, nil, [8, 9],
2303
+ :tSTRING_END, "\\", [9, 10],
2304
+ :tNL, nil, [10, 11])
2305
+ end
2306
+
2307
+ def test_string_pct_w_backslash_interp_nl
2308
+ assert_scanned("%W\\blah #x a \#@a b \#$b c \#{3} # \\",
2309
+ :tWORDS_BEG, "%W\\", [0, 3],
2310
+ :tSTRING_CONTENT, "blah", [3, 7],
2311
+ :tSPACE, nil, [7, 8],
2312
+ :tSTRING_CONTENT, "#x", [8, 10],
2313
+ :tSPACE, nil, [10, 11],
2314
+ :tSTRING_CONTENT, "a", [11, 12],
2315
+ :tSPACE, nil, [12, 13],
2316
+ :tSTRING_DVAR, nil, [13, 14],
2317
+ :tIVAR, "@a", [14, 16],
2318
+ :tSPACE, nil, [16, 17],
2319
+ :tSTRING_CONTENT, "b", [17, 18],
2320
+ :tSPACE, nil, [18, 19],
2321
+ :tSTRING_DVAR, nil, [19, 20],
2322
+ :tGVAR, "$b", [20, 22],
2323
+ :tSPACE, nil, [22, 23],
2324
+ :tSTRING_CONTENT, "c", [23, 24],
2325
+ :tSPACE, nil, [24, 25],
2326
+ :tSTRING_DBEG, '#{', [25, 27],
2327
+ :tINTEGER, 3, [27, 28],
2328
+ :tRCURLY, "}", [28, 29],
2329
+ :tSPACE, nil, [29, 30],
2330
+ :tSTRING_CONTENT, "#", [30, 31],
2331
+ :tSPACE, nil, [31, 32],
2332
+ :tSTRING_END, "\\", [32, 33])
2333
+ end
2334
+
2335
+ def test_string_pct_backslash_with_bad_escape
2336
+ # No escapes are allowed in a backslash-delimited string
2337
+ refute_scanned("%\\a\\n\\",
2338
+ :tSTRING_BEG, "%\\", [0, 2],
2339
+ :tSTRING_CONTENT, "a", [2, 3],
2340
+ :tSTRING_END, "\\", [3, 4],
2341
+ :tIDENTIFIER, "n", [4, 5])
2342
+ end
2343
+
2344
+ def test_string_pct_intertwined_with_heredoc
2345
+ assert_scanned("<<-foo + %\\a\nbar\nfoo\nb\\",
2346
+ :tSTRING_BEG, "<<\"", [0, 6],
2347
+ :tSTRING_CONTENT, "bar\n", [13, 17],
2348
+ :tSTRING_END, "foo", [17, 20],
2349
+ :tPLUS, "+", [7, 8],
2350
+ :tSTRING_BEG, "%\\", [9, 11],
2351
+ :tSTRING_CONTENT, "a\n", [11, 13],
2352
+ :tSTRING_CONTENT, "b", [21, 22],
2353
+ :tSTRING_END, "\\", [22, 23])
2354
+ end
2355
+
2356
+ def test_string_pct_q_backslash
2357
+ assert_scanned("%q\\a\\",
2358
+ :tSTRING_BEG, "%q\\", [0, 3],
2359
+ :tSTRING_CONTENT, "a", [3, 4],
2360
+ :tSTRING_END, "\\", [4, 5])
2361
+ end
2362
+
2363
+ def test_string_pct_Q_backslash
2364
+ assert_scanned("%Q\\a\\",
2365
+ :tSTRING_BEG, "%Q\\", [0, 3],
2366
+ :tSTRING_CONTENT, "a", [3, 4],
2367
+ :tSTRING_END, "\\", [4, 5])
2368
+ end
2369
+
2370
+ def test_string_single
2371
+ assert_scanned("'string'",
2372
+ :tSTRING, "string", [0, 8])
2373
+ end
2374
+
2375
+ def test_string_single_escape_chars
2376
+ assert_scanned("'s\\tri\\ng'",
2377
+ :tSTRING, "s\\tri\\ng", [0, 10])
2378
+ end
2379
+
2380
+ def test_string_single_nl
2381
+ assert_scanned("'blah\\\nblah'",
2382
+ :tSTRING_BEG, "'", [0, 1],
2383
+ :tSTRING_CONTENT, "blah\\\n", [1, 7],
2384
+ :tSTRING_CONTENT, "blah", [7, 11],
2385
+ :tSTRING_END, "'", [11, 12])
2386
+ end
2387
+
2388
+ def test_symbol
2389
+ assert_scanned(":symbol",
2390
+ :tSYMBOL, "symbol", [0, 7])
2391
+ end
2392
+
2393
+ def test_symbol_double
2394
+ assert_scanned(":\"symbol\"",
2395
+ :tSYMBEG, ":\"", [0, 2],
2396
+ :tSTRING_CONTENT, "symbol", [2, 8],
2397
+ :tSTRING_END, "\"", [8, 9])
2398
+ end
2399
+
2400
+ def test_symbol_single
2401
+ assert_scanned(":'symbol'",
2402
+ :tSYMBEG, ":'", [0, 2],
2403
+ :tSTRING_CONTENT, "symbol", [2, 8],
2404
+ :tSTRING_END, "'", [8, 9])
2405
+ end
2406
+
2407
+ def test_ternary
2408
+ assert_scanned("a ? b : c",
2409
+ :tIDENTIFIER, "a", [0, 1],
2410
+ :tEH, "?", [2, 3],
2411
+ :tIDENTIFIER, "b", [4, 5],
2412
+ :tCOLON, ":", [6, 7],
2413
+ :tIDENTIFIER, "c", [8, 9])
2414
+
2415
+ assert_scanned("a ?b : c",
2416
+ :tIDENTIFIER, "a", [0, 1],
2417
+ :tINTEGER, 98, [2, 4],
2418
+ :tCOLON, ":", [5, 6],
2419
+ :tIDENTIFIER, "c", [7, 8])
2420
+
2421
+ assert_scanned("a ?bb : c", # GAH! MATZ!!!
2422
+ :tIDENTIFIER, "a", [0, 1],
2423
+ :tEH, "?", [2, 3],
2424
+ :tIDENTIFIER, "bb", [3, 5],
2425
+ :tCOLON, ":", [6, 7],
2426
+ :tIDENTIFIER, "c", [8, 9])
2427
+
2428
+ assert_scanned("42 ?", # 42 forces expr_end
2429
+ :tINTEGER, 42, [0, 2],
2430
+ :tEH, "?", [3, 4])
2431
+ end
2432
+
2433
+ def test_tilde
2434
+ assert_scanned "~", :tTILDE, "~", [0, 1]
2435
+ end
2436
+
2437
+ def test_tilde_unary
2438
+ @lex.state = :expr_fname
2439
+ assert_scanned "~@", :tTILDE, "~@", [0, 2]
2440
+ end
2441
+
2442
+ def test_uminus
2443
+ assert_scanned("-blah",
2444
+ :tUMINUS, "-", [0, 1],
2445
+ :tIDENTIFIER, "blah", [1, 5])
2446
+ end
2447
+
2448
+ def test_underscore
2449
+ assert_scanned("_var", :tIDENTIFIER, "_var", [0, 4])
2450
+ end
2451
+
2452
+ def test_underscore_end
2453
+ assert_scanned("__END__\n")
2454
+ assert_scanned("__END__")
2455
+ assert_scanned("__END__ foo",
2456
+ :tIDENTIFIER, '__END__', [0, 7],
2457
+ :tIDENTIFIER, 'foo', [8, 11])
2458
+ assert_scanned("__END__\rfoo",
2459
+ :tIDENTIFIER, '__END__', [0, 7],
2460
+ :tIDENTIFIER, 'foo', [8, 11])
2461
+ end
2462
+
2463
+ def test_uplus
2464
+ assert_scanned("+blah",
2465
+ :tUPLUS, "+", [0, 1],
2466
+ :tIDENTIFIER, "blah", [1, 5])
2467
+ end
2468
+
2469
+ def test_if_unless_mod
2470
+ assert_scanned("return if true unless false",
2471
+ :kRETURN, "return", [0, 6],
2472
+ :kIF_MOD, "if", [7, 9],
2473
+ :kTRUE, "true", [10, 14],
2474
+ :kUNLESS_MOD, "unless", [15, 21],
2475
+ :kFALSE, "false", [22, 27])
2476
+ end
2477
+
2478
+ def test_if_stmt
2479
+ assert_scanned("if true\n return end",
2480
+ :kIF, "if", [0, 2],
2481
+ :kTRUE, "true", [3, 7],
2482
+ :tNL, nil, [7, 8],
2483
+ :kRETURN, "return", [9, 15],
2484
+ :kEND, "end", [16, 19])
2485
+ end
2486
+
2487
+ def test_sclass_label
2488
+ setup_lexer 20
2489
+ assert_scanned("class << a:b",
2490
+ :kCLASS, 'class', [0, 5],
2491
+ :tLSHFT, '<<', [6, 8],
2492
+ :tIDENTIFIER, 'a', [9, 10],
2493
+ :tSYMBOL, 'b', [10, 12])
2494
+ end
2495
+
2496
+ def test_fname_pct_s__22
2497
+ setup_lexer 22
2498
+ @lex.state = :expr_fname
2499
+ assert_scanned("%s(a)",
2500
+ :tPERCENT, '%', [0, 1],
2501
+ :tIDENTIFIER, 's', [1, 2],
2502
+ :tLPAREN2, '(', [2, 3],
2503
+ :tIDENTIFIER, 'a', [3, 4],
2504
+ :tRPAREN, ')', [4, 5])
2505
+ end
2506
+
2507
+ def test_fname_pct_s__23
2508
+ setup_lexer 23
2509
+ @lex.state = :expr_fname
2510
+ assert_scanned("%s(a)",
2511
+ :tSYMBEG, '%s(', [0, 3],
2512
+ :tSTRING_CONTENT, 'a', [3, 4],
2513
+ :tSTRING_END, ')', [4, 5])
2514
+ end
2515
+
2516
+ def test_static_env
2517
+ env = Parser::StaticEnvironment.new
2518
+ env.declare "a"
2519
+
2520
+ @lex.static_env = env
2521
+ assert_scanned("a [42]",
2522
+ :tIDENTIFIER, "a", [0, 1],
2523
+ :tLBRACK2, "[", [2, 3],
2524
+ :tINTEGER, 42, [3, 5],
2525
+ :tRBRACK, "]", [5, 6])
2526
+ end
2527
+
2528
+ def test_int_suffix
2529
+ [18, 19, 20].each do |version|
2530
+ setup_lexer version
2531
+
2532
+ assert_scanned("42r",
2533
+ :tINTEGER, 42, [0, 2],
2534
+ :tIDENTIFIER, 'r', [2, 3])
2535
+
2536
+ assert_scanned("42if",
2537
+ :tINTEGER, 42, [0, 2],
2538
+ :kIF_MOD, 'if', [2, 4])
2539
+ end
2540
+
2541
+ setup_lexer 21
2542
+
2543
+ assert_scanned("42r", :tRATIONAL, Rational(42), [0, 3])
2544
+ assert_scanned("42i", :tIMAGINARY, Complex(0, 42), [0, 3])
2545
+ assert_scanned("42ri", :tIMAGINARY, Complex(0, Rational(42)), [0, 4])
2546
+ end
2547
+
2548
+ def test_float_suffix
2549
+ [18, 19, 20].each do |version|
2550
+ setup_lexer version
2551
+
2552
+ assert_scanned("42.1r",
2553
+ :tFLOAT, 42.1, [0, 4],
2554
+ :tIDENTIFIER, 'r', [4, 5])
2555
+
2556
+ assert_scanned("42.1if",
2557
+ :tFLOAT, 42.1, [0, 4],
2558
+ :kIF_MOD, 'if', [4, 6])
2559
+
2560
+ assert_scanned("1e1r",
2561
+ :tFLOAT, 1e1, [0, 3],
2562
+ :tIDENTIFIER, 'r', [3, 4])
2563
+ end
2564
+
2565
+ begin
2566
+ # Feature-check.
2567
+ Rational("10")
2568
+
2569
+ setup_lexer 21
2570
+
2571
+ assert_scanned("42.1r", :tRATIONAL, Rational(421, 10), [0, 5])
2572
+ assert_scanned("42.1i", :tIMAGINARY, Complex(0, 42.1), [0, 5])
2573
+ assert_scanned("42.1ri", :tIMAGINARY, Complex(0, Rational(421, 10)), [0, 6])
2574
+ assert_scanned("42.1ir",
2575
+ :tIMAGINARY, Complex(0, 42.1), [0, 5],
2576
+ :tIDENTIFIER, 'r', [5, 6])
2577
+
2578
+ assert_scanned("1e1i", :tIMAGINARY, Complex(0, 1e1), [0, 4])
2579
+ assert_scanned("1e1r",
2580
+ :tFLOAT, 1e1, [0, 3],
2581
+ :tIDENTIFIER, 'r', [3, 4])
2582
+ assert_scanned("1e1ri",
2583
+ :tFLOAT, 1e1, [0, 3],
2584
+ :tIDENTIFIER, 'ri', [3, 5])
2585
+ assert_scanned("1e1ir",
2586
+ :tIMAGINARY, Complex(0, 1e1), [0, 4],
2587
+ :tIDENTIFIER, 'r', [4, 5])
2588
+ rescue NoMethodError
2589
+ # Ruby not modern enough
2590
+ end
2591
+ end
2592
+
2593
+ def test_eof
2594
+ assert_scanned("self",
2595
+ :kSELF, "self", [0, 4])
2596
+ assert_equal([false, ["$eof", Parser::Source::Range.new(@lex.source_buffer, 4, 4)]],
2597
+ @lex.advance)
2598
+ end
2599
+
2600
+ #
2601
+ # Test for 'fluent interface'
2602
+ #
2603
+
2604
+ def test_fluent_dot
2605
+ assert_scanned("x\n.y",
2606
+ :tIDENTIFIER, 'x', [0, 1],
2607
+ :tDOT, '.', [2, 3],
2608
+ :tIDENTIFIER, 'y', [3, 4])
2609
+
2610
+ assert_scanned("x\n .y",
2611
+ :tIDENTIFIER, 'x', [0, 1],
2612
+ :tDOT, '.', [4, 5],
2613
+ :tIDENTIFIER, 'y', [5, 6])
2614
+
2615
+ assert_scanned("x # comment\n .y",
2616
+ :tIDENTIFIER, 'x', [0, 1],
2617
+ :tDOT, '.', [14, 15],
2618
+ :tIDENTIFIER, 'y', [15, 16])
2619
+ end
2620
+
2621
+ def test_fluent_and_dot
2622
+ assert_scanned("x\n&.y",
2623
+ :tIDENTIFIER, 'x', [0, 1],
2624
+ :tANDDOT, '&.', [2, 4],
2625
+ :tIDENTIFIER, 'y', [4, 5])
2626
+ end
2627
+
2628
+ #
2629
+ # Tests for whitespace.
2630
+ #
2631
+
2632
+ def test_whitespace_fname
2633
+ @lex.state = :expr_fname
2634
+ assert_scanned('class',
2635
+ :kCLASS, 'class', [0, 5])
2636
+
2637
+ @lex.state = :expr_fname
2638
+ assert_scanned(' class',
2639
+ :kCLASS, 'class', [1, 6])
2640
+
2641
+ @lex.state = :expr_fname
2642
+ assert_scanned("\nclass",
2643
+ :kCLASS, 'class', [1, 6])
2644
+
2645
+ @lex.state = :expr_fname
2646
+ assert_scanned("\\\nclass",
2647
+ :kCLASS, 'class', [2, 7])
2648
+
2649
+ @lex.state = :expr_fname
2650
+ assert_scanned("#foo\nclass",
2651
+ :kCLASS, 'class', [5, 10])
2652
+ end
2653
+
2654
+ def test_whitespace_endfn
2655
+ setup_lexer(21)
2656
+
2657
+ @lex.state = :expr_endfn
2658
+ assert_scanned('foo:',
2659
+ :tLABEL, 'foo', [0, 4])
2660
+
2661
+ @lex.state = :expr_endfn
2662
+ assert_scanned(' foo:',
2663
+ :tLABEL, 'foo', [1, 5])
2664
+
2665
+ @lex.state = :expr_endfn
2666
+ assert_scanned("\nfoo:",
2667
+ :tNL, nil, [0, 1],
2668
+ :tIDENTIFIER, 'foo', [1, 4],
2669
+ :tCOLON, ':', [4, 5])
2670
+
2671
+ @lex.state = :expr_endfn
2672
+ assert_scanned("\nfoo: ",
2673
+ :tNL, nil, [0, 1],
2674
+ :tIDENTIFIER, 'foo', [1, 4],
2675
+ :tCOLON, ':', [4, 5])
2676
+
2677
+ @lex.state = :expr_endfn
2678
+ assert_scanned("\\\nfoo:",
2679
+ :tLABEL, 'foo', [2, 6])
2680
+
2681
+ @lex.state = :expr_endfn
2682
+ assert_scanned("#foo\nfoo:",
2683
+ :tNL, nil, [4, 5],
2684
+ :tIDENTIFIER, 'foo', [5, 8],
2685
+ :tCOLON, ':', [8, 9])
2686
+
2687
+ @lex.state = :expr_endfn
2688
+ assert_scanned("#foo\nfoo: ",
2689
+ :tNL, nil, [4, 5],
2690
+ :tIDENTIFIER, 'foo', [5, 8],
2691
+ :tCOLON, ':', [8, 9])
2692
+ end
2693
+
2694
+ def test_whitespace_dot
2695
+ @lex.state = :expr_dot
2696
+ assert_scanned('class',
2697
+ :tIDENTIFIER, 'class', [0, 5])
2698
+
2699
+ @lex.state = :expr_dot
2700
+ assert_scanned(' class',
2701
+ :tIDENTIFIER, 'class', [1, 6])
2702
+
2703
+ @lex.state = :expr_dot
2704
+ assert_scanned("\nclass",
2705
+ :tIDENTIFIER, 'class', [1, 6])
2706
+
2707
+ @lex.state = :expr_dot
2708
+ assert_scanned("\\\nclass",
2709
+ :tIDENTIFIER, 'class', [2, 7])
2710
+
2711
+ @lex.state = :expr_dot
2712
+ assert_scanned("#foo\nclass",
2713
+ :tIDENTIFIER, 'class', [5, 10])
2714
+ end
2715
+
2716
+ def test_whitespace_arg
2717
+ @lex.state = :expr_arg
2718
+ assert_scanned('+',
2719
+ :tPLUS, '+', [0, 1])
2720
+
2721
+ @lex.state = :expr_arg
2722
+ assert_scanned(' +',
2723
+ :tUPLUS, '+', [1, 2])
2724
+
2725
+ @lex.state = :expr_arg
2726
+ assert_scanned("\n+",
2727
+ :tNL, nil, [0, 1],
2728
+ :tUPLUS, '+', [1, 2])
2729
+
2730
+ @lex.state = :expr_arg
2731
+ assert_scanned("\\\n+",
2732
+ :tUPLUS, '+', [2, 3])
2733
+
2734
+ @lex.state = :expr_arg
2735
+ assert_scanned("\\\n +",
2736
+ :tUPLUS, '+', [3, 4])
2737
+
2738
+ @lex.state = :expr_arg
2739
+ assert_scanned("#foo\n+",
2740
+ :tNL, nil, [4, 5],
2741
+ :tUPLUS, '+', [5, 6])
2742
+ end
2743
+
2744
+ def test_whitespace_endarg
2745
+ @lex.state = :expr_endarg
2746
+ assert_scanned('{',
2747
+ :tLBRACE_ARG, '{', [0, 1])
2748
+
2749
+ @lex.state = :expr_endarg
2750
+ assert_scanned(' {',
2751
+ :tLBRACE_ARG, '{', [1, 2])
2752
+
2753
+ @lex.state = :expr_endarg
2754
+ assert_scanned("\n{",
2755
+ :tNL, nil, [0, 1],
2756
+ :tLBRACE, '{', [1, 2])
2757
+
2758
+ @lex.state = :expr_endarg
2759
+ assert_scanned("\\\n{",
2760
+ :tLBRACE_ARG, '{', [2, 3])
2761
+
2762
+ @lex.state = :expr_endarg
2763
+ assert_scanned("#foo\n{",
2764
+ :tNL, nil, [4, 5],
2765
+ :tLBRACE, '{', [5, 6])
2766
+ end
2767
+
2768
+ def test_whitespace_mid
2769
+ @lex.state = :expr_mid
2770
+ assert_scanned('+',
2771
+ :tUPLUS, '+', [0, 1])
2772
+
2773
+ @lex.state = :expr_mid
2774
+ assert_scanned(' +',
2775
+ :tUPLUS, '+', [1, 2])
2776
+
2777
+ @lex.state = :expr_mid
2778
+ assert_scanned("\n+",
2779
+ :tNL, nil, [0, 1],
2780
+ :tUPLUS, '+', [1, 2])
2781
+
2782
+ @lex.state = :expr_mid
2783
+ assert_scanned("\\\n+",
2784
+ :tUPLUS, '+', [2, 3])
2785
+
2786
+ @lex.state = :expr_mid
2787
+ assert_scanned("#foo\n+",
2788
+ :tNL, nil, [4, 5],
2789
+ :tUPLUS, '+', [5, 6])
2790
+ end
2791
+
2792
+ def test_whitespace_beg
2793
+ @lex.state = :expr_beg
2794
+ assert_scanned('+',
2795
+ :tUPLUS, '+', [0, 1])
2796
+
2797
+ @lex.state = :expr_beg
2798
+ assert_scanned(' +',
2799
+ :tUPLUS, '+', [1, 2])
2800
+
2801
+ @lex.state = :expr_beg
2802
+ assert_scanned("\n+",
2803
+ :tUPLUS, '+', [1, 2])
2804
+
2805
+ @lex.state = :expr_beg
2806
+ assert_scanned("\\\n+",
2807
+ :tUPLUS, '+', [2, 3])
2808
+
2809
+ @lex.state = :expr_beg
2810
+ assert_scanned("#foo\n+",
2811
+ :tUPLUS, '+', [5, 6])
2812
+ end
2813
+
2814
+ def test_whitespace_value
2815
+ setup_lexer(20)
2816
+
2817
+ @lex.state = :expr_value
2818
+ assert_scanned('a:b',
2819
+ :tIDENTIFIER, 'a', [0, 1],
2820
+ :tSYMBOL, 'b', [1, 3])
2821
+
2822
+ @lex.state = :expr_value
2823
+ assert_scanned(' a:b',
2824
+ :tIDENTIFIER, 'a', [1, 2],
2825
+ :tSYMBOL, 'b', [2, 4])
2826
+
2827
+ @lex.state = :expr_value
2828
+ assert_scanned("\na:b",
2829
+ :tIDENTIFIER, 'a', [1, 2],
2830
+ :tSYMBOL, 'b', [2, 4])
2831
+
2832
+ @lex.state = :expr_value
2833
+ assert_scanned("\\\na:b",
2834
+ :tIDENTIFIER, 'a', [2, 3],
2835
+ :tSYMBOL, 'b', [3, 5])
2836
+
2837
+ @lex.state = :expr_value
2838
+ assert_scanned("#foo\na:b",
2839
+ :tIDENTIFIER, 'a', [5, 6],
2840
+ :tSYMBOL, 'b', [6, 8])
2841
+ end
2842
+
2843
+ def test_whitespace_end
2844
+ @lex.state = :expr_end
2845
+ assert_scanned('+ 1',
2846
+ :tPLUS, '+', [0, 1],
2847
+ :tINTEGER, 1, [2, 3])
2848
+
2849
+ @lex.state = :expr_end
2850
+ assert_scanned(' + 1',
2851
+ :tPLUS, '+', [1, 2],
2852
+ :tINTEGER, 1, [3, 4])
2853
+
2854
+ @lex.state = :expr_end
2855
+ assert_scanned("\n+ 1",
2856
+ :tNL, nil, [0, 1],
2857
+ :tUNARY_NUM, '+', [1, 2],
2858
+ :tINTEGER, 1, [3, 4])
2859
+
2860
+ @lex.state = :expr_end
2861
+ assert_scanned("\\\n+ 1",
2862
+ :tPLUS, '+', [2, 3],
2863
+ :tINTEGER, 1, [4, 5])
2864
+
2865
+ @lex.state = :expr_end
2866
+ assert_scanned("#foo\n+ 1",
2867
+ :tNL, nil, [4, 5],
2868
+ :tUNARY_NUM, '+', [5, 6],
2869
+ :tINTEGER, 1, [7, 8])
2870
+ end
2871
+
2872
+ def test_whitespace_cr
2873
+ setup_lexer(20)
2874
+ assert_scanned("<<E\nfoo\nE\rO",
2875
+ :tSTRING_BEG, '<<"', [0, 3],
2876
+ :tSTRING_CONTENT, "foo\n", [4, 8],
2877
+ :tSTRING_END, 'E', [8, 11],
2878
+ :tNL, nil, [3, 4])
2879
+
2880
+ setup_lexer(21)
2881
+ refute_scanned("<<E\nfoo\nE\rO",
2882
+ :tSTRING_BEG, '<<"', [0, 3],
2883
+ :tSTRING_CONTENT, "foo\n", [4, 8])
2884
+ end
2885
+
2886
+ #
2887
+ # Handling of encoding-related issues.
2888
+ #
2889
+
2890
+ def test_transcoded_source_is_converted_back_to_original_encoding
2891
+ setup_lexer(19)
2892
+ @lex.force_utf32 = true
2893
+ @lex.tokens = []
2894
+ assert_scanned(utf('"a" + "b"'),
2895
+ :tSTRING, "a", [0, 3],
2896
+ :tPLUS, "+", [4, 5],
2897
+ :tSTRING, "b", [6, 9])
2898
+
2899
+ @lex.tokens.each do |_type, (str, _range)|
2900
+ assert_equal Encoding::UTF_8, str.encoding
2901
+ end
2902
+ end
2903
+
2904
+ #
2905
+ # Tests for bugs.
2906
+ #
2907
+ # These tests should be moved from nursery and properly
2908
+ # categorized when it's clear how to do that.
2909
+ #
2910
+
2911
+ def test_bug_sclass_joined
2912
+ assert_scanned("class<<self",
2913
+ :kCLASS, "class", [0, 5],
2914
+ :tLSHFT, "<<", [5, 7],
2915
+ :kSELF, "self", [7, 11])
2916
+ end
2917
+
2918
+ def test_bug_const_expr_end
2919
+ assert_scanned("Option",
2920
+ :tCONSTANT, 'Option', [0, 6])
2921
+
2922
+ assert_equal :expr_cmdarg, @lex.state
2923
+ end
2924
+
2925
+ def test_bug_expr_beg_div
2926
+ @lex.state = :expr_beg
2927
+ assert_scanned("/=/",
2928
+ :tREGEXP_BEG, "/", [0, 1],
2929
+ :tSTRING_CONTENT, "=", [1, 2],
2930
+ :tSTRING_END, "/", [2, 3],
2931
+ :tREGEXP_OPT, "", [3, 3])
2932
+
2933
+ @lex.state = :expr_beg
2934
+ assert_scanned("/ = /",
2935
+ :tREGEXP_BEG, "/", [0, 1],
2936
+ :tSTRING_CONTENT, " = ", [1, 4],
2937
+ :tSTRING_END, "/", [4, 5],
2938
+ :tREGEXP_OPT, "", [5, 5])
2939
+ end
2940
+
2941
+ def test_bug_expr_beg_percent
2942
+ @lex.state = :expr_beg
2943
+ assert_scanned("%=foo=",
2944
+ :tSTRING_BEG, "%=", [0, 2],
2945
+ :tSTRING_CONTENT, 'foo', [2, 5],
2946
+ :tSTRING_END, "=", [5, 6])
2947
+
2948
+ @lex.state = :expr_beg
2949
+ assert_scanned("% = ",
2950
+ :tSTRING_BEG, "% ", [0, 2],
2951
+ :tSTRING_CONTENT, '=', [2, 3],
2952
+ :tSTRING_END, ' ', [3, 4])
2953
+ end
2954
+
2955
+ def test_bug_expr_beg_document
2956
+ @lex.state = :expr_beg
2957
+ assert_scanned(" \n=begin\n=end\nend",
2958
+ :kEND, "end", [14, 17])
2959
+
2960
+ end
2961
+
2962
+ def test_bug_expr_beg_number
2963
+ @lex.state = :expr_beg
2964
+ assert_scanned("86400_000_000",
2965
+ :tINTEGER, 86400_000_000, [0, 13])
2966
+ end
2967
+
2968
+ def test_bug_expr_beg_backspace_nl
2969
+ @lex.state = :expr_beg
2970
+ assert_scanned("\n/foo/",
2971
+ :tREGEXP_BEG, "/", [1, 2],
2972
+ :tSTRING_CONTENT, "foo", [2, 5],
2973
+ :tSTRING_END, "/", [5, 6],
2974
+ :tREGEXP_OPT, "", [6, 6])
2975
+ end
2976
+
2977
+ def test_bug_expr_beg_heredoc
2978
+ assert_scanned("<<EOL % [\nfoo\nEOL\n]",
2979
+ :tSTRING_BEG, '<<"', [0, 5],
2980
+ :tSTRING_CONTENT, "foo\n", [10, 14],
2981
+ :tSTRING_END, 'EOL', [14, 17],
2982
+ :tPERCENT, '%', [6, 7],
2983
+ :tLBRACK, '[', [8, 9],
2984
+ :tRBRACK, ']', [18, 19])
2985
+ end
2986
+
2987
+ def test_bug_expr_beg_fid
2988
+ assert_scanned("Rainbows!",
2989
+ :tFID, 'Rainbows!', [0, 9])
2990
+ end
2991
+
2992
+ def test_bug_expr_beg_rescue_assoc
2993
+ assert_scanned("rescue=>",
2994
+ :kRESCUE, 'rescue', [0, 6],
2995
+ :tASSOC, '=>', [6, 8])
2996
+ end
2997
+
2998
+ def test_bug_expr_arg_percent
2999
+ @lex.state = :expr_arg
3000
+ assert_scanned("%[",
3001
+ :tPERCENT, "%", [0, 1],
3002
+ :tLBRACK, "[", [1, 2])
3003
+
3004
+ @lex.state = :expr_arg
3005
+ assert_scanned("%=1",
3006
+ :tOP_ASGN, "%", [0, 2],
3007
+ :tINTEGER, 1, [2, 3])
3008
+
3009
+ @lex.state = :expr_arg
3010
+ assert_scanned(" %[1]",
3011
+ :tSTRING_BEG, "%[", [1, 3],
3012
+ :tSTRING_CONTENT, '1', [3, 4],
3013
+ :tSTRING_END, ']', [4, 5])
3014
+
3015
+ @lex.state = :expr_arg
3016
+ assert_scanned(" %=1=",
3017
+ :tOP_ASGN, "%", [1, 3],
3018
+ :tINTEGER, 1, [3, 4],
3019
+ :tEQL, "=", [4, 5])
3020
+
3021
+ @lex.state = :expr_arg
3022
+ assert_scanned(" %\n",
3023
+ :tPERCENT, '%', [1, 2])
3024
+ end
3025
+
3026
+ def test_bug_expr_arg_lt_lt
3027
+ @lex.state = :expr_arg
3028
+ assert_scanned("<<EOS\nEOS",
3029
+ :tLSHFT, "<<", [0, 2],
3030
+ :tCONSTANT, "EOS", [2, 5],
3031
+ :tNL, nil, [5, 6],
3032
+ :tCONSTANT, "EOS", [6, 9])
3033
+
3034
+ @lex.state = :expr_arg
3035
+ assert_scanned(" <<EOS\nEOS",
3036
+ :tSTRING_BEG, "<<\"", [1, 6],
3037
+ :tSTRING_END, "EOS", [7, 10],
3038
+ :tNL, nil, [6, 7])
3039
+ end
3040
+
3041
+ def test_bug_expr_arg_slash
3042
+ @lex.state = :expr_arg
3043
+ assert_scanned("/1",
3044
+ :tDIVIDE, "/", [0, 1],
3045
+ :tINTEGER, 1, [1, 2])
3046
+
3047
+ @lex.state = :expr_arg
3048
+ assert_scanned("/ 1",
3049
+ :tDIVIDE, "/", [0, 1],
3050
+ :tINTEGER, 1, [2, 3])
3051
+
3052
+ @lex.state = :expr_arg
3053
+ assert_scanned(" /1/",
3054
+ :tREGEXP_BEG, "/", [1, 2],
3055
+ :tSTRING_CONTENT, "1", [2, 3],
3056
+ :tSTRING_END, "/", [3, 4],
3057
+ :tREGEXP_OPT, "", [4, 4])
3058
+
3059
+ @lex.state = :expr_arg
3060
+ assert_scanned(" / 1",
3061
+ :tDIVIDE, "/", [1, 2],
3062
+ :tINTEGER, 1, [3, 4])
3063
+ end
3064
+
3065
+ def test_bug_expr_arg_label
3066
+ setup_lexer 19
3067
+
3068
+ @lex.state = :expr_arg
3069
+ assert_scanned(" unless:",
3070
+ :tLABEL, 'unless', [1, 8])
3071
+
3072
+ @lex.state = :expr_arg
3073
+ assert_scanned(" unless: ",
3074
+ :tLABEL, 'unless', [1, 8])
3075
+ end
3076
+
3077
+ def test_bug_heredoc_continuation
3078
+ @lex.state = :expr_arg
3079
+ assert_scanned(" <<EOS\nEOS\nend",
3080
+ :tSTRING_BEG, "<<\"", [1, 6],
3081
+ :tSTRING_END, "EOS", [7, 10],
3082
+ :tNL, nil, [6, 7],
3083
+ :kEND, "end", [11, 14])
3084
+ end
3085
+
3086
+ def test_bug_heredoc_cr_lf
3087
+ assert_scanned("<<FIN\r\nfoo\r\nFIN\r\n",
3088
+ :tSTRING_BEG, "<<\"", [0, 5],
3089
+ :tSTRING_CONTENT, "foo\n", [6, 10],
3090
+ :tSTRING_END, "FIN", [10, 13],
3091
+ :tNL, nil, [5, 6])
3092
+ end
3093
+
3094
+ def test_bug_eh_symbol_no_newline
3095
+ assert_scanned("?\"\nfoo",
3096
+ :tINTEGER, 34, [0, 2],
3097
+ :tNL, nil, [2, 3],
3098
+ :tIDENTIFIER, "foo", [3, 6])
3099
+ end
3100
+
3101
+ def test_bug_expr_arg_newline
3102
+ @lex.state = :expr_arg
3103
+ assert_scanned("\nfoo",
3104
+ :tNL, nil, [0, 1],
3105
+ :tIDENTIFIER, "foo", [1, 4])
3106
+
3107
+ @lex.state = :expr_arg
3108
+ assert_scanned(" \nfoo",
3109
+ :tNL, nil, [1, 2],
3110
+ :tIDENTIFIER, "foo", [2, 5])
3111
+
3112
+ @lex.state = :expr_arg
3113
+ assert_scanned("#foo\nfoo",
3114
+ :tNL, nil, [4, 5],
3115
+ :tIDENTIFIER, "foo", [5, 8])
3116
+ end
3117
+
3118
+ def test_bug_expr_arg_comment_newline
3119
+ @lex.state = :expr_arg
3120
+ assert_scanned(" #\nfoo",
3121
+ :tNL, nil, [2, 3],
3122
+ :tIDENTIFIER, 'foo', [3, 6])
3123
+ end
3124
+
3125
+ def test_bug_expr_arg_eh_crlf
3126
+ @lex.state = :expr_arg
3127
+ assert_scanned(" ?\r\n",
3128
+ :tEH, '?', [1, 2])
3129
+ end
3130
+
3131
+ def test_bug_heredoc_backspace_nl
3132
+ assert_scanned(" <<'XXX'\nf \\\nXXX\n",
3133
+ :tSTRING_BEG, "<<'", [1, 8],
3134
+ :tSTRING_CONTENT, "f \\\n", [9, 13],
3135
+ :tSTRING_END, "XXX", [13, 16],
3136
+ :tNL, nil, [8, 9])
3137
+ end
3138
+
3139
+ def test_bug_heredoc_lshft
3140
+ assert_scanned("<<RULES << CLEANINGS\nRULES",
3141
+ :tSTRING_BEG, '<<"', [0, 7],
3142
+ :tSTRING_END, 'RULES', [21, 26],
3143
+ :tLSHFT, '<<', [8, 10],
3144
+ :tCONSTANT, 'CLEANINGS', [11, 20])
3145
+ end
3146
+
3147
+ def test_bug_sclass_comment_lshft_label
3148
+ assert_scanned("class # foo\n<< a:b;end",
3149
+ :kCLASS, 'class', [0, 5],
3150
+ :tLSHFT, '<<', [12, 14],
3151
+ :tIDENTIFIER, 'a', [15, 16],
3152
+ :tSYMBOL, 'b', [16, 18],
3153
+ :tSEMI, ';', [18, 19],
3154
+ :kEND, 'end', [19, 22])
3155
+ end
3156
+
3157
+ def test_bug_expr_dot_comment
3158
+ assert_scanned("foo. #bar\nbaz",
3159
+ :tIDENTIFIER, 'foo', [0, 3],
3160
+ :tDOT, '.', [3, 4],
3161
+ :tIDENTIFIER, 'baz', [10, 13])
3162
+ end
3163
+
3164
+ def test_bug_expr_dot_fid
3165
+ assert_scanned("foo.S?",
3166
+ :tIDENTIFIER, 'foo', [0, 3],
3167
+ :tDOT, '.', [3, 4],
3168
+ :tFID, 'S?', [4, 6])
3169
+ end
3170
+
3171
+ def test_bug_expr_dot_id_eq
3172
+ assert_scanned("foo.x= 1",
3173
+ :tIDENTIFIER, 'foo', [0, 3],
3174
+ :tDOT, '.', [3, 4],
3175
+ :tIDENTIFIER, 'x', [4, 5],
3176
+ :tEQL, '=', [5, 6],
3177
+ :tINTEGER, 1, [7, 8])
3178
+ end
3179
+
3180
+ def test_bug_expr_dot_fid_mod
3181
+ assert_scanned("foo.x!if 1",
3182
+ :tIDENTIFIER, 'foo', [0, 3],
3183
+ :tDOT, '.', [3, 4],
3184
+ :tFID, 'x!', [4, 6],
3185
+ :kIF_MOD, 'if', [6, 8],
3186
+ :tINTEGER, 1, [9, 10])
3187
+ end
3188
+
3189
+ def test_bug_expr_mid_comment
3190
+ assert_scanned("rescue #bar\nprint",
3191
+ :kRESCUE, 'rescue', [0, 6],
3192
+ :tNL, nil, [11, 12],
3193
+ :tIDENTIFIER, 'print', [12, 17])
3194
+ end
3195
+
3196
+ def test_bug_expr_mid_bareword
3197
+ assert_scanned("begin; rescue rescue1",
3198
+ :kBEGIN, 'begin', [0, 5],
3199
+ :tSEMI, ';', [5, 6],
3200
+ :kRESCUE, 'rescue', [7, 13],
3201
+ :tIDENTIFIER, 'rescue1', [14, 21])
3202
+ end
3203
+
3204
+ def test_bug_expr_value_document
3205
+ assert_scanned("1;\n=begin\n=end",
3206
+ :tINTEGER, 1, [0, 1],
3207
+ :tSEMI, ';', [1, 2])
3208
+ end
3209
+
3210
+ def test_bug_expr_end_colon
3211
+ assert_scanned("'foo':'bar'",
3212
+ :tSTRING, 'foo', [0, 5],
3213
+ :tCOLON, ':', [5, 6],
3214
+ :tSTRING, 'bar', [6, 11])
3215
+ end
3216
+
3217
+ def test_bug_expr_value_rescue_colon2
3218
+ @lex.state = :expr_value
3219
+ assert_scanned("rescue::Exception",
3220
+ :kRESCUE, 'rescue', [0, 6],
3221
+ :tCOLON3, '::', [6, 8],
3222
+ :tCONSTANT, 'Exception', [8, 17])
3223
+ end
3224
+
3225
+ def test_bug_expr_endarg_braces
3226
+ assert_scanned("let [] {",
3227
+ :tIDENTIFIER, 'let', [0, 3],
3228
+ :tLBRACK, '[', [4, 5],
3229
+ :tRBRACK, ']', [5, 6],
3230
+ :tLBRACE_ARG, '{', [7, 8])
3231
+ end
3232
+
3233
+ def test_bug_line_begin_label
3234
+ setup_lexer(19)
3235
+ assert_scanned("foo:bar",
3236
+ :tIDENTIFIER, 'foo', [0, 3],
3237
+ :tSYMBOL, 'bar', [3, 7])
3238
+ end
3239
+
3240
+ def test_bug_interp_expr_value
3241
+ assert_scanned('"#{f:a}"',
3242
+ :tSTRING_BEG, '"', [0, 1],
3243
+ :tSTRING_DBEG, '#{', [1, 3],
3244
+ :tIDENTIFIER, 'f', [3, 4],
3245
+ :tSYMBOL, 'a', [4, 6],
3246
+ :tRCURLY, '}', [6, 7],
3247
+ :tSTRING_END, '"', [7, 8])
3248
+ end
3249
+
3250
+ def test_bug_const_e
3251
+ assert_scanned('E10',
3252
+ :tCONSTANT, 'E10', [0, 3])
3253
+ assert_scanned('E4U',
3254
+ :tCONSTANT, 'E4U', [0, 3])
3255
+ end
3256
+
3257
+ def test_bug_symbol_newline
3258
+ assert_scanned(":foo\n",
3259
+ :tSYMBOL, 'foo', [0, 4],
3260
+ :tNL, nil, [4, 5])
3261
+
3262
+ assert_scanned(":foo=\n",
3263
+ :tSYMBOL, 'foo=', [0, 5],
3264
+ :tNL, nil, [5, 6])
3265
+ end
3266
+
3267
+ def test_bug_interleaved_heredoc
3268
+ assert_scanned(%Q{<<w; "\nfoo\nw\n"},
3269
+ :tSTRING_BEG, '<<"', [0, 3],
3270
+ :tSTRING_CONTENT, "foo\n", [7, 11],
3271
+ :tSTRING_END, 'w', [11, 12],
3272
+ :tSEMI, ';', [3, 4],
3273
+ :tSTRING_BEG, '"', [5, 6],
3274
+ :tSTRING_CONTENT, "\n", [6, 7],
3275
+ :tSTRING_END, '"', [13, 14])
3276
+
3277
+ @lex.state = :expr_beg
3278
+ assert_scanned(%Q{<<w; %w[\nfoo\nw\n1]},
3279
+ :tSTRING_BEG, '<<"', [0, 3],
3280
+ :tSTRING_CONTENT, "foo\n", [9, 13],
3281
+ :tSTRING_END, 'w', [13, 14],
3282
+ :tSEMI, ';', [3, 4],
3283
+ :tQWORDS_BEG, '%w[', [5, 8],
3284
+ :tSTRING_CONTENT, "1", [15, 16],
3285
+ :tSPACE, nil, [16, 16],
3286
+ :tSTRING_END, ']', [16, 17])
3287
+
3288
+ @lex.state = :expr_beg
3289
+ assert_scanned(%Q{<<w; "\#{\nfoo\nw\n}"},
3290
+ :tSTRING_BEG, '<<"', [0, 3],
3291
+ :tSTRING_CONTENT, "foo\n", [9, 13],
3292
+ :tSTRING_END, 'w', [13, 14],
3293
+ :tSEMI, ';', [3, 4],
3294
+ :tSTRING_BEG, '"', [5, 6],
3295
+ :tSTRING_DBEG, '#{', [6, 8],
3296
+ :tRCURLY, '}', [15, 16],
3297
+ :tSTRING_END, '"', [16, 17])
3298
+ end
3299
+
3300
+ def test_bug_fid_char
3301
+ setup_lexer(19)
3302
+ assert_scanned('eof??a',
3303
+ :tFID, 'eof?', [0, 4],
3304
+ :tCHARACTER, 'a', [4, 6])
3305
+ end
3306
+
3307
+ def test_bug_nonlabel_context__18
3308
+ env = Parser::StaticEnvironment.new
3309
+ env.declare "a"
3310
+
3311
+ @lex.static_env = env
3312
+ assert_scanned("1+a:a",
3313
+ :tINTEGER, 1, [0, 1],
3314
+ :tPLUS, '+', [1, 2],
3315
+ :tIDENTIFIER, 'a', [2, 3],
3316
+ :tCOLON, ':', [3, 4],
3317
+ :tIDENTIFIER, 'a', [4, 5])
3318
+ end
3319
+
3320
+ def test_bug_string_percent_newline
3321
+ assert_scanned(%Q{%\nfoo\n},
3322
+ :tSTRING_BEG, "%\n", [0, 2],
3323
+ :tSTRING_CONTENT, 'foo', [2, 5],
3324
+ :tSTRING_END, "\n", [5, 6])
3325
+ end
3326
+
3327
+ def test_bug_string_percent_zero
3328
+ assert_scanned(%Q{%\0foo\0},
3329
+ :tSTRING_BEG, "%\0", [0, 2],
3330
+ :tSTRING_CONTENT, 'foo', [2, 5],
3331
+ :tSTRING_END, "\0", [5, 6])
3332
+ end
3333
+
3334
+ def test_bug_string_utf_escape_composition
3335
+ assert_scanned(%q{"\xE2\x80\x99"},
3336
+ :tSTRING, "\xE2\x80\x99", [0, 14])
3337
+
3338
+ assert_scanned(utf(%q{"\xE2\x80\x99"}),
3339
+ :tSTRING, utf('’'), [0, 14])
3340
+ assert_scanned(utf(%q{"\342\200\231"}),
3341
+ :tSTRING, utf('’'), [0, 14])
3342
+ assert_scanned(utf(%q{"\M-b\C-\M-@\C-\M-Y"}),
3343
+ :tSTRING, utf('’'), [0, 20])
3344
+ end
3345
+
3346
+ def test_bug_string_utf_escape_noop
3347
+ assert_scanned(utf(%q{"\あ"}),
3348
+ :tSTRING, utf("あ"), [0, 4])
3349
+ end
3350
+
3351
+ def test_bug_string_non_utf
3352
+ assert_scanned(%Q{"caf\xE9"},
3353
+ :tSTRING, "caf\xE9", [0, 6])
3354
+ assert_scanned(%Q{"caf\xC3\xA9"},
3355
+ :tSTRING, "caf\xC3\xA9", [0, 7])
3356
+
3357
+ assert_scanned(utf(%q{"café"}),
3358
+ :tSTRING, utf("café"), [0, 6])
3359
+ end
3360
+
3361
+ def test_bug_semi__END__
3362
+ assert_scanned(%Q{foo;\n__END__},
3363
+ :tIDENTIFIER, 'foo', [0, 3],
3364
+ :tSEMI, ';', [3, 4])
3365
+ end
3366
+
3367
+ def test_bug_eql_end
3368
+ assert_scanned(%Q{=begin\n#=end\n=end})
3369
+ end
3370
+
3371
+ def test_bug_hidden_eof
3372
+ @lex.state = :expr_beg
3373
+ assert_scanned(%Q{"foo\0\x1a\x04bar"},
3374
+ :tSTRING_BEG, '"', [0, 1],
3375
+ :tSTRING_CONTENT, "foo\0", [1, 5],
3376
+ :tSTRING_CONTENT, "\x1a", [5, 6],
3377
+ :tSTRING_CONTENT, "\x04", [6, 7],
3378
+ :tSTRING_CONTENT, "bar", [7, 10],
3379
+ :tSTRING_END, '"', [10, 11])
3380
+
3381
+ @lex.state = :expr_beg
3382
+ assert_scanned(%Q{'foo\0\x1a\x04bar'},
3383
+ :tSTRING_BEG, "'", [0, 1],
3384
+ :tSTRING_CONTENT, "foo\0", [1, 5],
3385
+ :tSTRING_CONTENT, "\x1a", [5, 6],
3386
+ :tSTRING_CONTENT, "\x04", [6, 7],
3387
+ :tSTRING_CONTENT, "bar", [7, 10],
3388
+ :tSTRING_END, "'", [10, 11])
3389
+
3390
+ @lex.state = :expr_beg
3391
+ assert_scanned(%Q{%w[foo\0\x1a\x04bar]},
3392
+ :tQWORDS_BEG, '%w[', [0, 3],
3393
+ :tSTRING_CONTENT, "foo\0", [3, 7],
3394
+ :tSTRING_CONTENT, "\x1a", [7, 8],
3395
+ :tSTRING_CONTENT, "\x04", [8, 9],
3396
+ :tSTRING_CONTENT, "bar", [9, 12],
3397
+ :tSPACE, nil, [12, 12],
3398
+ :tSTRING_END, ']', [12, 13])
3399
+
3400
+ @lex.state = :expr_beg
3401
+ assert_scanned(%Q{%W[foo\0\x1a\x04bar]},
3402
+ :tWORDS_BEG, '%W[', [0, 3],
3403
+ :tSTRING_CONTENT, "foo\0", [3, 7],
3404
+ :tSTRING_CONTENT, "\x1a", [7, 8],
3405
+ :tSTRING_CONTENT, "\x04", [8, 9],
3406
+ :tSTRING_CONTENT, "bar", [9, 12],
3407
+ :tSPACE, nil, [12, 12],
3408
+ :tSTRING_END, ']', [12, 13])
3409
+
3410
+ @lex.state = :expr_beg
3411
+ assert_scanned(%Q{# foo\0\nbar},
3412
+ :tIDENTIFIER, 'bar', [7, 10])
3413
+
3414
+ @lex.state = :line_begin
3415
+ assert_scanned(%Q{=begin\n\0\n=end\nbar},
3416
+ :tIDENTIFIER, 'bar', [14, 17])
3417
+ end
3418
+
3419
+ def test_bug_num_adj_kw
3420
+ assert_scanned('1if',
3421
+ :tINTEGER, 1, [0, 1],
3422
+ :kIF_MOD, 'if', [1, 3])
3423
+
3424
+ assert_scanned('1.0if',
3425
+ :tFLOAT, 1.0, [0, 3],
3426
+ :kIF_MOD, 'if', [3, 5])
3427
+ end
3428
+
3429
+ def test_bug_unicode_in_literal
3430
+ setup_lexer(19)
3431
+ assert_scanned('"\u00a4"',
3432
+ :tSTRING, "\u00a4", [0, 8])
3433
+ end
3434
+
3435
+ def test_bug_utf32le_leak
3436
+ setup_lexer(19)
3437
+ @lex.force_utf32 = true
3438
+ assert_scanned('"F0"',
3439
+ :tSTRING, "F0", [0, 4])
3440
+ end
3441
+
3442
+ def test_bug_ragel_stack
3443
+ assert_scanned("\"\#{$2 ? $2 : 1}\"",
3444
+ :tSTRING_BEG, "\"", [0, 1],
3445
+ :tSTRING_DBEG, "\#{", [1, 3],
3446
+ :tNTH_REF, 2, [3, 5],
3447
+ :tEH, "?", [6, 7],
3448
+ :tNTH_REF, 2, [8, 10],
3449
+ :tCOLON, ":", [11, 12],
3450
+ :tINTEGER, 1, [13, 14],
3451
+ :tRCURLY, "}", [14, 15],
3452
+ :tSTRING_END, "\"", [15, 16])
3453
+ end
3454
+
3455
+ def test_bug_423
3456
+ @lex.state = :expr_beg
3457
+ assert_scanned(':&&',
3458
+ :tSYMBEG, ':', [0, 1],
3459
+ :tANDOP, '&&', [1, 3])
3460
+
3461
+ @lex.state = :expr_beg
3462
+ assert_scanned(':||',
3463
+ :tSYMBEG, ':', [0, 1],
3464
+ :tOROP, '||', [1, 3])
3465
+ end
3466
+
3467
+ def test_bug_418
3468
+ setup_lexer 19
3469
+
3470
+ assert_scanned("{\n=begin\nx: 1,\n=end\ny: 2}",
3471
+ :tLBRACE, '{', [0, 1],
3472
+ :tLABEL, 'y', [20, 22],
3473
+ :tINTEGER, 2, [23, 24],
3474
+ :tRCURLY, '}', [24, 25])
3475
+ end
3476
+
3477
+ def test_bug_407
3478
+ setup_lexer(21)
3479
+
3480
+ assert_scanned('123if cond',
3481
+ :tINTEGER, 123, [0, 3],
3482
+ :kIF_MOD, 'if', [3, 5],
3483
+ :tIDENTIFIER, 'cond', [6, 10])
3484
+
3485
+ assert_scanned('1.23if cond',
3486
+ :tFLOAT, 1.23, [0, 4],
3487
+ :kIF_MOD, 'if', [4, 6],
3488
+ :tIDENTIFIER, 'cond', [7, 11])
3489
+
3490
+ assert_scanned('123rescue cond',
3491
+ :tINTEGER, 123, [0, 3],
3492
+ :kRESCUE_MOD, 'rescue', [3, 9],
3493
+ :tIDENTIFIER, 'cond', [10, 14])
3494
+
3495
+ assert_scanned('1.23rescue cond',
3496
+ :tFLOAT, 1.23, [0, 4],
3497
+ :kRESCUE_MOD, 'rescue', [4, 10],
3498
+ :tIDENTIFIER, 'cond', [11, 15])
3499
+ end
3500
+
3501
+ def test_parser_bug_486
3502
+ setup_lexer(19)
3503
+ assert_scanned(':!@',
3504
+ :tSYMBOL, '!', [0, 3])
3505
+
3506
+ setup_lexer(19)
3507
+ assert_scanned(':~@',
3508
+ :tSYMBOL, '~', [0, 3])
3509
+ end
3510
+
3511
+ def test_slash_only_in_heredocs
3512
+ setup_lexer(23)
3513
+ refute_scanned(%Q{<<~E\n\\\nE})
3514
+
3515
+ setup_lexer(23)
3516
+ refute_scanned(%Q{<<-E\n\\\nE})
3517
+ end
3518
+
3519
+ def test_escapes_in_squiggly_heredoc
3520
+ setup_lexer(23)
3521
+
3522
+ assert_scanned(%Q{<<~E\n\a\b\e\f\r\t\\\v\nE},
3523
+ :tSTRING_BEG, '<<"', [0, 4],
3524
+ :tSTRING_CONTENT, "\a\b\e\f\r\t\v\n", [5, 14],
3525
+ :tSTRING_END, 'E', [14, 15],
3526
+ :tNL, nil, [4, 5])
3527
+
3528
+ setup_lexer(23)
3529
+
3530
+ assert_scanned(%Q{<<-E\n\a\b\e\f\r\t\\\v\nE},
3531
+ :tSTRING_BEG, '<<"', [0, 4],
3532
+ :tSTRING_CONTENT, "\a\b\e\f\r\t\v\n", [5, 14],
3533
+ :tSTRING_END, 'E', [14, 15],
3534
+ :tNL, nil, [4, 5])
3535
+ end
3536
+
3537
+ end