In Files

Parent

Methods

Files

Parslet::ParseFailed

Raised when the parse failed to match. It contains the message that should be presented to the user. More details can be extracted from the exceptions cause member: It contains an instance of {Parslet::Cause} that stores all the details of your failed parse in a tree structure.

begin
  parslet.parse(str)
rescue Parslet::ParseFailed => failure
  puts failure.cause.ascii_tree
end

Alternatively, you can just require ‘parslet/convenience’ and call the method parse_with_debug instead of parse. This method will never raise and print error trees to stdout.

require 'parslet/convenience'
parslet.parse_with_debug(str)

Attributes

cause[R]

Why the parse failed.

@return [Parslet::Cause]

Public Class Methods

new(message, cause=nil) click to toggle source
# File lib/parslet.rb, line 75
def initialize(message, cause=nil)
  super(message)
  @cause = cause
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.