jaskell.parsec.Eq Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jaskell-java8 Show documentation
Show all versions of jaskell-java8 Show documentation
This is a utils library for java 8 project.
It include parsec combinators and sql generators library.
package jaskell.parsec;
import java.io.EOFException;
import java.util.Objects;
/**
* Created by Mars Liu on 2016-01-03.
* Eq 即 equal , 判断得到的信息项是否与预期相等.
*/
public class Eq implements Parsec {
private final E item;
@Override
public E parse(State s) throws EOFException, ParsecException {
E re = s.next();
if (Objects.equals(re, item)){
return re;
} else {
String message = String.format("Expect %s is equal to %s", re, item);
throw s.trap(message);
}
}
public Eq(E item){
this.item = item;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy