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

60 lines
616 B
Text

class ErrTestp
rule
target: lines
;
lines: line
| lines line
;
line: A B C D E
| error E
;
end
---- inner
def initialize
@yydebug = false
@q = [
[:A, 'a'],
# [:B, 'b'],
[:C, 'c'],
[:D, 'd'],
[:E, 'e'],
[:A, 'a'],
[:B, 'b'],
[:C, 'c'],
[:D, 'd'],
[:E, 'e'],
[:A, 'a'],
[:B, 'b'],
# [:C, 'c'],
[:D, 'd'],
[:E, 'e'],
[false, nil]
]
end
def next_token
@q.shift
end
def on_error( t, val, values )
$stderr.puts "error on token '#{val}'(#{t})"
end
def parse
do_parse
end
---- footer
p = ErrTestp.new
p.parse