struct

TopDown::Parser::Fail

Inherits Struct < Value < Object

Empty struct representing a parse failure.

When Parser.parse is used, if it fails, it break the current sequence with a Fail.

However when the method is surrounded by a block, the Fail get returned. In this case it recommended to use Parser.forward_fail to break again.

result = Array.new(3) do
  parse("a")
end

typeof(result) # => Array(String) | TopDown::Parser::Fail

result = forward_fail(result)
typeof(result) # => Array(String)

Constructors

Instance methods

initialize
Source