rubylexer 0.7.0 → 0.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/History.txt +90 -0
- data/Manifest.txt +54 -3
- data/README.txt +4 -7
- data/Rakefile +3 -2
- data/lib/rubylexer.rb +856 -323
- data/lib/rubylexer/0.7.0.rb +11 -2
- data/lib/rubylexer/0.7.1.rb +2 -0
- data/lib/rubylexer/charhandler.rb +4 -4
- data/lib/rubylexer/context.rb +86 -9
- data/lib/rubylexer/rulexer.rb +455 -101
- data/lib/rubylexer/token.rb +166 -43
- data/lib/rubylexer/tokenprinter.rb +16 -8
- data/lib/rubylexer/version.rb +1 -1
- data/rubylexer.vpj +98 -0
- data/test/code/all_the_gems.rb +33 -0
- data/test/code/all_the_raas.rb +226 -0
- data/test/code/all_the_rubies.rb +2 -0
- data/test/code/deletewarns.rb +19 -1
- data/test/code/dumptokens.rb +39 -8
- data/test/code/errscan +2 -0
- data/test/code/isolate_error.rb +72 -0
- data/test/code/lexloop +14 -0
- data/test/code/locatetest.rb +150 -8
- data/test/code/regression.rb +109 -0
- data/test/code/rubylexervsruby.rb +53 -15
- data/test/code/strgen.rb +138 -0
- data/test/code/tarball.rb +144 -0
- data/test/code/testcases.rb +11 -0
- data/test/code/tokentest.rb +115 -24
- data/test/data/__eof2.rb +1 -0
- data/test/data/__eof5.rb +2 -0
- data/test/data/__eof6.rb +2 -0
- data/test/data/cvtesc.rb +17 -0
- data/test/data/g.rb +6 -0
- data/test/data/hd0.rb +3 -0
- data/test/data/hdateof.rb +2 -0
- data/test/data/hdempty.rb +3 -0
- data/test/data/hdr.rb +9 -0
- data/test/data/hdr_dos.rb +13 -0
- data/test/data/hdr_dos2.rb +18 -0
- data/test/data/heart.rb +2 -0
- data/test/data/here_escnl.rb +25 -0
- data/test/data/here_escnl_dos.rb +20 -0
- data/test/data/here_squote.rb +3 -0
- data/test/data/heremonsters.rb +140 -0
- data/test/data/heremonsters.rb.broken +68 -0
- data/test/data/heremonsters.rb.broken.save +68 -0
- data/test/data/heremonsters_dos.rb +140 -0
- data/test/data/heremonsters_dos.rb.broken +68 -0
- data/test/data/illegal_oneliners.rb +1 -0
- data/test/data/illegal_stanzas.rb +0 -0
- data/test/data/make_ws_strdelim.rb +22 -0
- data/test/data/maven2_builer_test.rb +82 -0
- data/test/data/migration.rb +8944 -0
- data/test/data/modl.rb +6 -0
- data/test/data/modl_dos.rb +7 -0
- data/test/data/modl_fails.rb +10 -0
- data/test/data/multilinestring.rb +6 -0
- data/test/data/oneliners.rb +555 -0
- data/test/data/p-op.rb +2 -0
- data/test/data/p.rb +3 -1710
- data/test/data/s.rb +90 -21
- data/test/data/simple.rb +1 -0
- data/test/data/simple_dos.rb +1 -0
- data/test/data/stanzas.rb +1194 -0
- data/test/data/strdelim_crlf.rb +6 -0
- data/test/data/stuff.rb +6 -0
- data/test/data/stuff2.rb +5 -0
- data/test/data/stuff3.rb +6 -0
- data/test/data/stuff4.rb +6 -0
- data/test/data/tkweird.rb +20 -0
- data/test/data/unending_stuff.rb +5 -0
- data/test/data/whatnot.rb +8 -0
- data/test/data/ws_strdelim.rb +0 -0
- data/test/test.sh +239 -0
- data/testing.txt +39 -50
- metadata +110 -12
- data/test/code/dl_all_gems.rb +0 -43
- data/test/code/unpack_all_gems.rb +0 -15
- data/test/data/gemlist.txt +0 -280
data/test/data/p-op.rb
CHANGED
data/test/data/p.rb
CHANGED
@@ -1,268 +1,11 @@
|
|
1
1
|
if false
|
2
|
-
return {}.size
|
3
|
-
1.return {}.size
|
4
|
-
|
5
|
-
break {}.size
|
6
|
-
1.break {}.size
|
7
|
-
|
8
|
-
next {}.size
|
9
|
-
1.next {}.size
|
10
|
-
|
11
|
-
raise {}.to_s+"****"
|
12
|
-
1.raise {}.to_s+"****"
|
13
|
-
|
14
|
-
throw {}.to_s+"****"
|
15
|
-
1.throw {}.to_s+"****"
|
16
|
-
end
|
17
|
-
|
18
|
-
module SR
|
19
|
-
def SelfReferencing
|
20
|
-
#old name alias
|
21
|
-
end
|
22
|
-
|
23
|
-
def SelfReferencing #old name alias
|
24
|
-
end
|
25
|
-
|
26
|
-
def SelfReferencing#old name alias
|
27
|
-
end
|
28
|
-
|
29
|
-
def SelfReferencing;end#old name alias
|
30
|
-
end
|
31
|
-
|
32
|
-
P ::Class
|
33
|
-
|
34
|
-
p <<Class
|
35
|
-
zzzz
|
36
|
-
Class
|
37
|
-
|
38
|
-
p(String <<Class)
|
39
|
-
sgsdfgf
|
40
|
-
Class
|
41
|
-
Class
|
42
|
-
|
43
|
-
proc{q=1;def q.foo; end} #q should be varnametoken, both times
|
44
|
-
module Defined_p_syntax_tests
|
45
|
-
def self.defined?(foo) :baz end #should be methname
|
46
|
-
def defined?(foo) :bar end #should be methname
|
47
|
-
def ameth
|
48
|
-
p(defined? 44) #should be keyword
|
49
|
-
p(self.defined? 44) #should be methname
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
p 2**3[4] #should be nowstoken before bracket
|
54
|
-
|
55
|
-
proc{
|
56
|
-
p /$/ #regexp
|
57
|
-
p /=$/ #operator
|
58
|
-
p /$/ #operator
|
59
|
-
}
|
60
|
-
|
61
|
-
proc{
|
62
|
-
p %=b=
|
63
|
-
2
|
64
|
-
p %(1)
|
65
|
-
}
|
66
|
-
|
67
|
-
proc{
|
68
|
-
p *=5
|
69
|
-
p %(1)
|
70
|
-
}
|
71
|
-
|
72
|
-
proc{
|
73
|
-
p &nil
|
74
|
-
p &=1
|
75
|
-
p %(1)
|
76
|
-
}
|
77
|
-
|
78
|
-
p %(1)
|
79
|
-
|
80
|
-
p %\hah, backslash as string delimiter\
|
81
|
-
def foo(bar=5,tt=6) end
|
82
|
-
wwww,eeee=1,2
|
83
|
-
proc{a.b,c.d=1,2}
|
84
|
-
proc{|a.b,c.d|}
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
p foo
|
92
|
-
|
93
|
-
if false
|
94
|
-
p % foo
|
95
|
-
p % foo
|
96
2
|
p %
|
97
3
|
foo
|
98
4
|
|
99
|
-
p(% foo )
|
100
|
-
p(% foo )
|
101
5
|
p(%
|
102
6
|
foo
|
103
7
|
|
104
8
|
)
|
105
|
-
end
|
106
|
-
|
107
|
-
p eval "%\sfoo\s"
|
108
|
-
|
109
|
-
p eval "%\tfoo\t"
|
110
|
-
p eval "%\vfoo\v"
|
111
|
-
p eval "%\rfoo\r"
|
112
|
-
p eval "%\nfoo\n"
|
113
|
-
p eval "%\0foo\0"
|
114
|
-
|
115
|
-
p eval "%\r\nfoo\r\n"
|
116
|
-
|
117
|
-
#foo
|
118
|
-
|
119
|
-
=begin
|
120
|
-
|
121
|
-
=end
|
122
|
-
|
123
|
-
p <<p
|
124
|
-
\
|
125
|
-
p
|
126
|
-
p
|
127
|
-
|
128
|
-
p <<'p'
|
129
|
-
\
|
130
|
-
p
|
131
|
-
p
|
132
|
-
|
133
|
-
p <<p
|
134
|
-
\n\t\r\v\\
|
135
|
-
p
|
136
|
-
|
137
|
-
p <<'p'
|
138
|
-
\n\t\r\v\\
|
139
|
-
p
|
140
|
-
|
141
|
-
p <<p
|
142
|
-
\
|
143
|
-
|
144
|
-
p
|
145
|
-
|
146
|
-
|
147
|
-
p %W[\
|
148
|
-
] #ruby interprets this one as a single (totally unescaped) newline,
|
149
|
-
#but i suspect that might be a bug.
|
150
|
-
|
151
|
-
p "\
|
152
|
-
"
|
153
|
-
|
154
|
-
p '\
|
155
|
-
'
|
156
|
-
|
157
|
-
p /\
|
158
|
-
/
|
159
|
-
|
160
|
-
p `\
|
161
|
-
`
|
162
|
-
|
163
|
-
p %w[\
|
164
|
-
]
|
165
|
-
|
166
|
-
p %[\
|
167
|
-
]
|
168
|
-
|
169
|
-
p "
|
170
|
-
|
171
|
-
"
|
172
|
-
|
173
|
-
p %{
|
174
|
-
|
175
|
-
}
|
176
|
-
|
177
|
-
p <<END
|
178
|
-
|
179
|
-
END
|
180
|
-
|
181
|
-
p <<'END'
|
182
|
-
|
183
|
-
END
|
184
|
-
|
185
|
-
|
186
|
-
p
|
187
|
-
p(1,2) #these 2 lines should tokenize identically
|
188
|
-
p (1,2) #except for the extra space on this one
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
p File
|
194
|
-
module Y19 #limit lvar scope
|
195
|
-
a,b,c,(d,e)=1,2,3,[4,5]
|
196
|
-
p a %(4)
|
197
|
-
p c %(4)
|
198
|
-
p d %(4)
|
199
|
-
p e %(4)
|
200
|
-
end
|
201
|
-
|
202
|
-
def printem___1 a
|
203
|
-
a
|
204
|
-
end
|
205
|
-
|
206
|
-
class F0000; end
|
207
|
-
def F0000; end
|
208
|
-
|
209
|
-
f0000=1
|
210
|
-
def f0000; end
|
211
|
-
|
212
|
-
def printem__1 a
|
213
|
-
p(a +77)
|
214
|
-
end
|
215
|
-
def printem_1 a,b
|
216
|
-
p(a +77)
|
217
|
-
p(b +77)
|
218
|
-
end
|
219
|
-
def printem1 a,b,c
|
220
|
-
p(a +77)
|
221
|
-
p(b +77)
|
222
|
-
p(c +77)
|
223
|
-
end
|
224
|
-
def printem10 a,b,c,d,e,f
|
225
|
-
p(a +77)
|
226
|
-
p(b +77)
|
227
|
-
p(c +77)
|
228
|
-
p(d +77)
|
229
|
-
p(e +77)
|
230
|
-
p(f +77)
|
231
|
-
end
|
232
|
-
def printem100 a,b,c,d,e,f,*g,&h
|
233
|
-
p(a +77)
|
234
|
-
p(b +77)
|
235
|
-
p(c +77)
|
236
|
-
p(d +77)
|
237
|
-
p(e +77)
|
238
|
-
p(f +77)
|
239
|
-
p(g +77)
|
240
|
-
p(h +77)
|
241
|
-
end
|
242
|
-
#<<'abc123def'
|
243
|
-
ddd="ddd"
|
244
|
-
|
245
|
-
#@@ddd=@ddd=$ddd=nil
|
246
|
-
def DDD;end
|
247
|
-
def ddd2; "asdAds" end
|
248
|
-
def (DDD()).foofarendle;end
|
249
|
-
def Integer.foofarendle;end
|
250
|
-
def @@ddd.foofarendle; 33;end
|
251
|
-
def @ddd.foofarendle; 33;end
|
252
|
-
def $ddd.foofarendle; 33;end
|
253
|
-
def ddd.foofarendle; 33;end
|
254
|
-
def ddd2.foofarendle; 33;end
|
255
|
-
def (ddd).foofarendle2; end
|
256
|
-
def (ddd()).foofarendle2; end
|
257
|
-
|
258
|
-
|
259
|
-
def (ddd2).foofarendle;end
|
260
|
-
def ddd2.foofarendle;end
|
261
|
-
|
262
|
-
|
263
|
-
def (is_a?(File::Stat)).foofarendle;end
|
264
|
-
|
265
|
-
p()
|
266
9
|
|
267
10
|
p((4\
|
268
11
|
+5))
|
@@ -275,992 +18,12 @@ p((4+\
|
|
275
18
|
p((4+\
|
276
19
|
|
277
20
|
5))
|
278
|
-
|
279
|
-
p(<<-jjj \
|
280
|
-
dsfgdf
|
281
|
-
jjj
|
282
|
-
)
|
283
|
-
|
284
|
-
p(<<-jjj
|
285
|
-
dsfgdf
|
286
|
-
jjj
|
287
|
-
)
|
288
|
-
|
289
|
-
p(<<-jjj \
|
290
|
-
dsfgdf
|
291
|
-
jjj
|
292
|
-
+"dfsdfs"
|
293
|
-
)
|
294
|
-
|
295
|
-
p(<<-jjj +
|
296
|
-
dsfgdf
|
297
|
-
jjj
|
298
|
-
"dfsdfs"
|
299
|
-
)
|
300
|
-
|
301
|
-
|
302
|
-
p( {:rest=>99})
|
303
|
-
p %{{{{#{"}}}"}}}}}
|
304
|
-
case 1
|
305
|
-
when *[2]: p 1
|
306
|
-
else p 2
|
307
|
-
end
|
308
|
-
|
309
|
-
p :"jim";
|
310
|
-
p :'jim';
|
311
|
-
p %s/jim/;
|
312
|
-
p %s"jim";
|
313
|
-
p %s'jim';
|
314
|
-
p %s`jim`;
|
315
|
-
p %s[jim];
|
316
|
-
p %s{jim};
|
317
|
-
p %s(jim);
|
318
|
-
p %s<jim>;
|
319
|
-
p %s jim ;
|
320
|
-
for bob in [100] do p(bob %(22)) end
|
321
|
-
|
322
|
-
|
323
|
-
proc{
|
324
|
-
foo bar=>baz
|
325
|
-
bar %(1)
|
326
|
-
}
|
327
|
-
|
328
|
-
module Y2534534
|
329
|
-
def foo1
|
330
|
-
p (1..10).method(:each) #implicit parens around the whole thing
|
331
|
-
end
|
332
|
-
|
333
|
-
def foo2()
|
334
|
-
p((1..10).method(:each)) #explicitly parenthesized... no implicit parens needed
|
335
|
-
end
|
336
|
-
|
337
|
-
def foo3()
|
338
|
-
p (1..10).method(:each) #implicit parens around the whole thing
|
339
|
-
#matz ruby parses this differently than identical line in foo1!?
|
340
|
-
end
|
341
|
-
|
342
|
-
end
|
343
|
-
|
344
|
-
|
345
|
-
module Y668
|
346
|
-
p [1,2,3,]
|
347
|
-
#p {1=>2,3=>4,} #syntax error
|
348
|
-
#p aaa,bbb,ccc,=1,2,3 #syntax error
|
349
|
-
p aaa
|
350
|
-
p bbb
|
351
|
-
p ccc
|
352
|
-
proc{|a,b,c,| p a,b,c }.call(1,2,3)
|
353
|
-
p proc{|
|
354
|
-
a,b,(c,d,),e|
|
355
|
-
p a %(1)
|
356
|
-
p b %(2)
|
357
|
-
p c %(3)
|
358
|
-
p d %(4)
|
359
|
-
p e %(5)
|
360
|
-
[ a,b,c,d,e]}.call(1,2,[3,4],5)
|
361
|
-
p (Module.instance_methods - Object.instance_methods).sort # an outer set of implicit parens is needed
|
362
|
-
p(Module.instance_methods - Object.instance_methods).sort #no outer implicit parens
|
363
|
-
"foo".slice (1-2).nil? #no outer implicit parens
|
364
|
-
p (1-2).nil? #outer implicit parens needed
|
365
|
-
p(1-2).nil? #no outer implicit parens needed
|
366
|
-
|
367
|
-
def self.z(*); end
|
368
|
-
def self.zz(*,&x); end
|
369
|
-
def self.zzz(&x); end
|
370
|
-
|
371
|
-
z z z z z z {}
|
372
|
-
z z z z z z do end
|
373
|
-
|
374
|
-
(/ 1/)
|
375
|
-
p(/ 1/)
|
376
|
-
# (p / 1/) #ruby no like
|
377
|
-
|
378
|
-
def ggg(x=nil) p x;9 end
|
379
|
-
(ggg / 1)
|
380
|
-
|
381
|
-
false and( true ? f : g )
|
382
|
-
false and( f .. g )
|
383
|
-
false and( f ... g )
|
384
|
-
p 1&2 #should be OperatorToken, not KeywordToken
|
385
|
-
p 1|2 #ditto
|
386
|
-
p 1**2
|
387
|
-
p 1*2
|
388
|
-
p 1%(2)
|
389
|
-
p 1^2
|
390
|
-
p 1+2
|
391
|
-
p 1-2
|
392
|
-
p 1/2
|
393
|
-
|
394
|
-
p 1?2:3 #keyword
|
395
|
-
|
396
|
-
p 1 ?2:3 #keyword
|
397
|
-
|
398
|
-
p 1? 2:3 #keyword
|
399
|
-
|
400
|
-
p 1?2 :3 #keyword
|
401
|
-
|
402
|
-
p 1?2: 3 #keyword
|
403
|
-
|
404
|
-
p 1 ? 2:3 #keyword
|
405
|
-
|
406
|
-
p 1 ?2 :3 #keyword
|
407
|
-
|
408
|
-
p 1 ?2: 3 #keyword
|
409
|
-
|
410
|
-
p 1? 2 :3 #keyword
|
411
|
-
|
412
|
-
p 1? 2: 3 #keyword
|
413
|
-
|
414
|
-
p 1?2 : 3 #keyword
|
415
|
-
|
416
|
-
p 1 ? 2 : 3 #keyword
|
417
|
-
|
418
|
-
p 1==2
|
419
|
-
p 1===2
|
420
|
-
p 1[2] #keyword
|
421
|
-
p 1;2 #keyword
|
422
|
-
p 1,2 #keyword
|
423
|
-
p 1.2
|
424
|
-
p 1.class #keyword
|
425
|
-
p 1..2 #keyword
|
426
|
-
p 1...2 #keyword
|
427
|
-
p 1<2
|
428
|
-
p 1>2
|
429
|
-
p 1<=2
|
430
|
-
p 1>=2
|
431
|
-
p 1<<2
|
432
|
-
p 1>>2
|
433
|
-
p 1!=2 #this is keyword
|
434
|
-
p 1=~2
|
435
|
-
p 1!~2 #this is keyword
|
436
|
-
p 1&&2 #...
|
437
|
-
p 1||2 #...
|
438
|
-
p 1<=>2
|
439
|
-
|
440
|
-
define_method(:foo, &proc{:bar})
|
441
|
-
define_method :foo, &proc{:bar}
|
442
|
-
define_method(:foo) &proc{:bar}
|
443
|
-
define_method :foo &proc{:bar}
|
444
|
-
p :k, *nil
|
445
|
-
p :k, *nil, &nil
|
446
|
-
p *nil
|
447
|
-
p *nil, &nil
|
448
|
-
end
|
449
|
-
|
450
|
-
|
451
|
-
module Y19 #limit lvar scope
|
452
|
-
a,b,c,(d,e)=1,2,3,[4,5]
|
453
|
-
p a %(4)
|
454
|
-
p c %(4)
|
455
|
-
p d %(4)
|
456
|
-
p e %(4)
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
a=[1,2,3,4,5]
|
461
|
-
|
462
|
-
def self.g(x=nil); 3 end
|
463
|
-
def a.g=(x) p x end
|
464
|
-
|
465
|
-
g = 5
|
466
|
-
|
467
|
-
self.g = 55
|
468
|
-
|
469
|
-
|
470
|
-
class<<a
|
471
|
-
def bb=(x) p :bb=, x end
|
472
|
-
end
|
473
|
-
|
474
|
-
A=a
|
475
|
-
class<<self
|
476
|
-
def aa; :aa end
|
477
|
-
def bb(arg=nil); p :bb; A end
|
478
|
-
alias bbb bb
|
479
|
-
|
480
|
-
def m; self end
|
481
|
-
def n; self end
|
482
|
-
|
483
|
-
def +(other) self end
|
484
|
-
def kk; nil end
|
485
|
-
def kk=(foo); nil end
|
486
|
-
end
|
487
|
-
|
488
|
-
|
489
|
-
proc{|a[4]|}.call 6
|
490
|
-
proc{|a[b]|}.call 7
|
491
|
-
proc{|a.bb| bb %(9) }.call 9
|
492
|
-
proc{|a[f]| f %(9) }.call 8
|
493
|
-
proc{|bb(aa).bb| aa %(10) }.call 10
|
494
|
-
proc{|bbb(aa).bb| bbb %(11) }.call 11
|
495
|
-
proc{|t,u,(v,w,x),(y,),z|
|
496
|
-
t %(12)
|
497
|
-
u %(12)
|
498
|
-
v %(12)
|
499
|
-
w %(12)
|
500
|
-
x %(12)
|
501
|
-
y %(12)
|
502
|
-
z %(12)
|
503
|
-
}.call(1,2,[3,4,5],[6],7)
|
504
|
-
proc{|(m).kk,(m+n).kk|
|
505
|
-
m %(13)
|
506
|
-
n %(13)
|
507
|
-
kk %(13)
|
508
|
-
}.call(13,14)
|
509
|
-
|
510
|
-
proc{|a.g| g %(9)}
|
511
|
-
|
512
|
-
p a
|
513
|
-
|
514
|
-
end
|
515
|
-
|
516
|
-
|
517
|
-
module R34634534
|
518
|
-
#how do I avoid getting into trouble with this test case?
|
519
|
-
#seems like I should be seeing local vars in the param list of
|
520
|
-
#the 2nd call to p....
|
521
|
-
class<<self
|
522
|
-
alias q p
|
523
|
-
alias r p
|
524
|
-
alias s p
|
525
|
-
end
|
526
|
-
|
527
|
-
p(q,r,s)
|
528
|
-
|
529
|
-
q %(1)
|
530
|
-
r %(1)
|
531
|
-
s %(1)
|
532
|
-
|
533
|
-
p (q,r,s)
|
534
|
-
|
535
|
-
q %(1)
|
536
|
-
r %(1)
|
537
|
-
s %(1)
|
538
|
-
end
|
539
|
-
|
540
|
-
|
541
|
-
|
542
|
-
p p :c, :d
|
543
|
-
p true ?
|
544
|
-
1 : 2
|
545
|
-
module M555
|
546
|
-
def r;4 end
|
547
|
-
r=r.nil? #2nd r seems like it should be MethNameToken, but is VarNameToken (for matz too)
|
548
|
-
end
|
549
|
-
|
550
|
-
p ?e.+?y
|
551
|
-
p ?e.+ ?y
|
552
|
-
p ?e.-?y
|
553
|
-
p ?e.*?y
|
554
|
-
p ?e./?y
|
555
|
-
p ?e.<<?y
|
556
|
-
p ?e.%?y
|
557
|
-
p ?e.**?y
|
558
|
-
p ?e.&?y
|
559
|
-
|
560
|
-
|
561
|
-
p "#{<<foobar0.each('|'){|s| '\nthort: '+s} }"
|
562
|
-
jbvd|g4543ghb|!@G$dfsd|fafr|e
|
563
|
-
|s4e5rrwware|BBBBB|*&^(*&^>"PMK:njs;d|
|
564
|
-
|
565
|
-
foobar0
|
566
|
-
|
567
|
-
|
568
|
-
p 0.9
|
569
|
-
p 1.45000000000000000000000000000000000000001
|
570
|
-
p 9.999999999999999999999999999999999999999999
|
571
|
-
p 9.999999999999999999999999999999999999999999e999999999999999999999999999
|
572
|
-
p 0b0100011001
|
573
|
-
p 0o123456701
|
574
|
-
p 0123456701
|
575
|
-
|
576
|
-
p 0x123456789abcdefABCDEF01
|
577
|
-
|
578
|
-
|
579
|
-
|
580
|
-
|
581
|
-
|
582
|
-
p % foo
|
583
|
-
p % foo
|
584
|
-
p %
|
585
|
-
foo
|
586
|
-
|
587
|
-
|
588
|
-
p eval "%\sfoo\s"
|
589
|
-
|
590
|
-
p eval "%\tfoo\t"
|
591
|
-
p :p
|
592
|
-
p :p
|
593
|
-
p eval "%\vfoo\v"
|
594
|
-
p eval "%\rfoo\r"
|
595
|
-
p :p
|
596
|
-
p :p
|
597
|
-
p eval "%\nfoo\n"
|
598
|
-
p eval "%\0foo\0"
|
599
|
-
|
600
|
-
p eval "%\r\nfoo\r\n"
|
601
|
-
|
602
|
-
#given that \n\r is not considered a valid eol
|
603
|
-
#sequence in ruby (unlike \r\n), the next 2 are ok
|
604
|
-
p eval "%\n\rfoo\n\r" #ruby get this wrong
|
605
|
-
p eval "%\n\rfoo\n" #this shouldn't work but does
|
606
|
-
|
607
|
-
#seems like just \r isn't valid newline either, which is
|
608
|
-
#puzzling but the following are are correct.
|
609
|
-
#does ruby do these all correctly? seems kinda inconsistant
|
610
|
-
#either both of these should fail, or both should succeed
|
611
|
-
p eval "%\r\nfoo\r" #this does not work,
|
612
|
-
p eval "%\r\nfoo\n" #this shouldn't work but does
|
613
|
-
|
614
|
-
p eval "%\rfoo\r" #this works
|
615
|
-
p eval "%\rfoo\n" #this does not work,
|
616
|
-
p eval "%\rfoo\r\n" #this does not work,
|
617
|
-
|
618
|
-
p eval "%\nfoo\r" #this does not work
|
619
|
-
p eval "%\nfoo\n" #this works
|
620
|
-
p eval "%\nfoo\r\n" #this works,
|
621
|
-
|
622
|
-
p "Hi, my name is #{"Slim #{(4)>2?"Whitman":"Shady"} "}."
|
623
|
-
p "Hi, my name is #{"Slim #{(4)<2?"Whitman":"Shady"} "}."
|
624
|
-
|
625
|
-
|
626
|
-
p(String *Class)
|
627
|
-
class String
|
628
|
-
class Class
|
629
|
-
end
|
630
|
-
end
|
631
|
-
#def String(x) x.to_s end #it's already built-in. duh!
|
632
|
-
def String.*(right) [self,right] end
|
633
|
-
def String.<<(right) [self,:<<,right] end
|
634
|
-
def String./(right) [self,:/,right] end
|
635
|
-
def String.[](right) [self,:[],right] end
|
636
|
-
def Class.-@; [:-@, self] end
|
637
|
-
p(String::Class)
|
638
|
-
p(String:: Class)
|
639
|
-
p(String ::Class)
|
640
|
-
p(String :: Class)
|
641
|
-
p(String<<Class)
|
642
|
-
p(String<< Class)
|
643
|
-
p(String <<Class)
|
644
|
-
sgsdfgf
|
645
|
-
Class
|
646
|
-
Class
|
647
|
-
p(String << Class)
|
648
|
-
p(String<<-Class)
|
649
|
-
p(String<< -Class)
|
650
|
-
p(String <<-Class)
|
651
|
-
sgsdfgf
|
652
|
-
Class
|
653
|
-
Class
|
654
|
-
p(String <<-Class)
|
655
|
-
sgsdfgf
|
656
|
-
Class
|
657
|
-
Class
|
658
|
-
Class
|
659
|
-
p(String << -Class)
|
660
|
-
|
661
|
-
p(String<<- Class)
|
662
|
-
p(String<< - Class)
|
663
|
-
p(String <<- Class)
|
664
|
-
Class
|
665
|
-
Class
|
666
|
-
p(String <<- Class)
|
667
|
-
Class
|
668
|
-
Class
|
669
|
-
Class
|
670
|
-
p(String << - Class)
|
671
|
-
p(String/Class)
|
672
|
-
p(String/ Class)
|
673
|
-
p(String /Class/)
|
674
|
-
p(String / Class) #borken
|
675
|
-
p(String[Class])
|
676
|
-
p(String[ Class])
|
677
|
-
p(String [Class])
|
678
|
-
p(String [ Class])
|
679
|
-
p(String*Class)
|
680
|
-
p(String* Class)
|
681
|
-
p(String *Class)
|
682
|
-
p(String * Class)
|
683
|
-
class <<String
|
684
|
-
undef :*,<<,/,[]
|
685
|
-
end
|
686
|
-
|
687
|
-
|
688
|
-
|
689
|
-
p(false::to_s)
|
690
|
-
p(false ::to_s)
|
691
|
-
p(false:: to_s)
|
692
|
-
p(false :: to_s)
|
693
|
-
|
694
|
-
|
695
|
-
class C2
|
696
|
-
class <<self
|
697
|
-
def self.p8; p 8 end
|
698
|
-
alias p? p
|
699
|
-
alias P? p
|
700
|
-
alias [] p
|
701
|
-
alias <=> p
|
702
|
-
end
|
703
|
-
|
704
|
-
q=9
|
705
|
-
Q=99
|
706
|
-
|
707
|
-
p:p8
|
708
|
-
false ? p: p8
|
709
|
-
p :p8
|
710
|
-
false ? p : p8
|
711
|
-
|
712
|
-
false ? q:p8
|
713
|
-
false ? q: p8
|
714
|
-
false ? q :p8
|
715
|
-
false ? q : p8
|
716
|
-
|
717
|
-
#false ? Q:p8 #gives ruby indigestion
|
718
|
-
false ? Q: p8
|
719
|
-
#false ? Q :p8 #gives ruby indigestion
|
720
|
-
false ? Q : p8
|
721
|
-
|
722
|
-
p?:p8
|
723
|
-
false ? p?: p8
|
724
|
-
p? :p8
|
725
|
-
false ? p? : p8
|
726
|
-
|
727
|
-
p??1
|
728
|
-
p? ?1
|
729
|
-
p(p?? 1 : 2)
|
730
|
-
p(p? ? 1 : 2)
|
731
|
-
|
732
|
-
P?:p8
|
733
|
-
false ? P?: p8
|
734
|
-
P? :p8
|
735
|
-
false ? P? : p8
|
736
|
-
|
737
|
-
P??1
|
738
|
-
P? ?1
|
739
|
-
p(P?? 1 : 2)
|
740
|
-
p(P? ? 1 : 2)
|
741
|
-
|
742
|
-
self.[]:p8
|
743
|
-
false ? self.[]: p8
|
744
|
-
self.[] :p8
|
745
|
-
false ? self.[] : p8
|
746
|
-
|
747
|
-
self.<=>:p8
|
748
|
-
false ? self.<=>: p8
|
749
|
-
self.<=> :p8
|
750
|
-
false ? self.<=> : p8
|
751
|
-
|
752
|
-
self <=>:p8
|
753
|
-
#false ? self <=>: p8 #gives ruby indigestion
|
754
|
-
self <=> :p8
|
755
|
-
#false ? self <=> : p8 #gives ruby indigestion
|
756
|
-
end
|
757
|
-
|
758
|
-
p <<stuff+'foobar'.tr('j-l','d-f')
|
759
|
-
"more stuff"
|
760
|
-
12345678
|
761
|
-
the quick brown fox jumped over the lazy dog
|
762
|
-
stuff
|
763
|
-
|
764
|
-
|
765
|
-
p <<p
|
766
|
-
sdfsfdf^^^^@@@
|
767
|
-
p
|
768
|
-
mix=nil
|
769
|
-
p / 5/mix
|
770
|
-
|
771
|
-
module M33
|
772
|
-
p="var:"
|
773
|
-
Q="func:"
|
774
|
-
def Q.method_missing(name,*args)
|
775
|
-
self+name.to_s+(args.join' ')
|
776
|
-
end
|
777
|
-
def p.method_missing(name,*args)
|
778
|
-
self+name.to_s+(args.join' ')
|
779
|
-
end
|
780
|
-
def self.p(*a); super; Q end
|
781
|
-
@a=1
|
782
|
-
$a=2
|
783
|
-
|
784
|
-
p(p~6)
|
785
|
-
p(p ~6)
|
786
|
-
p(p~ 6)
|
787
|
-
p(p ~ 6)
|
788
|
-
p(p*11)
|
789
|
-
p(p *11)
|
790
|
-
p(p* 11)
|
791
|
-
p(p * 11)
|
792
|
-
p(p&proc{})
|
793
|
-
p(p &proc{})
|
794
|
-
p(p& proc{})
|
795
|
-
p(p & proc{})
|
796
|
-
p(p !1)
|
797
|
-
# p(p ?1) #compile error, when p is var
|
798
|
-
p(p ! 1)
|
799
|
-
p(p ? 1 : 6)
|
800
|
-
p(p@a)
|
801
|
-
p(p @a)
|
802
|
-
# p(p@ a) #wont
|
803
|
-
# p(p @ a) #work
|
804
|
-
p(p#a
|
805
|
-
)
|
806
|
-
p(p #a
|
807
|
-
)
|
808
|
-
p(p# a
|
809
|
-
)
|
810
|
-
p(p # a
|
811
|
-
)
|
812
|
-
p(p$a)
|
813
|
-
p(p $a)
|
814
|
-
# p(p$ a) #wont
|
815
|
-
# p(p $ a) #work
|
816
|
-
p(p%Q{:foo})
|
817
|
-
p(p %Q{:foo})
|
818
|
-
p(p% Q{:foo})
|
819
|
-
p(p % Q{:foo})
|
820
|
-
p(p^6)
|
821
|
-
p(p ^6)
|
822
|
-
p(p^ 6)
|
823
|
-
p(p ^ 6)
|
824
|
-
p(p&7)
|
825
|
-
p(p &proc{7})
|
826
|
-
p(p& 7)
|
827
|
-
p(p & 7)
|
828
|
-
p(p(2))
|
829
|
-
p(p (2))
|
830
|
-
p(p( 2))
|
831
|
-
p(p ( 2))
|
832
|
-
p(p(p))
|
833
|
-
p(p())
|
834
|
-
p(p (p))
|
835
|
-
p(p ())
|
836
|
-
p(p ( p))
|
837
|
-
p(p ( ))
|
838
|
-
p(p( p))
|
839
|
-
p(p( ))
|
840
|
-
p(p)
|
841
|
-
p((p))
|
842
|
-
p(p )
|
843
|
-
p((p ))
|
844
|
-
p((p p))
|
845
|
-
p((p p,p))
|
846
|
-
p((p p))
|
847
|
-
p((p p,p))
|
848
|
-
p(p-0)
|
849
|
-
p(p -0)
|
850
|
-
p(p- 0)
|
851
|
-
p(p - 0)
|
852
|
-
p(p+9)
|
853
|
-
p(p +9)
|
854
|
-
p(p+ 9)
|
855
|
-
p(p + 9)
|
856
|
-
p(p[1])
|
857
|
-
p(p [1])
|
858
|
-
p(p[ 1])
|
859
|
-
p(p [ 1])
|
860
|
-
p(p{1})
|
861
|
-
p(p {1})
|
862
|
-
p(p{ 1})
|
863
|
-
p(p { 1})
|
864
|
-
p(p/1)
|
865
|
-
p(p /22)
|
866
|
-
p(p/ 1)
|
867
|
-
p(p / 22)
|
868
|
-
p(p._)
|
869
|
-
p(p ._)
|
870
|
-
p(p. _)
|
871
|
-
p(p . _)
|
872
|
-
p(false ? p:f)
|
873
|
-
p(false ? p :f)
|
874
|
-
p(false ? p: f)
|
875
|
-
p(false ? p : f)
|
876
|
-
p((p;1))
|
877
|
-
p((p ;1))
|
878
|
-
p((p; 1))
|
879
|
-
p((p ; 1))
|
880
|
-
p(p<1)
|
881
|
-
p(p <1)
|
882
|
-
p(p< 1)
|
883
|
-
p(p < 1)
|
884
|
-
p(p<<1)
|
885
|
-
p(p <<1)
|
886
|
-
p(p<< 1)
|
887
|
-
p(p << 1)
|
888
|
-
p(p'j')
|
889
|
-
p(p 'j')
|
890
|
-
p(p' j')
|
891
|
-
p(p ' j')
|
892
|
-
p(p"k")
|
893
|
-
p(p "k")
|
894
|
-
p(p" k")
|
895
|
-
p(p " k")
|
896
|
-
p(p|4)
|
897
|
-
p(p |4)
|
898
|
-
p(p| 4)
|
899
|
-
p(p | 4)
|
900
|
-
p(p>2)
|
901
|
-
p(p >2)
|
902
|
-
p(p> 2)
|
903
|
-
p(p > 2)
|
904
|
-
|
905
|
-
end
|
906
|
-
|
907
|
-
|
908
|
-
module M34
|
909
|
-
p(p~6)
|
910
|
-
p(p ~6)
|
911
|
-
p(p~ 6)
|
912
|
-
p(p ~ 6)
|
913
|
-
p(p*[1])
|
914
|
-
p(p *[1])
|
915
|
-
p(p* [1])
|
916
|
-
p(p * [1])
|
917
|
-
p(p&proc{})
|
918
|
-
p(p &proc{})
|
919
|
-
p(p& proc{})
|
920
|
-
p(p & proc{})
|
921
|
-
p(p !1)
|
922
|
-
p(p ?1)
|
923
|
-
p(p ! 1)
|
924
|
-
p(p ? 1 : 6)
|
925
|
-
p(p@a)
|
926
|
-
p(p @a)
|
927
|
-
# p(p@ a) #wont
|
928
|
-
# p(p @ a) #work
|
929
|
-
|
930
|
-
p(p#a
|
931
|
-
)
|
932
|
-
p(p #a
|
933
|
-
)
|
934
|
-
p(p# a
|
935
|
-
)
|
936
|
-
p(p # a
|
937
|
-
)
|
938
|
-
p(p$a)
|
939
|
-
p(p $a)
|
940
|
-
# p(p$ a) #wont
|
941
|
-
# p(p $ a) #work
|
942
|
-
p(p%Q{:foo})
|
943
|
-
p(p %Q{:foo})
|
944
|
-
p(p% Q{:foo})
|
945
|
-
p(p % Q{:foo})
|
946
|
-
p(p^6)
|
947
|
-
p(p ^6)
|
948
|
-
p(p^ 6)
|
949
|
-
p(p ^ 6)
|
950
|
-
p(p&7)
|
951
|
-
p(p &proc{7})
|
952
|
-
p(p& 7)
|
953
|
-
p(p & 7)
|
954
|
-
p(p(2))
|
955
|
-
p(p (2))
|
956
|
-
p(p( 2))
|
957
|
-
p(p ( 2))
|
958
|
-
p(p(p))
|
959
|
-
p(p())
|
960
|
-
p(p (p))
|
961
|
-
p(p ())
|
962
|
-
p(p ( p))
|
963
|
-
p(p ( ))
|
964
|
-
p(p( p))
|
965
|
-
p(p( ))
|
966
|
-
p(p)
|
967
|
-
p((p))
|
968
|
-
p(p )
|
969
|
-
p((p ))
|
970
|
-
p((p p))
|
971
|
-
p((p p,p))
|
972
|
-
p((p p))
|
973
|
-
p((p p,p))
|
974
|
-
p(p-0)
|
975
|
-
p(p -1)
|
976
|
-
p(p- 0)
|
977
|
-
p(p - 0)
|
978
|
-
p(p+9)
|
979
|
-
p(p +9)
|
980
|
-
p(p+ 9)
|
981
|
-
p(p + 9)
|
982
|
-
p(p[1])
|
983
|
-
p(p [1])
|
984
|
-
p(p[ 1])
|
985
|
-
p(p [ 1])
|
986
|
-
p(p{1})
|
987
|
-
p(p {1})
|
988
|
-
p(p{ 1})
|
989
|
-
p(p { 1})
|
990
|
-
p(p/1)
|
991
|
-
p(p /22/)
|
992
|
-
p(p/ 1)
|
993
|
-
p(p / 22)
|
994
|
-
p(p._)
|
995
|
-
p(p ._)
|
996
|
-
p(p. _)
|
997
|
-
p(p . _)
|
998
|
-
p(p:f)
|
999
|
-
p(p :f)
|
1000
|
-
p(false ? p: f)
|
1001
|
-
p(false ? p : f)
|
1002
|
-
p((p;1))
|
1003
|
-
p((p ;1))
|
1004
|
-
p((p; 1))
|
1005
|
-
p((p ; 1))
|
1006
|
-
p(p<1)
|
1007
|
-
p(p <1)
|
1008
|
-
p(p< 1)
|
1009
|
-
p(p < 1)
|
1010
|
-
p(p<<1)
|
1011
|
-
p(p <<1)
|
1012
|
-
foobar
|
1013
|
-
1
|
1014
|
-
p(p<< 1)
|
1015
|
-
p(p << 1)
|
1016
|
-
p(p'j')
|
1017
|
-
p(p 'j')
|
1018
|
-
p(p' j')
|
1019
|
-
p(p ' j')
|
1020
|
-
p(p"k")
|
1021
|
-
p(p "k")
|
1022
|
-
p(p" k")
|
1023
|
-
p(p " k")
|
1024
|
-
p(p|4)
|
1025
|
-
p(p |4)
|
1026
|
-
p(p| 4)
|
1027
|
-
p(p | 4)
|
1028
|
-
p(p>2)
|
1029
|
-
p(p >2)
|
1030
|
-
p(p> 2)
|
1031
|
-
p(p > 2)
|
1032
|
-
|
1033
21
|
end
|
1034
22
|
|
1035
23
|
|
1036
|
-
|
1037
|
-
def bill(x) x end
|
1038
|
-
p(bob %(22))
|
1039
|
-
for bob in [100] do p(bob %(22)) end
|
1040
|
-
p(bob %(22))
|
1041
|
-
def %(n) to_s+"%#{n}" end
|
1042
|
-
p(bill %(22))
|
1043
|
-
begin sdjkfsjkdfsd; rescue Object => bill; p(bill %(22)) end
|
1044
|
-
p(bill %(22))
|
1045
|
-
undef %
|
24
|
+
=begin things that seem like they should work, but cause syntax errors
|
1046
25
|
|
1047
|
-
|
1048
|
-
|
1049
|
-
public :`
|
1050
|
-
def `(s)
|
1051
|
-
print "bq: #{s}\n"
|
1052
|
-
end
|
1053
|
-
end
|
1054
|
-
|
1055
|
-
69.`('what a world')
|
1056
|
-
|
1057
|
-
79::`('what a word')
|
1058
|
-
|
1059
|
-
p :`
|
1060
|
-
|
1061
|
-
p{}
|
1062
|
-
p {}
|
1063
|
-
module Y7284
|
1064
|
-
a=5
|
1065
|
-
p p +5
|
1066
|
-
p a +5
|
1067
|
-
end
|
1068
|
-
|
1069
|
-
def nil.+(x) ~x end
|
1070
|
-
def nil.[](*x) [x] end
|
1071
|
-
p( p + 5 )
|
1072
|
-
p( p +5 )
|
1073
|
-
p( p+5 )
|
1074
|
-
p( p[] )
|
1075
|
-
p( p [] )
|
1076
|
-
p( p [ ] )
|
1077
|
-
class NilClass; undef +,[] end
|
1078
|
-
|
1079
|
-
class Foou
|
1080
|
-
public
|
1081
|
-
def [] x=-100,&y; p x; 100 end
|
1082
|
-
end
|
1083
|
-
|
1084
|
-
|
1085
|
-
module Y345636
|
1086
|
-
a0=8
|
1087
|
-
p Foou.new.[]!false #value
|
1088
|
-
p Foou.new.[] !false #value
|
1089
|
-
p Foou.new.[]~9 #value
|
1090
|
-
p Foou.new.[] ~9 #value
|
1091
|
-
p Foou.new.[]-9 #op
|
1092
|
-
p Foou.new.[]+9 #op
|
1093
|
-
p Foou.new.[] -9 #value
|
1094
|
-
p Foou.new.[] +9 #value
|
1095
|
-
p Foou.new.[]<<9 #op
|
1096
|
-
p Foou.new.[] <<9 #value
|
1097
|
-
foobar
|
1098
|
-
9
|
1099
|
-
p Foou.new.[]%9 #op
|
1100
|
-
p Foou.new.[]/9 #op
|
1101
|
-
p Foou.new.[] %(9) #value
|
1102
|
-
p Foou.new.[] /9/ #value
|
1103
|
-
p Foou.new.[]$9 #value
|
1104
|
-
p Foou.new.[]a0 #value
|
1105
|
-
p Foou.new.[] $9 #value
|
1106
|
-
p Foou.new.[] a0 #value
|
1107
|
-
p Foou.new.[]{9} #lambda (op)
|
1108
|
-
p Foou.new.[] {9} #lambda (op)
|
1109
|
-
|
1110
|
-
if p then p end
|
1111
|
-
|
1112
|
-
p({:foo=>:bar}) #why does this work? i'd think that ':foo=' would be 1 token
|
1113
|
-
p EMPTY = 0
|
1114
|
-
p BLACK = 1
|
1115
|
-
p WHITE = - BLACK
|
1116
|
-
end
|
1117
|
-
|
1118
|
-
module Y8576456
|
1119
|
-
a=b=c=0
|
1120
|
-
a ? b:c
|
1121
|
-
a ?b:c
|
1122
|
-
|
1123
|
-
p(a ? b:c)
|
1124
|
-
p(a ?b:c)
|
1125
|
-
|
1126
|
-
p~4
|
1127
|
-
p:f
|
1128
|
-
p(~4){}
|
1129
|
-
p(:f){}
|
1130
|
-
h={}
|
1131
|
-
h.default=:foo
|
1132
|
-
|
1133
|
-
p def (h="foobar").default= v; p @v=v;v end
|
1134
|
-
p h
|
1135
|
-
|
1136
|
-
p h.default=:b
|
1137
|
-
end
|
1138
|
-
|
1139
|
-
|
1140
|
-
module Y6543423
|
1141
|
-
x, (*y) = [:x, :y, :z]
|
1142
|
-
p x
|
1143
|
-
p y
|
1144
|
-
|
1145
|
-
x, *y = [:x, :y, :z]
|
1146
|
-
p x
|
1147
|
-
p y
|
1148
|
-
|
1149
|
-
x, * = [:x, :y, :z]
|
1150
|
-
p x
|
1151
|
-
end
|
1152
|
-
|
1153
|
-
|
1154
|
-
p Array("foo\nbar")
|
1155
|
-
|
1156
|
-
|
1157
|
-
|
1158
|
-
p +(4)
|
1159
|
-
p -(4)
|
1160
|
-
|
1161
|
-
p :'\\'
|
1162
|
-
|
1163
|
-
class Foop
|
1164
|
-
def Foop.bar a,b
|
1165
|
-
p a,b
|
1166
|
-
end
|
1167
|
-
end
|
1168
|
-
Foop.bar 1,2
|
1169
|
-
Foop::bar 3,4
|
1170
|
-
|
1171
|
-
|
1172
|
-
class Foop
|
1173
|
-
def Foop::baz a,b
|
1174
|
-
p :baz,a,b
|
1175
|
-
end
|
1176
|
-
end
|
1177
|
-
Foop.baz 5,6
|
1178
|
-
Foop::baz 7,8
|
1179
|
-
|
1180
|
-
|
1181
|
-
|
1182
|
-
without_creating=widgetname=nil
|
1183
|
-
if without_creating && !widgetname #foo
|
1184
|
-
fail ArgumentError,
|
1185
|
-
"if set 'without_creating' to true, need to define 'widgetname'"
|
1186
|
-
end
|
1187
|
-
|
1188
|
-
|
1189
|
-
|
1190
|
-
|
1191
|
-
#class, module, and def should temporarily hide local variables
|
1192
|
-
def mopsdfjskdf arg; arg*2 end
|
1193
|
-
mopsdfjskdf=5
|
1194
|
-
class C
|
1195
|
-
p mopsdfjskdf %(3) #calls method
|
1196
|
-
end
|
1197
|
-
|
1198
|
-
module M
|
1199
|
-
p mopsdfjskdf %(4) #calls method
|
1200
|
-
end
|
1201
|
-
|
1202
|
-
def d
|
1203
|
-
p mopsdfjskdf %(5) #calls method
|
1204
|
-
end
|
1205
|
-
p d
|
1206
|
-
p mopsdfjskdf %(6) #reads variable
|
1207
|
-
p proc{mopsdfjskdf %(7)}[] #reads variable
|
1208
|
-
|
1209
|
-
#fancy symbols
|
1210
|
-
p %s{symbol}
|
1211
|
-
|
1212
|
-
#multiple assignment test
|
1213
|
-
proc {
|
1214
|
-
a,b,c,d,e,f,g,h,i,j,k=1,2,3,4,5,6,7,8,9,10,11
|
1215
|
-
p(b %(c))
|
1216
|
-
p(a %(c))
|
1217
|
-
p(k %(c))
|
1218
|
-
p(p %(c))
|
1219
|
-
}.call
|
1220
|
-
|
1221
|
-
=begin disable for now
|
1222
|
-
|
1223
|
-
|
1224
|
-
p "#{<<kekerz}#{"foob"
|
1225
|
-
zimpler
|
1226
|
-
kekerz
|
1227
|
-
}"
|
1228
|
-
|
1229
|
-
|
1230
|
-
aaa=<<whatnot; p "#{'uh,yeah'
|
1231
|
-
gonna take it down, to the nitty-grit
|
1232
|
-
gonna tell you mother-fuckers why you ain't shit
|
1233
|
-
cause suckers like you just make me strong
|
1234
|
-
you been pumpin' that bullshit all day long
|
1235
|
-
whatnot
|
1236
|
-
}"
|
1237
|
-
p aaa
|
1238
|
-
|
1239
|
-
#test variable creation in string inclusion
|
1240
|
-
#currently broken because string inclusions
|
1241
|
-
#are lexed by a separate lexer!
|
1242
|
-
proc {
|
1243
|
-
p "jentawz: #{baz=200}"
|
1244
|
-
p( baz %(9))
|
1245
|
-
}.call
|
1246
|
-
|
1247
|
-
#scope of local variables always includes the here document
|
1248
|
-
#body if it includes the head
|
1249
|
-
p %w[well, whaddaya know].map{|j| <<-END }
|
1250
|
-
#{j #previous j should be local var, not method
|
1251
|
-
}45634543
|
1252
|
-
END
|
1253
|
-
|
1254
|
-
|
1255
|
-
|
1256
|
-
=end disable for now
|
1257
|
-
|
1258
|
-
|
1259
|
-
=begin ought to work...ruby doesn't like
|
1260
|
-
p :$1
|
1261
|
-
p :$98349576875974523789734582394578
|
1262
|
-
|
1263
|
-
(p / 1/) #ruby no like
|
26
|
+
(p / 1/)
|
1264
27
|
|
1265
28
|
class F34534334
|
1266
29
|
class A
|
@@ -1295,6 +58,7 @@ g+g 5 #this doesn't
|
|
1295
58
|
|
1296
59
|
[nil,p 5]
|
1297
60
|
"foo"+[1].join' '
|
61
|
+
"foo"+join' '
|
1298
62
|
if x=p :a,:b then end
|
1299
63
|
{:nil?=> 1}
|
1300
64
|
|
@@ -1344,476 +108,5 @@ end
|
|
1344
108
|
|
1345
109
|
raise LexerError, "expected >=#{tok.offset}, got #{endpos}, "\
|
1346
110
|
"token #{tok}:#{tok.class}" #there's a space after the backslash
|
1347
|
-
|
1348
|
-
=end disable for now
|
1349
|
-
|
1350
|
-
proc {
|
1351
|
-
}
|
1352
|
-
|
1353
|
-
p "#{<<foobar3}"
|
1354
|
-
bim
|
1355
|
-
baz
|
1356
|
-
bof
|
1357
|
-
foobar3
|
1358
|
-
|
1359
|
-
def func
|
1360
|
-
a,b,* = [1,2,3,4,5,6,7,8]
|
1361
|
-
p a,b
|
1362
|
-
a,b, = [1,2,3,4,5,6,7,8]
|
1363
|
-
p a,b
|
1364
|
-
|
1365
|
-
a,b = [1,2,3,4,5,6,7,8]
|
1366
|
-
p a,b
|
1367
|
-
a,*b = [1,2,3,4,5,6,7,8]
|
1368
|
-
p a,b
|
1369
|
-
|
1370
|
-
a,b,*c=[1,2,3,4,5,6,7,8]
|
1371
|
-
a,b,* c=[1,2,3,4,5,6,7,8]
|
1372
|
-
end
|
1373
|
-
func
|
1374
|
-
|
1375
|
-
|
1376
|
-
|
1377
|
-
p( %r{\/$})
|
1378
|
-
p( %r~<!include:([\/\w\.\-]+)>~m)
|
1379
|
-
|
1380
|
-
proc {
|
1381
|
-
h={:a=>(foo=100)}
|
1382
|
-
p( foo %(5))
|
1383
|
-
}.call
|
1384
|
-
|
1385
|
-
|
1386
|
-
|
1387
|
-
def foo(a=<<a,b=<<b,c=<<c)
|
1388
|
-
jfksdkjf
|
1389
|
-
dkljjkf
|
1390
|
-
a
|
1391
|
-
kdljfjkdg
|
1392
|
-
dfglkdfkgjdf
|
1393
|
-
dkf
|
1394
|
-
b
|
1395
|
-
lkdffdjksadhf
|
1396
|
-
sdflkdjgsfdkjgsdg
|
1397
|
-
dsfg;lkdflisgffd
|
1398
|
-
g
|
1399
|
-
c
|
1400
|
-
|
1401
|
-
a+b+c
|
1402
|
-
|
1403
|
-
end
|
1404
|
-
|
1405
|
-
p foo
|
1406
|
-
|
1407
|
-
|
1408
|
-
|
1409
|
-
|
1410
|
-
$a=1
|
1411
|
-
@b=2
|
1412
|
-
@@c=3
|
1413
|
-
p "#$a #@b #@@c #{$a+@b+@@c}"
|
1414
|
-
p "\#$a \#@b \#@@c \#{$a+@b+@@c}"
|
1415
|
-
p '#$a #@b #@@c #{$a+@b+@@c}'
|
1416
|
-
p '\#$a \#@b \#@@c \#{$a+@b+@@c}'
|
1417
|
-
p %w"#$a #@b #@@c #{$a+@b+@@c}"
|
1418
|
-
p %w"\#$a \#@b \#@@c \#{$a+@b+@@c}"
|
1419
|
-
p %W"#$a #@b #@@c #{$a+@b+@@c}"
|
1420
|
-
p %W"\#$a \#@b \#@@c \#{$a+@b+@@c}"
|
1421
|
-
p %Q[#$a #@b #@@c #{$a+@b+@@c}]
|
1422
|
-
p %Q[\#$a \#@b \#@@c \#{$a+@b+@@c}]
|
1423
|
-
p `echo #$a #@b #@@c #{$a+@b+@@c}`
|
1424
|
-
p `echo \#$a \#@b \#@@c \#{$a+@b+@@c}`
|
1425
|
-
p(/#$a #@b #@@c #{$a+@b+@@c}/)
|
1426
|
-
#p(/\#$a \#@b \#@@c \#{$a+@b+@@c}/) #moved to w.rb
|
1427
|
-
|
1428
|
-
|
1429
|
-
class AA; class BB; class CC
|
1430
|
-
FFOO=1
|
1431
|
-
end end end
|
1432
|
-
|
1433
|
-
p AA::BB::CC::FFOO
|
1434
|
-
|
1435
|
-
compile_body=outvar='foob'
|
1436
|
-
|
1437
|
-
if false
|
1438
|
-
method_src = c.compile(template, (HtmlCompiler::AnyData.new)).join("\n") +
|
1439
|
-
"\n# generated by PartsTemplate::compile_partstemplate at #{Time.new}\n"
|
1440
|
-
rescu -1
|
1441
|
-
end
|
1442
|
-
|
1443
|
-
p('rb_out', 'args', <<-'EOL')
|
1444
|
-
regsub -all {!} $args {\\!} args
|
1445
|
-
regsub -all "{" $args "\\{" args
|
1446
|
-
if {[set st [catch {ruby [format "TkCore.callback %%Q!%s!" $args]} ret]] != 0} {
|
1447
|
-
return -code $st $ret
|
1448
|
-
} {
|
1449
|
-
return $ret
|
1450
|
-
}
|
1451
|
-
EOL
|
1452
|
-
|
1453
|
-
|
1454
|
-
def add(*args)
|
1455
|
-
self.<<(*args)
|
1456
|
-
end
|
1457
|
-
|
1458
|
-
|
1459
|
-
|
1460
|
-
val=%[13,17,22,"hike", ?\s]
|
1461
|
-
if val.include? ?\s
|
1462
|
-
p val.split.collect{|v| (v)}
|
1463
|
-
end
|
1464
|
-
p "#{}"
|
1465
|
-
p "#(1)"
|
1466
|
-
class Hosts
|
1467
|
-
end
|
1468
|
-
class DNS < Hosts
|
1469
|
-
end
|
1470
|
-
def intialize(resolvers=[Hosts.new, DNS.new]) end
|
1471
|
-
def environment(env = File.basename($0, '.*')) end
|
1472
|
-
|
1473
|
-
def ssssss &block
|
1474
|
-
end
|
1475
|
-
def params_quoted(field_name, default)
|
1476
|
-
if block_given? then yield field_name else default end
|
1477
|
-
end
|
1478
|
-
def ==(o) 444 end
|
1479
|
-
def String.ffff4() self.to_s+"ffff" end
|
1480
|
-
|
1481
|
-
p *[]
|
1482
|
-
#abc123def
|
1483
|
-
module Y23423423
|
1484
|
-
for i in \
|
1485
|
-
[44,55,66,77,88] do p i**Math.sqrt(i) end
|
1486
|
-
|
1487
|
-
|
1488
|
-
#(
|
1489
|
-
for i in if
|
1490
|
-
false then foob12345; else [44,55,66,77,88] end do p i**Math.sqrt(i) end
|
1491
|
-
#)
|
1492
|
-
#end
|
1493
|
-
(
|
1494
|
-
for i in if false then
|
1495
|
-
foob12345; else [44,55,66,77,88] end do p i**Math.sqrt(i) end
|
1496
|
-
|
1497
|
-
c=j=0
|
1498
|
-
until while j<10 do j+=1 end.nil? do p 'pppppppppp' end
|
1499
|
-
for i in if false then foob12345;
|
1500
|
-
else [44,55,66,77,88] end do p i**Math.sqrt(i) end
|
1501
|
-
|
1502
|
-
for i in if false then foob12345; else
|
1503
|
-
[44,55,66,77,88] end do p i**Math.sqrt(i) end
|
1504
|
-
|
1505
|
-
|
1506
|
-
for i in (c;
|
1507
|
-
[44,55,66,77,88]) do p i**Math.sqrt(i) end
|
1508
|
-
)
|
1509
|
-
(
|
1510
|
-
|
1511
|
-
for i in (begin
|
1512
|
-
[44,55,66,77,88] end) do p i**Math.sqrt(i) end
|
1513
|
-
|
1514
|
-
for i in if false then foob12345; else
|
1515
|
-
[44,55,66,77,88] end do p i**Math.sqrt(i) end
|
1516
|
-
|
1517
|
-
for i in (
|
1518
|
-
|
1519
|
-
[44,55,66,77,88]) do p i**Math.sqrt(i) end
|
1520
|
-
|
1521
|
-
for i in (
|
1522
|
-
[44,55,66,77,88]) do p i**Math.sqrt(i) end
|
1523
|
-
|
1524
|
-
)
|
1525
|
-
end
|
1526
|
-
|
1527
|
-
|
1528
|
-
|
1529
|
-
def yy;yield end
|
1530
|
-
|
1531
|
-
block=proc{p "blah blah"}
|
1532
|
-
|
1533
|
-
yy &block
|
1534
|
-
p(1.+1)
|
1535
|
-
p pppp
|
1536
|
-
|
1537
|
-
module M66
|
1538
|
-
p(proc do
|
1539
|
-
p=123
|
1540
|
-
end.call)
|
1541
|
-
|
1542
|
-
p proc {
|
1543
|
-
p=123
|
1544
|
-
}.call
|
1545
|
-
|
1546
|
-
p def pppp
|
1547
|
-
p=123
|
1548
|
-
end
|
1549
|
-
p module Ppp
|
1550
|
-
p=123
|
1551
|
-
end
|
1552
|
-
p class Pppp < String
|
1553
|
-
p=123
|
1554
|
-
end
|
1555
|
-
end
|
1556
|
-
|
1557
|
-
def _make_regex(str) /([#{Regexp.escape(str)}])/n end
|
1558
|
-
p _make_regex("8smdf,34rh\#@\#$%$gfm/[]dD")
|
1559
|
-
|
1560
|
-
|
1561
|
-
p "#$a #@b #@@c
|
1562
|
-
|
1563
|
-
d e f
|
1564
|
-
#$a #@b #@@c
|
1565
|
-
"
|
1566
|
-
|
1567
|
-
p "\""
|
1568
|
-
|
1569
|
-
module Y89567567999
|
1570
|
-
a='a'
|
1571
|
-
class <<a
|
1572
|
-
def foobar
|
1573
|
-
self*101
|
1574
|
-
end
|
1575
|
-
alias eql? ==
|
1576
|
-
end
|
1577
|
-
|
1578
|
-
p a.foobar
|
1579
|
-
end
|
1580
|
-
|
1581
|
-
p(/^\s*(([+-\/*&\|^]|<<|>>|\|\||\&\&)=|\&\&|\|\|)/)
|
1582
|
-
p(:%)
|
1583
|
-
module Y45234234234223567675
|
1584
|
-
p( { :class => class_=0})
|
1585
|
-
end
|
1586
|
-
p cls_name = {}[:class]
|
1587
|
-
|
1588
|
-
|
1589
|
-
p foo
|
1590
|
-
p "#{$!.class}"
|
1591
|
-
p :p
|
1592
|
-
p(:p)
|
1593
|
-
p(:"[]")
|
1594
|
-
p :"[]"
|
1595
|
-
p("\\")
|
1596
|
-
p(/\\/)
|
1597
|
-
p(/[\\]/)
|
1598
|
-
p 0x80
|
1599
|
-
p ?p
|
1600
|
-
p 0.1
|
1601
|
-
p 0.8
|
1602
|
-
p 0.9
|
1603
|
-
p(-1)
|
1604
|
-
p %/p/
|
1605
|
-
p %Q[<LI>]
|
1606
|
-
i=99
|
1607
|
-
p %Q[<LI><A HREF="#{i[3]}.html\##{i[4]}">#{i[0]+i[1]+(i[2])}</A>\n]
|
1608
|
-
p(:side=>:top)
|
1609
|
-
p %w[a b c
|
1610
|
-
d e f]
|
1611
|
-
p %w[a b c\n
|
1612
|
-
d e f]
|
1613
|
-
p %w[\\]
|
1614
|
-
p %w[\]]
|
1615
|
-
p :+
|
1616
|
-
p 99 / 3
|
1617
|
-
|
1618
|
-
module Y66
|
1619
|
-
a=99;b=3
|
1620
|
-
p 1+(a / b)
|
1621
|
-
end
|
1622
|
-
p %Q[\"]
|
1623
|
-
p %Q[ some [nested] text]
|
1624
|
-
|
1625
|
-
|
1626
|
-
if false
|
1627
|
-
formatter.format_element(element) do
|
1628
|
-
amrita_expand_and_format1(element, context, formatter)
|
1629
|
-
end
|
1630
|
-
end
|
1631
|
-
if false
|
1632
|
-
ret = <<-END
|
1633
|
-
@@parts_template = #{template.to_ruby}
|
1634
|
-
def parts_template
|
1635
|
-
@@parts_template
|
1636
|
-
end
|
1637
|
-
|
1638
|
-
#{c.const_def_src.join("\n")}
|
1639
|
-
def amrita_expand_and_format(element, context, formatter)
|
1640
|
-
if element.tagname_symbol == :span and element.attrs.size == 0
|
1641
|
-
amrita_expand_and_format1(element, context, formatter)
|
1642
|
-
else
|
1643
|
-
formatter.format_element(element) do
|
1644
|
-
amrita_expand_and_format1(element, context, formatter)
|
1645
|
-
end
|
1646
|
-
end
|
1647
|
-
end
|
1648
|
-
|
1649
|
-
def amrita_expand_and_format1(element, context, formatter)
|
1650
|
-
#{method_src}
|
1651
|
-
end
|
1652
|
-
END
|
1653
|
-
j=55
|
1654
|
-
end
|
1655
|
-
|
1656
|
-
p '
|
1657
|
-
'
|
1658
|
-
p '\n'
|
1659
|
-
p "
|
1660
|
-
"
|
1661
|
-
p "\n"
|
1662
|
-
p %w/
|
1663
|
-
/
|
1664
|
-
p %w/\n/
|
1665
|
-
|
1666
|
-
p %W/
|
1667
|
-
/
|
1668
|
-
p %W/\n/
|
1669
|
-
p(/
|
1670
|
-
/)
|
1671
|
-
p(/\n/)
|
1672
|
-
p proc {
|
1673
|
-
p `
|
1674
|
-
`
|
1675
|
-
p `\n`
|
1676
|
-
}
|
1677
|
-
|
1678
|
-
|
1679
|
-
|
1680
|
-
p(%r[foo]i)
|
1681
|
-
p <<stuff+'foobar'.tr('j-l','d-f')
|
1682
|
-
"more stuff"
|
1683
|
-
12345678
|
1684
|
-
the quick brown fox jumped over the lazy dog
|
1685
|
-
stuff
|
1686
|
-
|
1687
|
-
p <<stuff+'foobar'.tr('j-l','d-f')\
|
1688
|
-
+"more stuff"
|
1689
|
-
12345678
|
1690
|
-
the quick brown fox jumped over the lazy dog
|
1691
|
-
stuff
|
1692
|
-
|
1693
|
-
p ENV["AmritaCacheDir"]
|
1694
|
-
p <<-BEGIN + <<-END
|
1695
|
-
def element_downcase(attributes = {})
|
1696
|
-
BEGIN
|
1697
|
-
end
|
1698
|
-
END
|
1699
|
-
|
1700
|
-
|
1701
|
-
|
1702
|
-
p <<ggg; def
|
1703
|
-
kleegarts() p 'kkkkkkk' end
|
1704
|
-
dfgdgfdf
|
1705
|
-
ggg
|
1706
|
-
koomblatz!() p 'jdkfsk' end
|
1707
|
-
|
1708
|
-
koomblatz!
|
1709
|
-
|
1710
|
-
module Y3423454
|
1711
|
-
p f = 3.7517675036461267e+17
|
1712
|
-
end
|
1713
|
-
p $10
|
1714
|
-
p $1001
|
1715
|
-
p( <<end )
|
1716
|
-
nine time nine men have stood untold.
|
1717
|
-
end
|
1718
|
-
|
1719
|
-
|
1720
|
-
def jd_to_wday(jd) (jd + 1) % 7 end
|
1721
|
-
p jd_to_wday(98)
|
1722
|
-
|
1723
|
-
|
1724
|
-
p pre = $`
|
1725
|
-
=begin
|
1726
111
|
=end
|
1727
112
|
|
1728
|
-
p <<"..end .."
|
1729
|
-
cbkvjb
|
1730
|
-
vb;lkxcvkbxc
|
1731
|
-
vxlc;kblxckvb
|
1732
|
-
xcvblcvb
|
1733
|
-
..end ..
|
1734
|
-
|
1735
|
-
p $-j=55
|
1736
|
-
|
1737
|
-
def empty() end
|
1738
|
-
|
1739
|
-
p <<a
|
1740
|
-
dkflg
|
1741
|
-
flk
|
1742
|
-
a
|
1743
|
-
|
1744
|
-
label='label';tab=[1,2,3]
|
1745
|
-
p <<S
|
1746
|
-
#{label} = arr = Array.new(#{tab.size}, nil)
|
1747
|
-
str = a = i = nil
|
1748
|
-
idx = 0
|
1749
|
-
clist.each do |str|
|
1750
|
-
str.split(',', -1).each do |i|
|
1751
|
-
arr[idx] = i.to_i unless i.empty?
|
1752
|
-
idx += 1
|
1753
|
-
end
|
1754
|
-
end
|
1755
|
-
|
1756
|
-
S
|
1757
|
-
|
1758
|
-
def printem1 a,b,c
|
1759
|
-
p(a +77)
|
1760
|
-
p(b +77)
|
1761
|
-
p(c +77)
|
1762
|
-
end
|
1763
|
-
|
1764
|
-
def foobar() end
|
1765
|
-
def foobar2
|
1766
|
-
end
|
1767
|
-
|
1768
|
-
def printem0(a)
|
1769
|
-
p(a +77)
|
1770
|
-
end
|
1771
|
-
def printem2 a,b,c; p(a +77); p(b +77); p(c +77) end
|
1772
|
-
def three() (1+2) end
|
1773
|
-
|
1774
|
-
def d;end
|
1775
|
-
def d()end
|
1776
|
-
def d(dd)end
|
1777
|
-
|
1778
|
-
def printem a,b,c
|
1779
|
-
p a;p b;p c
|
1780
|
-
p(a +77)
|
1781
|
-
p(b %(0.123))
|
1782
|
-
end
|
1783
|
-
printem 1,2,3
|
1784
|
-
|
1785
|
-
module Y24345678756
|
1786
|
-
a=1
|
1787
|
-
p(a +77)
|
1788
|
-
|
1789
|
-
def hhh(a=(1+2)) a end
|
1790
|
-
end
|
1791
|
-
|
1792
|
-
|
1793
|
-
END {
|
1794
|
-
p "bye-bye"
|
1795
|
-
}
|
1796
|
-
|
1797
|
-
|
1798
|
-
p <<here
|
1799
|
-
where?
|
1800
|
-
here
|
1801
|
-
p <<-what
|
1802
|
-
? that's
|
1803
|
-
what
|
1804
|
-
p proc{||}
|
1805
|
-
|
1806
|
-
module Y5566342346
|
1807
|
-
for i in if false
|
1808
|
-
foob12345; else [44,55,66,77,88] end do p i**Math.sqrt(i) end
|
1809
|
-
p "\v"
|
1810
|
-
c=0
|
1811
|
-
while c == /[ \t\f\r\13]/; end
|
1812
|
-
end
|
1813
|
-
|
1814
|
-
|
1815
|
-
|
1816
|
-
|
1817
|
-
|
1818
|
-
|
1819
|
-
|