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

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

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

/**
 * An immutable parse success.
 */
public class Success extends Result {

  private final Object result;

  public Success(String buffer, int position, Object result) {
    super(buffer, position);
    this.result = result;
  }

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

  @Override
  @SuppressWarnings("unchecked")
  public  T get() {
    return (T) result;
  }

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy