test/data/p.rb in rubylexer-0.7.0 vs test/data/p.rb in rubylexer-0.7.1
- old
+ new
@@ -1,271 +1,14 @@
if false
- return {}.size
- 1.return {}.size
-
- break {}.size
- 1.break {}.size
-
- next {}.size
- 1.next {}.size
-
- raise {}.to_s+"****"
- 1.raise {}.to_s+"****"
-
- throw {}.to_s+"****"
- 1.throw {}.to_s+"****"
-end
-
-module SR
-def SelfReferencing
-#old name alias
-end
-
-def SelfReferencing #old name alias
-end
-
-def SelfReferencing#old name alias
-end
-
-def SelfReferencing;end#old name alias
-end
-
-P ::Class
-
-p <<Class
- zzzz
-Class
-
-p(String <<Class)
-sgsdfgf
- Class
-Class
-
-proc{q=1;def q.foo; end} #q should be varnametoken, both times
-module Defined_p_syntax_tests
- def self.defined?(foo) :baz end #should be methname
- def defined?(foo) :bar end #should be methname
- def ameth
- p(defined? 44) #should be keyword
- p(self.defined? 44) #should be methname
- end
-end
-
-p 2**3[4] #should be nowstoken before bracket
-
-proc{
-p /$/ #regexp
-p /=$/ #operator
-p /$/ #operator
-}
-
-proc{
-p %=b=
-2
-p %(1)
-}
-
-proc{
-p *=5
-p %(1)
-}
-
-proc{
-p &nil
-p &=1
-p %(1)
-}
-
-p %(1)
-
-p %\hah, backslash as string delimiter\
-def foo(bar=5,tt=6) end
-wwww,eeee=1,2
-proc{a.b,c.d=1,2}
-proc{|a.b,c.d|}
-
-
-
-
-
-
-p foo
-
-if false
-p % foo
-p % foo
p %
foo
-p(% foo )
-p(% foo )
p(%
foo
)
-end
-p eval "%\sfoo\s"
-
-p eval "%\tfoo\t"
-p eval "%\vfoo\v"
-p eval "%\rfoo\r"
-p eval "%\nfoo\n"
-p eval "%\0foo\0"
-
-p eval "%\r\nfoo\r\n"
-
-#foo
-
-=begin
-
-=end
-
-p <<p
-\
-p
-p
-
-p <<'p'
-\
-p
-p
-
-p <<p
-\n\t\r\v\\
-p
-
-p <<'p'
-\n\t\r\v\\
-p
-
-p <<p
-\
-
-p
-
-
-p %W[\
-] #ruby interprets this one as a single (totally unescaped) newline,
- #but i suspect that might be a bug.
-
-p "\
-"
-
-p '\
-'
-
-p /\
-/
-
-p `\
-`
-
-p %w[\
-]
-
-p %[\
-]
-
-p "
-
-"
-
-p %{
-
-}
-
-p <<END
-
-END
-
-p <<'END'
-
-END
-
-
-p
-p(1,2) #these 2 lines should tokenize identically
-p (1,2) #except for the extra space on this one
-
-
-
-
-p File
-module Y19 #limit lvar scope
- a,b,c,(d,e)=1,2,3,[4,5]
- p a %(4)
- p c %(4)
- p d %(4)
- p e %(4)
-end
-
-def printem___1 a
- a
-end
-
-class F0000; end
-def F0000; end
-
-f0000=1
-def f0000; end
-
-def printem__1 a
- p(a +77)
-end
-def printem_1 a,b
- p(a +77)
- p(b +77)
-end
-def printem1 a,b,c
- p(a +77)
- p(b +77)
- p(c +77)
-end
-def printem10 a,b,c,d,e,f
- p(a +77)
- p(b +77)
- p(c +77)
- p(d +77)
- p(e +77)
- p(f +77)
-end
-def printem100 a,b,c,d,e,f,*g,&h
- p(a +77)
- p(b +77)
- p(c +77)
- p(d +77)
- p(e +77)
- p(f +77)
- p(g +77)
- p(h +77)
-end
-#<<'abc123def'
-ddd="ddd"
-
-#@@ddd=@ddd=$ddd=nil
-def DDD;end
-def ddd2; "asdAds" end
-def (DDD()).foofarendle;end
-def Integer.foofarendle;end
-def @@ddd.foofarendle; 33;end
-def @ddd.foofarendle; 33;end
-def $ddd.foofarendle; 33;end
-def ddd.foofarendle; 33;end
-def ddd2.foofarendle; 33;end
-def (ddd).foofarendle2; end
-def (ddd()).foofarendle2; end
-
-
-def (ddd2).foofarendle;end
-def ddd2.foofarendle;end
-
-
-def (is_a?(File::Stat)).foofarendle;end
-
-p()
-
p((4\
+5))
p((4\
+5))
@@ -273,997 +16,17 @@
+5))
p((4+\
5))
-
-p(<<-jjj \
- dsfgdf
- jjj
- )
-
-p(<<-jjj
- dsfgdf
- jjj
- )
-
-p(<<-jjj \
- dsfgdf
- jjj
- +"dfsdfs"
- )
-
-p(<<-jjj +
- dsfgdf
- jjj
- "dfsdfs"
- )
-
-
-p( {:rest=>99})
-p %{{{{#{"}}}"}}}}}
-case 1
-when *[2]: p 1
-else p 2
end
-p :"jim";
-p :'jim';
-p %s/jim/;
-p %s"jim";
-p %s'jim';
-p %s`jim`;
-p %s[jim];
-p %s{jim};
-p %s(jim);
-p %s<jim>;
-p %s jim ;
-for bob in [100] do p(bob %(22)) end
+=begin things that seem like they should work, but cause syntax errors
-proc{
- foo bar=>baz
- bar %(1)
-}
+ (p / 1/)
-module Y2534534
-def foo1
- p (1..10).method(:each) #implicit parens around the whole thing
-end
-
-def foo2()
- p((1..10).method(:each)) #explicitly parenthesized... no implicit parens needed
-end
-
-def foo3()
- p (1..10).method(:each) #implicit parens around the whole thing
- #matz ruby parses this differently than identical line in foo1!?
-end
-
-end
-
-
-module Y668
-p [1,2,3,]
-#p {1=>2,3=>4,} #syntax error
-#p aaa,bbb,ccc,=1,2,3 #syntax error
-p aaa
-p bbb
-p ccc
-proc{|a,b,c,| p a,b,c }.call(1,2,3)
-p proc{|
-a,b,(c,d,),e|
- p a %(1)
- p b %(2)
- p c %(3)
- p d %(4)
- p e %(5)
-[ a,b,c,d,e]}.call(1,2,[3,4],5)
-p (Module.instance_methods - Object.instance_methods).sort # an outer set of implicit parens is needed
-p(Module.instance_methods - Object.instance_methods).sort #no outer implicit parens
-"foo".slice (1-2).nil? #no outer implicit parens
-p (1-2).nil? #outer implicit parens needed
-p(1-2).nil? #no outer implicit parens needed
-
-def self.z(*); end
-def self.zz(*,&x); end
-def self.zzz(&x); end
-
-z z z z z z {}
-z z z z z z do end
-
-(/ 1/)
- p(/ 1/)
-# (p / 1/) #ruby no like
-
-def ggg(x=nil) p x;9 end
- (ggg / 1)
-
-false and( true ? f : g )
-false and( f .. g )
-false and( f ... g )
- p 1&2 #should be OperatorToken, not KeywordToken
- p 1|2 #ditto
- p 1**2
- p 1*2
- p 1%(2)
- p 1^2
- p 1+2
- p 1-2
- p 1/2
-
- p 1?2:3 #keyword
-
- p 1 ?2:3 #keyword
-
- p 1? 2:3 #keyword
-
- p 1?2 :3 #keyword
-
- p 1?2: 3 #keyword
-
- p 1 ? 2:3 #keyword
-
- p 1 ?2 :3 #keyword
-
- p 1 ?2: 3 #keyword
-
- p 1? 2 :3 #keyword
-
- p 1? 2: 3 #keyword
-
- p 1?2 : 3 #keyword
-
- p 1 ? 2 : 3 #keyword
-
- p 1==2
- p 1===2
- p 1[2] #keyword
- p 1;2 #keyword
- p 1,2 #keyword
- p 1.2
- p 1.class #keyword
- p 1..2 #keyword
- p 1...2 #keyword
- p 1<2
- p 1>2
- p 1<=2
- p 1>=2
- p 1<<2
- p 1>>2
- p 1!=2 #this is keyword
- p 1=~2
- p 1!~2 #this is keyword
- p 1&&2 #...
- p 1||2 #...
- p 1<=>2
-
- define_method(:foo, &proc{:bar})
- define_method :foo, &proc{:bar}
- define_method(:foo) &proc{:bar}
- define_method :foo &proc{:bar}
- p :k, *nil
- p :k, *nil, &nil
- p *nil
- p *nil, &nil
-end
-
-
-module Y19 #limit lvar scope
- a,b,c,(d,e)=1,2,3,[4,5]
- p a %(4)
- p c %(4)
- p d %(4)
- p e %(4)
-
-
-
- a=[1,2,3,4,5]
-
- def self.g(x=nil); 3 end
- def a.g=(x) p x end
-
- g = 5
-
- self.g = 55
-
-
- class<<a
- def bb=(x) p :bb=, x end
- end
-
- A=a
- class<<self
- def aa; :aa end
- def bb(arg=nil); p :bb; A end
- alias bbb bb
-
- def m; self end
- def n; self end
-
- def +(other) self end
- def kk; nil end
- def kk=(foo); nil end
- end
-
-
- proc{|a[4]|}.call 6
- proc{|a[b]|}.call 7
- proc{|a.bb| bb %(9) }.call 9
- proc{|a[f]| f %(9) }.call 8
- proc{|bb(aa).bb| aa %(10) }.call 10
- proc{|bbb(aa).bb| bbb %(11) }.call 11
- proc{|t,u,(v,w,x),(y,),z|
- t %(12)
- u %(12)
- v %(12)
- w %(12)
- x %(12)
- y %(12)
- z %(12)
- }.call(1,2,[3,4,5],[6],7)
- proc{|(m).kk,(m+n).kk|
- m %(13)
- n %(13)
- kk %(13)
- }.call(13,14)
-
- proc{|a.g| g %(9)}
-
- p a
-
-end
-
-
-module R34634534
-#how do I avoid getting into trouble with this test case?
-#seems like I should be seeing local vars in the param list of
-#the 2nd call to p....
- class<<self
- alias q p
- alias r p
- alias s p
- end
-
- p(q,r,s)
-
- q %(1)
- r %(1)
- s %(1)
-
- p (q,r,s)
-
- q %(1)
- r %(1)
- s %(1)
-end
-
-
-
-p p :c, :d
-p true ?
- 1 : 2
-module M555
- def r;4 end
- r=r.nil? #2nd r seems like it should be MethNameToken, but is VarNameToken (for matz too)
-end
-
-p ?e.+?y
-p ?e.+ ?y
-p ?e.-?y
-p ?e.*?y
-p ?e./?y
-p ?e.<<?y
-p ?e.%?y
-p ?e.**?y
-p ?e.&?y
-
-
-p "#{<<foobar0.each('|'){|s| '\nthort: '+s} }"
-jbvd|g4543ghb|!@G$dfsd|fafr|e
-|s4e5rrwware|BBBBB|*&^(*&^>"PMK:njs;d|
-
-foobar0
-
-
-p 0.9
-p 1.45000000000000000000000000000000000000001
-p 9.999999999999999999999999999999999999999999
-p 9.999999999999999999999999999999999999999999e999999999999999999999999999
-p 0b0100011001
-p 0o123456701
-p 0123456701
-
-p 0x123456789abcdefABCDEF01
-
-
-
-
-
-p % foo
-p % foo
-p %
-foo
-
-
-p eval "%\sfoo\s"
-
-p eval "%\tfoo\t"
-p :p
-p :p
-p eval "%\vfoo\v"
-p eval "%\rfoo\r"
-p :p
-p :p
-p eval "%\nfoo\n"
-p eval "%\0foo\0"
-
-p eval "%\r\nfoo\r\n"
-
-#given that \n\r is not considered a valid eol
-#sequence in ruby (unlike \r\n), the next 2 are ok
-p eval "%\n\rfoo\n\r" #ruby get this wrong
-p eval "%\n\rfoo\n" #this shouldn't work but does
-
-#seems like just \r isn't valid newline either, which is
-#puzzling but the following are are correct.
-#does ruby do these all correctly? seems kinda inconsistant
-#either both of these should fail, or both should succeed
-p eval "%\r\nfoo\r" #this does not work,
-p eval "%\r\nfoo\n" #this shouldn't work but does
-
-p eval "%\rfoo\r" #this works
-p eval "%\rfoo\n" #this does not work,
-p eval "%\rfoo\r\n" #this does not work,
-
-p eval "%\nfoo\r" #this does not work
-p eval "%\nfoo\n" #this works
-p eval "%\nfoo\r\n" #this works,
-
-p "Hi, my name is #{"Slim #{(4)>2?"Whitman":"Shady"} "}."
-p "Hi, my name is #{"Slim #{(4)<2?"Whitman":"Shady"} "}."
-
-
-p(String *Class)
-class String
-class Class
-end
-end
-#def String(x) x.to_s end #it's already built-in. duh!
-def String.*(right) [self,right] end
-def String.<<(right) [self,:<<,right] end
-def String./(right) [self,:/,right] end
-def String.[](right) [self,:[],right] end
-def Class.-@; [:-@, self] end
-p(String::Class)
-p(String:: Class)
-p(String ::Class)
-p(String :: Class)
-p(String<<Class)
-p(String<< Class)
-p(String <<Class)
-sgsdfgf
- Class
-Class
-p(String << Class)
-p(String<<-Class)
-p(String<< -Class)
-p(String <<-Class)
-sgsdfgf
- Class
-Class
-p(String <<-Class)
-sgsdfgf
-Class
- Class
-Class
-p(String << -Class)
-
-p(String<<- Class)
-p(String<< - Class)
-p(String <<- Class)
- Class
-Class
-p(String <<- Class)
-Class
- Class
-Class
-p(String << - Class)
-p(String/Class)
-p(String/ Class)
-p(String /Class/)
-p(String / Class) #borken
-p(String[Class])
-p(String[ Class])
-p(String [Class])
-p(String [ Class])
-p(String*Class)
-p(String* Class)
-p(String *Class)
-p(String * Class)
-class <<String
-undef :*,<<,/,[]
-end
-
-
-
-p(false::to_s)
-p(false ::to_s)
-p(false:: to_s)
-p(false :: to_s)
-
-
-class C2
- class <<self
- def self.p8; p 8 end
- alias p? p
- alias P? p
- alias [] p
- alias <=> p
- end
-
-q=9
-Q=99
-
-p:p8
-false ? p: p8
-p :p8
-false ? p : p8
-
-false ? q:p8
-false ? q: p8
-false ? q :p8
-false ? q : p8
-
-#false ? Q:p8 #gives ruby indigestion
-false ? Q: p8
-#false ? Q :p8 #gives ruby indigestion
-false ? Q : p8
-
-p?:p8
-false ? p?: p8
-p? :p8
-false ? p? : p8
-
-p??1
-p? ?1
-p(p?? 1 : 2)
-p(p? ? 1 : 2)
-
-P?:p8
-false ? P?: p8
-P? :p8
-false ? P? : p8
-
-P??1
-P? ?1
-p(P?? 1 : 2)
-p(P? ? 1 : 2)
-
-self.[]:p8
-false ? self.[]: p8
-self.[] :p8
-false ? self.[] : p8
-
-self.<=>:p8
-false ? self.<=>: p8
-self.<=> :p8
-false ? self.<=> : p8
-
-self <=>:p8
-#false ? self <=>: p8 #gives ruby indigestion
-self <=> :p8
-#false ? self <=> : p8 #gives ruby indigestion
-end
-
-p <<stuff+'foobar'.tr('j-l','d-f')
-"more stuff"
-12345678
-the quick brown fox jumped over the lazy dog
-stuff
-
-
-p <<p
-sdfsfdf^^^^@@@
-p
-mix=nil
-p / 5/mix
-
-module M33
- p="var:"
- Q="func:"
- def Q.method_missing(name,*args)
- self+name.to_s+(args.join' ')
- end
- def p.method_missing(name,*args)
- self+name.to_s+(args.join' ')
- end
- def self.p(*a); super; Q end
- @a=1
- $a=2
-
- p(p~6)
- p(p ~6)
- p(p~ 6)
- p(p ~ 6)
- p(p*11)
- p(p *11)
- p(p* 11)
- p(p * 11)
- p(p&proc{})
- p(p &proc{})
- p(p& proc{})
- p(p & proc{})
- p(p !1)
-# p(p ?1) #compile error, when p is var
- p(p ! 1)
- p(p ? 1 : 6)
- p(p@a)
- p(p @a)
-# p(p@ a) #wont
-# p(p @ a) #work
- p(p#a
-)
- p(p #a
-)
- p(p# a
-)
- p(p # a
-)
- p(p$a)
- p(p $a)
-# p(p$ a) #wont
-# p(p $ a) #work
- p(p%Q{:foo})
- p(p %Q{:foo})
- p(p% Q{:foo})
- p(p % Q{:foo})
- p(p^6)
- p(p ^6)
- p(p^ 6)
- p(p ^ 6)
- p(p&7)
- p(p &proc{7})
- p(p& 7)
- p(p & 7)
- p(p(2))
- p(p (2))
- p(p( 2))
- p(p ( 2))
- p(p(p))
- p(p())
- p(p (p))
- p(p ())
- p(p ( p))
- p(p ( ))
- p(p( p))
- p(p( ))
- p(p)
- p((p))
- p(p )
- p((p ))
- p((p p))
- p((p p,p))
- p((p p))
- p((p p,p))
- p(p-0)
- p(p -0)
- p(p- 0)
- p(p - 0)
- p(p+9)
- p(p +9)
- p(p+ 9)
- p(p + 9)
- p(p[1])
- p(p [1])
- p(p[ 1])
- p(p [ 1])
- p(p{1})
- p(p {1})
- p(p{ 1})
- p(p { 1})
- p(p/1)
- p(p /22)
- p(p/ 1)
- p(p / 22)
- p(p._)
- p(p ._)
- p(p. _)
- p(p . _)
- p(false ? p:f)
- p(false ? p :f)
- p(false ? p: f)
- p(false ? p : f)
- p((p;1))
- p((p ;1))
- p((p; 1))
- p((p ; 1))
- p(p<1)
- p(p <1)
- p(p< 1)
- p(p < 1)
- p(p<<1)
- p(p <<1)
- p(p<< 1)
- p(p << 1)
- p(p'j')
- p(p 'j')
- p(p' j')
- p(p ' j')
- p(p"k")
- p(p "k")
- p(p" k")
- p(p " k")
- p(p|4)
- p(p |4)
- p(p| 4)
- p(p | 4)
- p(p>2)
- p(p >2)
- p(p> 2)
- p(p > 2)
-
-end
-
-
-module M34
- p(p~6)
- p(p ~6)
- p(p~ 6)
- p(p ~ 6)
- p(p*[1])
- p(p *[1])
- p(p* [1])
- p(p * [1])
- p(p&proc{})
- p(p &proc{})
- p(p& proc{})
- p(p & proc{})
- p(p !1)
- p(p ?1)
- p(p ! 1)
- p(p ? 1 : 6)
- p(p@a)
- p(p @a)
-# p(p@ a) #wont
-# p(p @ a) #work
-
- p(p#a
-)
- p(p #a
-)
- p(p# a
-)
- p(p # a
-)
- p(p$a)
- p(p $a)
-# p(p$ a) #wont
-# p(p $ a) #work
- p(p%Q{:foo})
- p(p %Q{:foo})
- p(p% Q{:foo})
- p(p % Q{:foo})
- p(p^6)
- p(p ^6)
- p(p^ 6)
- p(p ^ 6)
- p(p&7)
- p(p &proc{7})
- p(p& 7)
- p(p & 7)
- p(p(2))
- p(p (2))
- p(p( 2))
- p(p ( 2))
- p(p(p))
- p(p())
- p(p (p))
- p(p ())
- p(p ( p))
- p(p ( ))
- p(p( p))
- p(p( ))
- p(p)
- p((p))
- p(p )
- p((p ))
- p((p p))
- p((p p,p))
- p((p p))
- p((p p,p))
- p(p-0)
- p(p -1)
- p(p- 0)
- p(p - 0)
- p(p+9)
- p(p +9)
- p(p+ 9)
- p(p + 9)
- p(p[1])
- p(p [1])
- p(p[ 1])
- p(p [ 1])
- p(p{1})
- p(p {1})
- p(p{ 1})
- p(p { 1})
- p(p/1)
- p(p /22/)
- p(p/ 1)
- p(p / 22)
- p(p._)
- p(p ._)
- p(p. _)
- p(p . _)
- p(p:f)
- p(p :f)
- p(false ? p: f)
- p(false ? p : f)
- p((p;1))
- p((p ;1))
- p((p; 1))
- p((p ; 1))
- p(p<1)
- p(p <1)
- p(p< 1)
- p(p < 1)
- p(p<<1)
- p(p <<1)
-foobar
-1
- p(p<< 1)
- p(p << 1)
- p(p'j')
- p(p 'j')
- p(p' j')
- p(p ' j')
- p(p"k")
- p(p "k")
- p(p" k")
- p(p " k")
- p(p|4)
- p(p |4)
- p(p| 4)
- p(p | 4)
- p(p>2)
- p(p >2)
- p(p> 2)
- p(p > 2)
-
-end
-
-
-def bob(x) x end
-def bill(x) x end
-p(bob %(22))
-for bob in [100] do p(bob %(22)) end
-p(bob %(22))
-def %(n) to_s+"%#{n}" end
-p(bill %(22))
-begin sdjkfsjkdfsd; rescue Object => bill; p(bill %(22)) end
-p(bill %(22))
-undef %
-
-class Object
-
-public :`
-def `(s)
- print "bq: #{s}\n"
-end
-end
-
-69.`('what a world')
-
-79::`('what a word')
-
-p :`
-
-p{}
-p {}
-module Y7284
-a=5
-p p +5
-p a +5
-end
-
-def nil.+(x) ~x end
-def nil.[](*x) [x] end
-p( p + 5 )
-p( p +5 )
-p( p+5 )
-p( p[] )
-p( p [] )
-p( p [ ] )
-class NilClass; undef +,[] end
-
-class Foou
- public
- def [] x=-100,&y; p x; 100 end
-end
-
-
-module Y345636
-a0=8
-p Foou.new.[]!false #value
-p Foou.new.[] !false #value
-p Foou.new.[]~9 #value
-p Foou.new.[] ~9 #value
-p Foou.new.[]-9 #op
-p Foou.new.[]+9 #op
-p Foou.new.[] -9 #value
-p Foou.new.[] +9 #value
-p Foou.new.[]<<9 #op
-p Foou.new.[] <<9 #value
-foobar
-9
-p Foou.new.[]%9 #op
-p Foou.new.[]/9 #op
-p Foou.new.[] %(9) #value
-p Foou.new.[] /9/ #value
-p Foou.new.[]$9 #value
-p Foou.new.[]a0 #value
-p Foou.new.[] $9 #value
-p Foou.new.[] a0 #value
-p Foou.new.[]{9} #lambda (op)
-p Foou.new.[] {9} #lambda (op)
-
-if p then p end
-
-p({:foo=>:bar}) #why does this work? i'd think that ':foo=' would be 1 token
-p EMPTY = 0
-p BLACK = 1
-p WHITE = - BLACK
-end
-
-module Y8576456
- a=b=c=0
- a ? b:c
- a ?b:c
-
- p(a ? b:c)
- p(a ?b:c)
-
-p~4
-p:f
-p(~4){}
-p(:f){}
-h={}
-h.default=:foo
-
-p def (h="foobar").default= v; p @v=v;v end
-p h
-
-p h.default=:b
-end
-
-
-module Y6543423
-x, (*y) = [:x, :y, :z]
-p x
-p y
-
-x, *y = [:x, :y, :z]
-p x
-p y
-
-x, * = [:x, :y, :z]
-p x
-end
-
-
-p Array("foo\nbar")
-
-
-
-p +(4)
-p -(4)
-
-p :'\\'
-
-class Foop
- def Foop.bar a,b
- p a,b
- end
-end
-Foop.bar 1,2
-Foop::bar 3,4
-
-
-class Foop
- def Foop::baz a,b
- p :baz,a,b
- end
-end
-Foop.baz 5,6
-Foop::baz 7,8
-
-
-
-without_creating=widgetname=nil
- if without_creating && !widgetname #foo
- fail ArgumentError,
- "if set 'without_creating' to true, need to define 'widgetname'"
- end
-
-
-
-
-#class, module, and def should temporarily hide local variables
-def mopsdfjskdf arg; arg*2 end
-mopsdfjskdf=5
- class C
- p mopsdfjskdf %(3) #calls method
- end
-
-module M
- p mopsdfjskdf %(4) #calls method
-end
-
- def d
- p mopsdfjskdf %(5) #calls method
- end
-p d
-p mopsdfjskdf %(6) #reads variable
-p proc{mopsdfjskdf %(7)}[] #reads variable
-
-#fancy symbols
-p %s{symbol}
-
-#multiple assignment test
-proc {
- a,b,c,d,e,f,g,h,i,j,k=1,2,3,4,5,6,7,8,9,10,11
- p(b %(c))
- p(a %(c))
- p(k %(c))
- p(p %(c))
-}.call
-
-=begin disable for now
-
-
-p "#{<<kekerz}#{"foob"
-zimpler
-kekerz
-}"
-
-
-aaa=<<whatnot; p "#{'uh,yeah'
-gonna take it down, to the nitty-grit
-gonna tell you mother-fuckers why you ain't shit
-cause suckers like you just make me strong
-you been pumpin' that bullshit all day long
-whatnot
-}"
-p aaa
-
-#test variable creation in string inclusion
-#currently broken because string inclusions
-#are lexed by a separate lexer!
-proc {
- p "jentawz: #{baz=200}"
- p( baz %(9))
-}.call
-
-#scope of local variables always includes the here document
-#body if it includes the head
-p %w[well, whaddaya know].map{|j| <<-END }
-#{j #previous j should be local var, not method
-}45634543
-END
-
-
-
-=end disable for now
-
-
-=begin ought to work...ruby doesn't like
-p :$1
-p :$98349576875974523789734582394578
-
- (p / 1/) #ruby no like
-
class F34534334
class A
class B
class C
end
@@ -1293,10 +56,11 @@
g *g g #this doesn't
g+g 5 #this doesn't
[nil,p 5]
"foo"+[1].join' '
+"foo"+join' '
if x=p :a,:b then end
{:nil?=> 1}
1+[1,2,3][1..-1].index 3
@@ -1342,478 +106,7 @@
equal?(p) or Position===p && equal? p.data #syntax error unless add parens, but why?
end
raise LexerError, "expected >=#{tok.offset}, got #{endpos}, "\
"token #{tok}:#{tok.class}" #there's a space after the backslash
-
-=end disable for now
-
-proc {
-}
-
-p "#{<<foobar3}"
-bim
-baz
-bof
-foobar3
-
-def func
- a,b,* = [1,2,3,4,5,6,7,8]
- p a,b
- a,b, = [1,2,3,4,5,6,7,8]
- p a,b
-
- a,b = [1,2,3,4,5,6,7,8]
- p a,b
- a,*b = [1,2,3,4,5,6,7,8]
- p a,b
-
- a,b,*c=[1,2,3,4,5,6,7,8]
- a,b,* c=[1,2,3,4,5,6,7,8]
-end
-func
-
-
-
-p( %r{\/$})
-p( %r~<!include:([\/\w\.\-]+)>~m)
-
-proc {
- h={:a=>(foo=100)}
- p( foo %(5))
-}.call
-
-
-
-def foo(a=<<a,b=<<b,c=<<c)
-jfksdkjf
-dkljjkf
-a
-kdljfjkdg
-dfglkdfkgjdf
-dkf
-b
-lkdffdjksadhf
-sdflkdjgsfdkjgsdg
-dsfg;lkdflisgffd
-g
-c
-
- a+b+c
-
-end
-
-p foo
-
-
-
-
-$a=1
-@b=2
-@@c=3
-p "#$a #@b #@@c #{$a+@b+@@c}"
-p "\#$a \#@b \#@@c \#{$a+@b+@@c}"
-p '#$a #@b #@@c #{$a+@b+@@c}'
-p '\#$a \#@b \#@@c \#{$a+@b+@@c}'
-p %w"#$a #@b #@@c #{$a+@b+@@c}"
-p %w"\#$a \#@b \#@@c \#{$a+@b+@@c}"
-p %W"#$a #@b #@@c #{$a+@b+@@c}"
-p %W"\#$a \#@b \#@@c \#{$a+@b+@@c}"
-p %Q[#$a #@b #@@c #{$a+@b+@@c}]
-p %Q[\#$a \#@b \#@@c \#{$a+@b+@@c}]
-p `echo #$a #@b #@@c #{$a+@b+@@c}`
-p `echo \#$a \#@b \#@@c \#{$a+@b+@@c}`
-p(/#$a #@b #@@c #{$a+@b+@@c}/)
-#p(/\#$a \#@b \#@@c \#{$a+@b+@@c}/) #moved to w.rb
-
-
-class AA; class BB; class CC
-FFOO=1
-end end end
-
-p AA::BB::CC::FFOO
-
-compile_body=outvar='foob'
-
-if false
- method_src = c.compile(template, (HtmlCompiler::AnyData.new)).join("\n") +
- "\n# generated by PartsTemplate::compile_partstemplate at #{Time.new}\n"
- rescu -1
-end
-
- p('rb_out', 'args', <<-'EOL')
- regsub -all {!} $args {\\!} args
- regsub -all "{" $args "\\{" args
- if {[set st [catch {ruby [format "TkCore.callback %%Q!%s!" $args]} ret]] != 0} {
- return -code $st $ret
- } {
- return $ret
- }
- EOL
-
-
-def add(*args)
- self.<<(*args)
-end
-
-
-
-val=%[13,17,22,"hike", ?\s]
- if val.include? ?\s
- p val.split.collect{|v| (v)}
- end
-p "#{}"
-p "#(1)"
-class Hosts
-end
-class DNS < Hosts
-end
-def intialize(resolvers=[Hosts.new, DNS.new]) end
-def environment(env = File.basename($0, '.*')) end
-
-def ssssss &block
-end
-def params_quoted(field_name, default)
- if block_given? then yield field_name else default end
-end
-def ==(o) 444 end
-def String.ffff4() self.to_s+"ffff" end
-
-p *[]
-#abc123def
-module Y23423423
-for i in \
-[44,55,66,77,88] do p i**Math.sqrt(i) end
-
-
-#(
-for i in if
-false then foob12345; else [44,55,66,77,88] end do p i**Math.sqrt(i) end
-#)
-#end
-(
-for i in if false then
-foob12345; else [44,55,66,77,88] end do p i**Math.sqrt(i) end
-
-c=j=0
-until while j<10 do j+=1 end.nil? do p 'pppppppppp' end
-for i in if false then foob12345;
-else [44,55,66,77,88] end do p i**Math.sqrt(i) end
-
-for i in if false then foob12345; else
-[44,55,66,77,88] end do p i**Math.sqrt(i) end
-
-
-for i in (c;
-[44,55,66,77,88]) do p i**Math.sqrt(i) end
-)
-(
-
-for i in (begin
-[44,55,66,77,88] end) do p i**Math.sqrt(i) end
-
-for i in if false then foob12345; else
-[44,55,66,77,88] end do p i**Math.sqrt(i) end
-
-for i in (
-
-[44,55,66,77,88]) do p i**Math.sqrt(i) end
-
-for i in (
-[44,55,66,77,88]) do p i**Math.sqrt(i) end
-
-)
-end
-
-
-
-def yy;yield end
-
-block=proc{p "blah blah"}
-
-yy &block
-p(1.+1)
-p pppp
-
-module M66
-p(proc do
- p=123
-end.call)
-
-p proc {
- p=123
-}.call
-
-p def pppp
- p=123
-end
-p module Ppp
- p=123
-end
-p class Pppp < String
- p=123
-end
-end
-
- def _make_regex(str) /([#{Regexp.escape(str)}])/n end
-p _make_regex("8smdf,34rh\#@\#$%$gfm/[]dD")
-
-
-p "#$a #@b #@@c
-
-d e f
-#$a #@b #@@c
-"
-
-p "\""
-
-module Y89567567999
-a='a'
-class <<a
- def foobar
- self*101
- end
- alias eql? ==
-end
-
-p a.foobar
-end
-
-p(/^\s*(([+-\/*&\|^]|<<|>>|\|\||\&\&)=|\&\&|\|\|)/)
-p(:%)
-module Y45234234234223567675
-p( { :class => class_=0})
-end
-p cls_name = {}[:class]
-
-
-p foo
-p "#{$!.class}"
-p :p
-p(:p)
-p(:"[]")
-p :"[]"
-p("\\")
-p(/\\/)
-p(/[\\]/)
-p 0x80
-p ?p
-p 0.1
-p 0.8
-p 0.9
-p(-1)
-p %/p/
-p %Q[<LI>]
-i=99
-p %Q[<LI><A HREF="#{i[3]}.html\##{i[4]}">#{i[0]+i[1]+(i[2])}</A>\n]
-p(:side=>:top)
-p %w[a b c
- d e f]
-p %w[a b c\n
- d e f]
-p %w[\\]
-p %w[\]]
-p :+
-p 99 / 3
-
-module Y66
-a=99;b=3
-p 1+(a / b)
-end
-p %Q[\"]
-p %Q[ some [nested] text]
-
-
-if false
- formatter.format_element(element) do
- amrita_expand_and_format1(element, context, formatter)
- end
-end
-if false
- ret = <<-END
- @@parts_template = #{template.to_ruby}
- def parts_template
- @@parts_template
- end
-
- #{c.const_def_src.join("\n")}
- def amrita_expand_and_format(element, context, formatter)
- if element.tagname_symbol == :span and element.attrs.size == 0
- amrita_expand_and_format1(element, context, formatter)
- else
- formatter.format_element(element) do
- amrita_expand_and_format1(element, context, formatter)
- end
- end
- end
-
- def amrita_expand_and_format1(element, context, formatter)
- #{method_src}
- end
- END
- j=55
-end
-
-p '
-'
-p '\n'
-p "
-"
-p "\n"
-p %w/
-/
-p %w/\n/
-
-p %W/
-/
-p %W/\n/
-p(/
-/)
-p(/\n/)
-p proc {
- p `
- `
- p `\n`
-}
-
-
-
-p(%r[foo]i)
-p <<stuff+'foobar'.tr('j-l','d-f')
-"more stuff"
-12345678
-the quick brown fox jumped over the lazy dog
-stuff
-
-p <<stuff+'foobar'.tr('j-l','d-f')\
-+"more stuff"
-12345678
-the quick brown fox jumped over the lazy dog
-stuff
-
-p ENV["AmritaCacheDir"]
-p <<-BEGIN + <<-END
- def element_downcase(attributes = {})
- BEGIN
- end
- END
-
-
-
-p <<ggg; def
-kleegarts() p 'kkkkkkk' end
-dfgdgfdf
-ggg
-koomblatz!() p 'jdkfsk' end
-
-koomblatz!
-
-module Y3423454
-p f = 3.7517675036461267e+17
-end
-p $10
-p $1001
-p( <<end )
-nine time nine men have stood untold.
-end
-
-
-def jd_to_wday(jd) (jd + 1) % 7 end
-p jd_to_wday(98)
-
-
-p pre = $`
-=begin
=end
-
-p <<"..end .."
-cbkvjb
-vb;lkxcvkbxc
-vxlc;kblxckvb
-xcvblcvb
-..end ..
-
-p $-j=55
-
-def empty() end
-
-p <<a
-dkflg
-flk
-a
-
-label='label';tab=[1,2,3]
- p <<S
-#{label} = arr = Array.new(#{tab.size}, nil)
-str = a = i = nil
-idx = 0
-clist.each do |str|
- str.split(',', -1).each do |i|
- arr[idx] = i.to_i unless i.empty?
- idx += 1
- end
-end
-
-S
-
-def printem1 a,b,c
- p(a +77)
- p(b +77)
- p(c +77)
-end
-
-def foobar() end
-def foobar2
-end
-
-def printem0(a)
- p(a +77)
-end
-def printem2 a,b,c; p(a +77); p(b +77); p(c +77) end
-def three() (1+2) end
-
-def d;end
-def d()end
-def d(dd)end
-
-def printem a,b,c
- p a;p b;p c
- p(a +77)
- p(b %(0.123))
-end
-printem 1,2,3
-
-module Y24345678756
-a=1
-p(a +77)
-
-def hhh(a=(1+2)) a end
-end
-
-
-END {
- p "bye-bye"
-}
-
-
-p <<here
-where?
-here
-p <<-what
- ? that's
- what
-p proc{||}
-
-module Y5566342346
-for i in if false
-foob12345; else [44,55,66,77,88] end do p i**Math.sqrt(i) end
-p "\v"
-c=0
- while c == /[ \t\f\r\13]/; end
-end
-
-
-
-
-
-