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
tdiary-5.2.0 vendor/bundle/ruby/2.7.0/gems/racc-1.5.2/test/assets/error_recovery.y
tdiary-5.1.7 vendor/bundle/ruby/2.7.0/gems/racc-1.5.2/test/assets/error_recovery.y
tdiary-5.1.7 vendor/bundle/ruby/3.0.0/gems/racc-1.5.2/test/assets/error_recovery.y
rails_mini_profiler-0.2.0 vendor/bundle/ruby/3.0.0/gems/racc-1.5.2/test/assets/error_recovery.y
mumukit-content-type-1.11.1 vendor/bundle/ruby/2.6.0/gems/racc-1.5.2/test/assets/error_recovery.y
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/tdiary-5.1.5/vendor/bundle/ruby/3.0.0/gems/racc-1.5.2/test/assets/error_recovery.y
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/racc-1.5.2/test/assets/error_recovery.y
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/tdiary-5.1.5/vendor/bundle/ruby/2.7.0/gems/racc-1.5.2/test/assets/error_recovery.y
tdiary-5.1.6 vendor/bundle/ruby/3.0.0/gems/racc-1.5.2/test/assets/error_recovery.y
tdiary-5.1.5 vendor/bundle/ruby/3.0.0/gems/racc-1.5.2/test/assets/error_recovery.y
tdiary-5.1.5 vendor/bundle/ruby/2.7.0/gems/racc-1.5.2/test/assets/error_recovery.y
racc-1.5.2-java test/assets/error_recovery.y
racc-1.5.2 test/assets/error_recovery.y
racc-1.5.1-java test/assets/error_recovery.y
racc-1.5.1 test/assets/error_recovery.y
racc-1.5.0-java test/assets/error_recovery.y
racc-1.5.0 test/assets/error_recovery.y
racc-1.4.16-java test/assets/error_recovery.y
racc-1.4.16 test/assets/error_recovery.y
racc-1.4.15-java test/assets/error_recovery.y