yard 0.9.24 → 0.9.25

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of yard might be problematic. Click here for more details.

Files changed (223) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +37 -24
  3. data/CHANGELOG.md +18 -3
  4. data/README.md +96 -101
  5. data/Rakefile +2 -0
  6. data/lib/yard/cli/diff.rb +4 -1
  7. data/lib/yard/cli/server.rb +22 -13
  8. data/lib/yard/code_objects/proxy.rb +2 -1
  9. data/lib/yard/globals.rb +1 -1
  10. data/lib/yard/handlers/c/base.rb +164 -129
  11. data/lib/yard/parser/ruby/ruby_parser.rb +6 -4
  12. data/lib/yard/registry_store.rb +1 -1
  13. data/lib/yard/templates/helpers/html_helper.rb +10 -3
  14. data/lib/yard/templates/helpers/markup/rdoc_markup.rb +5 -4
  15. data/lib/yard/version.rb +1 -1
  16. data/tasks/update_error_map.rake +53 -0
  17. data/yard.gemspec +1 -1
  18. metadata +3 -207
  19. data/spec/cli/command_parser_spec.rb +0 -43
  20. data/spec/cli/command_spec.rb +0 -36
  21. data/spec/cli/config_spec.rb +0 -148
  22. data/spec/cli/diff_spec.rb +0 -254
  23. data/spec/cli/display_spec.rb +0 -30
  24. data/spec/cli/gems_spec.rb +0 -81
  25. data/spec/cli/graph_spec.rb +0 -18
  26. data/spec/cli/help_spec.rb +0 -22
  27. data/spec/cli/i18n_spec.rb +0 -107
  28. data/spec/cli/list_spec.rb +0 -8
  29. data/spec/cli/markup_types_spec.rb +0 -22
  30. data/spec/cli/server_spec.rb +0 -324
  31. data/spec/cli/stats_spec.rb +0 -96
  32. data/spec/cli/yard_on_yard_spec.rb +0 -38
  33. data/spec/cli/yardoc_spec.rb +0 -896
  34. data/spec/cli/yri_spec.rb +0 -101
  35. data/spec/code_objects/base_spec.rb +0 -485
  36. data/spec/code_objects/class_object_spec.rb +0 -226
  37. data/spec/code_objects/code_object_list_spec.rb +0 -36
  38. data/spec/code_objects/constants_spec.rb +0 -116
  39. data/spec/code_objects/extra_file_object_spec.rb +0 -161
  40. data/spec/code_objects/macro_object_spec.rb +0 -150
  41. data/spec/code_objects/method_object_spec.rb +0 -184
  42. data/spec/code_objects/module_object_spec.rb +0 -142
  43. data/spec/code_objects/namespace_mapper_spec.rb +0 -32
  44. data/spec/code_objects/namespace_object_spec.rb +0 -171
  45. data/spec/code_objects/proxy_spec.rb +0 -147
  46. data/spec/code_objects/spec_helper.rb +0 -3
  47. data/spec/config_spec.rb +0 -171
  48. data/spec/core_ext/array_spec.rb +0 -13
  49. data/spec/core_ext/file_spec.rb +0 -72
  50. data/spec/core_ext/hash_spec.rb +0 -14
  51. data/spec/core_ext/insertion_spec.rb +0 -37
  52. data/spec/core_ext/module_spec.rb +0 -9
  53. data/spec/core_ext/string_spec.rb +0 -42
  54. data/spec/core_ext/symbol_hash_spec.rb +0 -89
  55. data/spec/docstring_parser_spec.rb +0 -280
  56. data/spec/docstring_spec.rb +0 -373
  57. data/spec/handlers/alias_handler_spec.rb +0 -82
  58. data/spec/handlers/attribute_handler_spec.rb +0 -96
  59. data/spec/handlers/base_spec.rb +0 -216
  60. data/spec/handlers/c/alias_handler_spec.rb +0 -34
  61. data/spec/handlers/c/attribute_handler_spec.rb +0 -41
  62. data/spec/handlers/c/class_handler_spec.rb +0 -78
  63. data/spec/handlers/c/constant_handler_spec.rb +0 -71
  64. data/spec/handlers/c/init_handler_spec.rb +0 -48
  65. data/spec/handlers/c/method_handler_spec.rb +0 -327
  66. data/spec/handlers/c/mixin_handler_spec.rb +0 -44
  67. data/spec/handlers/c/module_handler_spec.rb +0 -71
  68. data/spec/handlers/c/override_comment_handler_spec.rb +0 -47
  69. data/spec/handlers/c/path_handler_spec.rb +0 -36
  70. data/spec/handlers/c/spec_helper.rb +0 -23
  71. data/spec/handlers/c/struct_handler_spec.rb +0 -16
  72. data/spec/handlers/class_condition_handler_spec.rb +0 -87
  73. data/spec/handlers/class_handler_spec.rb +0 -247
  74. data/spec/handlers/class_method_handler_shared_examples.rb +0 -133
  75. data/spec/handlers/class_variable_handler_spec.rb +0 -12
  76. data/spec/handlers/constant_handler_spec.rb +0 -112
  77. data/spec/handlers/decorator_handler_methods_spec.rb +0 -393
  78. data/spec/handlers/dsl_handler_spec.rb +0 -226
  79. data/spec/handlers/examples/alias_handler_001.rb.txt +0 -46
  80. data/spec/handlers/examples/attribute_handler_001.rb.txt +0 -32
  81. data/spec/handlers/examples/class_condition_handler_001.rb.txt +0 -69
  82. data/spec/handlers/examples/class_handler_001.rb.txt +0 -120
  83. data/spec/handlers/examples/class_variable_handler_001.rb.txt +0 -10
  84. data/spec/handlers/examples/constant_handler_001.rb.txt +0 -35
  85. data/spec/handlers/examples/dsl_handler_001.rb.txt +0 -156
  86. data/spec/handlers/examples/exception_handler_001.rb.txt +0 -59
  87. data/spec/handlers/examples/extend_handler_001.rb.txt +0 -19
  88. data/spec/handlers/examples/method_condition_handler_001.rb.txt +0 -10
  89. data/spec/handlers/examples/method_handler_001.rb.txt +0 -128
  90. data/spec/handlers/examples/mixin_handler_001.rb.txt +0 -40
  91. data/spec/handlers/examples/module_handler_001.rb.txt +0 -29
  92. data/spec/handlers/examples/private_constant_handler_001.rb.txt +0 -8
  93. data/spec/handlers/examples/process_handler_001.rb.txt +0 -11
  94. data/spec/handlers/examples/visibility_handler_001.rb.txt +0 -36
  95. data/spec/handlers/examples/yield_handler_001.rb.txt +0 -54
  96. data/spec/handlers/exception_handler_spec.rb +0 -49
  97. data/spec/handlers/extend_handler_spec.rb +0 -28
  98. data/spec/handlers/legacy_base_spec.rb +0 -128
  99. data/spec/handlers/method_condition_handler_spec.rb +0 -15
  100. data/spec/handlers/method_handler_spec.rb +0 -214
  101. data/spec/handlers/mixin_handler_spec.rb +0 -60
  102. data/spec/handlers/module_function_handler_spec.rb +0 -106
  103. data/spec/handlers/module_handler_spec.rb +0 -35
  104. data/spec/handlers/private_class_method_handler_spec.rb +0 -11
  105. data/spec/handlers/private_constant_handler_spec.rb +0 -25
  106. data/spec/handlers/processor_spec.rb +0 -35
  107. data/spec/handlers/public_class_method_handler_spec.rb +0 -11
  108. data/spec/handlers/ruby/base_spec.rb +0 -95
  109. data/spec/handlers/ruby/legacy/base_spec.rb +0 -84
  110. data/spec/handlers/spec_helper.rb +0 -33
  111. data/spec/handlers/visibility_handler_spec.rb +0 -44
  112. data/spec/handlers/yield_handler_spec.rb +0 -52
  113. data/spec/i18n/locale_spec.rb +0 -81
  114. data/spec/i18n/message_spec.rb +0 -52
  115. data/spec/i18n/messages_spec.rb +0 -67
  116. data/spec/i18n/pot_generator_spec.rb +0 -295
  117. data/spec/i18n/text_spec.rb +0 -184
  118. data/spec/logging_spec.rb +0 -44
  119. data/spec/options_spec.rb +0 -171
  120. data/spec/parser/base_spec.rb +0 -24
  121. data/spec/parser/c_parser_spec.rb +0 -236
  122. data/spec/parser/examples/array.c.txt +0 -6267
  123. data/spec/parser/examples/example1.rb.txt +0 -8
  124. data/spec/parser/examples/extrafile.c.txt +0 -8
  125. data/spec/parser/examples/file.c.txt +0 -28
  126. data/spec/parser/examples/multifile.c.txt +0 -22
  127. data/spec/parser/examples/namespace.cpp.txt +0 -68
  128. data/spec/parser/examples/override.c.txt +0 -424
  129. data/spec/parser/examples/parse_in_order_001.rb.txt +0 -2
  130. data/spec/parser/examples/parse_in_order_002.rb.txt +0 -2
  131. data/spec/parser/examples/tag_handler_001.rb.txt +0 -8
  132. data/spec/parser/ruby/ast_node_spec.rb +0 -33
  133. data/spec/parser/ruby/legacy/statement_list_spec.rb +0 -299
  134. data/spec/parser/ruby/legacy/token_list_spec.rb +0 -79
  135. data/spec/parser/ruby/ruby_parser_spec.rb +0 -520
  136. data/spec/parser/ruby/token_resolver_spec.rb +0 -165
  137. data/spec/parser/source_parser_spec.rb +0 -727
  138. data/spec/parser/tag_parsing_spec.rb +0 -17
  139. data/spec/rake/yardoc_task_spec.rb +0 -118
  140. data/spec/registry_resolver_spec.rb +0 -15
  141. data/spec/registry_spec.rb +0 -463
  142. data/spec/registry_store_spec.rb +0 -327
  143. data/spec/rubygems/doc_manager_spec.rb +0 -112
  144. data/spec/serializers/data/serialized_yardoc/checksums +0 -1
  145. data/spec/serializers/data/serialized_yardoc/objects/Foo.dat +0 -0
  146. data/spec/serializers/data/serialized_yardoc/objects/Foo/bar_i.dat +0 -0
  147. data/spec/serializers/data/serialized_yardoc/objects/Foo/baz_i.dat +0 -0
  148. data/spec/serializers/data/serialized_yardoc/objects/root.dat +0 -0
  149. data/spec/serializers/data/serialized_yardoc/proxy_types +0 -2
  150. data/spec/serializers/file_system_serializer_spec.rb +0 -145
  151. data/spec/serializers/spec_helper.rb +0 -2
  152. data/spec/serializers/yardoc_serializer_spec.rb +0 -90
  153. data/spec/server/adapter_spec.rb +0 -39
  154. data/spec/server/commands/base_spec.rb +0 -91
  155. data/spec/server/commands/library_command_spec.rb +0 -39
  156. data/spec/server/doc_server_helper_spec.rb +0 -72
  157. data/spec/server/doc_server_serializer_spec.rb +0 -60
  158. data/spec/server/rack_adapter_spec.rb +0 -21
  159. data/spec/server/router_spec.rb +0 -123
  160. data/spec/server/spec_helper.rb +0 -22
  161. data/spec/server/static_caching_spec.rb +0 -47
  162. data/spec/server/webrick_servlet_spec.rb +0 -20
  163. data/spec/server_spec.rb +0 -19
  164. data/spec/spec_helper.rb +0 -212
  165. data/spec/tags/default_factory_spec.rb +0 -168
  166. data/spec/tags/default_tag_spec.rb +0 -11
  167. data/spec/tags/directives_spec.rb +0 -463
  168. data/spec/tags/library_spec.rb +0 -48
  169. data/spec/tags/overload_tag_spec.rb +0 -53
  170. data/spec/tags/ref_tag_list_spec.rb +0 -53
  171. data/spec/tags/types_explainer_spec.rb +0 -203
  172. data/spec/templates/class_spec.rb +0 -45
  173. data/spec/templates/constant_spec.rb +0 -41
  174. data/spec/templates/engine_spec.rb +0 -131
  175. data/spec/templates/examples/class001.html +0 -308
  176. data/spec/templates/examples/class001.txt +0 -36
  177. data/spec/templates/examples/class002.html +0 -39
  178. data/spec/templates/examples/constant001.txt +0 -25
  179. data/spec/templates/examples/constant002.txt +0 -7
  180. data/spec/templates/examples/constant003.txt +0 -11
  181. data/spec/templates/examples/method001.html +0 -137
  182. data/spec/templates/examples/method001.txt +0 -35
  183. data/spec/templates/examples/method002.html +0 -91
  184. data/spec/templates/examples/method002.txt +0 -20
  185. data/spec/templates/examples/method003.html +0 -165
  186. data/spec/templates/examples/method003.txt +0 -45
  187. data/spec/templates/examples/method004.html +0 -48
  188. data/spec/templates/examples/method004.txt +0 -10
  189. data/spec/templates/examples/method005.html +0 -105
  190. data/spec/templates/examples/method005.txt +0 -33
  191. data/spec/templates/examples/method006.html +0 -108
  192. data/spec/templates/examples/method006.txt +0 -20
  193. data/spec/templates/examples/module001.dot +0 -33
  194. data/spec/templates/examples/module001.html +0 -833
  195. data/spec/templates/examples/module001.txt +0 -33
  196. data/spec/templates/examples/module002.html +0 -341
  197. data/spec/templates/examples/module003.html +0 -202
  198. data/spec/templates/examples/module004.html +0 -394
  199. data/spec/templates/examples/module005.html +0 -82
  200. data/spec/templates/examples/tag001.txt +0 -82
  201. data/spec/templates/helpers/base_helper_spec.rb +0 -171
  202. data/spec/templates/helpers/html_helper_spec.rb +0 -666
  203. data/spec/templates/helpers/html_syntax_highlight_helper_spec.rb +0 -65
  204. data/spec/templates/helpers/markup/rdoc_markup_spec.rb +0 -84
  205. data/spec/templates/helpers/markup_helper_spec.rb +0 -136
  206. data/spec/templates/helpers/method_helper_spec.rb +0 -107
  207. data/spec/templates/helpers/module_helper_spec.rb +0 -35
  208. data/spec/templates/helpers/shared_signature_examples.rb +0 -126
  209. data/spec/templates/helpers/text_helper_spec.rb +0 -65
  210. data/spec/templates/markup_processor_integrations/asciidoctor_spec.rb +0 -60
  211. data/spec/templates/markup_processor_integrations/integration_spec_helper.rb +0 -50
  212. data/spec/templates/markup_processor_integrations/rdoc_markdown_spec.rb +0 -48
  213. data/spec/templates/markup_processor_integrations/rdoc_spec.rb +0 -39
  214. data/spec/templates/markup_processor_integrations/redcarpet_spec.rb +0 -64
  215. data/spec/templates/markup_processor_integrations/redcloth_spec.rb +0 -64
  216. data/spec/templates/method_spec.rb +0 -118
  217. data/spec/templates/module_spec.rb +0 -203
  218. data/spec/templates/onefile_spec.rb +0 -66
  219. data/spec/templates/section_spec.rb +0 -144
  220. data/spec/templates/spec_helper.rb +0 -76
  221. data/spec/templates/tag_spec.rb +0 -52
  222. data/spec/templates/template_spec.rb +0 -410
  223. data/spec/verifier_spec.rb +0 -106
@@ -1,2 +0,0 @@
1
- class MyModule::MyClass
2
- end
@@ -1,2 +0,0 @@
1
- module MyModule
2
- end
@@ -1,8 +0,0 @@
1
- class Foo
2
-
3
- # @api public
4
- # @return nil
5
- def foo
6
- end
7
-
8
- end
@@ -1,33 +0,0 @@
1
- # frozen_string_literal: true
2
- require 'pp'
3
- require 'stringio'
4
-
5
- include YARD::Parser::Ruby
6
-
7
- RSpec.describe YARD::Parser::Ruby::AstNode do
8
- describe "#jump" do
9
- it "jumps to the first specific inner node if found" do
10
- ast = s(:paren, s(:paren, s(:params, s(s(:ident, "hi"), s(:ident, "bye")))))
11
- expect(ast.jump(:params)[0][0].type).to equal(:ident)
12
- end
13
-
14
- it "returns the original ast if no inner node is found" do
15
- ast = s(:paren, s(:list, s(:list, s(s(:ident, "hi"), s(:ident, "bye")))))
16
- expect(ast.jump(:params).object_id).to eq ast.object_id
17
- end
18
- end
19
-
20
- describe "#pretty_print" do
21
- it "shows a list of nodes" do
22
- obj = YARD::Parser::Ruby::RubyParser.parse("# x\nbye", "x").ast
23
- out = StringIO.new
24
- PP.pp(obj, out)
25
- vcall = RUBY_VERSION >= '1.9.3' ? 'vcall' : 'var_ref'
26
- expect(out.string).to eq "s(s(:#{vcall},\n" \
27
- " s(:ident, \"bye\", line: 2..2, source: 4..6),\n" \
28
- " docstring: \"x\",\n" \
29
- " line: 2..2,\n" \
30
- " source: 4..6))\n"
31
- end
32
- end
33
- end if HAVE_RIPPER
@@ -1,299 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- RSpec.describe YARD::Parser::Ruby::Legacy::StatementList do
4
- def stmts(code) YARD::Parser::Ruby::Legacy::StatementList.new(code) end
5
- def stmt(code) stmts(code).first end
6
-
7
- it "parses dangling block expressions" do
8
- s = stmt <<-eof
9
- if
10
- foo
11
- puts 'hi'
12
- end
13
- eof
14
-
15
- expect(s.tokens.to_s(true)).to eq "if\n foo\n ...\n end"
16
- expect(s.tokens.to_s).to eq "if\n foo"
17
- expect(s.block.to_s).to eq "puts 'hi'"
18
-
19
- s = stmt <<-eof
20
- if foo ||
21
- bar
22
- puts 'hi'
23
- end
24
- eof
25
-
26
- expect(s.tokens.to_s(true)).to eq "if foo ||\n bar\n ...\n end"
27
- expect(s.tokens.to_s).to eq "if foo ||\n bar"
28
- expect(s.block.to_s).to eq "puts 'hi'"
29
- end
30
-
31
- it "allows semicolons within parentheses" do
32
- s = stmt "(foo; bar)"
33
-
34
- expect(s.tokens.to_s(true)).to eq "(foo; bar)"
35
- expect(s.block).to be nil
36
- end
37
-
38
- it "allows for non-block statements" do
39
- s = stmt "hello_world(1, 2, 3)"
40
- expect(s.tokens.to_s).to eq "hello_world(1, 2, 3)"
41
- expect(s.block).to be nil
42
- end
43
-
44
- it "allows block statements to be used as part of other block statements" do
45
- s = stmt "while (foo; bar); foo = 12; end; while"
46
-
47
- expect(s.tokens.to_s(true)).to eq "while (foo; bar); ... end"
48
- expect(s.tokens.to_s).to eq "while (foo; bar)"
49
- expect(s.block.to_s).to eq "foo = 12"
50
- end
51
-
52
- it "allows continued processing after a block" do
53
- s = stmt "if foo; end.stuff"
54
- expect(s.tokens.to_s(true)).to eq "if foo; end.stuff"
55
- expect(s.block.to_s).to eq ""
56
-
57
- s = stmt "if foo; end[stuff]"
58
- expect(s.tokens.to_s(true)).to eq "if foo; end[stuff]"
59
- expect(s.block.to_s).to eq ""
60
-
61
- s = stmt "if foo; hi end.map do; 123; end"
62
- expect(s.tokens.to_s(true)).to eq "if foo; ... end.map do; 123; end"
63
- expect(s.block.to_s).to eq "hi"
64
- end
65
-
66
- it "parses default arguments" do
67
- s = stmt "def foo(bar, baz = 1, bang = 2); bar; end"
68
- expect(s.tokens.to_s(true)).to eq "def foo(bar, baz = 1, bang = 2) ... end"
69
- expect(s.block.to_s).to eq "bar"
70
-
71
- s = stmt "def foo bar, baz = 1, bang = 2; bar; end"
72
- expect(s.tokens.to_s(true)).to eq "def foo bar, baz = 1, bang = 2; ... end"
73
- expect(s.block.to_s).to eq "bar"
74
-
75
- s = stmt "def foo bar , baz = 1 , bang = 2; bar; end"
76
- expect(s.tokens.to_s(true)).to eq "def foo bar , baz = 1 , bang = 2; ... end"
77
- expect(s.block.to_s).to eq "bar"
78
- end
79
-
80
- it "parses complex default arguments" do
81
- s = stmt "def foo(bar, baz = File.new(1, 2), bang = 3); bar; end"
82
- expect(s.tokens.to_s(true)).to eq "def foo(bar, baz = File.new(1, 2), bang = 3) ... end"
83
- expect(s.block.to_s).to eq "bar"
84
-
85
- s = stmt "def foo bar, baz = File.new(1, 2), bang = 3; bar; end"
86
- expect(s.tokens.to_s(true)).to eq "def foo bar, baz = File.new(1, 2), bang = 3; ... end"
87
- expect(s.block.to_s).to eq "bar"
88
-
89
- s = stmt "def foo bar , baz = File.new(1, 2) , bang = 3; bar; end"
90
- expect(s.tokens.to_s(true)).to eq "def foo bar , baz = File.new(1, 2) , bang = 3; ... end"
91
- expect(s.block.to_s).to eq "bar"
92
- end
93
-
94
- it "parses blocks with do/end" do
95
- s = stmt <<-eof
96
- foo do
97
- puts 'hi'
98
- end
99
- eof
100
-
101
- expect(s.tokens.to_s(true)).to eq "foo do\n ...\n end"
102
- expect(s.block.to_s).to eq "puts 'hi'"
103
- end
104
-
105
- it "parses blocks with {}" do
106
- s = stmt "x { y }"
107
- expect(s.tokens.to_s(true)).to eq "x { ... }"
108
- expect(s.block.to_s).to eq "y"
109
-
110
- s = stmt "x() { y }"
111
- expect(s.tokens.to_s(true)).to eq "x() { ... }"
112
- expect(s.block.to_s).to eq "y"
113
- end
114
-
115
- it "parses blocks with begin/end" do
116
- s = stmt "begin xyz end"
117
- expect(s.tokens.to_s(true)).to eq "begin ... end"
118
- expect(s.block.to_s).to eq "xyz"
119
- end
120
-
121
- it "parses nested blocks" do
122
- s = stmt "foo(:x) { baz(:y) { skippy } }"
123
-
124
- expect(s.tokens.to_s(true)).to eq "foo(:x) { ... }"
125
- expect(s.block.to_s).to eq "baz(:y) { skippy }"
126
- end
127
-
128
- it "does not parse hashes as blocks" do
129
- s = stmt "x({})"
130
- expect(s.tokens.to_s(true)).to eq "x({})"
131
- expect(s.block.to_s).to eq ""
132
-
133
- s = stmt "x = {}"
134
- expect(s.tokens.to_s(true)).to eq "x = {}"
135
- expect(s.block.to_s).to eq ""
136
-
137
- s = stmt "x(y, {})"
138
- expect(s.tokens.to_s(true)).to eq "x(y, {})"
139
- expect(s.block.to_s).to eq ""
140
- end
141
-
142
- it "parses hashes in blocks with {}" do
143
- s = stmt "x {x = {}}"
144
-
145
- expect(s.tokens.to_s(true)).to eq "x {...}"
146
- expect(s.block.to_s).to eq "x = {}"
147
- end
148
-
149
- it "parses blocks with {} in hashes" do
150
- s = stmt "[:foo, x {}]"
151
-
152
- expect(s.tokens.to_s(true)).to eq "[:foo, x {}]"
153
- expect(s.block.to_s).to eq ""
154
- end
155
-
156
- it "handles multiple methods" do
157
- s = stmt <<-eof
158
- def %; end
159
- def b; end
160
- eof
161
- expect(s.to_s).to eq "def %; end"
162
- end
163
-
164
- it "handles nested methods" do
165
- s = stmt <<-eof
166
- def *(o) def +@; end
167
- def ~@
168
- end end
169
- eof
170
- expect(s.tokens.to_s(true)).to eq "def *(o) ... end"
171
- expect(s.block.to_s).to eq "def +@; end\n def ~@\n end"
172
-
173
- s = stmts(<<-eof)
174
- def /(other) 'hi' end
175
- def method1
176
- def dynamic; end
177
- end
178
- eof
179
- expect(s[1].to_s).to eq "def method1\n def dynamic; end\n end"
180
- end
181
-
182
- it "gets comment line numbers" do
183
- s = stmt <<-eof
184
- # comment
185
- # comment
186
- # comment
187
- def method; end
188
- eof
189
- expect(s.comments).to eq ["comment", "comment", "comment"]
190
- expect(s.comments_range).to eq(1..3)
191
-
192
- s = stmt <<-eof
193
-
194
- # comment
195
- # comment
196
- def method; end
197
- eof
198
- expect(s.comments).to eq ["comment", "comment"]
199
- expect(s.comments_range).to eq(2..3)
200
-
201
- s = stmt <<-eof
202
- # comment
203
- # comment
204
-
205
- def method; end
206
- eof
207
- expect(s.comments).to eq ["comment", "comment"]
208
- expect(s.comments_range).to eq(1..2)
209
-
210
- s = stmt <<-eof
211
- # comment
212
- def method; end
213
- eof
214
- expect(s.comments).to eq ["comment"]
215
- expect(s.comments_range).to eq(1..1)
216
-
217
- s = stmt <<-eof
218
- def method; end # comment
219
- eof
220
- expect(s.comments).to eq ["comment"]
221
- expect(s.comments_range).to eq(1..1)
222
- end
223
-
224
- it "only looks up to two lines back for comments" do
225
- s = stmt <<-eof
226
- # comments
227
-
228
- # comments
229
-
230
- def method; end
231
- eof
232
- expect(s.comments).to eq ["comments"]
233
-
234
- s = stmt <<-eof
235
- # comments
236
-
237
-
238
- def method; end
239
- eof
240
- expect(s.comments).to eq nil
241
-
242
- ss = stmts <<-eof
243
- # comments
244
-
245
-
246
- def method; end
247
-
248
- # hello
249
- def method2; end
250
- eof
251
- expect(ss[0].comments).to eq nil
252
- expect(ss[1].comments).to eq ['hello']
253
- end
254
-
255
- it "handles CRLF (Windows) newlines" do
256
- s = stmts("require 'foo'\r\n\r\n# Test Test\r\n# \r\n# Example:\r\n# example code\r\ndef test\r\nend\r\n")
257
- expect(s[1].comments).to eq ['Test Test', '', 'Example:', ' example code']
258
- end
259
-
260
- it "handles elsif blocks" do
261
- s = stmts(stmt("if 0\n foo\nelsif 2\n bar\nend\nbaz").block)
262
- expect(s.size).to eq 2
263
- expect(s[1].tokens.to_s).to eq "elsif 2"
264
- expect(s[1].block.to_s).to eq "bar"
265
- end
266
-
267
- it "handles else blocks" do
268
- s = stmts(stmt("if 0\n foo\nelse\n bar\nend\nbaz").block)
269
- expect(s.size).to eq 2
270
- expect(s[1].tokens.to_s).to eq "else"
271
- expect(s[1].block.to_s).to eq "bar"
272
- end
273
-
274
- it "allows aliasing keywords" do
275
- ['do x', 'x do', 'end begin', 'begin end'].each do |a|
276
- s = stmt("alias #{a}\ndef foo; end")
277
- expect(s.tokens.to_s).to eq "alias #{a}"
278
- expect(s.block).to be nil
279
- end
280
-
281
- s = stmt("alias do x if 2 ==\n 2")
282
- expect(s.tokens.to_s).to eq "alias do x if 2 ==\n 2"
283
- end
284
-
285
- it "does not open a block on an aliased keyword block opener" do
286
- s = stmts(<<-eof)
287
- class A; alias x do end
288
- class B; end
289
- eof
290
- expect(s[0].block.to_s).to eq 'alias x do'
291
- expect(s.size).to be > 1
292
- end
293
-
294
- it "converts heredoc to string" do
295
- src = "<<-XML\n foo\n\nXML"
296
- s = stmt(src)
297
- expect(s.source).to eq '"foo\n\n"'
298
- end
299
- end
@@ -1,79 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- RSpec.describe YARD::Parser::Ruby::Legacy::TokenList do
4
- Legacy = YARD::Parser::Ruby::Legacy
5
- TokenList = Legacy::TokenList
6
- LT = Legacy::RubyToken
7
-
8
- describe "#initialize / #push" do
9
- it "accepts a tokenlist (via constructor or push)" do
10
- expect { TokenList.new(TokenList.new) }.not_to raise_error
11
- expect(TokenList.new.push(TokenList.new("x = 2")).size).to eq 6
12
- end
13
-
14
- it "accept a token (via constructor or push)" do
15
- expect { TokenList.new(LT::Token.new(0, 0)) }.not_to raise_error
16
- expect(TokenList.new.push(LT::Token.new(0, 0),
17
- LT::Token.new(1, 1)).size).to eq 2
18
- end
19
-
20
- it "accepts a string and parse it as code (via constructor or push)" do
21
- expect { TokenList.new("x = 2") }.not_to raise_error
22
- x = TokenList.new
23
- x.push("x", "=", "2")
24
- expect(x.size).to eq 6
25
- expect(x.to_s).to eq "x\n=\n2\n"
26
- end
27
-
28
- it "does not accept any other input" do
29
- expect { TokenList.new(:notcode) }.to raise_error(ArgumentError)
30
- end
31
-
32
- it "does not interpolate string data" do
33
- x = TokenList.new('x = "hello #{world}"')
34
- expect(x.size).to eq 6
35
- expect(x[4].class).to eq LT::TkDSTRING
36
- expect(x.to_s).to eq 'x = "hello #{world}"' + "\n"
37
- end
38
-
39
- it "handles label syntax" do
40
- x = TokenList.new('a:1,b:2')
41
- expect(x[0].class).to eq LT::TkLABEL
42
- expect(x[0].text).to eq 'a:'
43
- expect(x[3].class).to eq LT::TkLABEL
44
- expect(x[3].text).to eq 'b:'
45
- end
46
- end
47
-
48
- describe "#to_s" do
49
- before do
50
- @t = TokenList.new
51
- @t << LT::TkDEF.new(1, 1, "def")
52
- @t << LT::TkSPACE.new(1, 1)
53
- @t << LT::TkIDENTIFIER.new(1, 1, "x")
54
- @t << LT::TkStatementEnd.new(1, 1)
55
- @t << LT::TkSEMICOLON.new(1, 1) << LT::TkSPACE.new(1, 1)
56
- @t << LT::TkBlockContents.new(1, 1)
57
- @t << LT::TkSPACE.new(1, 1) << LT::TkEND.new(1, 1, "end")
58
- @t[0].set_text "def"
59
- @t[1].set_text " "
60
- @t[2].set_text "x"
61
- @t[4].set_text ";"
62
- @t[5].set_text " "
63
- @t[7].set_text " "
64
- @t[8].set_text "end"
65
- end
66
-
67
- it "only shows the statement portion of the tokens by default" do
68
- expect(@t.to_s).to eq "def x"
69
- end
70
-
71
- it "shows ... for the block token if all of the tokens are shown" do
72
- expect(@t.to_s(true)).to eq "def x; ... end"
73
- end
74
-
75
- it "ignores ... if show_block = false" do
76
- expect(@t.to_s(true, false)).to eq "def x; end"
77
- end
78
- end
79
- end
@@ -1,520 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- RSpec.describe YARD::Parser::Ruby::RubyParser do
4
- def stmt(stmt)
5
- YARD::Parser::Ruby::RubyParser.new(stmt, nil).parse.root.first
6
- end
7
-
8
- def stmts(stmts)
9
- YARD::Parser::Ruby::RubyParser.new(stmts, nil).parse.root
10
- end
11
-
12
- def tokenize(stmt)
13
- YARD::Parser::Ruby::RubyParser.new(stmt, nil).parse.tokens
14
- end
15
-
16
- describe "#parse" do
17
- it "gets comment line numbers" do
18
- s = stmt <<-eof
19
- # comment
20
- # comment
21
- # comment
22
- def method; end
23
- eof
24
- expect(s.comments).to eq "comment\ncomment\ncomment"
25
- expect(s.comments_range).to eq(1..3)
26
-
27
- s = stmt <<-eof
28
-
29
- # comment
30
- # comment
31
- def method; end
32
- eof
33
- expect(s.comments).to eq "comment\ncomment"
34
- expect(s.comments_range).to eq(2..3)
35
-
36
- s = stmt <<-eof
37
- # comment
38
- # comment
39
-
40
- def method; end
41
- eof
42
- expect(s.comments).to eq "comment\ncomment"
43
- expect(s.comments_range).to eq(1..2)
44
-
45
- s = stmt <<-eof
46
- # comment
47
- def method; end
48
- eof
49
- expect(s.comments).to eq "comment"
50
- expect(s.comments_range).to eq(1..1)
51
-
52
- s = stmt <<-eof
53
- def method; end # comment
54
- eof
55
- expect(s.comments).to eq "comment"
56
- expect(s.comments_range).to eq(1..1)
57
- end
58
-
59
- it "only looks up to two lines back for comments" do
60
- s = stmts <<-eof
61
- # comments
62
-
63
- # comments
64
-
65
- def method; end
66
- eof
67
- expect(s[1].comments).to eq "comments"
68
-
69
- s = stmts <<-eof
70
- # comments
71
-
72
-
73
- def method; end
74
- eof
75
- expect(s[1].comments).to eq nil
76
-
77
- ss = stmts <<-eof
78
- # comments
79
-
80
-
81
- def method; end
82
-
83
- # hello
84
- def method2; end
85
- eof
86
- expect(ss[1].comments).to eq nil
87
- expect(ss[2].comments).to eq 'hello'
88
- end
89
-
90
- it "handles block comment followed by line comment" do
91
- ss = stmts <<-eof
92
- # comments1
93
-
94
- =begin
95
- comments2
96
- =end
97
- # comments3
98
- def hello; end
99
- eof
100
- expect(ss.last.comments).to eq "comments3"
101
- end
102
-
103
- it "handles block comment followed by block comment" do
104
- ss = stmts <<-eof
105
- =begin
106
- comments1
107
- =end
108
- =begin
109
- comments2
110
- =end
111
- def hello; end
112
- eof
113
- expect(ss.last.comments.strip).to eq "comments2"
114
- end
115
-
116
- it "handles 1.9 lambda syntax with args" do
117
- src = "->(a,b,c=1,*args,&block) { hello_world }"
118
- expect(stmt(src).source).to eq src
119
- end
120
-
121
- it "handles 1.9 lambda syntax" do
122
- src = "-> { hello_world }"
123
- expect(stmt(src).source).to eq src
124
- end
125
-
126
- it "handles standard lambda syntax" do
127
- src = "lambda { hello_world }"
128
- expect(stmt(src).source).to eq src
129
- end
130
-
131
- it "throws a ParserSyntaxError on invalid code" do
132
- expect { stmt("Foo, bar.") }.to raise_error(YARD::Parser::ParserSyntaxError)
133
- end
134
-
135
- it "handles bare hashes as method parameters" do
136
- src = "command :a => 1, :b => 2, :c => 3"
137
- expect(stmt(src).jump(:command)[1].source).to eq ":a => 1, :b => 2, :c => 3"
138
-
139
- src = "command a: 1, b: 2, c: 3"
140
- expect(stmt(src).jump(:command)[1].source).to eq "a: 1, b: 2, c: 3"
141
- end
142
-
143
- it "handles source for hash syntax" do
144
- src = "{ :a => 1, :b => 2, :c => 3 }"
145
- expect(stmt(src).jump(:hash).source).to eq "{ :a => 1, :b => 2, :c => 3 }"
146
- end
147
-
148
- it "handles an empty hash" do
149
- expect(stmt("{}").jump(:hash).source).to eq "{}"
150
- end
151
-
152
- it "new hash label syntax should show label without colon" do
153
- ast = stmt("{ a: 1 }").jump(:label)
154
- expect(ast[0]).to eq "a"
155
- expect(ast.source).to eq "a:"
156
- end
157
-
158
- it "handles begin/rescue blocks" do
159
- ast = stmt("begin; X; rescue => e; Y end").jump(:rescue)
160
- expect(ast.source).to eq "rescue => e; Y end"
161
-
162
- ast = stmt("begin; X; rescue A => e; Y end").jump(:rescue)
163
- expect(ast.source).to eq "rescue A => e; Y end"
164
-
165
- ast = stmt("begin; X; rescue A, B => e; Y end").jump(:rescue)
166
- expect(ast.source).to eq "rescue A, B => e; Y end"
167
- end
168
-
169
- it "handles method rescue blocks" do
170
- ast = stmt("def x; A; rescue Y; B end")
171
- expect(ast.source).to eq "def x; A; rescue Y; B end"
172
- expect(ast.jump(:rescue).source).to eq "rescue Y; B end"
173
- end
174
-
175
- it "handles defs with keywords as method name" do
176
- ast = stmt("# docstring\nclass A;\ndef class; end\nend")
177
- expect(ast.jump(:class).docstring).to eq "docstring"
178
- expect(ast.jump(:class).line_range).to eq(2..4)
179
- end
180
-
181
- it "handles defs with unnamed argument with default values" do
182
- ast = stmt('def hello(one, two = 2, three = 3) end').jump(:params)
183
- expect(ast.source).to eq 'one, two = 2, three = 3'
184
- end
185
-
186
- it "handles defs with splats" do
187
- ast = stmt('def hello(one, *two) end').jump(:params)
188
- expect(ast.source).to eq 'one, *two'
189
- end
190
-
191
- if YARD.ruby2?
192
- it "handles defs with named arguments with default values" do
193
- ast = stmt('def hello(one, two: 2, three: 3) end').jump(:params)
194
- expect(ast.source).to eq 'one, two: 2, three: 3'
195
- end
196
- end
197
-
198
- if NAMED_OPTIONAL_ARGUMENTS
199
- it "handles defs with named arguments without default values" do
200
- ast = stmt('def hello(one, two:, three:) end').jump(:params)
201
- expect(ast.source).to eq 'one, two:, three:'
202
- end
203
-
204
- it "handles defs with double splats" do
205
- ast = stmt('def hello(one, **two) end').jump(:params)
206
- expect(ast.source).to eq 'one, **two'
207
- end
208
- end
209
-
210
- it "ends source properly on array reference" do
211
- ast = stmt("AS[0, 1 ] ")
212
- expect(ast.source).to eq 'AS[0, 1 ]'
213
-
214
- ast = stmt('def x(a = S[1]) end').jump(:params)
215
- expect(ast.source).to eq 'a = S[1]'
216
- end
217
-
218
- it "ends source properly on if/unless mod" do
219
- %w(if unless while).each do |mod|
220
- expect(stmt("A=1 #{mod} true").source).to eq "A=1 #{mod} true"
221
- end
222
- end
223
-
224
- it "shows proper source for assignment" do
225
- expect(stmt("A=1").jump(:assign).source).to eq "A=1"
226
- end
227
-
228
- it "shows proper source for a top_const_ref" do
229
- s = stmt("::\nFoo::Bar")
230
- expect(s.jump(:top_const_ref).source).to eq "::\nFoo"
231
- expect(s).to be_ref
232
- expect(s.jump(:top_const_ref)).to be_ref
233
- expect(s.source).to eq "::\nFoo::Bar"
234
- expect(s.line_range.to_a).to eq [1, 2]
235
- end
236
-
237
- it "shows proper source for inline heredoc" do
238
- src = "def foo\n foo(<<-XML, 1, 2)\n bar\n\n XML\nend"
239
- s = stmt(src)
240
- t = tokenize(src)
241
- expect(s.source).to eq src
242
- expect(t.map {|x| x[1] }.join).to eq src
243
- end
244
-
245
- it "shows proper source for regular heredoc" do
246
- src = "def foo\n x = <<-XML\n Hello \#{name}!\n Bye!\n XML\nend"
247
- s = stmt(src)
248
- t = tokenize(src)
249
- expect(s.source).to eq src
250
- expect(t.map {|x| x[1] }.join).to eq src
251
- end
252
-
253
- it "shows proper source for heredoc with comment" do
254
- src = "def foo\n x = <<-XML # HI!\n Hello \#{name}!\n Bye!\n XML\nend"
255
- s = stmt(src)
256
- t = tokenize(src)
257
- expect(s.source).to eq src
258
- expect(t.map {|x| x[1] }.join).to eq src
259
- end
260
-
261
- it "shows proper source for string" do
262
- ["'", '"'].each do |q|
263
- src = "#{q}hello\n\nworld#{q}"
264
- s = stmt(src)
265
- expect(s.jump(:string_content).source).to eq "hello\n\nworld"
266
- expect(s.source).to eq src
267
- end
268
-
269
- src = '("this is a string")'
270
- expect(stmt(src).jump(:string_literal).source).to eq '"this is a string"'
271
- end
272
-
273
- %w(w W i I).each do |tok|
274
- it "shows proper source for %#{tok}() array" do
275
- src = "%#{tok}(\na b c\n d e f\n)"
276
- expect(stmt(src).source).to eq src
277
- end
278
-
279
- it "shows proper source for %#{tok}{} array" do
280
- src = "%#{tok}{\na b c\n d e f\n}"
281
- expect(stmt(src).source).to eq src
282
- end
283
- end
284
-
285
- {'i' => :qsymbols_literal, 'I' => :symbols_literal,
286
- 'w' => :qwords_literal, 'W' => :words_literal}.each do |id, sym|
287
- it "parses %#{id}(...) literals" do
288
- [
289
- "TEST = %#{id}(A B C)",
290
- "TEST = %#{id}( A B C )",
291
- "TEST = %#{id}( \nA \nB \nC \n)",
292
- "TEST = %#{id}(\n\nAD\n\nB\n\nC\n\n)",
293
- "TEST = %#{id}(\n A\n B\n C\n )"
294
- ].each do |str|
295
- node = stmt(str).jump(sym)
296
- expect(node.source).to eq(str[/(\%#{id}\(.+\))/m, 1])
297
- end
298
- end
299
-
300
- it "tokenizing %#{id}(...) returns correct tokens" do
301
- toks = tokenize("TEST = %#{id}(A B C)").flatten
302
- expect(toks.count(:tstring_content)).to eq(3)
303
- end
304
- end
305
-
306
- it "properly tokenizes symbols" do
307
- tokens = tokenize(<<-eof)
308
- class X
309
- Foo = :''
310
- Fuu = :bar
311
- Bar = :BAR
312
- Baz = :"B+z"
313
- Qux = :if
314
- end
315
- eof
316
- symbols = tokens.select {|t| t[0] == :symbol }.map {|t| t[1] }
317
- expect(symbols).to eq %w(:'' :bar :BAR :"B+z" :if)
318
- end
319
-
320
- it "parses %w() array in constant declaration" do
321
- s = stmt(<<-eof)
322
- class Foo
323
- FOO = %w( foo bar )
324
- end
325
- eof
326
- expect(s.jump(:qwords_literal).source).to eq '%w( foo bar )'
327
- if RUBY_VERSION >= '1.9.3' # ripper fix: array node encapsulates qwords
328
- expect(s.jump(:array).source).to eq '%w( foo bar )'
329
- end
330
- end
331
-
332
- it "parses %w() array source in object[] parsed context" do
333
- s = stmts(<<-eof)
334
- {}[:key]
335
- FOO = %w( foo bar )
336
- eof
337
- expect(s[1].jump(:array).source).to eq '%w( foo bar )'
338
- end
339
-
340
- it "parses %w() array source in object[]= parsed context" do
341
- s = stmts(<<-eof)
342
- {}[:key] = :value
343
- FOO = %w( foo bar )
344
- eof
345
- expect(s[1].jump(:array).source).to eq '%w( foo bar )'
346
- end
347
-
348
- it "parses [] as array" do
349
- s = stmt(<<-eof)
350
- class Foo
351
- FOO = ['foo', 'bar']
352
- end
353
- eof
354
- expect(s.jump(:array).source).to eq "['foo', 'bar']"
355
- end
356
-
357
- it "shows source for unary minus" do
358
- expect(stmt("X = - 1").jump(:unary).source).to eq '- 1'
359
- end
360
-
361
- it "shows source for unary exclamation" do
362
- expect(stmt("X = !1").jump(:unary).source).to eq '!1'
363
- end
364
-
365
- it "has the correct line range for class/modules" do
366
- s = stmt(<<-eof)
367
- class Foo
368
- def foo; end
369
-
370
-
371
-
372
- # Ending comment
373
- end
374
- eof
375
- expect(s.jump(:class).line_range).to eq(1..7)
376
- end
377
-
378
- it "has the correct line range for blocks" do
379
- Registry.clear
380
- ast = YARD.parse_string(<<-eof).enumerator
381
- module A
382
- some_method
383
- end
384
- eof
385
- expect(ast.first.block.source.strip).to eq "some_method"
386
- end
387
-
388
- it "finds lone comments" do
389
- Registry.clear
390
- ast = YARD.parse_string(<<-eof).enumerator
391
- class Foo
392
- ##
393
- # comment here
394
-
395
-
396
- def foo; end
397
-
398
- # end comment
399
- end
400
- eof
401
- comment = ast.first.last.jump(:comment)
402
- expect(comment.type).to eq :comment
403
- expect(comment.docstring_hash_flag).to be true
404
- expect(comment.docstring.strip).to eq "comment here"
405
-
406
- expect(ast.first.last.last.type).to eq :comment
407
- expect(ast.first.last.last.docstring).to eq "end comment"
408
- end
409
-
410
- it "does not group comments if they don't begin the line" do
411
- Registry.clear
412
- YARD.parse_string(<<-eof).enumerator
413
- class Foo
414
- CONST1 = 1 # Comment here
415
- CONST2 = 2 # Another comment here
416
- end
417
- eof
418
- expect(Registry.at("Foo::CONST1").docstring).to eq "Comment here"
419
- expect(Registry.at("Foo::CONST2").docstring).to eq "Another comment here"
420
- end
421
-
422
- it "handles comments in the middle of a multi-line statement" do
423
- Registry.clear
424
- YARD.parse_string <<-eof
425
- foo # BREAK
426
- .bar
427
-
428
- # Documentation
429
- class Baz; end
430
- eof
431
- expect(Registry.at('Baz')).not_to be_nil
432
- expect(Registry.at('Baz').docstring).to eq 'Documentation'
433
- end
434
-
435
- %w(if unless).each do |type|
436
- it "does not get confused by modifier '#{type}' statements" do
437
- Registry.clear
438
- YARD.parse_string(<<-eof).enumerator
439
- module Foo
440
- #{type} test?
441
- # Docstring
442
- class Bar
443
- # Docstring2
444
- def foo
445
- x #{type} true
446
- end
447
- end
448
- end
449
- end
450
- eof
451
-
452
- expect(Registry.at("Foo::Bar").docstring).to eq "Docstring"
453
- expect(Registry.at("Foo::Bar#foo").docstring).to eq "Docstring2"
454
- end
455
-
456
- it "supports #{type} statements at start of source" do
457
- Registry.clear
458
- YARD.parse_string <<-eof
459
- #{type} condition?
460
- class Foo; def bar; #{type} true; end end end
461
- end
462
- eof
463
-
464
- expect(log.io.string).to eq ""
465
- expect(Registry.at('Foo#bar')).not_to eq nil
466
- end
467
-
468
- it "can handle complex non-modifier '#{type}' statements" do
469
- Registry.clear
470
- YARD.parse_string <<-eof
471
- class Foo
472
- def initialize(data, options = Hash.new)
473
- #{type} true; raise "error" end
474
- @x = ( #{type} 1; true end ) # This line should not blow up
475
- end
476
- end
477
- eof
478
-
479
- expect(log.io.string).to eq ""
480
- expect(Registry.at('Foo#initialize')).not_to eq nil
481
- end
482
-
483
- it "does not add comment blocks to #{type}_mod nodes" do
484
- Registry.clear
485
- YARD.parse_string(<<-eof).enumerator
486
- class Foo
487
- # Docstring
488
- def bar; end if true
489
- end
490
- eof
491
-
492
- expect(Registry.at("Foo#bar").docstring).to eq "Docstring"
493
- end
494
- end
495
-
496
- it "removes frozen string line from initial file comments" do
497
- YARD.parse_string "# frozen_string_literal: true\n# this is a comment\nclass Foo; end"
498
- YARD.parse_string "# Frozen-string-literal: true\n# this is a comment\nclass Bar; end"
499
-
500
- expect(Registry.at(:Foo).docstring).to eq "this is a comment"
501
- expect(Registry.at(:Bar).docstring).to eq "this is a comment"
502
- end
503
-
504
- it "handles compile errors" do
505
- expect { stmt(":~$ Do not clobber") }.to raise_error(Parser::ParserSyntaxError)
506
- end
507
-
508
- it "handles cls/mod comments without line spacing" do
509
- ast = stmt <<-eof
510
- module A
511
- # comment 1
512
- # comment 2
513
- class B
514
- end
515
- end
516
- eof
517
- expect(ast.jump(:class).docstring).to eq "comment 1\ncomment 2"
518
- end
519
- end
520
- end if HAVE_RIPPER