plan9port

fork of plan9port with libvec, libstr and libsdb
Log | Files | Refs | README | LICENSE

test.rc (1160B)


      1 # test for parser
      2 
      3 a
      4 a b
      5 a|b
      6 a | b
      7 {a; b; c}
      8 x=y a && b || c
      9 x=y a | b | c
     10 x=y for(i) a | b
     11 >x for(i) a | b
     12 >x a || b && c
     13 a >x || b && c
     14 a | for(i) b | c
     15 fn x {y; z} | b && c
     16 if (x) y
     17 if not z
     18 `{} >x >[1=2]y >[3=] z <w
     19 ~ x y && z
     20 x | y && z
     21 x | y || z
     22 ! x | y | z
     23 @ x | y | z
     24 x | ! y | z
     25 x | @y | z
     26 ! x | if(y) z
     27 @ x | if(y) z
     28 x=1 y | if(z) w
     29 a'b' c
     30 a^'b'^ c
     31 a^'b' c
     32 $$x
     33 $x($y)
     34 $"x
     35 $#x
     36 $#$x
     37 -$x-
     38 `{a;b;c}
     39 <{a;b}
     40 x for in while if not ~ ! @ switch fn
     41 x not$y
     42 a;b;c
     43 if(x)
     44 y
     45 if(x)
     46 {
     47 y
     48 }
     49 if not
     50 z
     51 for(x)
     52 y
     53 for(x in y)
     54 z
     55 while(x)
     56 y
     57 # yacc doesn't accept a newline before the brace
     58 # even though the rule is written as if it would
     59 switch x {
     60 }
     61 switch (x) {
     62 }
     63 z
     64 x &&
     65 y
     66 x ||
     67 y
     68 x |
     69 y
     70 switch x {y} && z
     71 switch x {} | y
     72 
     73 OPTIONS=$OPTIONS' /axescount '^`{echo $1 | sed s/-a//}^' def'
     74 
     75 # bug in old printfont script - expected more free carats
     76 # OPTIONS=$OPTIONS' /axescount '`{echo $1 | sed s/-a//}' def'
     77 
     78 (x) = y
     79 x=y
     80 x = y
     81 
     82 # works now!
     83 # x y=z
     84 # x =y
     85 # x -flag=y
     86 
     87 >z x | y
     88 
     89 # rejected now, was like parens were spaces before.
     90 # echo Formatting Venti arenas and indices (this takes a while).
     91 
     92 
     93 # echo $STATLINE(1)^$STATLINE(3)'	'$STATLINE(2)'	'$STATLINE(4)'	'$LSLINE(6)