All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.petitparser.context.Failure Maven / Gradle / Ivy

There is a newer version: 2.4.0
Show newest version
package org.petitparser.context;

/**
 * An immutable parse failure.
 */
public class Failure extends Result {

  private final String message;

  public Failure(String buffer, int position, String message) {
    super(buffer, position);
    this.message = message;
  }

  @Override
  public String getMessage() {
    return message;
  }

  @Override
  public boolean isFailure() {
    return true;
  }

  @Override
  public  T get() {
    throw new ParseError(this);
  }

  @Override
  public String toString() {
    return super.toString() + ": " + message;
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy