struct TopDown::Parser::Fail

Overview

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)

Defined in:

parser/parser.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new #

[View source]

Instance Method Detail

def initialize #

[View source]