plan9port/src/cmd/rc/test.rc
Russ Cox 7d6a248f2c rc: move free carat handling into parser
This fixes at least one shell script (printfont) that expected

	'x'`{y}'z'

to mean

	'x'^`{y}^'z'

as it now does. Before it meant:

	'x'^`{y} 'z'

One surprise is that adjacent lists get a free carat:

	(x y z)(1 2 3)

is

	(x1 y2 z3)

This doesn't affect any rc script in Plan 9 or plan9port.
2020-05-04 23:41:15 -04:00

76 lines
894 B
Text

# test for parser
a
a b
a|b
a | b
{a; b; c}
x=y a && b || c
x=y a | b | c
x=y for(i) a | b
>x for(i) a | b
>x a || b && c
a >x || b && c
a | for(i) b | c
fn x {y; z} | b && c
if (x) y
if not z
`{} >x >[1=2]y >[3=] z <w
~ x y && z
x | y && z
x | y || z
! x | y | z
@ x | y | z
x | ! y | z
x | @y | z
! x | if(y) z
@ x | if(y) z
x=1 y | if(z) w
a'b' c
a^'b'^ c
a^'b' c
$$x
$x($y)
$"x
$#x
$#$x
-$x-
`{a;b;c}
<{a;b}
x for in while if not ~ ! @ switch fn
x not$y
a;b;c
if(x)
y
if(x)
{
y
}
if not
z
for(x)
y
for(x in y)
z
while(x)
y
# yacc doesn't accept a newline before the brace
# even though the rule is written as if it would
switch x {
}
switch (x) {
}
z
x &&
y
x ||
y
x |
y
switch x {y} && z
switch x {} | y
OPTIONS=$OPTIONS' /axescount '^`{echo $1 | sed s/-a//}^' def'
# bug in old printfont script - expected more free carats
# OPTIONS=$OPTIONS' /axescount '`{echo $1 | sed s/-a//}' def'