Sha256: 2704289c47505a69a8f12f1f5c1b158d9207fac8233e68b7fe3fca591559abda

Contents?: true

Size: 545 Bytes

Versions: 23

Compression:

Stored size: 545 Bytes

Contents

# 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

Version data entries

23 entries across 18 versions & 4 rubygems

Version Path
racc-1.4.15 test/assets/error_recovery.y
racc-1.4.14-java test/assets/error_recovery.y
racc-1.4.14 test/assets/error_recovery.y