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

61 lines
616 B
Text
Raw Normal View History

2019-05-13 08:25:22 -04:00
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