mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
35 lines
No EOL
545 B
Text
35 lines
No EOL
545 B
Text
# Regression test case for the bug discussed here:
|
|
# https://github.com/whitequark/parser/issues/93
|
|
# In short, a Racc-generated parser could go into an infinite loop when
|
|
# attempting error recovery at EOF
|
|
|
|
class InfiniteLoop
|
|
|
|
rule
|
|
|
|
stmts: stmt
|
|
| error stmt
|
|
|
|
stmt: '%' stmt
|
|
|
|
end
|
|
|
|
---- inner
|
|
|
|
def parse
|
|
@errors = []
|
|
do_parse
|
|
end
|
|
|
|
def next_token
|
|
nil
|
|
end
|
|
|
|
def on_error(error_token, error_value, value_stack)
|
|
# oh my, an error
|
|
@errors << [error_token, error_value]
|
|
end
|
|
|
|
---- footer
|
|
|
|
InfiniteLoop.new.parse |