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
2019-06-19 18:17:25 +09:00

41 lines
426 B
Text

#
# 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