1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/test/racc/assets/nonass.y

42 lines
426 B
Text
Raw Normal View History

2019-05-13 08:25:22 -04:00
#
# nonassoc test
#
class P
preclow
nonassoc N
left P
prechigh
rule
target : exp
exp : exp N exp
| exp P exp
| T
end
---- inner
def parse
@src = [[:T,'T'], [:N,'N'], [:T,'T'], [:N,'N'], [:T,'T']]
do_parse
end
def next_token
@src.shift
end
---- footer
begin
P.new.parse
rescue ParseError
exit 0
else
$stderr.puts 'parse error not raised: nonassoc not work'
exit 1
end