org.unlaxer.tinyexpression.parser.NakedVariableParser Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of tinyExpression Show documentation
Show all versions of tinyExpression Show documentation
TinyExpression implemented with Unlaxer
The newest version!
package org.unlaxer.tinyexpression.parser;
import java.util.Optional;
import org.unlaxer.Name;
import org.unlaxer.parser.Parser;
import org.unlaxer.parser.Parsers;
import org.unlaxer.parser.clang.IdentifierParser;
import org.unlaxer.parser.combinator.LazyChain;
import org.unlaxer.util.cache.SupplierBoundCache;
public class NakedVariableParser extends LazyChain implements VariableParser{//implements Expression , BooleanExpression , StringExpression{
private static final long serialVersionUID = -8533685205048474333L;
static final SupplierBoundCache SINGLETON = new SupplierBoundCache<>(NakedVariableParser::new);
public NakedVariableParser() {
super();
}
public NakedVariableParser(Name name) {
super(name);
}
@Override
public org.unlaxer.parser.Parsers getLazyParsers() {
return
new Parsers(
Parser.get(DollarParser.class),
Parser.newInstance(IdentifierParser.class).addTag(variableNameTag)
);
}
@Override
public Optional typeAsOptional() {
return Optional.empty();
}
public static NakedVariableParser get() {
return SINGLETON.get();
}
}