org.unlaxer.sample.calc.parser.operator.ImmediateValueOperator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of calculator Show documentation
Show all versions of calculator Show documentation
a simple parser combinator inspired by RelaxNG
package org.unlaxer.sample.calc.parser.operator;
import java.math.BigDecimal;
import java.util.function.Supplier;
import org.unlaxer.Token;
import org.unlaxer.sample.calc.CalculationContext;
public class ImmediateValueOperator implements UnaryOperator> {
public static final ImmediateValueOperator SINGLETON = new ImmediateValueOperator();
@Override
public Supplier evaluate(CalculationContext calculationContext , Token token) {
return ()->new BigDecimal(token.tokenString.get());
}
}