blob: 1fd21ac7d04974b8f56e1dc43aca97526aec1fe8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
# 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
|