redparse 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,3 @@
1
+ module TYDFG
2
+ p a ;
3
+ end
@@ -0,0 +1,7 @@
1
+ p(%
2
+ abc\
3
+ xyz
4
+
5
+ )
6
+
7
+
@@ -0,0 +1,2 @@
1
+ %W[\
2
+ ]
@@ -0,0 +1,2 @@
1
+ %W[\ ]
2
+
@@ -0,0 +1,344 @@
1
+ =begin
2
+ redparse - a ruby parser written in ruby
3
+ Copyright (C) 2008 Caleb Clausen
4
+
5
+ This library is free software; you can redistribute it and/or
6
+ modify it under the terms of the GNU Lesser General Public
7
+ License as published by the Free Software Foundation; either
8
+ version 2.1 of the License, or (at your option) any later version.
9
+
10
+ This library is distributed in the hope that it will be useful,
11
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
+ Lesser General Public License for more details.
14
+
15
+ You should have received a copy of the GNU Lesser General Public
16
+ License along with this library; if not, write to the Free Software
17
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
+ =end
19
+
20
+ #require 'test/code/rubylexervsruby'
21
+ #require 'test/code/strgen'
22
+ require "redparse/problemfiles"
23
+
24
+ class RedParse
25
+ module LocateTest
26
+ begin
27
+ require 'rubygems'
28
+ require 'rubylexer'
29
+ require 'test/code/locatetest'
30
+ RL=RubyLexer::LocateTest
31
+ rescue Exception:
32
+ RL=Module.new
33
+ def RL.const_missing(k) [] end
34
+ end
35
+
36
+ #ENV['RUBY']||='ruby'
37
+ $RUBY=ENV['RUBY']||'ruby'
38
+ #test $RUBY || export RUBY=ruby
39
+
40
+ #$RUBYLEXERVSRUBY="#$RUBY test/code/rubylexervsruby.rb"
41
+
42
+ RUBY_VERSION[/^1\.8\.7/] or raise 'need ruby>= 1.8.7'
43
+
44
+
45
+
46
+ #if RUBY_VERSION --version|grep '^ruby 1\.6'; then
47
+ # echo 'error: need ruby 1.8'; exit
48
+ #fi
49
+
50
+
51
+ RLROOT= (File.dirname $0)+'/../rubylexer'
52
+ #cd `dirname -- $0`
53
+
54
+ =begin if locate fails, we should use the algorithm from this sh code
55
+
56
+ #also look in bin and lib directories
57
+ file -L `echo $PATH":/sbin:/usr/sbin"|tr : "\n"|sort -u|xargs -i echo "{}/*"`| \
58
+ grep "ruby[^:]*script"|cut -d: -f1 > test/results/rubyexelibs
59
+
60
+ ruby -e 'print ($:.sort.uniq+[""]).join"\n"'|xargs -i ls "{}/*.rb" >> test/results/rubyexelibs
61
+
62
+ for i in `cat test/results/rubyexelibs`; do
63
+ $RUBYLEXERVSRUBY $i;
64
+ done
65
+
66
+ =end
67
+
68
+ puts "hack hack hack: absolute path in ruby test file list"
69
+ puts "hack hack hack: skipping japanese/zipcodes.rb; too big!"
70
+ TEST_THESE_FIRST= DATA.read.split.map{|n| n[1..-1]}
71
+
72
+ [
73
+ "/home/caleb/rubies/ruby-1.8.7/instruby.rb",
74
+ "/home/caleb/sandbox/rubylexer/test/data/oneliners.rb",
75
+ "/home/caleb/sandbox/rubylexer/test/data/heremonsters_dos.rb",
76
+ "/home/caleb/sandbox/rubylexer/test/data/whatnot.rb",
77
+ "/home/caleb/sandbox/rubylexer/test/data/pre.rb",
78
+ "/home/caleb/sandbox/rubylexer/test/data/stanzas.rb",
79
+ "/home/caleb/sandbox/rubylexer/test/data/ws_strdelim.rb",
80
+ "/home/caleb/sandbox/rubylexer/test/data/unending_stuff.rb",
81
+ "/home/caleb/sandbox/rubylexer/test/data/stuff2.rb",
82
+ "/home/caleb/sandbox/rubylexer/test/data/strdelim_crlf.rb",
83
+ "/home/caleb/sandbox/rubylexer/jewels/installpkg-0.0.1/lib/.install-pkg.rb.swp",
84
+ "/var/lib/gems/1.8/gems/rubylexer-0.6.2/testdata/p.rb",
85
+
86
+ "/home/caleb/sandbox/rubylexer/jewels/samizdat-0.6.1/samizdat/lib/samizdat/storage.rb",
87
+ # "/home/caleb/sandbox/rubylexer/jewels/math3d-0.04/tests/make_tests.rb",
88
+ "/home/caleb/sandbox/rubylexer/jewels/QuickBaseClient.rb/quickbasecontactsappbuilder.rb",
89
+ # "/home/caleb/sandbox/rubylexer/jewels/QuickBaseClient.rb/quickbaseclient.rb",
90
+ "/home/caleb/sandbox/rubylexer/jewels/ruby-ivy_0.1.0/ruby-ivy/examples/._000-IVYTranslater.rb",
91
+ "/home/caleb/sandbox/rubylexer/jewels/ruby-ivy_0.1.0/ruby-ivy/examples/._002-ApplicationList.rb",
92
+ "/home/caleb/sandbox/rubylexer/jewels/ruby-ivy_0.1.0/ruby-ivy/examples/._001-UnBind.rb",
93
+ "/home/caleb/sandbox/rubylexer/jewels/ruby-ivy_0.1.0/ruby-ivy/._extconf.rb",
94
+ # "/home/caleb/sandbox/rubylexer/jewels/smf-0.15.10/sample/virtual-samp.rb",
95
+ # "/home/caleb/sandbox/rubylexer/jewels/syntax/syntax.rb",
96
+ # "/home/caleb/sandbox/rubylexer/jewels/rex-1.0rc1/rex/packages/rex/test/rex-20060511.rb",
97
+ # "/home/caleb/sandbox/rubylexer/jewels/rex-1.0rc1/rex/packages/rex/test/rex-20060125.rb",
98
+ # "/home/caleb/sandbox/rubylexer/jewels/japanese-zipcodes-0.0.20080227/lib/japanese/zipcodes.rb", #too big!!!!
99
+
100
+ # "/home/caleb/sandbox/rubylexer/jewels/ruby-asp_0.4.1/ruby-asp/lib/asp/params.rb",
101
+ # "/home/caleb/sandbox/rubylexer/jewels/ruby-asp_0.4.1/ruby-asp/bin/ruby-asp.rb",
102
+ "/home/caleb/sandbox/rubylexer/jewels/ruby-asp_0.4.1/ruby-asp/setup.rb",
103
+ # "/home/caleb/sandbox/rubylexer/jewels/ruby-asp_0.4.1/ruby-asp/lib/asp/goto.rb",
104
+ # "/home/caleb/sandbox/rubylexer/jewels/ruby-asp_0.4.1/ruby-asp/lib/asp/globalasa.rb",
105
+ "/home/caleb/sandbox/rubylexer/jewels/ruby-asp_0.4.1/ruby-asp/lib/apache/aspruby-run.rb",
106
+ "/home/caleb/sandbox/rubylexer/jewels/osc-0.1.3/install.rb",
107
+ "/home/caleb/sandbox/rubylexer/jewels/osc-0.1.3/install.rb",
108
+ # "/home/caleb/sandbox/rubylexer/jewels/gallery-0.0.8/interface/admin.rb",
109
+ # "/home/caleb/sandbox/rubylexer/jewels/gallery-0.0.8/lib/gallery/base-administrator.rb",
110
+ # "/home/caleb/sandbox/rubylexer/jewels/gallery-0.0.8/lib/rubyphoto/imlib.rb",
111
+ # "/home/caleb/sandbox/rubylexer/jewels/gallery-0.0.8/lib/rubyphoto/album.rb",
112
+ "/home/caleb/sandbox/rubylexer/jewels/strscan-0.6.7/install.rb",
113
+ "/home/caleb/sandbox/rubylexer/jewels/opml-0.0.20060519/setup.rb",
114
+ # "/home/caleb/sandbox/rubylexer/jewels/diakonos-0.8.4/lib/diakonos.rb",
115
+ # "/home/caleb/sandbox/rubylexer/jewels/diakonos-0.8.4/lib/diakonos/buffer.rb",
116
+ # "/home/caleb/sandbox/rubylexer/jewels/tengen-0.1.0/lib/tengen/ui/main_app.rb",
117
+ "/home/caleb/sandbox/rubylexer/jewels/rwiki-2.1.1/interface/rw-mail.rb",
118
+ "/home/caleb/sandbox/rubylexer/jewels/rwiki-2.1.1/installer/rwiki-installer.rb",
119
+ # "/home/caleb/sandbox/rubylexer/jewels/rwiki-2.1.1/lib/rwiki/db/cvs.rb",
120
+ # "/home/caleb/sandbox/rubylexer/jewels/rwiki-2.1.1/lib/rwiki/db/svn.rb",
121
+ "/home/caleb/sandbox/rubylexer/jewels/rwiki-2.1.1/lib/rwiki/hotpage.rb",
122
+ # "/home/caleb/sandbox/rubylexer/jewels/rwiki-2.1.1/site/ruby-lang/migrate.rb",
123
+ # "/home/caleb/sandbox/rubylexer/jewels/yajb-0.8.1/src/ruby/bstream.rb",
124
+ # "/home/caleb/sandbox/rubylexer/jewels/yajb-0.8.1/src/ruby/jlambda.rb",
125
+ # "/home/caleb/sandbox/rubylexer/jewels/yajb-0.8.1/src/ruby/comm_xmlrpc.rb",
126
+ "/home/caleb/sandbox/rubylexer/jewels/yajb-0.8.1/lib/yajb/jbridge.rb",
127
+ ]
128
+ pf=ProblemFiles.new
129
+ RUBYLIST=(pf.badlist+
130
+ TEST_THESE_FIRST+RL::TEST_THESE_FIRST+
131
+ RL::RUBYBINS+
132
+ [ RLROOT+"/test/data/p.rb",
133
+ *Dir["test/data/*.rb"]+
134
+ `(
135
+ locate /inline.rb /tk.rb;
136
+ locate examples/examples_test.rb;
137
+ locate .rb;
138
+ locate rakefile; locate Rakefile; locate RAKEFILE;
139
+ )|egrep -v '(/test/(results|data)/|.broken$)'`.
140
+ split("\n")
141
+ ].sort_by{rand})-pf.goodlist + pf.goodlist
142
+ RUBYLIST.reject!{|x| %r{japanese/zipcodes\.rb$}===x } #65M of ruby src!!!
143
+ RUBYLIST.uniq!
144
+
145
+ def self.main
146
+ testdata=RUBYLIST.dup
147
+ until testdata.empty?
148
+ chunk=testdata.slice!(0...20)
149
+
150
+ chunk=chunk.select{|fn| system "#$RUBY -c #{fn} >/dev/null 2>&1" }
151
+
152
+ # puts "testing: "+chunk.join(" ")
153
+ chunk.empty? and next
154
+ system $RUBY, "-Ilib", "bin/redparse", "--update-problemfiles", "-q", "--vsparsetree", *chunk
155
+ exit 2 if $?>>8 == 2 #exit if child got ^c
156
+ end
157
+ end
158
+
159
+ #for i in test/data/p.rb `(locate /tk.rb;locate examples/examples_test.rb;#locate .rb; locate rakefile; locate Rakefile; locate RAKEFILE)|egrep -v '/#test/results/'`; do
160
+ # $RUBYLEXERVSRUBY $i
161
+ #done
162
+ end
163
+ end
164
+
165
+ RedParse::LocateTest.main if $0==__FILE__
166
+ __END__
167
+ /home/caleb/sandbox/rubylexer/test/data/heremonsters_dos.rb
168
+ /home/caleb/sandbox/rubylexer/jewels/QuickBaseClient.rb/quickbasecontactsappbuilder.rb
169
+ /home/caleb/rubies/186/lib/ruby/1.8/ftools.rb
170
+ /home/caleb/rubies/186/lib/ruby/1.8/rdoc/generators/template/html/html.rb
171
+ /home/caleb/rubies/186/lib/ruby/1.8/yaml/types.rb
172
+ /home/caleb/rubies/186/lib/ruby/gems/1.8/gems/ParseTree-2.1.1/lib/parse_tree.rb
173
+ /home/caleb/rubies/186/lib/ruby/gems/1.8/gems/cursor-0.9/duck.rb
174
+ /home/caleb/rubies/186/lib/ruby/site_ruby/1.8/rubygems/source_index.rb
175
+ /home/caleb/rubies/187/lib/ruby/1.8/ftools.rb
176
+ /home/caleb/rubies/187/lib/ruby/1.8/rdoc/generators/template/html/html.rb
177
+ /home/caleb/rubies/187/lib/ruby/1.8/yaml/types.rb
178
+ /home/caleb/rubies/187/lib/ruby/gems/1.8/gems/ParseTree-2.2.0/lib/parse_tree.rb
179
+ /home/caleb/rubies/187/lib/ruby/gems/1.8/gems/cursor-0.9/duck.rb
180
+ /home/caleb/rubies/187/lib/ruby/site_ruby/1.8/rubygems/source_index.rb
181
+ /home/caleb/rubies/190/lib/ruby/1.9.0/rdoc/generators/template/html/html.rb
182
+ /home/caleb/rubies/190/lib/ruby/1.9.0/rubygems/source_index.rb
183
+ /home/caleb/rubies/190/lib/ruby/1.9.0/yaml/types.rb
184
+ /home/caleb/rubies/190/lib/ruby/gems/1.9.0/gems/ParseTree-2.1.1/lib/parse_tree.rb
185
+ /home/caleb/rubies/190/lib/ruby/site_ruby/1.9.0/rubygems/source_index.rb
186
+ /home/caleb/rubies/ruby-1.8.6/lib/ftools.rb
187
+ /home/caleb/rubies/ruby-1.8.6/lib/rdoc/generators/template/html/html.rb
188
+ /home/caleb/rubies/ruby-1.8.6/lib/yaml/types.rb
189
+ /home/caleb/rubies/ruby-1.8.6/test/fileutils/test_fileutils.rb
190
+ /home/caleb/rubies/ruby-1.8.7/lib/ftools.rb
191
+ /home/caleb/rubies/ruby-1.8.7/lib/rdoc/generators/template/html/html.rb
192
+ /home/caleb/rubies/ruby-1.8.7/lib/yaml/types.rb
193
+ /home/caleb/rubies/ruby-1.8.7/sample/test.rb
194
+ /home/caleb/rubies/ruby-1.8.7/test/fileutils/test_fileutils.rb
195
+ /home/caleb/rubies/ruby-1.8.7/test/ruby/test_proc.rb
196
+ /home/caleb/rubies/ruby-1.8.7-preview2/lib/ftools.rb
197
+ /home/caleb/rubies/ruby-1.8.7-preview2/lib/rdoc/generators/template/html/html.rb
198
+ /home/caleb/rubies/ruby-1.8.7-preview2/lib/yaml/types.rb
199
+ /home/caleb/rubies/ruby-1.8.7-preview2/test/fileutils/test_fileutils.rb
200
+ /home/caleb/rubies/ruby-1.9.0-0/lib/rdoc/generators/template/html/html.rb
201
+ /home/caleb/rubies/ruby-1.9.0-0/lib/rubygems/source_index.rb
202
+ /home/caleb/rubies/ruby-1.9.0-0/lib/yaml/types.rb
203
+ /home/caleb/sandbox/rubylexer/jewels/alib-0.5.1/lib/alib-0.5.1/util.rb
204
+ /home/caleb/sandbox/rubylexer/jewels/stick-1.3.3/test/test_matrix.rb
205
+ /home/caleb/sandbox/rubylexer/jewels/rwdtinker-1.67/ev/rwd.rb
206
+ /home/caleb/sandbox/rubylexer/jewels/rubyslippers-1.03/extras/rconftool.rb
207
+ /home/caleb/rubies/ruby-1.9.0-0/test/fileutils/test_fileutils.rb
208
+ /home/caleb/rubies/ruby-1.9.0-0/test/rubygems/test_gem_commands_cert_command.rb
209
+ /home/caleb/sandbox/rubylexer/jewels/rubysync-0.2.1/lib/ruby_sync/connectors/base_connector.rb
210
+ /home/caleb/sandbox/rubylexer/jewels/rubyslippers-1.03/ev/rwd.rb
211
+ /home/caleb/sandbox/rubylexer/jewels/karmasphere-client-0.6.4/lib/karmasphere/query.rb
212
+ /home/caleb/sandbox/rubylexer/jewels/roby-0.7.2/test/test_transactions.rb
213
+ /home/caleb/sandbox/rubylexer/jewels/rwddemo-0.92/extras/rconftool.rb
214
+ /home/caleb/sandbox/rubylexer/jewels/ambition-0.5.2/app_generators/ambition_adapter/ambition_adapter_generator.rb
215
+ /usr/lib/ruby/1.8/tk/canvastag.rb
216
+ /home/caleb/rubies/rubygems-1.1.1/test/test_gem_commands_cert_command.rb
217
+ /home/caleb/sandbox/rubylexer/jewels/udat-1.4.1/lib/udat.rb
218
+ /home/caleb/sandbox/rubylexer/jewels/rmail-1.0.0/test/testmessage.rb
219
+ /home/caleb/sandbox/rubylexer/jewels/camping-1.5/examples/campsh.rb
220
+ /home/caleb/sandbox/rubylexer/jewels/clickatell-0.4.1/lib/clickatell.rb
221
+ /home/caleb/sandbox/rubylexer/jewels/rfeedparser-0.9.940/lib/rfeedparser.rb
222
+ /home/caleb/sandbox/rubylexer/jewels/passenger-2.0.1/lib/passenger/abstract_server.rb
223
+ /home/caleb/sandbox/rubylexer/jewels/rubywebdialogs/rubywebdialogs.rb
224
+ /usr/lib/ruby/1.8/qwik/util-css.rb
225
+ /home/caleb/sandbox/rubylexer/jewels/aspectr-0.3.7/lib/aspectr.rb
226
+ /home/caleb/sandbox/rubylexer/jewels/optiflag-0.6.5/examples/example_2_6.rb
227
+ /home/caleb/sandbox/rubylexer/jewels/rwdhypernote-0.10/ev/rwd.rb
228
+ /home/caleb/sandbox/rubylexer/jewels/rubywebdialogs-0.2.0/realstuff.rb
229
+ /home/caleb/sandbox/rubylexer/jewels/stick-1.3.3/lib/stick/matrix.rb
230
+ /usr/share/hiki/hiki/docdiff/charstring.rb
231
+ /home/caleb/sandbox/rubylexer/jewels/rb2html-2.4/rb2html/haskell_lexer.rb
232
+ /home/caleb/sandbox/rubylexer/jewels/mspire-0.3.9/lib/spec_id/srf.rb
233
+ /home/caleb/sandbox/rubylexer/jewels/rb-wartslib-0.9.14/lib/wartslib/wl-file.rb
234
+ /home/caleb/sandbox/rubylexer/jewels/sqliki_generator-0.0.4/templates/lib_sanitize_html.rb
235
+ /home/caleb/sandbox/rubylexer/jewels/rwdshell-1.00/extras/rconftool.rb
236
+ /home/caleb/sandbox/rubylexer/jewels/main-2.8.0/lib/main/base.rb
237
+ /home/caleb/sandbox/rubylexer/jewels/aws-s3-0.5.1/lib/aws/s3/base.rb
238
+ /usr/lib/ruby/1.8/ftools.rb
239
+ /home/caleb/sandbox/rubylexer/jewels/pseudoxml-0.1.0/RAKEFILE
240
+ /usr/lib/ruby/1.8/rdoc/generators/template/html/html.rb
241
+ /home/caleb/sandbox/rubylexer/jewels/typo-5.0.3.98.1/vendor/plugins/rspec/spec/spec/mocks/mock_spec.rb
242
+ /home/caleb/sandbox/rubylexer/jewels/rubytorrent-0.3/lib/rubytorrent/server.rb
243
+ /home/caleb/sandbox/rubylexer/jewels/optiflag-0.6.5/testcases/tc_values_as_hash.rb
244
+ /home/caleb/sandbox/rubylexer/jewels/optiflag-0.6.5/examples/example_3.rb
245
+ /home/caleb/sandbox/rubylexer/jewels/Nephila-0.6.0/config/environment.rb
246
+ /usr/share/rails/railties/builtin/rails_info/rails/info.rb
247
+ /home/caleb/sandbox/rubylexer/jewels/ruby-rpm-1.2.3/lib/rpm.rb
248
+ /home/caleb/sandbox/rubylexer/jewels/optiflag-0.6.5/testcases/tc_bug_one.rb
249
+ /home/caleb/sandbox/rubylexer/jewels/optiflag-0.6.5/testcases/tc_basic_char_flags.rb
250
+ /usr/lib/ruby/1.8/rant/c/include.rb
251
+ /home/caleb/sandbox/rubylexer/jewels/ya2yaml-0.26/lib/ya2yaml.rb
252
+ /home/caleb/sandbox/rubylexer/jewels/spree-0.2.0/vendor/rails/activesupport/lib/active_support/multibyte/handlers/utf8_handler.rb
253
+ /home/caleb/sandbox/rubylexer/jewels/rq-3.4.0/rails/vendor/rails/actionpack/test/controller/fragment_store_setting_test.rb
254
+ /home/caleb/sandbox/rubylexer/jewels/typo-5.0.3.98.1/config/environment.rb
255
+ /home/caleb/sandbox/rubylexer/jewels/date4-0.1.27/lib/date4/date.rb
256
+ /usr/share/skktools/filters/skkdictools.rb
257
+ /home/caleb/sandbox/rubylexer/jewels/aeditor-1.9/lib/aeditor/test_lexer.rb
258
+ /home/caleb/sandbox/rubylexer/jewels/optiflag-0.6.5/quick.rb
259
+ /home/caleb/sandbox/rubylexer/jewels/rabbit-0.5.6/lib/rabbit/image/eps.rb
260
+ /home/caleb/sandbox/rubylexer/jewels/gecoder-with-gecode-0.8.2/lib/gecoder/interface/constraints/set/connection.rb
261
+ /home/caleb/sandbox/rubylexer/jewels/onebody-0.3.0/vendor/rails/actionpack/test/controller/caching_test.rb
262
+ /home/caleb/sandbox/rubylexer/jewels/rwdhypernote-0.10/extras/rconftool.rb
263
+ /home/caleb/sandbox/rubylexer/jewels/Ron-0.1.0/lib/ron.rb
264
+ /home/caleb/sandbox/rubylexer/jewels/radiant-0.6.7/vendor/rails/railties/lib/initializer.rb
265
+ /usr/share/rails/activesupport/lib/active_support/multibyte/handlers/utf8_handler.rb
266
+ /home/caleb/sandbox/rubylexer/jewels/rwdgutenberg-0.07/extras/rconftool.rb
267
+ /home/caleb/sandbox/rubylexer/jewels/inline-0.1.0/lib/inline/editor.rb
268
+ /home/caleb/sandbox/rubylexer/jewels/xx-2.1.0/lib/xx-2.1.0.rb
269
+ /home/caleb/sandbox/rubylexer/jewels/ok-extensions-1.0.15/lib/extensions/fixnum.rb
270
+ /home/caleb/sandbox/rubylexer/jewels/aspectr-0-3-5/lib/aspectr.rb
271
+ /home/caleb/sandbox/rubylexer/jewels/rubygems-update-1.2.0/lib/rubygems/test_utilities.rb
272
+ /home/caleb/sandbox/rubylexer/jewels/whistle-0.1.1/vendor/ruby-feedparser-0.5-stripped/lib/feedparser/sgml-parser.rb
273
+ /home/caleb/sandbox/rubylexer/jewels/hpricot-0.6/lib/hpricot/modules.rb
274
+ /home/caleb/sandbox/rubylexer/jewels/ruby-web-1.1.1/lib/web/htmlparser/sgml-parser.rb
275
+ /usr/lib/ruby/1.8/rant/import/c/dependencies.rb
276
+ /home/caleb/sandbox/rubylexer/jewels/dbi-0.1.0/lib/dbd/FrontBase.rb
277
+ /home/caleb/sandbox/rubylexer/jewels/live_console-0.1.0/lib/live_console.rb
278
+ /home/caleb/sandbox/rubylexer/jewels/html-table-1.3.1/test/tc_header.rb
279
+ /home/caleb/sandbox/rubylexer/jewels/optiflag-0.6.5/testcases/tc_enumerated_value_validation.rb
280
+ /home/caleb/sandbox/rubylexer/jewels/bigtinker-0.93/ev/rwd.rb
281
+ /home/caleb/sandbox/rubylexer/jewels/xmlscan-0.2.3/tests/visitor.rb
282
+ /home/caleb/sandbox/rubylexer/jewels/dm-core-0.9.2/lib/dm-core/types/discriminator.rb
283
+ /home/caleb/sandbox/rubylexer/jewels/sup-0.5/lib/sup/imap.rb
284
+ /home/caleb/sandbox/rubylexer/jewels/optiflag-0.6.5/examples/example_2_2.rb
285
+ /home/caleb/sandbox/rubylexer/jewels/authorails-1.0.0/lib/initializer.rb
286
+ /usr/lib/ruby/1.9.0/tk/textmark.rb
287
+ /var/lib/gems/1.8/gems/Ron-0.1.0/lib/ron.rb
288
+ /home/caleb/sandbox/rubylexer/jewels/optiflag-0.6.5/examples/example_2.rb
289
+ /home/caleb/sandbox/rubylexer/jewels/allinoneruby-0.2.11/realstuff.rb
290
+ /home/caleb/sandbox/rubylexer/jewels/typo-5.0.3.98.1/db/migrate/040_attach_content_to_blog.rb
291
+ /home/caleb/sandbox/rubylexer/jewels/bijou-0.1.0/lib/bijou/processor.rb
292
+ /home/caleb/sandbox/rubylexer/jewels/rq-3.4.0/lib/rq/lockfile.rb
293
+ /usr/lib/ruby/1.9.0/tkextlib/vu/pie.rb
294
+ /usr/lib/ruby/1.9.0/optparse.rb
295
+ /home/caleb/sandbox/reg/regcompiler.rb
296
+ /home/caleb/sandbox/rubylexer/jewels/rubygame-2.3.0/lib/rubygame/rect.rb
297
+ /usr/lib/ruby/1.9.0/tk/canvastag.rb
298
+ /home/caleb/sandbox/rubylexer/jewels/html-table-1.3.1/test/tc_foot.rb
299
+ /home/caleb/sandbox/rubylexer/jewels/optiflag-0.6.5/examples/example_2_3.rb
300
+ /home/caleb/sandbox/rubylexer/jewels/html-table-1.3.1/test/tc_caption.rb
301
+ /home/caleb/sandbox/rubylexer/jewels/extract-curves-0.1.1/ruby_libs/pav/string/observable.rb
302
+ /home/caleb/sandbox/rubylexer/jewels/starling-0.9.3/lib/starling/runner.rb
303
+ /usr/lib/ruby/1.9.0/rubygems/source_index.rb
304
+ /home/caleb/sandbox/rubylexer/jewels/RbYAML-0.2.0/lib/rbyaml/types.rb
305
+ /home/caleb/sandbox/rubylexer/jewels/rio-0.4.1/doc/generators/template/html/rio.rb
306
+ /home/caleb/sandbox/rubylexer/jewels/rwdaddresses-1.03/extras/vpim/rrule.rb
307
+ /usr/lib/ruby/1.8/feed2imap/sgml-parser.rb
308
+ /usr/lib/ruby/1.8/htree/modules.rb
309
+ /home/caleb/sandbox/rubylexer/jewels/Dnsruby-1.0/test/tc_tsig.rb
310
+ /usr/lib/ruby/1.8/yaml/types.rb
311
+ /home/caleb/sandbox/rubylexer/jewels/rubyscript2exe/rubyscript2exe.rb
312
+ /home/caleb/sandbox/rubylexer/jewels/rfeedparser-ictv-0.9.931/lib/rfeedparser.rb
313
+ /usr/lib/ruby/1.8/amazon.rb
314
+ /home/caleb/sandbox/redparse/redparse.rb
315
+ /home/caleb/sandbox/rubylexer/jewels/rq-3.4.0/rails/vendor/rails/railties/builtin/rails_info/rails/info.rb
316
+ /home/caleb/sandbox/rubylexer/jewels/extract_curves-0.0.1/ruby_libs/pav/string/observable.rb
317
+ /home/caleb/sandbox/rubylexer/jewels/simplemapper-0.0.6/lib/simple_mapper/default_plugins/oauth.rb
318
+ /usr/share/kagemai/lib/xmlscan/parser.rb
319
+ /home/caleb/sandbox/rubylexer/jewels/text-hyphen-1.0.0/lib/text/hyphen/language/id.rb
320
+ /home/caleb/sandbox/rubylexer/jewels/rant-0.5.7/lib/rant/c/include.rb
321
+ /home/caleb/sandbox/rubylexer/jewels/cursor-0.9/duck.rb
322
+ /home/caleb/sandbox/rubylexer/jewels/ruby-nxt-0.8.1/examples/commands.rb
323
+ /var/lib/gems/1.8/gems/cursor-0.9/duck.rb
324
+ /home/caleb/sandbox/rubylexer/jewels/voruby-1.1.1/lib/voruby/simple/parameters.rb
325
+ /home/caleb/sandbox/rubylexer/jewels/Dnsruby-1.0/lib/Dnsruby/resource/A.rb
326
+ /home/caleb/sandbox/rubylexer/jewels/catori-0.2.6/lib/taglib.rb
327
+ /home/caleb/sandbox/rubylexer/jewels/gettext-1.91.0/test/test_rails_caching.rb
328
+ /home/caleb/sandbox/rubylexer/jewels/rwdschedule-1.02/extras/rconftool.rb
329
+ /home/caleb/sandbox/rubylexer/jewels/spree-0.2.0/vendor/rails/actionpack/lib/action_controller/request.rb
330
+ /home/caleb/sandbox/rubylexer/jewels/rubum-0.01/rubum_standalone/ruby/rubum/rdf/lib/.svn/text-base/basicrdf.rb.svn-base
331
+ /home/caleb/sandbox/rubylexer/jewels/rabbit-0.5.6/lib/rabbit/image/base.rb
332
+ /usr/lib/ruby/1.9.0/resolv.rb
333
+ /home/caleb/sandbox/rubylexer/jewels/sqliki-0.0.4/templates/lib_sanitize_html.rb
334
+ /home/caleb/sandbox/rubylexer/jewels/whistle-0.1.1/lib/resource.rb
335
+ /home/caleb/sandbox/rubylexer/jewels/onebody-0.3.0/vendor/rails/actionpack/lib/action_controller/routing/route.rb
336
+ /home/caleb/sandbox/rubylexer/jewels/html-table-1.3.1/examples/intermediate2.rb
337
+ /usr/share/hiki/hiki/plugin.rb
338
+ /home/caleb/sandbox/rubylexer/jewels/xmlparser-0.6.8/xmlparser/samples/digesttest.rb
339
+ /home/caleb/sandbox/rubylexer/jewels/puppet-0.24.4/lib/puppet/file_serving/indirection_hooks.rb
340
+ /home/caleb/sandbox/rubylexer/jewels/assert_xpath-0.4.2/lib/assert_xpath.rb~
341
+ /home/caleb/sandbox/rubylexer/jewels/basset-1.0.1/lib/basset/classification_evaluator.rb
342
+ /usr/lib/ruby/1.8/hpricot/traverse.rb
343
+ /home/caleb/sandbox/rubylexer/jewels/net-netrc-0.2.1/lib/net/netrc.rb
344
+ /home/caleb/sandbox/rubylexer/jewels/etc-0.2.0/lib/etc.rb
@@ -0,0 +1,3319 @@
1
+ =begin
2
+ redparse - a ruby parser written in ruby
3
+ Copyright (C) 2008 Caleb Clausen
4
+
5
+ This library is free software; you can redistribute it and/or
6
+ modify it under the terms of the GNU Lesser General Public
7
+ License as published by the Free Software Foundation; either
8
+ version 2.1 of the License, or (at your option) any later version.
9
+
10
+ This library is distributed in the hope that it will be useful,
11
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
+ Lesser General Public License for more details.
14
+
15
+ You should have received a copy of the GNU Lesser General Public
16
+ License along with this library; if not, write to the Free Software
17
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
+ =end
19
+
20
+ require 'test/unit'
21
+ require 'rubygems'
22
+ require 'parse_tree'
23
+
24
+ require "redparse"
25
+
26
+ begin
27
+ require "test/code/testcases"
28
+ rescue Exception
29
+ puts "!!!!!!RubyLexer's test/code/testcases not found!!!!"
30
+ module TestCases;TESTCASES=[];end
31
+ end
32
+
33
+ class RedParseTest<Test::Unit::TestCase
34
+ ONELINERS=[
35
+ '%w[- \\\\\\\\ e]'...'',
36
+ '%w[- \\\\\\\\ ]'...'',
37
+ 'a=[]; a [42] = 24'...'', #not legal unless a is a local var
38
+ '%w![ ] { } ( ) | - * . \\\\\\\\ ? + ^ $ #!'...'',
39
+ '%W(white\ \ \ \ \ space).should == ["white ", " ", " ", " space"]'...'',
40
+ 'module A; b; rescue C=>d; e; else g; ensure f; end'...'',
41
+ 'class A; b; rescue C=>d; e; else g; ensure f; end'...'',
42
+ 'class<<A; b; rescue C=>d; e; else g; ensure f; end'...'',
43
+ 'File.open() {|f| ; }'...'',
44
+ 'e { |c|; print "%02X" % c }'...'',
45
+ ' /\A#{__FILE__}/'...'',
46
+ ' /\A#{"F"}/'...'',
47
+ '"\\\\\\\\\\""'...'',
48
+ '"\\\\\\""'...'',
49
+ '"\\\\\\\\\\\"'...'',
50
+ '"\\\\\\\"'...'',
51
+
52
+ 'alias :"foo#{bar}" :"baz#{quux}"'...'',
53
+ 'undef :"foo#{bar}", :"baz#{quux}"'...'',
54
+ 'A::B::C'...'',
55
+ 's=3; s::T'...'',
56
+ 'return ENV[]'...'',
57
+ ' [TypeValue, ClassValue = Clalue] '...'',
58
+ '{44 => TypeValue, ClassValue = Clalue => 55}'...'',
59
+ '{44 => TypeValue = Type, ClassValue = Clalue => 55}'...'',
60
+ 'module::A::B::Special::Extend C end'...'',
61
+ 'module ::A::B::Special::Extend C end'...'',
62
+ 'module A::B::Special::Extend C end'...'',
63
+ 'module A::B ::Special::Extend C end'...'',
64
+ 'module A::B :: Special::Extend C end'...'',
65
+ 'module A::B:: Special::Extend C end'...'',
66
+ 'class BUNE end'...'',
67
+ 'class BUNE; extend end'...'',
68
+ 'module BUNE end'...'',
69
+ 'module BUNE extend end'...'',
70
+ 'module BUNE extend OptiFgset end'...'',
71
+ '0.5'...'',
72
+ 'class BUG_ONE extend OptiFlag::Flagset; end'...'', #illegal
73
+ 'module ::BUG_ONE extend OptiFlag::Flagset; end'...'',
74
+ 'module ::BUG::ONE extend OptiFlag::Flagset; end'...'',
75
+ 'module BUG::ONE extend OptiFlag::Flagset; end'...'',
76
+ 'module BUG_ONE extend OptiFlag::Flagset; end'...'',
77
+ 'module BUG_ONE; extend OptiFlag::Flagset; end'...'',
78
+ ' ClassHash[TypeValue = Type, ClassValue = Clalue] =1'...'',
79
+ ' ClassHash[[TypeValue = Type, ClassValue = Clalue]] =1'...'',
80
+ ' ClassHash[[[TypeValue = Type, ClassValue = Clalue]]] =1'...'',
81
+ ' ClassHash[TypeValue = Type, ClassValue = Clalue] '...'',
82
+ ' ClassHash[[TypeValue = Type, ClassValue = Clalue]] '...'',
83
+ ' ClassHash[[[TypeValue = Type, ClassValue = Clalue]]] '...'',
84
+ ' [TypeValue = Type, ClassValue = Clalue] '...'',
85
+ ' [[TypeValue = Type, ClassValue = Clalue]] '...'',
86
+ ' [[[TypeValue = Type, ClassValue = Clalue]]] '...'',
87
+ 'begin r;rescue *re;r;end'...'',
88
+ 'if v; else return([vUew]).e end'...'',
89
+ 'unless v; else return ([vUew]).e end'...'',
90
+ 'if v; else return ([vUew]).e end'...'',
91
+ 'begin v; else return ([vUew]).e end'...'',
92
+ 'case v; when 4; 5; else return ([vUew]).e end'...'',
93
+ 'def v; t; else return ([vUew]).e end'...'',
94
+ 'def i;"..#{@@c = 1}";end'...'',
95
+ '"""Universal feed parser in Ruby""";$K=fgdf'...'',
96
+ "case F;when G; else;case; when j; end;end"...'',
97
+ ' m.cn= 1, V'...'',
98
+ '__LINE__'...'',
99
+ '"#{}"""'...'',
100
+ 'def line(host = host,guest=host); end'...'',
101
+ 'def e; begin; y; g else t; m; end ;end'...'',
102
+ '[a,*b=c]'...'',
103
+ 'p a,*b=c'...'',
104
+ 'p(a,*b=c)'...'',
105
+ '[*b=c]'...'',
106
+ 'p *b=c'...'',
107
+ 'p(*b=c)'...'',
108
+ 'p = p m %(1)'...'', #the parsing of this one makes no sense to me!
109
+ 'p = p m %(1) do end'...'', #the parsing of this one makes no sense to me!
110
+ 'p = p m %(1) ,t'...'', #the parsing of this one makes no sense to me!
111
+ 'p = p m %(1) ,*t'...'', #the parsing of this one makes no sense to me!
112
+ 'p = p m %(1) ,&t'...'', #the parsing of this one makes no sense to me!
113
+ 'p = k.p m %(1)'...'', #the parsing of this one makes no sense to me!
114
+ 'p = k.p m %(1) do end'...'', #the parsing of this one makes no sense to me!
115
+ 'p = k::p m %(1)'...'', #the parsing of this one makes no sense to me!
116
+ 'p = k::p m %(1) do end'...'', #the parsing of this one makes no sense to me!
117
+ 'p=556;p (e) /a'...'',
118
+ '(a;b;c);d;e;f;(g;h;i)'...'',
119
+ 'def __DATA__.f; end'...'',
120
+ 'def continue.f; end'...'',
121
+ 'a0 = k ? a rescue b : d'...'',
122
+ 'a0 = a rescue k ? b : d'...'',
123
+ 'k ? a0 = a rescue b : d'...'',
124
+ '{a0 = a rescue b => c}'...'',
125
+ 'p(a0 = a rescue b,c)'...'',
126
+ 'p a0 = a rescue b,c'...'',
127
+ '[a0 = a rescue b,c]'...'',
128
+ 'a0 = a rescue b and c'...'',
129
+ 'a0 = a rescue b or c'...'',
130
+ 'a0 = a rescue b if c'...'',
131
+ 'a0 = a rescue b && c'...'',
132
+ 'begin begin; ync; p1; end;rr end'...'',
133
+ 'a= y 1,2 rescue c'...'',
134
+ '"f";p (1..10).method(:each)'...'',
135
+ '"\C-\p "'...'',
136
+ 'p (&a)'...'',
137
+ 'p (*a)'...'',
138
+ 'return % 1 '...'',
139
+ 'return / 1 /'...'',
140
+ 'a.return % 1 '...'',
141
+ 'a.return / 1 /'...'',
142
+ 'break % 1 '...'',
143
+ 'break / 1 /'...'',
144
+ 'a.break % 1 '...'',
145
+ 'a.break / 1 /'...'',
146
+ 'break % 1 '...'',
147
+ 'break / 1 /'...'',
148
+ 'a.break % 1 '...'',
149
+ 'a.break / 1 /'...'',
150
+
151
+ 'return[1]'...'',
152
+ 'next[1]'...'',
153
+ 'break[1]'...'',
154
+ 'continue[1]'...'',
155
+ 'a.return[1]'...'',
156
+ 'a.next[1]'...'',
157
+ 'a.break[1]'...'',
158
+ 'a.continue[1]'...'',
159
+
160
+ 'yield *a=r'...'',
161
+ 'begin; q; rescue a=r,b; end'...'',
162
+ 'case g; when a=r,b; end'...'',
163
+ 'begin; g; rescue *a=r; end'...'',
164
+ 'case g; when *a=r; end'...'',
165
+ 'm.yield *a=r'...'',
166
+ 'm.rescue a=r,b'...'',
167
+ 'm.when a=r,b'...'',
168
+ 'm.rescue *a=r'...'',
169
+ 'm.when *a=r'...'',
170
+
171
+ '(*a=c)'...'',
172
+ '((*a=c))'...'',
173
+ '(((*a=c)))'...'',
174
+ '((((*a=c))))'...'',
175
+
176
+ 'p *a=c'...'',
177
+ 'p(*a=c)'...'',
178
+ 'p((*a=c))'...'',
179
+ 'p(((*a=c)))'...'',
180
+ 'p((((*a=c))))'...'',
181
+ 'p (*a=c)'...'',
182
+ 'p (1),*a=c'...'',
183
+ '{p (1) => b}'...'',
184
+ '"1#{p (1,2).m}2"'...'',
185
+ '"1#{p ().m}2"'...'',
186
+ '"1#{p (1).m}2"'...'',
187
+ '"1#{tt;p (1).m}2"'...'',
188
+ 'a0 = az=d,y'...'',
189
+ 'begin; rescue A=>b.c : end'...'',
190
+ 'begin; rescue A=>b.c then end'...'',
191
+ 'begin; rescue A=>@a; end'...'',
192
+ 'begin; rescue A=>@@a; end'...'',
193
+ 'begin; rescue A=>$a; end'...'',
194
+ 'begin; rescue A=>$!; end'...'',
195
+ 'begin; rescue A=>A; end'...'',
196
+ 'begin; rescue A=>::B; end'...'',
197
+ 'begin; rescue A=>A::B; end'...'',
198
+ 'begin; rescue A=>a.b; end'...'',
199
+ 'begin; rescue A=>p[4]; end'...'',
200
+ 'begin; rescue A=>p (1).m; end'...'',
201
+ 'm ? n : (b)'...'',
202
+ 'm ? n : (begin; end)'...'',
203
+ 'begin; rescue =>e; p end'...'',
204
+ 'begin; rescue E=>e; p end'...'',
205
+ 'a0 = *t rescue b0'...'',
206
+ 'a0 = p 1.q rescue b0'...'',
207
+ 'a0 = p 1.q,2 rescue b0'...'',
208
+ 'def a(b,c) e=*g end'...'',
209
+ 'def a(b,c) d,e=f,g end'...'',
210
+ 'def a b,d=p (1.10).m,*f,&g; end'...'',
211
+ 'a=*b rescue c rescue d'...'',
212
+ 'a=b rescue c rescue d'...'',
213
+ '*a0 = *a=b'...'',
214
+ 'a0 = *a=b'...'',
215
+ '*a[z]=c rescue b'...'',
216
+ 'a0 = @data.[]=(*args) rescue b0'...'',
217
+ 'm{|p (1..10).method(:each)[*b]| c}'...'',
218
+ 'm{|p (1)[b]| }'...'',
219
+ 'm{|p ()[b]| }'...'',
220
+ 'm{|p (1,2)[b]| }'...'',
221
+ 'a0 = b 1 do end rescue c'...'',
222
+ 'a0 = b do end rescue c'...'',
223
+ 'a0 = b() do end rescue c'...'',
224
+ 'p (1.10).me,z=c'...'',
225
+ 'p(1.10).me,z=c'...'',
226
+ 'p (1..10).method(:each)[z,*b],z=c,y'...'',
227
+ 'a = p rescue b'...'',
228
+ 'a,g = p rescue b'...'',
229
+ ' false and ( t) '...'',
230
+ 'a0 = begin;rescue;end rescue b0'...'',
231
+ 'a0 = def a b,d=e; end rescue b0'...'',
232
+ 'a0 = def a b=c,d=e; end rescue b0'...'',
233
+ 'def a b,d=e; end'...'',
234
+ '{p (1) => a}'...'',
235
+ '{p (1).m => a}'...'',
236
+ 'a0 = begin; end rescue b0'...'',
237
+ 'a0 = begin; a; end rescue b0'...'',
238
+ 'a0 = (a;b;) rescue b0'...'',
239
+ 'a0= y,begin a end rescue b0'...'',
240
+ 'a0= y,*begin a end rescue b0'...'',
241
+ 'a0= *begin a end rescue b0'...'',
242
+ 'a0= y,begin a end rescue b0,z'...'',
243
+ 'a0= begin a end rescue b0,z'...'',
244
+ 'a0= begin a end rescue b0,*z'...'',
245
+ '*a0= begin a end rescue b0'...'',
246
+ 'y,*a0= begin a end rescue b0'...'',
247
+ 'y,a0= begin a end rescue b0'...'',
248
+ 'y,a0,= begin a end rescue b0'...'',
249
+ 'y,a0,* = begin a end rescue b0'...'',
250
+ 'y,a0,*j= begin a end rescue b0'...'',
251
+ '(a0,)= begin a end rescue b0'...'',
252
+ 'begin a end rescue b0'...'',
253
+
254
+ 'c do p (110).m end'...'',
255
+ 'a=a do end'...'',
256
+ 'b a=a do end'...'',
257
+ 'b=1;a=b do end'...'',
258
+ 'st = a::F f rescue p'...'',
259
+ 'st = a.F f rescue p'...'',
260
+ 'st = F f rescue p'...'',
261
+ '{p (1).metho => 4}'...'',
262
+ 'p (1).c'...'',
263
+ 'k=z=c,d rescue b'...'',
264
+ 'a=1,2 rescue 4'...'',
265
+ 'a,*k=p,z=c rescue b'...'',
266
+ 'a,k=p,z=c rescue b'...'',
267
+ 'a=p,z=c rescue 0'...'',
268
+ 'a =p (1).m,z=c rescue b'...'',
269
+ 'z{|| p (1).m}'...'',
270
+ 'b or p (1).m'...'',
271
+ 'b and p (1).m'...'',
272
+ 'b || p (1).m'...'',
273
+ 'b && p (1).m'...'',
274
+ 'b ? p (1).m : g'...'',
275
+
276
+ 'c unless p (1).m'...'',
277
+ 'c if p (1).m'...'',
278
+ 'c until p (1).m'...'',
279
+ 'c while p (1).m'...'',
280
+
281
+ 'unless p (1).m; end'...'',
282
+ 'if p (1).m; end'...'',
283
+ 'until p (1).m; end'...'',
284
+ 'while p (1).m; end'...'',
285
+ 'z if c..p (1).m'...'',
286
+ 'z if c...p (1).m'...'',
287
+ 'yield *p (1).m'...'',
288
+ 'p p (1).m'...'',
289
+ 'a.p p (1).m'...'',
290
+ 'p p ().m'...'',
291
+ 'p p (1,2).m'...'',
292
+ 'p p(1).m'...'',
293
+ 'p(p (1).m)'...'',
294
+
295
+ 'begin; m; rescue A=>p (1).metho; end'...'',
296
+
297
+ 'h(a=>p (1).metho)'...'',
298
+ 'h a=>p (1).metho'...'',
299
+ 'h(a=>p (1).metho,2)'...'',
300
+ 'h a=>p (1).metho,2'...'',
301
+
302
+ '{a=>p (1).metho}'...'',
303
+ '{a=>p ().metho}'...'',
304
+ '{a=>p (1,2).metho}'...'',
305
+
306
+ '"#{begin}"'...'',
307
+ 'a0 = "#{begin; a; rescue b; p (1..10).method(:each)}" rescue b0'...'',
308
+
309
+ 'begin; p; rescue p(4).m; end'...'',
310
+ 'begin; p; rescue p (4).m; end'...'',
311
+ 'begin; p; rescue p ().m; end'...'',
312
+ 'begin; p; rescue p (4,5).m; end'...'',
313
+
314
+
315
+
316
+ ' p rescue p a4.m'...'',
317
+ ' p rescue p (4).m'...'',
318
+ ' p rescue p ().m'...'',
319
+ ' p rescue p (4,5).m'...'',
320
+ 'a0 += p (1).d'...'',
321
+ 'a0 = p (1..10).method(:each)[*b]=c rescue b0'...'',
322
+ '*a0 = *(a= c)'...'',
323
+ '*a0 = (*a= c)'...'',
324
+ '*a0 = *a=c'...'',
325
+ 'a0 = (*a=c)'...'',
326
+ 'a0 = *a=c'...'',
327
+ 'a0 = *(a=c)'...'',
328
+ 'a0 = m,*a=c'...'',
329
+ 'a0 = m,*a=c rescue b0'...'',
330
+ 'a0 = *a+=c'...'',
331
+ 'a0 += *a=c'...'',
332
+ 'a0 += *a+=c'...'',
333
+
334
+ 'a0 = begin raise "foo" end rescue b0'...'',
335
+ 'a0= a0 = su rescue b0 rescue b0'...'',
336
+ 'class Using_Paths < Doc < FigureMaker; end'...'',
337
+ 'a=begin end rescue b'...'',
338
+ 'a=begin b end rescue c'...'',
339
+ 'a=begin b; rescue c; d end rescue e'...'',
340
+ 'a=() rescue b'...'',
341
+ 'a=(b) rescue c'...'',
342
+ 'a=(b c) rescue d'...'',
343
+ 'a=(b(c)) rescue d'...'',
344
+
345
+ 'a rescue b if c'...'',
346
+ 'begin end until a'...'',
347
+ 'o ? begin end : l'...'',
348
+ 'o && begin end'...'',
349
+ 'o || begin end'...'',
350
+ 'o and begin end'...'',
351
+ 'o or begin end'...'',
352
+ 'not begin end'...'',
353
+ '! begin end'...'',
354
+ 'Sw.===(anything).should == true'...'',
355
+ 'def line(type, txt, selector, host = host, port = port); end'...'',
356
+ 'a0 = def a.b; end rescue b0'...'',
357
+ 'def a.b; end rescue b0'...'',
358
+
359
+ 'a = (r(e) +t(j)) rescue 2'...'',
360
+ 'a = (r e +t(j)) rescue 2'...'',
361
+ 'a = (p) rescue 2'...'',
362
+ 'a = (p(1)) rescue 2'...'',
363
+ 'a = (p(1,g)) rescue 2'...'',
364
+ 'a = (p 1,g) rescue 2'...'',
365
+
366
+ 'a = r(e) +t(j) rescue 2'...'',
367
+ 'a = r e +t(j) rescue 2'...'',
368
+ 'a = p rescue 2'...'',
369
+ 'a = p(1) rescue 2'...'',
370
+ 'a = p(1,g) rescue 2'...'',
371
+ 'a = p 1,g rescue 2'...'',
372
+ '//nonsense'...'',
373
+ '//xenon'...'',
374
+ 'def wait; begin; ync; mup; end ;end'...'',
375
+ 'first or (first,last=*rand_pos_pair)'...'',
376
+ 'return - @com_disk'...'',
377
+ 'continue - @com_disk'...'',
378
+ 'yield - @com_disk'...'',
379
+ 'break - @com_disk'...'',
380
+ 'next - @com_disk'...'',
381
+ 'raise - @com_disk'...'',
382
+ 'undef - com_disk'...'',
383
+ 'alias - com_disk'...'',
384
+ 'defined? - @com_disk'...'',
385
+ 'a rescue - @com_disk'...'',
386
+ 'if a; else - @com_disk;end'...'',
387
+ 'if - @com_disk;end'...'',
388
+ 'unless - @com_disk;end'...'',
389
+ 'while - @com_disk;end'...'',
390
+ 'until - @com_disk;end'...'',
391
+ 'begin - @com_disk;end'...'',
392
+ 'end - @com_disk'...'',
393
+ 'b do - @com_disk end'...'',
394
+ 'for - @com_disk in a do b end'...'',
395
+ 'for a in - @com_disk do b end'...'',
396
+ 'if a; b; elsif - @com_disk; c end'...'',
397
+ 'begin a; ensure - @com_disk; end'...'',
398
+ 'catch - @com_disk'...'',
399
+ 'throw - @com_disk'...'',
400
+
401
+ 'return * @com_disk'...'',
402
+ 'continue * @com_disk'...'',
403
+ 'yield * @com_disk'...'',
404
+ 'break * @com_disk'...'',
405
+ 'next * @com_disk'...'',
406
+ 'raise * @com_disk'...'',
407
+ 'undef * com_disk'...'',
408
+ 'alias * com_disk'...'',
409
+ 'defined? * @com_disk'...'',
410
+ 'a rescue * @com_disk'...'',
411
+ 'if a; else * @com_disk;end'...'',
412
+ 'if * @com_disk;end'...'',
413
+ 'unless * @com_disk;end'...'',
414
+ 'while * @com_disk;end'...'',
415
+ 'until * @com_disk;end'...'',
416
+ 'begin * @com_disk;end'...'',
417
+ 'end * @com_disk'...'',
418
+ 'b do * @com_disk end'...'',
419
+ 'for * @com_disk in a do b end'...'',
420
+ 'for a in * @com_disk do b end'...'',
421
+ 'if a; b; elsif * @com_disk; c end'...'',
422
+ 'begin a; ensure * @com_disk; end'...'',
423
+ 'catch * @com_disk'...'',
424
+ 'throw * @com_disk'...'',
425
+
426
+
427
+ 'a.return - @com_disk'...'',
428
+ 'm.continue - @com_disk'...'',
429
+ 'm.yield - @com_disk'...'',
430
+ 'm.break - @com_disk'...'',
431
+ 'm.next - @com_disk'...'',
432
+ 'm.raise - @com_disk'...'',
433
+ 'm.undef - com_disk'...'',
434
+ 'm.alias - com_disk'...'',
435
+ 'm.defined? - @com_disk'...'',
436
+ 'm.rescue - @com_disk'...'',
437
+ 'm.else - @com_disk'...'',
438
+ 'm.if - @com_disk'...'',
439
+ 'm.unless - @com_disk'...'',
440
+ 'm.while - @com_disk'...'',
441
+ 'm.until - @com_disk'...'',
442
+ 'm.begin - @com_disk'...'',
443
+ 'm.end - @com_disk'...'',
444
+ 'm.do - @com_disk'...'',
445
+ 'm.for - @com_disk'...'',
446
+ 'm.in - @com_disk '...'',
447
+ 'm.elsif - @com_disk'...'',
448
+ 'm.ensure - @com_disk'...'',
449
+ 'm.catch - @com_disk'...'',
450
+ 'm.throw - @com_disk'...'',
451
+
452
+ 'm.return * @com_disk'...'',
453
+ 'm.continue * @com_disk'...'',
454
+ 'm.yield * @com_disk'...'',
455
+ 'm.break * @com_disk'...'',
456
+ 'm.next * @com_disk'...'',
457
+ 'm.raise * @com_disk'...'',
458
+ 'm.undef * com_disk'...'',
459
+ 'm.alias * com_disk'...'',
460
+ 'm.defined? * @com_disk'...'',
461
+ 'm.rescue * @com_disk'...'',
462
+ 'm.else * @com_disk'...'',
463
+ 'm.if * @com_disk'...'',
464
+ 'm.unless * @com_disk'...'',
465
+ 'm.while * @com_disk'...'',
466
+ 'm.until * @com_disk'...'',
467
+ 'm.begin * @com_disk'...'',
468
+ 'm.end * @com_disk'...'',
469
+ 'm.do * @com_disk'...'',
470
+ 'm.for * @com_disk '...'',
471
+ 'm.in * @com_disk'...'',
472
+ 'm.elsif * @com_disk'...'',
473
+ 'm.ensure * @com_disk'...'',
474
+ 'm.catch * @com_disk'...'',
475
+ 'm.throw * @com_disk'...'',
476
+
477
+
478
+ '%W[Ml.#{G.ma}.Z M.#{G.m} yaml.Z ]'...'',
479
+ '@data.[]=(*args)'...'',
480
+ 'have_header(*curses=%w"ncurses.h")'...'',
481
+ 'Proc{|a,&b|}'...'',
482
+ 'Proc{|a,&b| c}'...'',
483
+ 'e if f rescue 0'...'',
484
+ 'e unless f rescue 0'...'',
485
+ 'e while f rescue 0'...'',
486
+ 'e until f rescue 0'...'',
487
+ 'begin;mode;rescue;o_chmod rescue nil;end'...'',
488
+ 'stat = File.stat f rescue error'...'',
489
+ 'case a;else;end'...'',
490
+ 'n = o ? begin end : l'...'',
491
+ 'o ? begin end : l'...'',
492
+ 'if o then begin end else l end'...'',
493
+ 'o && begin end'...'',
494
+ 'o || begin end'...'',
495
+ 'o & begin end'...'',
496
+ 'o | begin end'...'',
497
+ 'o and begin end'...'',
498
+ 'o or begin end'...'',
499
+ 'o if begin end'...'',
500
+ 'o unless begin end'...'',
501
+ 'o while begin end'...'',
502
+ 'o until begin end'...'',
503
+
504
+ 'def self; end'...'',
505
+ 'def nil; end'...'',
506
+ 'def true; end'...'',
507
+ 'def false; end'...'',
508
+ 'def __FILE__; end'...'',
509
+ 'def __LINE__; end'...'',
510
+ 'def __END__; end'...'',
511
+
512
+ 'def continue; end'...'',
513
+ 'def yield; end'...'',
514
+ 'def break; end'...'',
515
+ 'def next; end'...'',
516
+ 'def return; end'...'',
517
+ 'def raise; end'...'',
518
+ 'def undef; end'...'',
519
+ 'def alias; end'...'',
520
+ 'def def; end'...'',
521
+ 'def module; end'...'',
522
+ 'def class; end'...'',
523
+ 'def defined?; end'...'',
524
+ 'def rescue; end'...'',
525
+ 'def else; end'...'',
526
+ 'def if; end'...'',
527
+ 'def unless; end'...'',
528
+ 'def while; end'...'',
529
+ 'def until; end'...'',
530
+ 'def begin; end'...'',
531
+ 'def end; end'...'',
532
+ 'def do; end'...'',
533
+ 'def for; end'...'',
534
+ 'def in; end'...'',
535
+ 'def elsif; end'...'',
536
+ 'def ensure; end'...'',
537
+ 'def catch; end'...'',
538
+ 'def throw; end'...'',
539
+
540
+ 'def continue.x; end'...'',
541
+ 'def yield.x; end'...'',
542
+ 'def break.x; end'...'',
543
+ 'def next.x; end'...'',
544
+ 'def return.x; end'...'',
545
+ 'def raise.x; end'...'',
546
+ 'def defined?.x; end'...'',
547
+ 'def catch.x; end'...'',
548
+ 'def throw.x; end'...'',
549
+ 'def self.x; end'...'',
550
+ 'def nil.x; end'...'',
551
+ 'def true.x; end'...'',
552
+ 'def false.x; end'...'',
553
+ 'def __FILE__.x; end'...'',
554
+ 'def __LINE__.x; end'...'',
555
+ 'def __END__.x; end'...'',
556
+
557
+ 'p p {} do end'...'',
558
+ ' ca (:f).gg '...'',
559
+ ' return gsub() {}'...'',
560
+ 'p timeout(5) {45}'...'',
561
+ '%w[ a b]'...'',
562
+
563
+ 'defined?(MOD_RUBY)..ENV'...'',
564
+ 'defined?(MOD_RUBY)...ENV'...'',
565
+ 'defined? MOD_RUBY..ENV'...'',
566
+ 'defined? MOD_RUBY...ENV'...'',
567
+
568
+ 'defined?(MOD_RUBY).ENV'...'',
569
+ 'defined?(MOD_RUBY)::ENV'...'',
570
+ 'defined? MOD_RUBY.ENV'...'',
571
+ 'defined? MOD_RUBY::ENV'...'',
572
+
573
+ 'defined?(MOD_RUBY)[ENV]'...'',
574
+ 'defined?(MOD_RUBY)[ENV]=1'...'',
575
+ 'defined? MOD_RUBY[ENV]'...'',
576
+ 'defined? MOD_RUBY[ENV]=1'...'',
577
+ 'defined?(MOD_RUBY)**ENV'...'',
578
+ 'defined? MOD_RUBY**ENV'...'',
579
+
580
+
581
+ 'defined?(MOD_RUBY)<=ENV'...'',
582
+ 'defined?(MOD_RUBY)>=ENV'...'',
583
+ 'defined? MOD_RUBY<=ENV'...'',
584
+ 'defined? MOD_RUBY>=ENV'...'',
585
+ 'defined?(MOD_RUBY)<ENV'...'',
586
+ 'defined?(MOD_RUBY)>ENV'...'',
587
+ 'defined? MOD_RUBY<ENV'...'',
588
+ 'defined? MOD_RUBY>ENV'...'',
589
+ 'defined?(MOD_RUBY)|ENV'...'',
590
+ 'defined?(MOD_RUBY)&ENV'...'',
591
+ 'defined? MOD_RUBY|ENV'...'',
592
+ 'defined? MOD_RUBY&ENV'...'',
593
+ 'defined?(MOD_RUBY)<<ENV'...'',
594
+ 'defined?(MOD_RUBY)>>ENV'...'',
595
+ 'defined? MOD_RUBY<<ENV'...'',
596
+ 'defined? MOD_RUBY>>ENV'...'',
597
+ 'defined?(MOD_RUBY)+ENV'...'',
598
+ 'defined?(MOD_RUBY)-ENV'...'',
599
+ 'defined? MOD_RUBY+ENV'...'',
600
+ 'defined? MOD_RUBY-ENV'...'',
601
+ 'defined?(MOD_RUBY)*ENV'...'',
602
+ 'defined?(MOD_RUBY)/ENV'...'',
603
+ 'defined? MOD_RUBY*ENV'...'',
604
+ 'defined? MOD_RUBY/ENV'...'',
605
+ 'defined?(MOD_RUBY)%ENV'...'',
606
+ 'defined?(MOD_RUBY)^ENV'...'',
607
+ 'defined? MOD_RUBY%ENV'...'',
608
+ 'defined? MOD_RUBY^ENV'...'',
609
+
610
+
611
+ 'defined?(MOD_RUBY)==ENV'...'',
612
+ 'defined?(MOD_RUBY)===ENV'...'',
613
+ 'defined? MOD_RUBY==ENV'...'',
614
+ 'defined? MOD_RUBY===ENV'...'',
615
+ 'defined?(MOD_RUBY)!=ENV'...'',
616
+ 'defined?(MOD_RUBY)<=>ENV'...'',
617
+ 'defined? MOD_RUBY!=ENV'...'',
618
+ 'defined? MOD_RUBY<=>ENV'...'',
619
+ 'defined?(MOD_RUBY)=~ENV'...'',
620
+ 'defined?(MOD_RUBY)!~ENV'...'',
621
+ 'defined? MOD_RUBY=~ENV'...'',
622
+ # 'defined? MOD_RUBY!~ENV'...'', #not legal
623
+
624
+
625
+ 'defined? MOD_RUBY=ENV'...'',
626
+ 'defined? MOD_RUBY+=ENV'...'',
627
+ 'defined? MOD_RUBY-=ENV'...'',
628
+ 'defined? MOD_RUBY/=ENV'...'',
629
+ 'defined? MOD_RUBY*=ENV'...'',
630
+ 'defined? MOD_RUBY%=ENV'...'',
631
+ 'defined? MOD_RUBY**=ENV'...'',
632
+ 'defined? MOD_RUBY<<=ENV'...'',
633
+ 'defined? MOD_RUBY>>=ENV'...'',
634
+ 'defined? MOD_RUBY&&=ENV'...'',
635
+ 'defined? MOD_RUBY||=ENV'...'',
636
+ 'defined? MOD_RUBY&=ENV'...'',
637
+ 'defined? MOD_RUBY|=ENV'...'',
638
+ 'defined? MOD_RUBY^=ENV'...'',
639
+
640
+ 'self[-1] += succ_table'...'',
641
+ 'begin; p rescue;o_chmod rescue nil;end'...'',
642
+ 'defined?(MOD_RUBY) && ENV'...'',
643
+ 'defined?(MOD_RUBY) || ENV'...'',
644
+ 'defined?(MOD_RUBY) and ENV'...'',
645
+ 'defined?(MOD_RUBY) or ENV'...'',
646
+ 'defined? MOD_RUBY && ENV'...'',
647
+ 'defined? MOD_RUBY || ENV'...'',
648
+ 'defined? MOD_RUBY and ENV'...'',
649
+ 'defined? MOD_RUBY or ENV'...'',
650
+
651
+ 'alias $ERROR_INFO $!'...'',
652
+ 'alias :$ERROR_INFO $!'...'',
653
+ 'alias $ERROR_INFO :$!'...'',
654
+ 'alias :$ERROR_INFO :$!'...'',
655
+ 'defined?(BINARY) ? BINARY : 0'...'',
656
+ 'ca (:f){}'...'',
657
+ 'def run; system; else;end'...'',
658
+ '"n#@t#{l}#@m"'...'',
659
+ 'f a rescue b'...'',
660
+ 'f g a rescue b'...'',
661
+ 'defined? a rescue b'...'',
662
+ 'yield a rescue b'...'',
663
+ 'return a rescue b'...'',
664
+ 'break a rescue b'...'',
665
+ 'next a rescue b'...'',
666
+ "%q[asdfadfas\\']"...'',
667
+ ' begin; rescue ;;error; end'...'',
668
+ 'a.b=~c'...'',
669
+ "x::I = 1"...'',
670
+ "x.I = 1"...'',
671
+ "X::I = 1"...'',
672
+ "X.I = 1"...'',
673
+ " alias :'=$=' :e "...'',
674
+ " alias :'==' :e "...'',
675
+ ' alias :"==" :e '...'',
676
+ ' alias :"==\\1" :e '...'',
677
+ 'alias :\'foo\' bar'...'',
678
+ 'alias :"foo#{dfgdfg}" bar'...'',
679
+ 'alias :"foo" bar#{mdfgnxc}'...'',
680
+ 'alias :"foo#{dfgdfg}" bar#{fgsdg}'...'',
681
+ '+-+-+++++---+++-++-0'...'',
682
+ "%q[\\']"...'',
683
+ '%((((())#{})))'...'',
684
+ '%(((#{}(()))))'...'',
685
+ '%(((((#{})))))'...'',
686
+ 'ev.length/=2'...'',
687
+ 'ev.length /=2'...'',
688
+ 'ev.length/= 2'...'',
689
+ 'ev.length /= 2'...'',
690
+ 'a.~@'...'',
691
+ 'a.~'...'',
692
+ 'a::~@'...'',
693
+ 'a::~'...'',
694
+ 'def ~@; end'...'',
695
+ 'def a.~@; end'...'',
696
+ 'def a::~@; end'...'',
697
+ ':~@'...'',
698
+ "%\n\\c\nyy\n"...'',
699
+ "(%\r\neee\#{kk}\\\r\n\r\n)"...'',
700
+ "(%\r\neee\#{kk}\\\n\r\n)"...'',
701
+ "(%\r\neee\#{kk}\r\n)"...'',
702
+ "(%\r\neee\#{kk}\\\r\n\n)"...'',
703
+ "(%\r\neee\#{kk}\\\n\n)"...'',
704
+ "(%\r\neee\#{kk}\n)"...'',
705
+ "(%\neee\#{kk}\\\r\n\r\n)"...'',
706
+ "(%\neee\#{kk}\\\n\r\n)"...'',
707
+ "(%\neee\#{kk}\r\n)"...'',
708
+ "(%\neee\#{kk}\\\r\n\n)"...'',
709
+ "(%\neee\#{kk}\\\n\n)"...'',
710
+ "(%\neee\#{kk}\n)"...'',
711
+ '%@#@_@'...'',
712
+ '%$#$_$'...'',
713
+ '$;'...'',
714
+ '$;=1'...'',
715
+ '"\c""'...'',
716
+ '"\C-""'...'',
717
+ '"\M-""'...'',
718
+ '"\C-\M-""'...'',
719
+ '"\M-\C-""'...'',
720
+ 'begin a; rescue b=>e; @c=e.f; end'...'',
721
+ 'a=b do end'...'',
722
+ 'c a=b do end'...'',
723
+ 'filename =~ //'...'',
724
+ 'filename !~ //'...'',
725
+ 'Dir.chdir DIR do end'...'',
726
+ 'DIR do end'...'',
727
+ 'Dir.chdir DIR { }'...'',
728
+ 'p ()'...'',
729
+ 'p (1,2,3)'...'',
730
+ 'p(1..10).method(:each)'...'',
731
+ 'a.p(1..10).method(:each)'...'',
732
+ 'a::p(1..10).method(:each)'...'',
733
+ 'p (1..10).method(:each)'...'',
734
+ 'a.p (1..10).method(:each)'...'',
735
+ 'a::p (1..10).method(:each)'...'',
736
+ 'p(1..10,1).method(:each)'...'',
737
+ 'a.p(1..10,1).method(:each)'...'',
738
+ 'a::p(1..10,1).method(:each)'...'',
739
+ 'p (1..10,1).method(:each)'...'',
740
+ 'a.p (1..10,1).method(:each)'...'',
741
+ 'a::p (1..10,1).method(:each)'...'',
742
+ 'p().method(:each)'...'',
743
+ 'a.p().method(:each)'...'',
744
+ 'a::p().method(:each)'...'',
745
+ 'p ().method(:each)'...'',
746
+ 'a.p ().method(:each)'...'',
747
+ 'a::p ().method(:each)'...'',
748
+ 'p 1;2;p 1'...'',
749
+ 'def self.zz(*,&x) y end'...'',
750
+ 'def self.zz(&x) y end'...'',
751
+ 'def self.zz(*,&x); end'...'',
752
+ 'def self.zz(&x); end'...'',
753
+ '"is #{x}#{"Slim #{2?"W":"S"} "}."'...'',
754
+ '"is #{"Slim #{2?"W":"S"} "}."'...'',
755
+ '"is #{"Slim #{2?"W":"S"} " "rr"}."'...'',
756
+ '%W"is #{x}#{"Slim #{2?"W":"S"} "}."'...'',
757
+ '%W"is #{"Slim #{2?"W":"S"} "}."'...'',
758
+ '%W"is #{"Slim #{2?"W":"S"} " "rr"}."'...'',
759
+
760
+ '"is #{"Slim #{2?"W":"S"}"}."'...'',
761
+ '%W"is #{"Slim #{2?"W":"S"}"}."'...'',
762
+ '"is #{"Slim #{2?"W":"S"}"}#{xx}."'...'',
763
+ '%W"is #{"Slim #{2?"W":"S"}"}#{xx}."'...'',
764
+ 'case $1; when 0,*[2,66]: p 1; when 3; 4 else p 2 end'...'',
765
+ 'case $1; when 0,*a: p 1; when 3; 4 else p 2 end'...'',
766
+ ' p(String <<- Class)'...'',
767
+ ' p(String << - Class)'...'',
768
+ ' p(String >>- Class)'...'',
769
+ ' p(String >> - Class)'...'',
770
+ '"2266"**"#{22}" "#{44}" "55" "#{66}"'...'',
771
+ '["2266", "#{22}" "#{44}" "55" "#{66}"]'...'',
772
+ 'assert_equal("22aacd445566", "#{22}aa" "cd#{44}" "55" "#{66}")'...'',
773
+ '"fff#{r}" "#{66}"'...'',
774
+ '"fff#{r}" "#{66}3"'...'',
775
+ '%q[\\[\\]\\\\]'...'"[]\\\\"',
776
+ '%w[\\[\\]\\\\]'...'(array "[]\\\\")',
777
+ '%r[\\[\\]\\\\]'...'/\\[\\]\\\\/',
778
+ '%s[\\[\\]\\\\]'...'',
779
+ '%q"\\"\\\\"'...'"\\"\\\\"',
780
+ '%w"\\"\\\\"'...'(array "\\"\\\\")',
781
+ '%r"\\"\\\\"'...'/"\\\\/',
782
+ '%s"\\"\\\\"'...'',
783
+ "%q'\\'\\\\'"...'"\'\\\\"',
784
+ "%w'\\'\\\\'"...'(array "\'\\\\")',
785
+ "%r'\\'\\\\'"...'/\'\\\\/',
786
+ "%s'\\'\\\\'"...'',
787
+ "'\\'\\\\'"...'"\'\\\\"',
788
+ '0x1134234aefeb'...'18915628085227',
789
+ '0d57896675'...'57896675',
790
+ '0o234526546'...'41069926',
791
+ '0234526546'...'41069926',
792
+ '0b1010001001011111'...'41567',
793
+ '"a"; b'...'"a" (b)',
794
+ "()"...'()',
795
+ "1"...'1',
796
+ "1+1"...'(+ 1 1)',
797
+ "2+3*4"...'(+ 2 (* 3 4))',
798
+ "a"...'(a)',
799
+ "a.b"...'((a) b)',
800
+ "[]"...'[]',
801
+ "[3]"...'[3]',
802
+ "[3,4]"...'[3 4]',
803
+ "list()"...'()',
804
+ "list(3)"...'(3)',
805
+ "list(3,4)"...'(3 4)',
806
+ "b[]"...'((b) [])',
807
+ "b[3]"...'((b) [] 3)',
808
+ "a.b[]"...'(((a) b) [])',
809
+ "a.b[3]"...'(((a) b) [] 3)',
810
+ "a::b[3]"...'(((a) b) [] 3)',
811
+ "a if b"...'(if (b) (a))',
812
+ "a unless b"...'(unless (b) (a))',
813
+ "a while b"...'(while (b) (a))',
814
+ "a until b"...'(until (b) (a))',
815
+ "a and b"...'(and (a) (b))',
816
+ "a or b"...'(or (a) (b))',
817
+ "2**3[4]"...'(** 2 (3 [] 4))',
818
+ "+a[2]"...'(+@ ((a) [] 2))',
819
+ "$a=b"...'(set $a (b))',
820
+ '@a=b'...'(set @a (b))',
821
+ '@@a=b'...'(set @@a (b))',
822
+ 'A=b'...'(set A (b))',
823
+ 'a=b=1'...'(set a (set b 1))',
824
+ '$a+=b'...'(set $a (+ $a (b)))',
825
+ '@a+=b'...'(set @a (+ @a (b)))',
826
+ '@@a+=b'...'(set @@a (+ @@a (b)))',
827
+ 'A+=b'...'(set A (+ A (b)))',
828
+ 'a=b+=1'...'(set a (set b (+ b 1)))',
829
+ 'a+=b=1'...'(set a (+ a (set b 1)))',
830
+ 'a+=b+=1'...'(set a (+ a (set b (+ b 1))))',
831
+ 'a(b)'...'(a (b))',
832
+ 'b=1;a(b)'...'(set b 1) (a b)',
833
+ 'a(*b)'..."(eval (cons 'a ((b) list)))",
834
+ 'a(b,*c)'...'',
835
+ 'a(&b)'...'(a (b))',
836
+ 'a(b,&c)'...'(a (b) (c))',
837
+ 'a(b,c,&c)'...'(a (b) (c) (c))',
838
+ 'a(b,*c,&c)'...'',
839
+ 'a(){b}'...'(a (do () (b)))',
840
+ 'a(b){c}'...'(a (b) (do () (c)))',
841
+ 'a(b,c){c}'...'(a (b) (c) (do () (b)))',
842
+ 'a(b,*c){c}'...'',
843
+ 'a()'...'(a)',
844
+ 'a{b}'...'(a (do () (b)))',
845
+ 'a b{c}'...'(a (b (do () (c))))',
846
+ 'a b,c {c}'...'(a (b (do () (c))))',
847
+ 'a b,*c {c}'...'',
848
+ 'a do b end'...'(a (do () (b)))',
849
+ 'a b do c end'...'(a (b) (do () (c)))',
850
+ 'a b,c do c end'...'(a (b) (c) (do () (b)))',
851
+ 'a b,*c do c end'...'',
852
+ 'a%=b'...'(set a (% a (b)))',
853
+ 'a.b%c'...'(% ((a) b) (c))',
854
+ 'a.b%=c'...'(set _t1* (a)) (_t1* b= (% (_t1* b) (c)))',
855
+ 'a.b.c%=d'...'(set _t1* ((a) b)) (_t1* c= (% (_t1* c) (d)))',
856
+ 'a::b%=c'...'(set _t1* (a)) (_t1* b= (% (_t1* b) (c)))',
857
+ 'a.b[]=d'...'(((a) b) []= (d))',
858
+ 'a.b[c]=d'...'(((a) b) []= (c) (d))', #???
859
+ 'a.b[c,c2]=d'...'(((a) b) []= (c) (c2) (d))',
860
+ # 'a.b[]%=d'...'', #causes segfault with ruby 1.8.5 and ParseTree... fixed in 1.8.6
861
+ 'a.b[c]%=d'...'',
862
+ 'a.b[c,c2]%=d'...'',
863
+ 'a(b).c%=d'...'',
864
+ 'a b c'...'(a (b (c)))',
865
+ 'if a; b end'...'(if (a) (b))',
866
+ 'if a: b end'...'(if (a) (b))',
867
+ 'if a then b end'...'(if (a) (b))',
868
+ 'if a; b else c end'...'(if (a) (b) (else (c)))',
869
+ 'if a; b elsif c; d end'...'',
870
+ 'if a; b elsif c; d else e end'...'',
871
+ 'if a; else c end'...'',
872
+ 'if a; elsif c; d end'...'',
873
+ 'if a; elsif c; d else e end'...'',
874
+ 'if a+0; b end'...'',
875
+ 'if a+0: b end'...'',
876
+ 'if a+0 then b end'...'',
877
+ 'if a+0; b else c end'...'',
878
+ 'if a+0; b elsif c; d end'...'',
879
+ 'if a+0; b elsif c; d else e end'...'',
880
+ 'if a+0; else c end'...'',
881
+ 'if a+0; elsif c; d end'...'',
882
+ 'if a; elsif c; d else e end'...'',
883
+
884
+ 'unless a; b end'...'',
885
+ 'unless a; b else c end'...'',
886
+
887
+ 'while a; b end'...'',
888
+ 'until a; b end'...'',
889
+
890
+ 'case; when b; c end'...'',
891
+ 'case a; when b; c end'...'',
892
+ 'case a; when b: c end'...'',
893
+ 'case a; when b then c end'...'',
894
+ 'case a; when b,c,d then d end'...'',
895
+ 'case a; when b,c,d: d end'...'',
896
+ 'case a; when B,C,D: d end'...'',
897
+
898
+ 'case a; when b; when c; end'...'',
899
+ 'case a; when b; c when d; e end'...'',
900
+ 'case a; when b; c; when d; e end'...'',
901
+ 'case a; when b; c; when d; e else f end'...'',
902
+
903
+ 'for a in b; c end'...'',
904
+ 'for a in b do c end'...'',
905
+ 'for a in b: c end'...'',
906
+ 'for a,b in c: d end'...'',
907
+ 'for a,b in c; d end'...'',
908
+ 'for a,b in c do d end'...'',
909
+
910
+ '(a+b)'...'(+ a b)',
911
+ ';a;2;'...'(a) 2',
912
+ ';1;2;'...'1 2',
913
+ '(;1;2;)'...'1 2',
914
+ '!a'...'',
915
+ '::A'...'',
916
+ ':a'...'',
917
+ 'defined? a'...'',
918
+
919
+ 'a**b**c'...'((a) ** ((b) ** (c)))',
920
+
921
+ '{a=>b}'...'',
922
+ '{A=>b}'...'',
923
+ '{a a=>b}'...'', #syntax error
924
+ '{a+a=>b}'...'',
925
+ '{a()=>b}'...'',
926
+ '{a{}=>b}'...'',
927
+ '{+a=>b}'...'',
928
+ '{-a=>b}'...'',
929
+ '{~a=>b}'...'',
930
+ '{!a=>b}'...'',
931
+ '{::A=>b}'...'',
932
+ '{:a=>b}'...'',
933
+ '{not a=>b}'...'', #syntax error
934
+ '{defined? a=>b}'...'',
935
+ '{1, 2, 2, 4, 3, 6}'...'',
936
+
937
+
938
+ 'begin rescue B; rescue ; end'...'',
939
+ 'begin rescue ; end'...'',
940
+ 'begin; a; rescue; end'...'',
941
+ 'begin; a; rescue B; end'...'',
942
+ 'begin; a; rescue B; d; end'...'',
943
+ 'begin; a; rescue B; d; e; end'...'',
944
+ 'begin; a; rescue B=>c; end'...'',
945
+ 'begin; a; rescue =>c; end'...'',
946
+ 'begin; a; rescue B=>c; d; end'...'',
947
+ 'begin; a; rescue B=>c; d; e; end'...'',
948
+ 'begin; a; rescue B; d; else f; end'...'',
949
+ 'begin; a; rescue B; d; else f; ensure; e; end'...'',
950
+ 'begin; a; rescue B=>c; d; else f; ensure; e; end'...'',
951
+
952
+ 'begin; a; else f; ensure; e; end'...'',
953
+ 'begin; a; b; else f; g ensure; e; end'...'',
954
+ 'begin; a; else f; g ensure; e; end'...'',
955
+ 'begin; a; b; else f ensure; e; end'...'',
956
+
957
+ 'begin end'...'',
958
+ 'begin; end'...'',
959
+ 'begin; else; ensure; end'...'',
960
+ 'begin else ensure end'...'',
961
+
962
+ 'begin a end while b'...'',
963
+ 'begin a end until b'...'',
964
+ 'begin a end while !b'...'',
965
+ 'begin a end until !b'...'',
966
+ 'begin a end while not b'...'',
967
+ 'begin a end until not b'...'',
968
+ 'begin a end while b==c'...'',
969
+ 'begin a end until b==c'...'',
970
+ 'begin a end while b=~c'...'',
971
+ 'begin a end until b=~c'...'',
972
+ 'begin a end while b!=c'...'',
973
+ 'begin a end until b!=c'...'',
974
+ 'begin a end while b!~c'...'',
975
+ 'begin a end until b!~c'...'',
976
+
977
+ 'begin end while b'...'',
978
+ 'begin a;b end while c'...'',
979
+
980
+ 'begin rescue a; b end while c'...'',
981
+ 'begin a; rescue b; c end while d'...'',
982
+ 'begin a;b; rescue c; d end while e'...'',
983
+
984
+ 'begin else a end while b'...'',
985
+ 'begin a; else b end while c'...'',
986
+ 'begin a;b; else c end while d'...'',
987
+
988
+ 'begin ensure a end while b'...'',
989
+ 'begin a; ensure b end while c'...'',
990
+ 'begin a;b; ensure c end while d'...'',
991
+
992
+ 'a+b=c'...'(+ (a) (set b (c)))',
993
+ 'b.c=1'...'((b) c= 1)',
994
+ 'b.c=d'...'((b) c= (d))',
995
+ 'b::c=d'...'((b) c= (d))',
996
+ 'B::c=d'...'(B c= (d))',
997
+ 'a+b.c=d'...'(+ a ((b) c= (d)))',
998
+ 'a+b[c]=d'...'',
999
+ 'a+B::c=d'...'(+ (a) (B c= (d)))',
1000
+
1001
+ 'def b; c end'...'',
1002
+ 'b do c end'...'',
1003
+
1004
+ 'true'...'true',
1005
+ 'false'...'false',
1006
+ 'nil'...'nil',
1007
+ ':foo'...'',
1008
+ '[]'...'',
1009
+ '[a]'...'',
1010
+ '[a,b]'...'',
1011
+ '{}'...'',
1012
+ '{a=>b}'...'',
1013
+ '{a=>b,c=>d}'...'',
1014
+ '0'...'0',
1015
+ '0.0'...'0.0',
1016
+ '$1'...'$1',
1017
+ '$0'...'$0',
1018
+ '$&'...'$&',
1019
+ '$$'...'$$',
1020
+ '$:'...'$:',
1021
+ '$*'...'$*',
1022
+ '$a'...'$a',
1023
+ '@a'...'@a',
1024
+ '@@a'...'@@a',
1025
+ 'a=1;a'...'(set a 1) a',
1026
+ 'proc{yeild}'...'',
1027
+ "'a'"..."",
1028
+ '/a/'...'',
1029
+ '`a`'...'',
1030
+ '%w[a]'...'',
1031
+ '%w[a b]'...'',
1032
+ '%w[a b c]'...'',
1033
+ '%W[a]'...'',
1034
+ '%W[a b]'...'',
1035
+ '%W[a b c]'...'',
1036
+ '%W[a#{}]'...'',
1037
+ '%W[a b#{}]'...'',
1038
+ '%W[a b c#{}]'...'',
1039
+
1040
+ '%[a]'...'"a"',
1041
+ '%[a b]'...'"a b"',
1042
+ '%[a b c]'...'"a b c"',
1043
+ '%q[a]'..."'a'",
1044
+ '%q[a b]'..."'a b'",
1045
+ '%q[a b c]'..."'a b c'",
1046
+ 'self'...'self',
1047
+ '__FILE__'...'',
1048
+ '__LINE__'...'',
1049
+
1050
+ 'while false; break end'...'',
1051
+ 'while false; next end'...'',
1052
+ 'while false; redo end'...'',
1053
+ 'while false; retry end'...'',
1054
+
1055
+ 'while false; break end'...'',
1056
+ 'until false; break end'...'',
1057
+ 'for a in b; break end'...'',
1058
+ 'loop do break end'...'',
1059
+
1060
+ 'loop { break 1,2,*[3,4] }'...'',
1061
+ 'loop { break 1,2 }'...'',
1062
+ 'loop { break 1}'...'',
1063
+ 'loop { break(1)}'...'',
1064
+ 'loop { break }'...'',
1065
+ 'loop { break() }'...'',
1066
+
1067
+ 'while false; break *[3,4] end'...'',
1068
+ 'while false; break 1,2,*[3,4] end'...'',
1069
+ 'while false; break 1,2 end'...'',
1070
+ 'while false; break(1) end'...'',
1071
+
1072
+ 'a.b c'...'((a) b (c))',
1073
+ 'RuntimeError.new()'...'(RuntimeError new)',
1074
+ 'RuntimeError.new("foo")'...'(RuntimeError new "foo")',
1075
+ 'if (true) :foo end'...'',
1076
+ 'raise'...'',
1077
+ 'raise "foo"'...'',
1078
+ 'raise RuntimeError'...'',
1079
+ 'raise RuntimeError,"foo"'...'',
1080
+ 'raise RuntimeError.new("foo")'...'',
1081
+ 'return'...'',
1082
+ 'return a'...'',
1083
+ 'return a,b'...'',
1084
+ 'return a,b,*c'...'',
1085
+
1086
+ 'BEGIN {a}'...'',
1087
+ 'END {a}'...'',
1088
+ 'BEGIN {}'...'',
1089
+ 'END {}'...'',
1090
+ 'BEGIN {a};b'...'',
1091
+ 'END {a};b'...'',
1092
+ 'BEGIN {};a'...'',
1093
+ 'END {};a'...'',
1094
+
1095
+ '"foo" "bar"'...'"foobar"',
1096
+
1097
+ '""'...'""',
1098
+
1099
+ 'loop{break{}}'...'',
1100
+ 'loop{break{a=>b}}'...'',
1101
+ 'def foo; return{} end'...'',
1102
+ 'def foo; return{a=>b} end'...'',
1103
+
1104
+ 'foo do return{} end'...'',
1105
+ 'foo do return{a=>b} end'...'',
1106
+
1107
+ 'a.return'...'((a) return)',
1108
+ 'a.return {}'...'',
1109
+ 'a.break {}'...'',
1110
+ 'a.return {b}'...'',
1111
+ 'a.break {b}'...'',
1112
+ '()'...'()',
1113
+ 'nil;a'...'() (a)',
1114
+ 'true;a'...'(true) (a)',
1115
+ 'false;a'...'(false) (a)',
1116
+ 'self;a'...'(self) (a)',
1117
+ '();a'...'() (a)',
1118
+ '__FILE__;a'...'',
1119
+ '__LINE__;a'...'',
1120
+ '1;a'...'',
1121
+ '"1";a'...'',
1122
+ '"1#{2}";a'...'',
1123
+
1124
+ '~a**2'...'',
1125
+ '!a**2'...'',
1126
+ '+a**2'...'',
1127
+ '-a**2'...'',
1128
+
1129
+ '--a'...'',
1130
+
1131
+ '%W[a#{b}c]'...'',
1132
+ '%W[a #{b}c]'...'',
1133
+ '%W[a#{b} c]'...'',
1134
+ '%W[a #{b} c]'...'',
1135
+
1136
+ '"a b c #{d}"'...'',
1137
+ '"a b c #{d}\n"'...'',
1138
+ '"a b c #{d} "'...'',
1139
+ '"#{a} b c"'...'',
1140
+
1141
+ 'a.BEGIN {}'...'',
1142
+ 'a.END {}'...'',
1143
+
1144
+ 'p??y'...'', #bug in rubylexer 0.6.2, no workaround
1145
+ '1.+?y'...'', #bug in rubylexer 0.6.2, no workaround
1146
+ 'loop{break{}.size}'...'',
1147
+
1148
+ '/a b #{c}/'...'',
1149
+
1150
+ '`a b #{c}`'...'',
1151
+ 'a{}'...'',
1152
+ 'a rescue b and c'...'',
1153
+ 'a rescue b or c'...'',
1154
+ 'a rescue b if c'...'',
1155
+
1156
+ 'def a.b; end'...'',
1157
+ 'a=""; def a.b; end'...'',
1158
+ 'def A.b; end'...'',
1159
+ 'a=""; def (a).b; end'...'',
1160
+ 'a=""; def (a()).b; end'...'',
1161
+ 'a=""; def ("a"+"").b; end'...'',
1162
+ 'def (a.b.c).b; end'...'',
1163
+ 'def (a).b; end'...'',
1164
+
1165
+ 'a.b do end'...'',
1166
+ 'a=""; a.b do end'...'',
1167
+ 'A.b'...'',
1168
+ 'A.b do end'...'',
1169
+ '(a).b'...'',
1170
+ 'a=""; (a).b'...'',
1171
+ '(a).b do end'...'',
1172
+ 'a=""; (a).b do end'...'',
1173
+ 'a=""; (a()).b do end'...'',
1174
+ 'a=""; ("a"+"").b do end'...'',
1175
+ '(a.b.c).b do end'...'',
1176
+ '(a).b do end'...'',
1177
+
1178
+ 'def a b=c,d=e,*f; g end'...'',
1179
+ 'def a b=c,d=e,*f; end'...'',
1180
+ 'def a b=c,d=e,&f; g end'...'',
1181
+ 'def a b=c,d=e,&f; end'...'',
1182
+ 'def a b=c,d=e,*f,&g; h end'...'',
1183
+ 'def a b=c,d=e,*f,&g; end'...'',
1184
+
1185
+ 'a b=c,d=e,*f do g end'...'',
1186
+ 'a b=c,d=e,*f do end'...'',
1187
+ 'a b=c,d=e,&f'...'',
1188
+ 'a b=c,d=e,&f'...'',
1189
+ 'a b=c,d=e,*f,&g'...'',
1190
+ 'a b=c,d=e,*f,&g'...'',
1191
+
1192
+ 'def a b=c,d=e; f end'...'',
1193
+ 'def a b=c,d=e; end'...'',
1194
+ 'def a b=c; end'...'',
1195
+
1196
+ 'a b=c,d=e do f end'...'',
1197
+ 'a b=c,d=e do end'...'',
1198
+ 'a b=c do end'...'',
1199
+
1200
+ 'def a; rescue; b; end'...'',
1201
+ 'def a; else b end'...'',
1202
+ 'def a; ensure b end'...'',
1203
+
1204
+ 'def a; rescue; b; else c end'...'',
1205
+ 'def a; else b; ensure c end'...'',
1206
+ 'def a; rescue; b; ensure c end'...'',
1207
+
1208
+
1209
+ 'def a;d;e; rescue; b; end'...'',
1210
+ 'def a;d;e; else b end'...'',
1211
+ 'def a;d;e; ensure b end'...'',
1212
+
1213
+ 'def a; d;e;rescue; b; else c end'...'',
1214
+ 'def a; d;e;else b; ensure c end'...'',
1215
+ 'def a; d;e;rescue; b; ensure c end'...'',
1216
+
1217
+ 'def a; rescue; b; else c; ensure d end'...'',
1218
+ 'def a; e;f; rescue; b; else c; ensure d end'...'',
1219
+
1220
+ 'def a.b; c end'...'',
1221
+ 'def a.b=; c end'...'',
1222
+ 'def b i=1; c end'...'',
1223
+ 'def a.b i=1; c end'...'',
1224
+ 'def a.b= i=1; c end'...'',
1225
+ 'def a.b=i=1; c end'...'',
1226
+ 'def a.b=(i=1); c end'...'',
1227
+
1228
+ 'a rescue b'...'', #bug in rubylexer 0.6.2, no workaround
1229
+ 'a rescue b.c'...'', #bug in rubylexer 0.6.2, no workaround
1230
+ 'a rescue b;c'...'', #bug in rubylexer 0.6.2, no workaround
1231
+ 'a rescue (b;c)'...'', #bug in rubylexer 0.6.2, no workaround
1232
+
1233
+ '%W[a]'...'',
1234
+ '%W[ a]'...'',
1235
+ '%W[a ]'...'',
1236
+ '%W[ a ]'...'',
1237
+
1238
+ '%W[a#{}]'...'',
1239
+ '%W[ a#{}]'...'',
1240
+ '%W[a #{}]'...'',
1241
+ '%W[ a #{}]'...'',
1242
+
1243
+ "%W[\va#{}]"...'',
1244
+ "%W[\v#{}]"...'',
1245
+
1246
+ '"#{}"'...'', #bug in rubylexer 0.6.2, no workaround
1247
+ "'#{}'"...'', #bug in rubylexer 0.6.2, no workaround
1248
+ '/#{}/'...'', #bug in rubylexer 0.6.2, no workaround
1249
+ '`#{}`'...'', #bug in rubylexer 0.6.2, no workaround
1250
+ '%w"#{}"'...'', #bug in rubylexer 0.6.2, no workaround
1251
+ '%W"#{}"'...'', #bug in rubylexer 0.6.2, no workaround
1252
+ '%W" #{}"'...'', #bug in rubylexer 0.6.2, no workaround
1253
+ '%W"#{} "'...'', #bug in rubylexer 0.6.2, no workaround
1254
+ '%W" #{} "'...'', #bug in rubylexer 0.6.2, no workaround
1255
+ '%q"#{}"'...'', #bug in rubylexer 0.6.2, no workaround
1256
+ '%Q"#{}"'...'', #bug in rubylexer 0.6.2, no workaround
1257
+ '%r"#{}"'...'', #bug in rubylexer 0.6.2, no workaround
1258
+ '%x"#{}"'...'', #bug in rubylexer 0.6.2, no workaround
1259
+ '"#{a}"'...'', #bug in rubylexer 0.6.2, no workaround
1260
+
1261
+ '%w"a"'...'',
1262
+ '%W"a"'...'',
1263
+ '%W"a#{}"'...'',
1264
+ '%W"a #{}"'...'',
1265
+ '%q"a"'...'', #
1266
+ '%Q"a"'...'',
1267
+ '%r"a"'...'',
1268
+ '%x"a"'...'',
1269
+
1270
+ '%W[#{a}]'...'',
1271
+ '%W[#{a} b]'...'',
1272
+ '%W[a #{b}]'...'',
1273
+ '%W[a b #{c}]'...'',
1274
+
1275
+
1276
+ ':"a#{b}"'...'',
1277
+
1278
+ '"a"; b'...'',
1279
+ "'a'; b"...'',
1280
+ '/a/; b'...'',
1281
+ '`a`; b'...'',
1282
+ '%w"a"; b'...'',
1283
+ '%W"a"; b'...'',
1284
+ '"a#{}"; b'...'',
1285
+
1286
+ 'module A; end'...'',
1287
+ 'class A; end'...'',
1288
+ 'class A<B; end'...'',
1289
+ 'class<<a; end'...'',
1290
+
1291
+ 'module A; b end'...'',
1292
+ 'class A; b end'...'',
1293
+ 'class A<B; c end'...'',
1294
+ 'class<<a; b end'...'',
1295
+
1296
+ 'module A; b;c end'...'',
1297
+ 'class A; b;c end'...'',
1298
+ 'class A<B; c;d end'...'',
1299
+ 'class<<a; b;c end'...'',
1300
+
1301
+
1302
+ '/a/i'...'',
1303
+ '/a/m'...'',
1304
+ '/a/o'...'',
1305
+ '/a/x'...'',
1306
+ '/a/imox'...'',
1307
+
1308
+ '/a#{b}/i'...'',
1309
+ '/a#{b}/m'...'',
1310
+ '/a#{b}/o'...'',
1311
+ '/a#{b}/x'...'',
1312
+ '/a#{b}/imox'...'',
1313
+
1314
+ '/a#{b}c/i'...'',
1315
+ '/a#{b}c/m'...'',
1316
+ '/a#{b}c/o'...'',
1317
+ '/a#{b}c/x'...'',
1318
+ '/a#{b}c/imox'...'',
1319
+
1320
+
1321
+ #ellipsis as flow control.. annoying
1322
+ 'a..b'...'',
1323
+ 'a...b'...'',
1324
+ 'a..b and c'...'',
1325
+ 'a..b or c'...'',
1326
+ 'c and a..b and c'...'',
1327
+ 'c or a..b or c'...'',
1328
+
1329
+ 'not a...b'...'',
1330
+ 'not a..b'...'',
1331
+ 'c if a..b'...'',
1332
+ 'c unless a..b'...'',
1333
+ 'c if a..b and c'...'',
1334
+ 'c unless a..b or c'...'',
1335
+ 'c if c and a..b and c'...'',
1336
+ 'c unless c or a..b or c'...'',
1337
+
1338
+ 'not (a..b)'...'',
1339
+ 'not (a..b) and c'...'',
1340
+ 'not z and (a..b) and c'...'',
1341
+ 'not z and (a..b)'...'',
1342
+ 'not z and a..b and c'...'',
1343
+ 'not z and a..b'...'',
1344
+ 'not (z and (a..b) and c)'...'',
1345
+ 'not (z and (a..b))'...'',
1346
+ 'not (z and a..b and c)'...'',
1347
+ 'not (z and a..b)'...'',
1348
+ '!(a..b)'...'',
1349
+ 'c if (a..b)'...'',
1350
+ 'c if ((a..b))'...'',
1351
+ 'c if (((((((((a..b)))))))))'...'',
1352
+ 'c if !(a..b)'...'',
1353
+ 'c if not (a..b)'...'',
1354
+ 'c unless (a..b)'...'',
1355
+ 'c if (a..b) and c'...'',
1356
+ 'c unless (a..b) or c'...'',
1357
+ 'c if c and (a..b) and c'...'',
1358
+ 'c unless c or (a..b) or c'...'',
1359
+ 'z if a || b or c..d'...'',
1360
+ 'z if a || c..d'...'',
1361
+
1362
+
1363
+
1364
+ #regex as flow control.. annoying
1365
+ '/a..b/'...'',
1366
+ '/a...b/'...'',
1367
+ '/a..b/ and c'...'',
1368
+ '/a..b/ or c'...'',
1369
+ 'c and /a..b/ and c'...'',
1370
+ 'c or /a..b/ or c'...'',
1371
+
1372
+ 'not /a...b/'...'',
1373
+ 'not /a..b/'...'',
1374
+ 'c if /a..b/'...'',
1375
+ 'c unless /a..b/'...'',
1376
+ 'c if /a..b/ and c'...'',
1377
+ 'c unless /a..b/ or c'...'',
1378
+ 'c if c and /a..b/ and c'...'',
1379
+ 'c unless c or /a..b/ or c'...'',
1380
+
1381
+ 'not (/a..b/)'...'',
1382
+ 'not (/a..b/) and c'...'',
1383
+ 'not z and (/a..b/) and c'...'',
1384
+ 'not z and (/a..b/)'...'',
1385
+ 'not z and /a..b/ and c'...'',
1386
+ 'not z and /a..b/'...'',
1387
+ 'not (z and (/a..b/) and c)'...'',
1388
+ 'not (z and (/a..b/))'...'',
1389
+ 'not (z and /a..b/ and c)'...'',
1390
+ 'not (z and /a..b/)'...'',
1391
+ '!(/a..b/)'...'',
1392
+ 'c if (/a..b/)'...'',
1393
+ 'c if ((/a..b/))'...'',
1394
+ 'c if (((((((((/a..b/)))))))))'...'',
1395
+ 'c if !(/a..b/)'...'',
1396
+ 'c if not (/a..b/)'...'',
1397
+ 'c unless (/a..b/)'...'',
1398
+ 'c if (/a..b/) and c'...'',
1399
+ 'c unless (/a..b/) or c'...'',
1400
+ 'c if c and (/a..b/) and c'...'',
1401
+ 'c unless c or (/a..b/) or c'...'',
1402
+ 'z if a || b or /c..d/'...'',
1403
+ 'z if a || /c..d/'...'',
1404
+
1405
+ 'a&&b'...'',
1406
+ 'a||b'...'',
1407
+ 'a&&=b'...'',
1408
+ 'a||=b'...'',
1409
+ 'not a and b'...'',
1410
+
1411
+ 'a&&b&&c'...'',
1412
+ 'a||b||c'...'',
1413
+ 'a and b and c'...'',
1414
+ 'a or b or c'...'',
1415
+ 'a and b or c'...'',
1416
+ 'a or b and c'...'',
1417
+ 'a&&b||c'...'',
1418
+ 'a||b&&c'...'',
1419
+
1420
+ 'a!~b'...'',
1421
+ 'a !~ b'...'',
1422
+ 'a=~b'...'',
1423
+ 'z.a=~b'...'',
1424
+ 'a!=b'...'',
1425
+ 'a==b'...'',
1426
+ 'a===b'...'',
1427
+
1428
+ 'a<=>b'...'',
1429
+ 'a<=b'...'',
1430
+ 'a>=b'...'',
1431
+ 'a<b'...'',
1432
+ 'a>b'...'',
1433
+
1434
+ 'a^b'...'',
1435
+ 'a|b'...'',
1436
+ 'a&b'...'',
1437
+
1438
+ 'a>>b'...'',
1439
+ 'a<<b'...'',
1440
+
1441
+ 'a and b && c'...'',
1442
+ 'a && b and c'...'',
1443
+ 'a or b || c'...'',
1444
+ 'a || b or c'...'',
1445
+
1446
+ '(a and b) && c'...'',
1447
+ '(a && b) and c'...'',
1448
+ '(a or b) || c'...'',
1449
+ '(a || b) or c'...'',
1450
+
1451
+ 'a&&(b&&c)'...'',
1452
+ 'a||(b||c)'...'',
1453
+ 'a and (b and c)'...'',
1454
+ 'a or (b or c)'...'',
1455
+
1456
+ 'a&&b'...'',
1457
+ 'a &&b'...'',
1458
+ 'a&& b'...'',
1459
+ 'a && b'...'',
1460
+
1461
+ 'a<<b'...'',
1462
+ # 'a <<b'...'', #here document, tested elsewhere
1463
+ 'a<< b'...'',
1464
+ 'a << b'...'',
1465
+
1466
+ 'if not a; b end'...'',
1467
+ 'unless not a; b end'...'',
1468
+ 'while not a; b end'...'',
1469
+ 'until not a; b end'...'',
1470
+
1471
+ '$a||=b'...'',
1472
+ '@a||=b'...'',
1473
+ '@@a||=b'...'',
1474
+ 'A||=b'...'',
1475
+ 'a.b||=c'...'',
1476
+ 'a[b]||=c'...'',
1477
+ 'def a() end'...'',
1478
+ 'def a(b) c end'...'',
1479
+ 'def a(b=nil) c end'...'',
1480
+ 'a ? b : c'...'',
1481
+ 'a=b=c=1;a ?b:c'...'',
1482
+ 'eof!?nil:true'...'',
1483
+ 'eof!? a: b'...'',
1484
+ 'eof!?a'...'',
1485
+ 'eof??ni : 0'...'',
1486
+ 'eof ?ni : 0'...'',
1487
+ 'eof??n'...'',
1488
+ 'eof ?n'...'',
1489
+
1490
+ 'eof??ni() : 0'...'',
1491
+ 'eof??ni(1) : 0'...'',
1492
+ 'eof??ni(*a) : 0'...'',
1493
+ 'eof??ni(&b) : 0'...'',
1494
+ 'eof??ni{a} : 0'...'',
1495
+ 'eof??ni(a,b,*c,&d) : 0'...'',
1496
+ 'eof??ni(a,b,*c){|d| e} : 0'...'',
1497
+ 'eof??z.ni(a,b,*c){|d| e} : 0'...'', #syntax error
1498
+ 'eof??zz.ni(a,b,*c){|d| e} : 0'...'',
1499
+ 'eof??z0.ni(a,b,*c){|d| e} : 0'...'',
1500
+ 'ni{|| }'...'',
1501
+ 'ni{|b| }'...'',
1502
+ 'ni{|b,c| }'...'',
1503
+ 'ni{|b,c,*d| }'...'',
1504
+ 'ni{|b.c,d[e],*f| }'...'',
1505
+ 'ni{|b.c,d.e,*f| }'...'',
1506
+ 'ni{|b,(c,d),e| }'...'',
1507
+ 'ni{|b,(c,d),*e| }'...'',
1508
+ 'ni{|b,(c,*d),*e| }'...'',
1509
+ 'ni{|b,(c.f,*d),*e| }'...'',
1510
+ 'ni{|b,(c[f],*d),*e| }'...'',
1511
+ 'ni{|b,(c.f,g[h],*d),*e| }'...'',
1512
+
1513
+ 'b,c=z'...'',
1514
+ 'b,c,*d=z'...'',
1515
+ 'b.c,d[e],*f=z'...'',
1516
+ 'b,(c,d),e=z'...'',
1517
+ 'b,(c,d),*e=z'...'',
1518
+ 'b,(c,*d),*e=z'...'',
1519
+ 'b,(c.f,*d),*e=z'...'',
1520
+ 'b,(c[f],*d),*e=z'...'',
1521
+ 'b,(c.f,g[h],*d),*e=z'...'',
1522
+ 'k{b,(i,j,c.f,g[h],*d),*e=z}'...'',
1523
+
1524
+ '::B'...'',
1525
+ 'A::B'...'',
1526
+
1527
+ 'a,b=c,d=e,f'...'',
1528
+ 'a,*b=c,d=e,*f'...'',
1529
+
1530
+ 'a=*b'...'',
1531
+ '*a=b'...'',
1532
+ '*a=*b'...'',
1533
+
1534
+ '*d=e,*f'...'',
1535
+ 'd=e,*f'...'',
1536
+ '*d=e,f'...'',
1537
+ 'd=e,f'...'',
1538
+
1539
+ 'z{|a,*b.c| d}'...'',
1540
+ # 'z{|a,*B::C| d}'...'', #ParseTree 2.1.1 segfault
1541
+ 'z{|a,*b[c]| d}'...'',
1542
+ 'z{|a,*$b| d}'...'',
1543
+ 'z{|a,a[b]| d}'...'',
1544
+ 'z{|a,a[b]| a.c;d}'...'',
1545
+ 'z{|a,c[b],c| a.c;d}'...'',
1546
+ 'a=0;z{|a,a[b]| a.c;d}'...'',
1547
+ 'z{a=0}'...'',
1548
+ 'a,b=c,d'...'',
1549
+ '(a,b)=c,d'...'',
1550
+ '((a,b))=c,d'...'',
1551
+ '(((a,b)))=c,d'...'',
1552
+
1553
+ '%w[]'...'',
1554
+ '%W[]'...'',
1555
+
1556
+ 'alias a b'...'',
1557
+ 'undef a'...'',
1558
+ 'undef a,b'...'',
1559
+ 'undef a,b,c'...'',
1560
+
1561
+ 'alias :a :b'...'',
1562
+ 'undef :a'...'',
1563
+ 'undef :a,:b'...'',
1564
+ 'undef :a,:b,:c'...'',
1565
+
1566
+ 'begin a; rescue b,c,f; d end'...'',
1567
+
1568
+ 'begin a;g; rescue b,c,f; d end'...'',
1569
+
1570
+ #for clause can contain multiple assignment too...
1571
+ 'for a,(b,*c),k,*l in d do e end'...'',
1572
+ 'for *a in d do e end'...'',
1573
+
1574
+ 'f{a=1;g{a=2}}'...'',
1575
+ 'f{a=1;p a;g{a=2; p g}}'...'',
1576
+ 'a=1;f{|a| a}'...'',
1577
+ 'a=1;f{|a,b| a+b}'...'',
1578
+ 'xxx=0; xxx ?111:222'...'',
1579
+ 'xxx=yyy=zzz=0; xxx ?yyy:zzz'...'',
1580
+ %[xxx=0; xxx ?'':"" ]...'',
1581
+
1582
+ '(a,b),c=[1,2],3'...'',
1583
+
1584
+ 'z(1){|a,a[b]| d}'...'',
1585
+
1586
+ 'a,=1'...'',
1587
+ 'a,b,=1'...'',
1588
+ 'a,* =1'...'',
1589
+ 'a,b,* =1'...'',
1590
+
1591
+ 'aa,(a,)=1'...'',
1592
+ 'aa,(a,b,)=1'...'',
1593
+ 'aa,(a,*) =1'...'',
1594
+ 'aa,(a,b,*) =1'...'',
1595
+
1596
+ 'f{|a,|d}'...'',
1597
+ 'f{|a,b,|d}'...'',
1598
+ 'f{|a,*|d}'...'',
1599
+ 'f{|a,b,*|d}'...'',
1600
+
1601
+ 'f{|aa,(a,)|d}'...'',
1602
+ 'f{|aa,(a,b,)|d}'...'',
1603
+ 'f{|aa,(a,*)|d}'...'',
1604
+ 'f{|aa,(a,b,*)|d}'...'',
1605
+ 'for a.b in c do e end'...'',
1606
+ '(*a)=1'...'',
1607
+ '(*a)=b'...'',
1608
+ 'for a in b do end'...'',
1609
+ 'for *a in b do end'...'',
1610
+ 'for (*a) in b do end'...'',
1611
+ 'for (a,) in b do end'...'',
1612
+
1613
+ 'def f(a,b,*); c end'...'',
1614
+
1615
+ ' * =f,g'...'',
1616
+ '(*)=f,g'...'',
1617
+ '(a,)=b'...'',
1618
+
1619
+ 'return(a and b)'...'',
1620
+ 'break(a and b)'...'',
1621
+ 'next(a and b)'...'',
1622
+ 'begin a; rescue b,f: c end'...'',
1623
+ 'begin a; rescue b,f=>g: c end'...'',
1624
+
1625
+ 'begin a;h; rescue b,f: c end'...'',
1626
+ 'begin a;h; rescue b,f=>g: c end'...'',
1627
+
1628
+ 'a ? defined? b : c'...'',
1629
+ 'if defined? b : c end'...'',
1630
+ 'if not b : c end'...'',
1631
+ 'class A::B; end'...'', #ParseTree 2.1.1 gets this wrong... had to quirk it
1632
+
1633
+
1634
+ '"#{a}#{b}"'...'',
1635
+ '"1#{a}2#{b}3"'...'',
1636
+ '"1#{a}2#{b}3" "1#{a}2#{b}3"'...'',
1637
+ '"1#{a}2#{b}" "1#{a}2#{b}3"'...'',
1638
+ '"1#{a}2#{b}3""1#{a}2#{b}3"'...'',
1639
+ '"1#{a}2#{b}""1#{a}2#{b}3"'...'',
1640
+
1641
+ '"1#{a}2#{b}3" "#{a}2#{b}3"'...'',
1642
+ '"1#{a}2#{b}" "#{a}2#{b}3"'...'',
1643
+
1644
+ '"a#{m}a" "b#{n}b"'...'',
1645
+ '"a#{m}a" "bb"'...'',
1646
+ '"aa" "b#{n}b"'...'',
1647
+ '"aa" "bb"'...'',
1648
+ 'a=1;"#{a}"'...'',
1649
+ '"#{A}"'...'',
1650
+ '"#$A"'...'',
1651
+ '"#@A"'...'',
1652
+ '"#@@A"'...'',
1653
+
1654
+ 'p(a and b)'...'', #not legal
1655
+
1656
+ '1..2'...'',
1657
+ 'a if 1..2'...'',
1658
+
1659
+ 'nc=(nextchar unless eof?)'...'',
1660
+ 'super'...'',
1661
+ 'super()'...'',
1662
+ 'super(1)'...'',
1663
+ 'super(1,2)'...'',
1664
+ 'super(1,2,3)'...'',
1665
+ 'super(*a)'...'',
1666
+ 'super(1,*b)'...'',
1667
+ 'super(1,2,*c)'...'',
1668
+ 'super(&a)'...'',
1669
+ 'super(1,&b)'...'',
1670
+ 'super(1,2,&c)'...'',
1671
+ 'super(*a,&b)'...'',
1672
+ 'super(1,*b,&c)'...'',
1673
+ 'super(1,2,*c,&d)'...'',
1674
+ 'a.super'...'',
1675
+ 'a.super()'...'',
1676
+ 'a.super(1)'...'',
1677
+ 'a.super(1,2)'...'',
1678
+ 'a.super(1,2,3)'...'',
1679
+ 'a.super(*a)'...'',
1680
+ 'a.super(1,*b)'...'',
1681
+ 'a.super(1,2,*c)'...'',
1682
+ 'a.super(&a)'...'',
1683
+ 'a.super(1,&b)'...'',
1684
+ 'a.super(1,2,&c)'...'',
1685
+ 'a.super(*a,&b)'...'',
1686
+ 'a.super(1,*b,&c)'...'',
1687
+ 'a.super(1,2,*c,&d)'...'',
1688
+
1689
+ 'yield'...'',
1690
+ 'yield()'...'',
1691
+ 'yield(1)'...'',
1692
+ 'yield(1,2)'...'',
1693
+ 'yield(1,2,3)'...'',
1694
+ 'yield(*a)'...'',
1695
+ 'yield(1,*b)'...'',
1696
+ 'yield(1,2,*c)'...'',
1697
+ #ruby 1.9
1698
+ # 'yield(&a)'...'',
1699
+ # 'yield(1,&b)'...'',
1700
+ # 'yield(1,2,&c)'...'',
1701
+ # 'yield(*a,&b)'...'',
1702
+ # 'yield(1,*b,&c)'...'',
1703
+ # 'yield(1,2,*c,&d)'...'',
1704
+ 'a.yield'...'',
1705
+ 'a.yield()'...'',
1706
+ 'a.yield(1)'...'',
1707
+ 'a.yield(1,2)'...'',
1708
+ 'a.yield(1,2,3)'...'',
1709
+ 'a.yield(*a)'...'',
1710
+ 'a.yield(1,*b)'...'',
1711
+ 'a.yield(1,2,*c)'...'',
1712
+ 'a.yield(&a)'...'',
1713
+ 'a.yield(1,&b)'...'',
1714
+ 'a.yield(1,2,&c)'...'',
1715
+ 'a.yield(*a,&b)'...'',
1716
+ 'a.yield(1,*b,&c)'...'',
1717
+ 'a.yield(1,2,*c,&d)'...'',
1718
+
1719
+ 'return'...'',
1720
+ 'return()'...'',
1721
+ 'return(1)'...'',
1722
+ 'return 1'...'',
1723
+ 'break'...'',
1724
+ 'break()'...'',
1725
+ 'break(1)'...'',
1726
+ 'break 1'...'',
1727
+ 'next'...'',
1728
+ 'next()'...'',
1729
+ 'next(1)'...'',
1730
+ 'next 1'...'',
1731
+
1732
+ #these aren't legal with parens around param list
1733
+ 'return 1,2'...'',
1734
+ 'return 1,2,3'...'',
1735
+ 'return *a '...'',
1736
+ 'return 1,*b'...'',
1737
+ 'return 1,2,*c'...'',
1738
+ 'break 1,2'...'',
1739
+ 'break 1,2,3'...'',
1740
+ 'break *a '...'',
1741
+ 'break 1,*b'...'',
1742
+ 'break 1,2,*c'...'',
1743
+ 'next 1,2'...'',
1744
+ 'next 1,2,3'...'',
1745
+ 'next *a '...'',
1746
+ 'next 1,*b'...'',
1747
+ 'next 1,2,*c'...'',
1748
+
1749
+ 'a.return'...'',
1750
+ 'a.return()'...'',
1751
+ 'a.return(1)'...'',
1752
+ 'a.return(1,2)'...'',
1753
+ 'a.return(1,2,3)'...'',
1754
+ 'a.return(*a)'...'',
1755
+ 'a.return(1,*b)'...'',
1756
+ 'a.return(1,2,*c)'...'',
1757
+ 'a.return(&a)'...'',
1758
+ 'a.return(1,&b)'...'',
1759
+ 'a.return(1,2,&c)'...'',
1760
+ 'a.return(*a,&b)'...'',
1761
+ 'a.return(1,*b,&c)'...'',
1762
+ 'a.return(1,2,*c,&d)'...'',
1763
+
1764
+ 'a.break'...'',
1765
+ 'a.break()'...'',
1766
+ 'a.break(1)'...'',
1767
+ 'a.break(1,2)'...'',
1768
+ 'a.break(1,2,3)'...'',
1769
+ 'a.break(*a)'...'',
1770
+ 'a.break(1,*b)'...'',
1771
+ 'a.break(1,2,*c)'...'',
1772
+ 'a.break(&a)'...'',
1773
+ 'a.break(1,&b)'...'',
1774
+ 'a.break(1,2,&c)'...'',
1775
+ 'a.break(*a,&b)'...'',
1776
+ 'a.break(1,*b,&c)'...'',
1777
+ 'a.break(1,2,*c,&d)'...'',
1778
+
1779
+ 'a.next'...'',
1780
+ 'a.next()'...'',
1781
+ 'a.next(1)'...'',
1782
+ 'a.next(1,2)'...'',
1783
+ 'a.next(1,2,3)'...'',
1784
+ 'a.next(*a)'...'',
1785
+ 'a.next(1,*b)'...'',
1786
+ 'a.next(1,2,*c)'...'',
1787
+ 'a.next(&a)'...'',
1788
+ 'a.next(1,&b)'...'',
1789
+ 'a.next(1,2,&c)'...'',
1790
+ 'a.next(*a,&b)'...'',
1791
+ 'a.next(1,*b,&c)'...'',
1792
+ 'a.next(1,2,*c,&d)'...'',
1793
+ '[*a]'...'',
1794
+ '[a,*b]'...'',
1795
+ '[a,b,*c]'...'',
1796
+ 'a="0";class<<a; b end'...'',
1797
+ 'k=Hash;class CornedBeef<k; end'...'',
1798
+ 'a+b'...'',
1799
+ 'a +b'...'',
1800
+ 'a+ b'...'',
1801
+ 'a + b'...'',
1802
+ 'a-b'...'',
1803
+ 'a -b'...'',
1804
+ 'a- b'...'',
1805
+ 'a - b'...'',
1806
+ 'a*b'...'',
1807
+ 'a *b'...'',
1808
+ 'a* b'...'',
1809
+ 'a * b'...'',
1810
+ 'a&b'...'',
1811
+ 'a &b'...'',
1812
+ 'a& b'...'',
1813
+ 'a & b'...'',
1814
+
1815
+ 'A::B'...'',
1816
+ 'A ::B'...'',
1817
+ 'A:: B'...'',
1818
+ 'A :: B'...'',
1819
+
1820
+ 'a(&b)'...'',
1821
+ '/[}]/'...'',
1822
+ '%{\}}'...'',
1823
+ '/\}/'...'',
1824
+ '/\@/'...'',
1825
+ '/\y/'...'',
1826
+ '/\ /x'...'',
1827
+ '"\}"'...'',
1828
+ 'i?::R'...'',
1829
+ 'i? ::R'...'',
1830
+ 'i? +R'...'',
1831
+ 'i? -R'...'',
1832
+ 'i? *R'...'',
1833
+ 'i? &R'...'',
1834
+ '%w[\|\|]'...'',
1835
+ '%W[\|\|]'...'',
1836
+ '%x[\|\|]'...'',
1837
+ '%s[\|\|]'...'',
1838
+ '%q[\|\|]'...'',
1839
+ '%Q[\|\|]'...'',
1840
+ '%r[\|\|]'...'',
1841
+
1842
+ 'def evaluate rule; rescue Exception; puts ""; end'...'',
1843
+ 'def evaluate rule; foo; rescue Exception; puts ""; end'...'',
1844
+ 'def evaluate rule; foo; rescue Exception=>e; puts e; end'...'',
1845
+ 'def evaluate rule; foo; rescue RX; f(g); rescue Exception=>e; puts e; end'...'',
1846
+ 'def evaluate rule; foo; rescue RX; f(g); rescue Exception=>e; puts e; else k end'...'',
1847
+
1848
+ 'def evaluate rule; foo; bar;rescue Exception; puts ""; end'...'',
1849
+ 'def evaluate rule; foo; bar;rescue Exception=>e; puts e; end'...'',
1850
+ 'def evaluate rule; foo; bar;rescue RX; f(g); rescue Exception=>e; puts e; end'...'',
1851
+ 'def evaluate rule; foo; bar;rescue RX; f(g); rescue Exception=>e; puts e; else k end'...'',
1852
+ 'def a(b,c,d,e=f,g=h,*i,&j) k;l;m rescue n; rescue o,p,q=>r: s; rescue t; u; rescue; v else w ensure x end'...'',
1853
+ 'begin k;l;m rescue n; rescue o,p,q=>r: s; rescue t; u; rescue; v else w ensure x end'...'',
1854
+
1855
+ '%w[ ]'...'',
1856
+ '%W[ ]'...'',
1857
+ '%w[\ ]'...'',
1858
+ '%W[\ ]'...'',
1859
+ '%w[\ ]'...'',
1860
+ '%W[\ ]'...'',
1861
+ '%W[\n]'...'',
1862
+ '%W[\q]'...'',
1863
+
1864
+
1865
+ '%W[ #{}]'...'',
1866
+ '%W[\ #{}]'...'',
1867
+ '%W[\ #{}]'...'',
1868
+ '%W[\n#{}]'...'',
1869
+ '%W[\q#{}]'...'',
1870
+
1871
+ '%[\"]'...'',
1872
+ '%W[\"]'...'',
1873
+ '%W[\C-a]'...'',
1874
+ '%W[\"#{}]'...'',
1875
+ '%W[\C-a#{}]'...'',
1876
+ '"\M-\M-\M-\M-\c4"'...'',
1877
+ '"\M-\M-\M-\M-\M-4"'...'',
1878
+ '"\M-\C-4"' ...'',
1879
+ '"\C-\M-4"'...'',
1880
+ '"\\C-\\C-\\C-\\c\\C-a"'...'',
1881
+ '"\c6"'...'',
1882
+ ':"y"'...'',
1883
+ ':"y?"'...'',
1884
+ ':"y!"'...'',
1885
+ ':"y="'...'',
1886
+ ':"\y"'...'',
1887
+ ':"\\y"'...'',
1888
+ ':"\\\\y"'...'',
1889
+ ':"y\""'...'',
1890
+ '%{\\C-\\\\}'...'',
1891
+ '%{\\C-\\}}'...'',
1892
+ '%{\\C-\\{}'...'',
1893
+ '%{\\C-\\"}'...'',
1894
+ '%{\\C-"}'...'',
1895
+ '"\\C-\\""'...'',
1896
+ ":'\\\\'"...'',
1897
+ '%W[\\#]'...'',
1898
+ '%W[\\"]'...'',
1899
+ '%W[\\\\]'...'',
1900
+ '%W[\\##{}]'...'',
1901
+ '%W[\\"#{}]'...'',
1902
+ '%W[\\\\#{}]'...'',
1903
+
1904
+ '"\\\\M-\\C-?"'...'',
1905
+ '"\\C-?"'...'',
1906
+
1907
+ "%w[\\\v]"...'',
1908
+ "%W[\\\v]"...'',
1909
+ "%W[\\\v#{}]"...'',
1910
+ "%w[\v]"...'',
1911
+ "%W[\v]"...'',
1912
+ "%W[\v#{}]"...'',
1913
+
1914
+ '+?c'...'',
1915
+ '+:s'...'',
1916
+ '+%s{s}'...'',
1917
+ '+/r/'...'',
1918
+ '+%r{r}'...'',
1919
+ '+:"s"'...'',
1920
+ "+:'s'"...'',
1921
+
1922
+ '+/r#{1}/'...'',
1923
+ '+%r{r#{1}}'...'',
1924
+ '+:"s#{1}"'...'',
1925
+
1926
+ '+ ?c'...'',
1927
+ '+ :s'...'',
1928
+ '+ %s{s}'...'',
1929
+ '+ /r/'...'',
1930
+ '+ %r{r}'...'',
1931
+ '+ :"s"'...'',
1932
+ "+ :'s'"...'',
1933
+
1934
+ '+ /r#{1}/'...'',
1935
+ '+ %r{r#{1}}'...'',
1936
+ '+ :"s#{1}"'...'',
1937
+
1938
+ '+1'...'',
1939
+ '+ 1'...'',
1940
+ 'def a; 0..0 end'...'',
1941
+
1942
+ '0.0;a'...'',
1943
+ '0..0;a'...'',
1944
+ '0...0;a'...'',
1945
+
1946
+ '+++++++++++1'...'',
1947
+ '+++++++++++-1'...'',
1948
+ '++++++-+++++1'...'',
1949
+ '-+++++++++++1'...'',
1950
+ '--1'...'',
1951
+ '- 1'...'',
1952
+ '"\C-""'...'',
1953
+ '+/reg#{exp}/'...'',
1954
+ '?\C-\?'...'',
1955
+ '?\C-?'...'',
1956
+ 'a=b rescue c'...'',
1957
+ 'a=b=d rescue c'...'',
1958
+ '(a=b) rescue c'...'',
1959
+ 'a.d=b rescue c'...'',
1960
+ 'a[d]=b rescue c'...'',
1961
+ # 'A::D=b rescue c'...'', #segfaults ParseTree 2.1.1
1962
+ 'a,=b rescue c'...'',
1963
+ 'a,* =b rescue c'...'',
1964
+ 'a,d=b rescue c'...'',
1965
+ 'a,*d=b rescue c'...'',
1966
+ '(a,)=b rescue c'...'',
1967
+ '(a,*)=b rescue c'...'',
1968
+ '(a,d)=b rescue c'...'',
1969
+ '(a,*d)=b rescue c'...'',
1970
+
1971
+ '*a=b rescue c'...'',
1972
+ 'a=*b rescue c'...'',
1973
+ 'a=b,d rescue c'...'',
1974
+ 'a+=b rescue c'...'',
1975
+ '"#{__FILE__}"'...'',
1976
+ '"#{__LINE__}"'...'',
1977
+ '"#{nil}"'...'',
1978
+ '"#{true}"'...'',
1979
+ '"#{false}"'...'',
1980
+ '"#{self}"'...'',
1981
+ '"#{()}"'...'',
1982
+ '"sdfe#{g5}4t#{(((((__FILE__)))))}dfsd#{g}"'...'',
1983
+ '"#{"foo"}"'...'',
1984
+ '"#{("foo")}"'...'',
1985
+ '"#{"foo"}bar#{baz}"'...'',
1986
+
1987
+ 'begin; a; rescue b; end; c'...'',
1988
+ 'if begin; a; rescue b; end then c end'...'',
1989
+ 'while begin; a; rescue b; end ; end'...'',
1990
+ 'begin; m; rescue begin; a; rescue b; end: end'...'',
1991
+ 'begin; m; rescue begin; a; rescue b; end,o: end'...'',
1992
+ 'def l; m; rescue begin; a; rescue b; end: end'...'',
1993
+ 'def l; m; rescue begin; a; rescue b; end,o: end'...'',
1994
+ 'for i in begin; a; rescue b; end do gf end'...'',
1995
+ 'def m n=begin; a; rescue b; end; end'...'',
1996
+ 'def (begin; a; rescue b; end).m; end'...'',
1997
+ 'def ((begin; a; rescue b; end)).m; end'...'',
1998
+ 'begin; a; rescue b; end.m'...'',
1999
+ '(begin; a; rescue b; end).m'...'',
2000
+ 'c=begin; a; rescue b; end'...'',
2001
+ 'c+=begin; a; rescue b; end'...'',
2002
+ 'p begin; a; rescue b; end'...'',
2003
+ 'p(begin; a; rescue b; end)'...'',
2004
+ 'c=begin; a; rescue b; end,0'...'',
2005
+ 'c=0,begin; a; rescue b; end'...'',
2006
+ 'c=0,begin; a; rescue b; end,0'...'',
2007
+ '[begin; a; rescue b; end]'...'',
2008
+ '{begin; a; rescue b; end=>m}'...'',
2009
+ '{m=>begin; a; rescue b; end}'...'',
2010
+ 'begin; a; rescue b; end+m'...'',
2011
+ 'm+begin; a; rescue b; end'...'',
2012
+ '+begin; a; rescue b; end'...'',
2013
+ '-begin; a; rescue b; end'...'',
2014
+ '~begin; a; rescue b; end'...'',
2015
+ 'p(*begin; a; rescue b; end)'...'',
2016
+ 'p(&begin; a; rescue b; end)'...'',
2017
+ 'begin; a; rescue b; end ? m : n'...'',
2018
+ 'm rescue begin; a; rescue b; end'...'',
2019
+ 'm > begin; a; rescue b; end'...'',
2020
+ 'm < begin; a; rescue b; end'...'',
2021
+ 'm >= begin; a; rescue b; end'...'',
2022
+ 'm <= begin; a; rescue b; end'...'',
2023
+ 'm <=> begin; a; rescue b; end'...'',
2024
+ 'm === begin; a; rescue b; end'...'',
2025
+ 'm == begin; a; rescue b; end'...'',
2026
+ 'm = begin; a; rescue b; end'...'',
2027
+ 'm % begin; a; rescue b; end'...'',
2028
+ 'm %= begin; a; rescue b; end'...'',
2029
+ 'm >> begin; a; rescue b; end'...'',
2030
+ 'm << begin; a; rescue b; end'...'',
2031
+ 'm >>= begin; a; rescue b; end'...'',
2032
+ 'm <<= begin; a; rescue b; end'...'',
2033
+ 'm **= begin; a; rescue b; end'...'',
2034
+ 'm *= begin; a; rescue b; end'...'',
2035
+ 'm /= begin; a; rescue b; end'...'',
2036
+ 'm -= begin; a; rescue b; end'...'',
2037
+ 'm += begin; a; rescue b; end'...'',
2038
+ 'm ^= begin; a; rescue b; end'...'',
2039
+ 'm &= begin; a; rescue b; end'...'',
2040
+ 'm |= begin; a; rescue b; end'...'',
2041
+ 'm &&= begin; a; rescue b; end'...'',
2042
+ 'm ||= begin; a; rescue b; end'...'',
2043
+ 'm * begin; a; rescue b; end'...'',
2044
+ 'm ** begin; a; rescue b; end'...'',
2045
+ 'm / begin; a; rescue b; end'...'',
2046
+ 'm - begin; a; rescue b; end'...'',
2047
+ 'm + begin; a; rescue b; end'...'',
2048
+ 'm ^ begin; a; rescue b; end'...'',
2049
+ 'm & begin; a; rescue b; end'...'',
2050
+ 'm | begin; a; rescue b; end'...'',
2051
+
2052
+ 'm ; begin; a; rescue b; end'...'',
2053
+ 'begin; a; rescue b; end ; m'...'',
2054
+ 'begin; a; rescue b; end if m'...'',
2055
+ 'begin; a; rescue b; end while m'...'',
2056
+ 'begin begin; a; rescue b; end end'...'',
2057
+ 'begin; a; rescue b; end[m]'...'',
2058
+ 'begin; a; rescue b; end[m]=n'...'',
2059
+ 'begin; a; rescue b; end.each'...'',
2060
+
2061
+
2062
+ 'm ? begin; a; rescue b; end : nil'...'',
2063
+ 'm ? nil : begin; a; rescue b; end'...'',
2064
+ 'm && begin; a; rescue b; end'...'',
2065
+ 'm and begin; a; rescue b; end'...'',
2066
+ 'm or begin; a; rescue b; end'...'',
2067
+ 'm || begin; a; rescue b; end'...'',
2068
+
2069
+ 'm ? !begin; a; rescue b; end : nil'...'',
2070
+ 'm ? nil : !begin; a; rescue b; end'...'',
2071
+ 'm && !begin; a; rescue b; end'...'',
2072
+ 'm and !begin; a; rescue b; end'...'',
2073
+ 'm or !begin; a; rescue b; end'...'',
2074
+ 'm || !begin; a; rescue b; end'...'',
2075
+
2076
+ 'm ? (begin; a; rescue b; end) : nil'...'',
2077
+ 'm ? nil : (begin; a; rescue b; end)'...'',
2078
+ 'm && (begin; a; rescue b; end)'...'',
2079
+ 'm and (begin; a; rescue b; end)'...'',
2080
+ 'm or (begin; a; rescue b; end)'...'',
2081
+ 'm || (begin; a; rescue b; end)'...'',
2082
+
2083
+ 'begin; a; rescue b; end and m'...'',
2084
+ 'begin; a; rescue b; end && m'...'',
2085
+ 'begin; a; rescue b; end or m'...'',
2086
+ 'begin; a; rescue b; end || m'...'',
2087
+ 'not begin; a; rescue b; end'...'',
2088
+ '!begin; a; rescue b; end'...'',
2089
+ 'if m; n; elsif begin; a; rescue b; end then o end'...'',
2090
+ 'begin; a; rescue b; end if m'...'',
2091
+ 'm if begin; a; rescue b; end'...'',
2092
+ 'm unless begin; a; rescue b; end'...'',
2093
+ 'm while begin; a; rescue b; end'...'',
2094
+ 'm until begin; a; rescue b; end'...'',
2095
+ 'case m; when begin; a; rescue b; end; j; when n; o end'...'',
2096
+ 'case m; when begin; a; rescue b; end,k; j; when n; o end'...'',
2097
+ 'case m; when k,begin; a; rescue b; end; j; when n; o end'...'',
2098
+ 'case m; when k,begin; a; rescue b; end,k; j; when n; o end'...'',
2099
+ '"#{begin; a; rescue b; end}"'...'',
2100
+ '"foo#{(__FILE__)}quux#{"biff"}" "baz"'...'',
2101
+ '"foo#{("bar")}quux#{"biff"}" "baz"'...'',
2102
+ '"foo#{"bar"}quux#{"biff"}" "baz"'...'',
2103
+ '"foo#{bar}quux#{"biff"}" "baz"'...'',
2104
+ '"foo#{bar}quux#{biff}" "baz"'...'',
2105
+ '"foo#{bar}quux" "baz"'...'',
2106
+ '"foo#{"bar"}" "baz"'...'',
2107
+ '"foo" "bar#{}" "baz"'...'',
2108
+ 'p(&a.b)'...'',
2109
+ 'p(*a+b)'...'',
2110
+ 'm &begin; a; rescue b; end'...'',
2111
+ 'm *begin; a; rescue b; end'...'',
2112
+ 'm(&begin; a; rescue b; end)'...'',
2113
+ 'm(*begin; a; rescue b; end)'...'',
2114
+ 'm=*begin; a; rescue b; end'...'',
2115
+ 'p begin; a; rescue b; end=>d'...'',
2116
+ 'p d=>begin; a; rescue b; end'...'',
2117
+ 'p d=>b'...'',
2118
+ 'p d=>b,*h'...'',
2119
+ 'p a,b,d=>b,*h,&g'...'',
2120
+ 'p d=>b,*h,&g'...'',
2121
+ 'p d=>b,&g'...'',
2122
+ 'p(a,b,d=>b,*h){g}'...'',
2123
+ 'p(d=>b,*h){g}'...'',
2124
+ 'p(d=>b){g}'...'',
2125
+ 'p a,b,d=>b,*h do g end'...'',
2126
+ 'p d=>b,*h do g end'...'',
2127
+ 'p d=>b do g end'...'',
2128
+ '"#{""}"'...'',
2129
+ '%[a#{"b"}c#{__FILE__}e#{"f"}]'...'',
2130
+ '/a#{"b"}c#{__FILE__}e#{"f"}/'...'',
2131
+ '/a#{"b"}c#{__FILE__}e#{"f"}/o'...'',
2132
+ '`a#{"b"}c#{__FILE__}e#{"f"}`'...'',
2133
+ '%W[a#{"b"}c#{__FILE__}e#{"f"}]'...'',
2134
+ ':"s#{1}"'...'',
2135
+ 'while a; end'...'',
2136
+ 'while a: end'...'',
2137
+ 'while a do end'...'',
2138
+ '%W[a#{"b"}c]'...'',
2139
+ '%W[a#{"b"}]'...'',
2140
+ '%W[#{"b"}c]'...'',
2141
+ '%W[a#{" b "}]'...'',
2142
+ 'a[b=>c]'...'',
2143
+ 'a[b=>c,*d]'...'',
2144
+ 'a[*b]'...'',
2145
+ 'a[b=>c]=d'...'',
2146
+ 'a[b=>c,*d]=e'...'',
2147
+ 'a[*b]=c'...'',
2148
+
2149
+ 'a[z,b=>c]'...'',
2150
+ 'a[z,b=>c,*d]'...'',
2151
+ 'a[z,*b]'...'',
2152
+ 'a[z,b=>c]=d'...'',
2153
+ 'a[z,b=>c,*d]=e'...'',
2154
+ 'a[z,*b]=c'...'',
2155
+
2156
+ 'a[y,z,b=>c]'...'',
2157
+ 'a[y,z,b=>c,*d]'...'',
2158
+ 'a[y,z,*b]'...'',
2159
+ 'a[y,z,b=>c]=d'...'',
2160
+ 'a[y,z,b=>c,*d]=e'...'',
2161
+ 'a[y,z,*b]=c'...'',
2162
+
2163
+
2164
+ 'a[b=>c]+=d'...'',
2165
+ 'a[b=>c,*d]+=e'...'',
2166
+ 'a[*b]+=c'...'',
2167
+ 'a[z,*b]+=c'...'',
2168
+ 'a[y,z,*b]+=c'...'',
2169
+
2170
+ 'a[b=>c]||=d'...'',
2171
+ 'a[b=>c,*d]||=e'...'',
2172
+ 'a[*b]||=c'...'',
2173
+ 'a[z,*b]||=c'...'',
2174
+ 'a[y,z,*b]||=c'...'',
2175
+
2176
+ 'a[b=>c],z=d'...'',
2177
+ 'a[b=>c,*d],z=e'...'',
2178
+ 'a[*b],z=c'...'',
2179
+ 'a[z,*b],z=c'...'',
2180
+ 'a[y,z,*b],z=c'...'',
2181
+
2182
+ 'a[b=>c],z=d,y'...'',
2183
+ 'a[b=>c,*d],z=e,y'...'',
2184
+ 'a[*b],z=c,y'...'',
2185
+ 'a[z,*b],z=c,y'...'',
2186
+ 'a[y,z,*b],z=c,y'...'',
2187
+
2188
+ '*a[b=>c]=d'...'',
2189
+ '*a[b=>c,*d]=e'...'',
2190
+ '*a[*b]=c'...'',
2191
+ '*a[z,*b]=c'...'',
2192
+ '*a[y,z,*b]=c'...'',
2193
+
2194
+
2195
+ 'm,*a[b=>c]=d'...'',
2196
+ 'm,*a[b=>c,*d]=e'...'',
2197
+ 'm,*a[*b]=c'...'',
2198
+ 'm,*a[z,*b]=c'...'',
2199
+ 'm,*a[y,z,*b]=c'...'',
2200
+
2201
+ 'm,(a[b=>c],)=d'...'',
2202
+ 'm,(a[b=>c,*d],)=e'...'',
2203
+ 'm,(a[*b],)=c'...'',
2204
+ 'm,(a[z,*b],)=c'...'',
2205
+ 'm,(a[y,z,*b],)=c'...'',
2206
+
2207
+ 'for a[b=>c] in d do end'...'',
2208
+ 'for a[b=>c,*d] in e do end'...'',
2209
+ 'for a[*b] in c do end'...'',
2210
+ 'for a[z,*b] in c do end'...'',
2211
+ 'for a[y,z,*b] in c do end'...'',
2212
+
2213
+ 'm{|a[b=>c]| d}'...'',
2214
+ 'm{|a[b=>c,*d]| e}'...'',
2215
+ 'm{|a[*b]| c}'...'',
2216
+ 'm{|a[z,*b]| c}'...'',
2217
+ 'm{|a[y,z,*b]| c}'...'',
2218
+
2219
+
2220
+ 'm{|(a[b=>c],)| d}'...'',
2221
+ 'm{|(a[b=>c,*d,)]| e}'...'',
2222
+ 'm{|(a[*b],)| c}'...'',
2223
+ 'm{|(a[z,*b],)| c}'...'',
2224
+ 'm{|(a[y,z,*b],)| c}'...'',
2225
+
2226
+
2227
+
2228
+
2229
+
2230
+ '[b=>c]'...'',
2231
+ '[b=>c,d=>e]'...'',
2232
+ '[*b]'...'',
2233
+
2234
+ '[z,*b]'...'',
2235
+
2236
+ '[y,z,*b]'...'',
2237
+ 'def a; l=if b; else; end; super *l; end'...'',
2238
+ 'def a; super *c; end'...'',
2239
+ 'def a; super b,*c; end'...'',
2240
+ 'super *c'...'',
2241
+ 'super b,*c'...'',
2242
+ 'yield *c'...'',
2243
+ 'yield b,*c'...'',
2244
+ 'break *c'...'',
2245
+ 'break b,*c'...'',
2246
+ 'next *c'...'',
2247
+ 'next b,*c'...'',
2248
+ ' T.c[:u]=w'...'',
2249
+ 'next a,b,*c do d end'...'',
2250
+ 'yield a,b,*c do d end'...'',
2251
+ 'break a,b,*c do d end'...'',
2252
+ 'super a,b,*c do d end'...'',
2253
+ 'return a,b,*c do d end'...'',
2254
+ 'm{|(a[b],t)| c }'...'',
2255
+ 'm{|(a[b],)| c }'...'',
2256
+ 'm{|(a[],)| c }'...'',
2257
+ 'z[begin; a; rescue b; end]'...'',
2258
+ 'z[begin; a; rescue b; end]=c'...'',
2259
+ 'z[begin; a; rescue b; end]=*c'...'',
2260
+ '*z[begin; a; rescue b; end]=*c'...'',
2261
+ '(z[begin; a; rescue b; end],)=c'...'',
2262
+ '(z[begin; a; rescue b; end],*)=c'...'',
2263
+ '(z[begin; a; rescue b; end],*f),g=c'...'',
2264
+
2265
+ 'y{|z[begin; a; rescue b; end]|c}'...'',
2266
+ '(size-1).downto(0){|i| expr=self[i]}'...'',
2267
+ 'self[]'...'',
2268
+ 'self[a]'...'',
2269
+ 'self[]=b'...'',
2270
+ 'self[a]=b'...'',
2271
+ 'm{|(a,)| }'...'',
2272
+ 'm{|(a,b)| }'...'',
2273
+ 'for (a,) in b do c end'...'',
2274
+ 'm{|a,| }'...'',
2275
+ 'for a, in b do c end'...'',
2276
+ 'm{|((a,),),j| }'...'',
2277
+ 'm{|((a,)),j| }'...'',
2278
+ 'm{|(*h)| }'...'',
2279
+ 'def (@@foo=bar).baz; quux end'...'',
2280
+ 'def a; @@b=c; end'...'',
2281
+ 'def a.b; @@c=d; end'...'',
2282
+
2283
+ 'def a(b=(@@foo=bar)) end'...'',
2284
+ 'def a(b=@@foo=bar) end'...'',
2285
+ 'def a b=@@foo=bar; end'...'',
2286
+ 'a[-b]'...'',
2287
+ '//!~a'...'',
2288
+ '%w(1067595299 955945823 477289528 4107218783 4228976476)'...'',
2289
+
2290
+ 'break if /vt100/ =~ line'...'',
2291
+ 'b if /vt100/ =~ line'...'',
2292
+ '/vt100/ =~ line and f'...'',
2293
+ '/vt100/ =~ line'...'',
2294
+ 'BEGIN{a=1};a'...'',
2295
+ 'proc{ BEGIN{a=1};a }'...'',
2296
+ 'END{ BEGIN{a=1};a }'...'',
2297
+ 'proc{ proc{ BEGIN{a=1};a } }'...'',
2298
+ 'END{a=1};a'...'',
2299
+ 'proc{ END{a=1};a }'...'',
2300
+ 'BEGIN{ END{a=1};a }'...'',
2301
+ 'proc{ proc{ END{a=1};a } }'...'',
2302
+ 'def mo4(a, *b, &c) end'...'',
2303
+ 'assert_equal "\177\377\377\377", [-2**31-1].pack("N")'...'',
2304
+ 'def tt3(&b) tt2(&b) end'...'',
2305
+ 'def tt3(&b) end'...'',
2306
+ 'def self.defin(foo) end'...'',
2307
+ 'def self.defin?(foo) end'...'',
2308
+ 'def self.defined?(foo) end'...'',
2309
+ 'def x.defin(foo) end'...'',
2310
+ 'def x.defin?(foo) end'...'',
2311
+ 'def x.defined?(foo) end'...'',
2312
+ 'def defined?(foo) end'...'',
2313
+
2314
+ 'def self.defin(foo) hh end'...'',
2315
+ 'def self.defin?(foo) hh end'...'',
2316
+ 'def self.defined?(foo) hh end'...'',
2317
+ 'def x.defin(foo) hh end'...'',
2318
+ 'def x.defin?(foo) hh end'...'',
2319
+ 'def x.defined?(foo) hh end'...'',
2320
+ 'def defined?(foo) hh end'...'',
2321
+
2322
+ 'def self.defin(foo) nil end'...'',
2323
+ 'def self.defin?(foo) nil end'...'',
2324
+ 'def self.defined?(foo) nil end'...'',
2325
+ 'def x.defin(foo) nil end'...'',
2326
+ 'def x.defin?(foo) nil end'...'',
2327
+ 'def x.defined?(foo) nil end'...'',
2328
+ 'def defined?(foo) nil end'...'',
2329
+
2330
+ 'def self.defin(foo) () end'...'',
2331
+ 'def self.defin?(foo) () end'...'',
2332
+ 'def self.defined?(foo) () end'...'',
2333
+ 'def x.defin(foo) () end'...'',
2334
+ 'def x.defin?(foo) () end'...'',
2335
+ 'def x.defined?(foo) () end'...'',
2336
+ 'def defined?(foo) () end'...'',
2337
+
2338
+ 'def self.defin(foo) {} end'...'',
2339
+ 'def self.defin?(foo) {} end'...'',
2340
+ 'def self.defined?(foo) {} end'...'',
2341
+ 'def x.defin(foo) {} end'...'',
2342
+ 'def x.defin?(foo) {} end'...'',
2343
+ 'def x.defined?(foo) {} end'...'',
2344
+ 'def defined?(foo) {} end'...'',
2345
+
2346
+ 'def self.defin(foo) [] end'...'',
2347
+ 'def self.defin?(foo) [] end'...'',
2348
+ 'def self.defined?(foo) [] end'...'',
2349
+ 'def x.defin(foo) [] end'...'',
2350
+ 'def x.defin?(foo) [] end'...'',
2351
+ 'def x.defined?(foo) [] end'...'',
2352
+ 'def defined?(foo) [] end'...'',
2353
+
2354
+ "$`"...'',
2355
+ "$'"...'',
2356
+ "$+"...'',
2357
+ "case\n when true; 4 end"...'',
2358
+ "case when true; 4 end"...'',
2359
+ '$2'...'',
2360
+ '$11'...'',
2361
+ '$111'...'',
2362
+ '$111111'...'',
2363
+ '$11111111111111111111111111111111111111111111111111111111111111111111'...'',
2364
+ '-2::c'...'',
2365
+ '-2.c'...'',
2366
+ '-2[3]'...'',
2367
+ '-2[3]=4'...'',
2368
+ '-2**3.1'...'',
2369
+ '-2**31'...'',
2370
+ '-2.7**31'...'',
2371
+ '-2e7**31'...'',
2372
+ '-2.7e8**31'...'',
2373
+ '-0**31'...'',
2374
+ '-0.0**31'...'',
2375
+ '-0e0**31'...'',
2376
+ '-0.0e0**31'...'',
2377
+ '$-1'...'',
2378
+ '$-9'...'',
2379
+ '$-0'...'',
2380
+ '$-a'...'',
2381
+ "$-\v"...'',
2382
+ '$-[]'...'',
2383
+ 'a,b=(*c=b,a)'...'',
2384
+
2385
+ ]
2386
+ NOTWORKINGYET=[
2387
+ #later...
2388
+ ]
2389
+
2390
+
2391
+ STANZAS=%q[
2392
+ begin
2393
+ a
2394
+ rescue B=>c
2395
+ d
2396
+ else
2397
+ f
2398
+ ensure
2399
+ e
2400
+ end
2401
+
2402
+ begin
2403
+ a
2404
+ else
2405
+ f
2406
+ ensure
2407
+ e
2408
+ end
2409
+
2410
+ begin
2411
+ a
2412
+ rescue B=>c
2413
+ d
2414
+ else
2415
+ f
2416
+ end
2417
+
2418
+ begin
2419
+ a
2420
+ rescue B=>c
2421
+ d
2422
+ ensure
2423
+ e
2424
+ end
2425
+
2426
+ begin
2427
+ a
2428
+ else
2429
+ f
2430
+ end
2431
+
2432
+ begin
2433
+ a
2434
+ rescue B=>c
2435
+ d
2436
+ end
2437
+
2438
+ begin
2439
+ a
2440
+ rescue B=>c
2441
+ d
2442
+ else
2443
+ f
2444
+ end
2445
+
2446
+ begin
2447
+ a
2448
+ rescue B
2449
+ c
2450
+ end
2451
+
2452
+ begin
2453
+ a
2454
+ rescue B=>c
2455
+ end
2456
+
2457
+ begin
2458
+ a
2459
+ rescue
2460
+ b
2461
+ end
2462
+
2463
+ <<heredoc
2464
+ a b c
2465
+ heredoc
2466
+
2467
+ <<-heredoc
2468
+ heredoc
2469
+
2470
+ <<-heredoc
2471
+ a b c
2472
+ heredoc
2473
+
2474
+ <<-"heredoc"
2475
+ a b c
2476
+ heredoc
2477
+
2478
+ <<-"heredoc"
2479
+ a b c #{d}
2480
+ heredoc
2481
+
2482
+ <<-"heredoz"
2483
+ a b c #{d}
2484
+ heredoz
2485
+
2486
+ <<-'heredoc'
2487
+ a b c
2488
+ heredoc
2489
+
2490
+ <<-'heredoc'
2491
+ a b c #{d}
2492
+ heredoc
2493
+
2494
+ <<-`heredoc`
2495
+ a b c
2496
+ heredoc
2497
+
2498
+ <<`heredoc`
2499
+ a b c
2500
+ heredoc
2501
+
2502
+ <<-`heredoc`
2503
+ a b c #{d}
2504
+ heredoc
2505
+
2506
+ <<`heredoc`
2507
+ a b c #{d}
2508
+ heredoc
2509
+
2510
+ p(<<-heredoc)
2511
+ a b c
2512
+ heredoc
2513
+
2514
+ p <<-heredoc
2515
+ a b c
2516
+ heredoc
2517
+
2518
+ p <<-heredoc + "dfgsf"
2519
+ a b c
2520
+ heredoc
2521
+
2522
+ p <<-heredoc + "sdfsdF" and 5
2523
+ a b c
2524
+ heredoc
2525
+
2526
+ p <<-heredoc "x y z" and 5
2527
+ a b c
2528
+ heredoc
2529
+
2530
+ =begin
2531
+ =end
2532
+
2533
+ =begin a
2534
+ b
2535
+ =end c
2536
+
2537
+ if a
2538
+ then b
2539
+ else c
2540
+ end
2541
+
2542
+ if a;
2543
+ then b
2544
+ else c
2545
+ end
2546
+
2547
+ if a; then b
2548
+ else c
2549
+ end
2550
+
2551
+ if a
2552
+ then b else c
2553
+ end
2554
+
2555
+ if a
2556
+ else c
2557
+ end
2558
+
2559
+ if a; else c
2560
+ end
2561
+
2562
+ if
2563
+ a
2564
+ then
2565
+ b
2566
+ end
2567
+
2568
+ if
2569
+ a
2570
+ then
2571
+ b
2572
+ else
2573
+ c
2574
+ end
2575
+
2576
+ <<-foo+<<-bar
2577
+ a b c
2578
+ foo
2579
+ d e f
2580
+ bar
2581
+
2582
+ <<-foo+'123
2583
+ abc
2584
+ foo
2585
+ 456'
2586
+
2587
+ case a
2588
+ when b
2589
+ then c
2590
+ end
2591
+
2592
+
2593
+ case
2594
+ a
2595
+ when
2596
+ b
2597
+ then
2598
+ c
2599
+ end
2600
+
2601
+ case
2602
+ a;
2603
+ when
2604
+ b;
2605
+ then
2606
+ c;
2607
+ end
2608
+
2609
+ result=[
2610
+ MethNameToken.new(old.ident,old.offset),
2611
+ ImplicitParamListStartToken.new(input_position),
2612
+ ImplicitParamListEndToken.new(input_position),
2613
+ *ignored_tokens
2614
+ ]
2615
+
2616
+ %r{^(
2617
+ class|module|end|self|true|false|nil|def|
2618
+ __FILE__|__LINE__|(\\})\\)
2619
+ )$}x
2620
+
2621
+ /sdf
2622
+ sdf
2623
+ sdfsdf
2624
+ sdfsf/
2625
+
2626
+ /sdf
2627
+ sdf\\
2628
+ sdfsdf
2629
+ sdfsf/
2630
+
2631
+ def evaluate rule,stack
2632
+ #dissect the rule
2633
+ rescue Exception
2634
+ puts "error while executing rule: #{}"
2635
+ end
2636
+
2637
+ def self.has_return_hash_fix?
2638
+ rl=RubyLexer.new("","return {}.size")
2639
+ end
2640
+
2641
+ %[\\
2642
+ ]
2643
+
2644
+ %q[\\
2645
+ ]
2646
+
2647
+ %Q[\\
2648
+ ]
2649
+
2650
+ %r[\\
2651
+ ]
2652
+
2653
+ %s[\\
2654
+ ]
2655
+
2656
+ %x[\\
2657
+ ]
2658
+
2659
+ %w[\\
2660
+ ]
2661
+
2662
+ %w[
2663
+ ]
2664
+
2665
+ /\\
2666
+ /
2667
+
2668
+ %r[\\
2669
+ ]
2670
+
2671
+ %W[\\
2672
+ ]
2673
+
2674
+ %W[a\\
2675
+ ]
2676
+
2677
+ %W[a b\\
2678
+ ]
2679
+
2680
+ %W[a b \\
2681
+ ]
2682
+
2683
+ %W[
2684
+ ]
2685
+
2686
+ "\\C-\\
2687
+ "
2688
+
2689
+ :"
2690
+ "
2691
+
2692
+ p "#{__FILE__}"
2693
+ p "#{__LINE__}"
2694
+
2695
+ a b, c
2696
+ __END__
2697
+ d e, f
2698
+
2699
+ a b, c
2700
+ =begin x
2701
+ y
2702
+ =end z
2703
+ __END__
2704
+ d e, f
2705
+
2706
+ a{<<-f;b}
2707
+ #{b=1}
2708
+ f
2709
+
2710
+ a{<<-f;b}+
2711
+ #{b=1}
2712
+ f
2713
+ c
2714
+
2715
+ a{<<-f;b}\\
2716
+ #{b=1}
2717
+ f
2718
+ +c
2719
+
2720
+ funcnames.collect{|fn| <<-endeval; hn }.to_s(fn,hn,gn=1)
2721
+ #{fn} #{gn} #{hn=2}
2722
+ endeval
2723
+ p fn,gn,hn
2724
+
2725
+ <<-foo+"str"
2726
+ foo
2727
+
2728
+ BEGIN {
2729
+ puts "b1"
2730
+ local_begin1 = "local_begin1"
2731
+ $global_begin1 = "global_begin1"
2732
+ ConstBegin1 = "ConstBegin1"
2733
+ }
2734
+ BEGIN {
2735
+ puts "b2"
2736
+ BEGIN {
2737
+ puts "b2-1"
2738
+ local_begin2=33
2739
+ }
2740
+ }
2741
+ # for scope check
2742
+ raise if defined?(local_begin1)
2743
+ raise if defined?(local_begin2)
2744
+ raise unless defined?($global_begin1)
2745
+ raise unless defined?(::ConstBegin1)
2746
+ local_for_end2 = "e2"
2747
+ $global_for_end1 = "e1"
2748
+
2749
+ END {
2750
+ puts "b1"
2751
+ local_begin1 = "local_begin1"
2752
+ $global_begin1 = "global_begin1"
2753
+ ConstBegin1 = "ConstBegin1"
2754
+ }
2755
+ END {
2756
+ puts "b2"
2757
+ END {
2758
+ puts "b2-1"
2759
+ local_begin2=33
2760
+ }
2761
+ }
2762
+ # for scope check
2763
+ raise if defined?(local_begin1)
2764
+ raise if defined?(local_begin2)
2765
+ raise unless defined?($global_begin1)
2766
+ raise unless defined?(::ConstBegin1)
2767
+ local_for_end2 = "e2"
2768
+ $global_for_end1 = "e1"
2769
+
2770
+ events=[]
2771
+ set_trace_func(Proc.new { |event, file, lineno, mid, bidning, klass|
2772
+ events << [event, lineno, mid, klass]
2773
+ })
2774
+ a = 1
2775
+ foo
2776
+ a
2777
+ b = 1 + 2
2778
+ if b == 3
2779
+ case b
2780
+ when 2
2781
+ c = "b == 2"
2782
+ when 3
2783
+ c = "b == 3"
2784
+ end
2785
+ end
2786
+
2787
+ proc{q=1;def q.foo; end} #q should be varnametoken, both times
2788
+ module Defined_p_syntax_tests
2789
+ def self.defined?(foo) :baz end #should be methname
2790
+ def defined?(foo) :bar end #should be methname
2791
+ def ameth
2792
+ p(defined? 44) #should be keyword
2793
+ p(self.defined? 44) #should be methname
2794
+ end
2795
+ end
2796
+
2797
+ def x# [ruby-dev:24228]
2798
+ assert_nothing_raised {
2799
+ def temporally_method_for_test_eval_and_define_method(&block)
2800
+ lambda {
2801
+ class << Object.new; self end.__send__(:define_method, :zzz, &block)
2802
+ }
2803
+ end
2804
+ v = eval("temporally_method_for_test_eval_and_define_method {}")
2805
+ {}[0] = {}
2806
+ v.call
2807
+ }
2808
+ end
2809
+
2810
+ def tt3(&block)
2811
+ tt2(raise(ArgumentError,""),&block)
2812
+ end
2813
+
2814
+
2815
+ def test_char
2816
+ # character constants(assumes ASCII)
2817
+ assert_equal(?a, "a"[0])
2818
+ assert_equal(?a, ?a)
2819
+ assert_equal(1, ?\\C-a)
2820
+ assert_equal(225, ?\\M-a)
2821
+ assert_equal(129, ?\\M-\\C-a)
2822
+ assert_equal(?A, "a".upcase![0])
2823
+ assert_equal(?a, "A".downcase![0])
2824
+ assert_equal("ABC", "abc".tr!("a-z", "A-Z"))
2825
+ assert_equal("ABC", "aabbcccc".tr_s!("a-z", "A-Z"))
2826
+ assert_equal("abc", "abcc".squeeze!("a-z"))
2827
+ assert_equal("ad", "abcd".delete!("bc"))
2828
+ $x = "abcdef"
2829
+ $y = [ ?a, ?b, ?c, ?d, ?e, ?f ]
2830
+ $bad = false
2831
+ $x.each_byte {|i|
2832
+ if i != $y.shift
2833
+ $bad = true
2834
+ break
2835
+ end
2836
+ }
2837
+ assert(!$bad)
2838
+ s = "a string"
2839
+ s[0..s.size]="another string"
2840
+ assert_equal("another string", s)
2841
+ s = <<EOS
2842
+ #{
2843
+ [1,2,3].join(",")
2844
+ }
2845
+ EOS
2846
+ assert_equal("1,2,3\\n", s)
2847
+ assert_equal(926381, "Just".to_i(36))
2848
+ assert_equal(-23200231779, "-another".to_i(36))
2849
+ assert_equal("ruby", 1299022.to_s(36))
2850
+ assert_equal("-hacker", -1045307475.to_s(36))
2851
+ assert_equal(265419172580680477752431643787347, "Just_another_Ruby_hacker".to_i(36))
2852
+ assert_equal("-justanotherrubyhacker", -265419172580680477752431643787347.to_s(36))
2853
+ a = []
2854
+ (0..255).each {|n|
2855
+ ch = [n].pack("C")
2856
+ a.push ch if /a#{Regexp.quote ch}b/x =~ "ab"
2857
+ }
2858
+ assert_equal(0, a.size)
2859
+ end
2860
+
2861
+ /:(\\d+)/ =~ caller[0]
2862
+ file = $`
2863
+ line = $1.to_i
2864
+ code = <<"End"
2865
+ define_method("test_id2ref_#{line}") {\\
2866
+ o = ObjectSpace._id2ref(obj.object_id);\\
2867
+ assert_same(obj, o, "didn't round trip: \\#{obj.inspect}");\\
2868
+ }
2869
+ End
2870
+
2871
+ assert(begin
2872
+ for k,v in y
2873
+ raise if k*2 != v
2874
+ end
2875
+ true
2876
+ rescue
2877
+ false
2878
+ end)
2879
+
2880
+ case
2881
+ when true
2882
+ assert(true)
2883
+ when false, nil
2884
+ assert(false)
2885
+ else
2886
+ assert(false)
2887
+ end
2888
+
2889
+ def test_endblockwarn
2890
+ ruby = EnvUtil.rubybin
2891
+ # Use Tempfile to create temporary file path.
2892
+ launcher = Tempfile.new(self.class.name)
2893
+ errout = Tempfile.new(self.class.name)
2894
+ launcher << <<EOF
2895
+ errout = ARGV.shift
2896
+ STDERR.reopen(File.open(errout, "w"))
2897
+ STDERR.sync = true
2898
+ Dir.chdir(#{q(DIR)})
2899
+ cmd = "\\"#{ruby}\\" \\"endblockwarn.rb\\""
2900
+ system(cmd)
2901
+ EOF
2902
+ launcher.close
2903
+ launcherpath = launcher.path
2904
+ errout.close
2905
+ erroutpath = errout.path
2906
+ system("#{q(ruby)} #{q(launcherpath)} #{q(erroutpath)}")
2907
+ expected = <<EOW
2908
+ endblockwarn.rb:2: warning: END in method; use at_exit
2909
+ (eval):2: warning: END in method; use at_exit
2910
+ EOW
2911
+ assert_equal(expected, File.read(erroutpath))
2912
+ # expecting Tempfile to unlink launcher and errout file.
2913
+ end
2914
+
2915
+ module TYDFG
2916
+ p a ;
2917
+ end
2918
+
2919
+ p <<ggg; def
2920
+ kleegarts() p 'kkkkkkk' end
2921
+ dfgdgfdf
2922
+ ggg
2923
+ koomblatz!() p 'jdkfsk' end
2924
+
2925
+ class
2926
+ A; end
2927
+
2928
+ module
2929
+ A; end
2930
+
2931
+ class
2932
+ A<B; end
2933
+
2934
+ undef
2935
+ A
2936
+
2937
+ undef
2938
+ A,B
2939
+
2940
+ def
2941
+ A; b end
2942
+
2943
+ alias
2944
+ q
2945
+ p
2946
+
2947
+ alias
2948
+ q p
2949
+
2950
+ p <<'p'
2951
+ \\n\\t\\r\\v\\\\
2952
+ p
2953
+
2954
+ p 1==2
2955
+ p 1===2
2956
+ p 1[2] #keyword
2957
+ p 1;2 #keyword
2958
+ p 1,2 #keyword
2959
+ p 1.2
2960
+
2961
+ before_time = Time.now
2962
+ ARGV.each do |fname|
2963
+ if fname == '-v'
2964
+ verbose = true
2965
+ next
2966
+ end
2967
+ rss = nil
2968
+ f = File.new(fname).read
2969
+ begin
2970
+ ## do validate parse
2971
+ rss = RSS::Parser.parse(f)
2972
+ rescue RSS::InvalidRSSError
2973
+ error($!) if verbose
2974
+ ## do non validate parse for invalid RSS 1.0
2975
+ begin
2976
+ rss = RSS::Parser.parse(f, false)
2977
+ rescue RSS::Error
2978
+ ## invalid RSS.
2979
+ error($!) if verbose
2980
+ end
2981
+ rescue RSS::Error
2982
+ error($!) if verbose
2983
+ end
2984
+ end
2985
+
2986
+ begin
2987
+ lcode = IO::readlines( @xGAsaFile.untaint ).untaint
2988
+ code = lcode.join( " " )
2989
+ @oAspHandler.load_code( code )
2990
+ rescue => e
2991
+ if Asp::Common::debug == 1
2992
+ result = @oApacheRequest.escape_html(e.message)
2993
+ @oApacheRequest.server.log_error( "[Ruby/ASP] [%d] : (%s #%d) : %s", $$, __FILE__, __LINE__, result )
2994
+ end
2995
+ return false
2996
+ end
2997
+
2998
+ begin
2999
+ xOutCode = @oXmlScript.script( xCode )
3000
+ rescue XmlScriptError => e
3001
+ @error_line = e.line
3002
+ @error_message = e.message
3003
+ end
3004
+
3005
+ location_display = if(location.size == 1)
3006
+ location[0].sub(/\A(.+:\d+).*/, ' [\\1]')
3007
+ else
3008
+ "\n#{location.join("\n")}"
3009
+ end
3010
+ "Failure:\n#@test_name#{location_display}:\n#@message"
3011
+
3012
+ def parse_date(aString)
3013
+ return Time.rfc822(aString) rescue Time.parse(aString)
3014
+ end
3015
+
3016
+ %w(
3017
+ CVS SCCS)
3018
+
3019
+ raise AttributeConstraintError(
3020
+ )
3021
+
3022
+ raise AttributeConstraintError( #and a comment here
3023
+ )
3024
+
3025
+ raise AttributeConstraintError( #and a comment here
3026
+ #and here
3027
+ )
3028
+
3029
+ raise AttributeConstraintError( #and a comment here
3030
+ #and here
3031
+ =begin
3032
+ =end
3033
+ )
3034
+
3035
+ raise AttributeConstraintError( #and a comment here
3036
+ #and here
3037
+ =begin
3038
+ and here too
3039
+ =end
3040
+ )
3041
+
3042
+ raise AttributeConstraintError( #and a comment here
3043
+ #and here
3044
+ =begin look!
3045
+ and here too
3046
+ =end
3047
+ )
3048
+
3049
+ raise AttributeConstraintError( #and a comment here
3050
+ #and here
3051
+ =begin
3052
+ and here too
3053
+ =end look!
3054
+ )
3055
+
3056
+ raise AttributeConstraintError( #and a comment here
3057
+ #and here
3058
+ =begin look!
3059
+ and here too
3060
+ =end look!
3061
+ )
3062
+
3063
+ l rescue
3064
+ r
3065
+
3066
+ undef new_master, new_slave, new_safe_slave
3067
+ undef new_trusted_slave, new_safeTk
3068
+
3069
+ "\\xa5\\xaa\\xa5\\xd6\\xa5\\xb8\\xa5\\xa7\\xa5\\xaf\\xa5\\xc8\\xbb\\xd8\\xb8\\xfe\\
3070
+ \\xa5\\xb9\\xa5\\xaf\\xa5\\xea\\xa5\\xd7\\xa5\\xc8\\xb8\\xc0\\xb8\\xec\\
3071
+ Ruby"
3072
+
3073
+ "f"
3074
+ d
3075
+
3076
+ begin; rescue A=>b.c
3077
+ end
3078
+
3079
+ %W[#{G}
3080
+ Z]
3081
+
3082
+ <<-EOS<<__LINE__
3083
+ EOS
3084
+
3085
+ ] ##############################END OF STANZAS#################################################
3086
+ ###############################################################################################
3087
+
3088
+
3089
+ SINGLE_OPEN2CLOSE={
3090
+ "'"=>"'",
3091
+ ":'"=>"'",
3092
+ '%q['=>']',
3093
+ '%s['=>']',
3094
+ '%w['=>']',
3095
+ }
3096
+ DOUBLE_OPEN2CLOSE={
3097
+ '"'=>'"',
3098
+ ':"'=>'"',
3099
+ '`'=>'`',
3100
+ '/'=>'/',
3101
+ '%['=>']',
3102
+ '%Q['=>']',
3103
+ '%r['=>']',
3104
+ '%x['=>']',
3105
+ '%W['=>']',
3106
+ ''=>'',
3107
+ }
3108
+ DOUBLE_CHAR_DECORATORS=['\c','\C-','\M-']
3109
+ SINGLE_CHAR_DECORATORS=['\\','']
3110
+ CHAR_DECORATORS=SINGLE_CHAR_DECORATORS+DOUBLE_CHAR_DECORATORS
3111
+ ESC_SEQS=[]
3112
+ (0..0x7F).each{|ch| ch=ch.chr
3113
+ SINGLE_OPEN2CLOSE.each_pair{|open,close|
3114
+ #next if "\0"==ch and /^(:|%s)/===open
3115
+ SINGLE_CHAR_DECORATORS.each{|dec|
3116
+ ESC_SEQS << open+dec+ch+close #unless dec=='' and (open+close)[ch]
3117
+ }
3118
+ }
3119
+ DOUBLE_OPEN2CLOSE.each_pair{|open,close|
3120
+ #next if /[xcCM0-7]/===ch
3121
+ #next if "\0"==ch and /^:/===open
3122
+ CHAR_DECORATORS.each{|dec|
3123
+ #next if dec=='' and (open+close)[ch]
3124
+ ESC_SEQS << open+dec+"\\"+ch+close
3125
+ ESC_SEQS << open+dec+ch+close #unless %r{^(/|%r)}===open
3126
+ }
3127
+ num=CHAR_DECORATORS.size
3128
+ ESC_SEQS << open+(0...rand(num)).inject(ch){|sum,i|
3129
+ CHAR_DECORATORS[rand(num)]+sum
3130
+ }+close
3131
+ }
3132
+ } unless ENV['FAST']
3133
+
3134
+ from_rubinius=[]
3135
+ if File.exist? "../rubinius"
3136
+ load "../rubinius/spec/parser/fixtures/sexp_expectations.rb"
3137
+ from_rubinius=SEXP_EXPECTATIONS.values.map{|v| v["Ruby"] }
3138
+ end
3139
+
3140
+ EXAMPLES=ONELINERS.map{|rng| rng.first}+STANZAS.split(/\n( *\n)+/)+TestCases::TESTCASES+
3141
+ from_rubinius #+ESC_SEQS
3142
+
3143
+ WRAPPERS=[ #enable at most 2 or tests take forever!!!
3144
+ '(...)', #normal mode, should usually be enabled
3145
+ # 'a0 = (...) rescue b0',
3146
+ # 'a0 = ((...)) rescue b0',
3147
+ # '(...) #with a comment',
3148
+ # "(...)#with comment and newline\n",
3149
+ # "(...)\n",
3150
+ # "(...);p __LINE__",
3151
+ # "defined? (...)",
3152
+ # "a=a (...)",
3153
+ # "b=1;b (...)",
3154
+ # "return (...)"
3155
+ ]
3156
+ INJECTABLES=[ #take it easy with these too
3157
+ # 'p (1..10).method(:each)',
3158
+ # 'a0 rescue b0',
3159
+ # 'begin; r; t end',
3160
+ # 'a=b,c=d',
3161
+ ]
3162
+ puts "warning: most data fuzzing is disabled for now"
3163
+ puts "warning: unparser tests disabled for now"
3164
+
3165
+ RUBYIDENT=/((?:$|@@?)?[a-z_][a-z_0-9]*[?!]?)/i
3166
+
3167
+ def self.snippet2testmethod(snippet)
3168
+ escaped=snippet.gsub(/[\\']/){"\\"+$&}
3169
+ safe=escaped.gsub(/([^ -~])/){
3170
+ x=$1[0].to_s(16)
3171
+ x.size==1 and x="0"+x
3172
+ "\\x"+x
3173
+ }
3174
+ safe.gsub! /\\\\/,"__"
3175
+ safe[/[^ -~]|\\\\/] and fail
3176
+ "
3177
+ define_method 'test_parsing_of_#{safe}' do
3178
+ #puts 'test_parsing_of_#{safe}'
3179
+ pt=ParseTree.new
3180
+ check_parsing '#{escaped}',pt
3181
+ end
3182
+ "
3183
+ end
3184
+
3185
+ i=0
3186
+ code=EXAMPLES.map{|xmpl|
3187
+ #remove comment if present
3188
+ /\A(.*)\s*\Z/===xmpl and xmpl=$1
3189
+ #remove x{...} wrapper if present
3190
+ /\A\s*x\s*\{(.*)\}\Z/===xmpl and xmpl=$1
3191
+ # xmpl= (xmpl[/\A\s*x\s*\{(.*)\}\s*(#.*)?\Z/,1] rescue xmpl)
3192
+
3193
+ wrapped=WRAPPERS.map{|wrap|
3194
+ #apply wrapper
3195
+ snippet2testmethod(wrap.gsub('(...)', xmpl))
3196
+ }
3197
+ injected=INJECTABLES.map{|inj|
3198
+ xlist=xmpl.split(RUBYIDENT)
3199
+ if xlist.size>1
3200
+ i=rand(xlist.size&~1)|1
3201
+ i&1==1 or fail
3202
+ /\A#{RUBYIDENT}\Z/o===xlist[i] or fail
3203
+ xlist[i]=inj
3204
+ snippet2testmethod(xlist.to_s)
3205
+ end
3206
+ }
3207
+ wrapped+injected
3208
+ }.to_s
3209
+ #puts code.split("\n")[5880..5890].join("\n")
3210
+ eval code
3211
+
3212
+ def test_case_that_segfaults_ruby185
3213
+ assert_equal \
3214
+ [[:op_asgn1, [:call, [:vcall, :a], :b], [:zarray], :%, [:vcall, :d]]],
3215
+ RedParse.new('a.b[]%=d','-').parse.to_parsetree(:quirks)
3216
+ end
3217
+
3218
+ def test_case_that_segfaults_ruby186_slash_parsetree211
3219
+ assert_equal [[:cdecl, [:colon3, :B], [:lit,1]]],
3220
+ RedParse.new('::B=1','-').parse.to_parsetree(:quirks)
3221
+ assert_equal [[:cdecl, [:colon2, [:const, :A], :B], [:lit,1]]],
3222
+ RedParse.new('A::B=1','-').parse.to_parsetree(:quirks)
3223
+ end
3224
+
3225
+ def test_case_that_segfaults_ruby187_slash_parsetree220
3226
+ assert_equal [[:iter, [:fcall, :Proc], [:block_pass, [:dasgn_curr, :b], 0]]],
3227
+ RedParse.new('Proc{|&b|}','-').parse.to_parsetree(:quirks)
3228
+ end
3229
+
3230
+ def assert_hopefully_raises_Exception xmpl
3231
+ begin
3232
+ yield
3233
+ rescue Exception
3234
+ assert true
3235
+ else
3236
+ puts "warning: syntax error expected, but none was seen, expression: <<< #{xmpl} >>>"
3237
+ end
3238
+ end
3239
+
3240
+ BEGIN{p Dir.getwd; File.unlink "problemexprs" rescue nil}
3241
+ def problem_exprs
3242
+ @problem_exprs||=nil
3243
+ return @problem_exprs if @problem_exprs
3244
+
3245
+ @problem_exprs=File.open("problemexprs","a")
3246
+
3247
+ rescue Exception
3248
+ @problem_exprs=$stdout
3249
+ end
3250
+
3251
+ def check_parsing xmpl,pt=ParseTree.new
3252
+ /unparse/===xmpl and warn 'unparse in parser test data!'
3253
+ problem_exprs=problem_exprs()
3254
+ =begin
3255
+ xmpl=<<-prefix+xmpl+<<-suffix
3256
+ BEGIN{throw :never_exec_parse_data_try1,1}
3257
+ BEGIN{throw :never_exec_parse_data_try2,2}
3258
+ BEGIN{throw :never_exec_parse_data_try3,3}
3259
+ BEGIN{raise "never_exec_parse_data_try4"}
3260
+ BEGIN{raise "never_exec_parse_data_try5"}
3261
+ prefix
3262
+ ;0
3263
+ suffix
3264
+ =end
3265
+ # tree=nil
3266
+ # output=false
3267
+ # loops=0
3268
+ begin
3269
+ # output=
3270
+ # catch(:never_exec_parse_data_try1){
3271
+ # catch(:never_exec_parse_data_try2){
3272
+ # catch(:never_exec_parse_data_try3){
3273
+ tree=pt.parse_tree_for_string(xmpl)
3274
+ # }
3275
+ # }
3276
+ # }
3277
+ # break if loops+=1 > 3
3278
+ rescue Interrupt: raise
3279
+ rescue Exception=>e:
3280
+ #raise "last gasp ParseTree exec catcher failed!"
3281
+ tree=e
3282
+ tree2=nodes=nil
3283
+ assert_hopefully_raises_Exception(xmpl){
3284
+ nodes=RedParse.new(xmpl,"-").parse
3285
+ tree2=nodes.to_parsetree(:quirks)
3286
+ }
3287
+ else
3288
+ begin
3289
+ nodes=RedParse.new(xmpl,"-").parse
3290
+ tree2=nodes.to_parsetree(:quirks)
3291
+ assert_equal tree, tree2
3292
+ rescue Exception=>e
3293
+ if problem_exprs
3294
+ problem_exprs.write xmpl+"\n"
3295
+ problem_exprs.flush
3296
+ end
3297
+ raise e
3298
+ else
3299
+ if false and problem_exprs and tree!=tree2
3300
+ problem_exprs.write xmpl+"\n"
3301
+ problem_exprs.flush
3302
+ end
3303
+ end #rescue false
3304
+
3305
+ end #until output.equal? tree
3306
+
3307
+ return #skip unparse tests for now
3308
+
3309
+ reparsed= RedParse.new(nodes.unparse({}),"-").parse
3310
+ assert_equal nodes.delete_extraneous_ivars!,
3311
+ reparsed.delete_extraneous_ivars!
3312
+
3313
+ tree3=reparsed.to_parsetree(:quirks)
3314
+ assert_equal tree, tree3
3315
+
3316
+ # rescue Exception=>e:
3317
+ # raise "error: #{e}:#{e.class} while testing '#{xmpl}'"
3318
+ end
3319
+ end