org.unlaxer.tinyexpression.parser.javalang.JavaStyleDelimitedLazyOneOrMore 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
package org.unlaxer.tinyexpression.parser.javalang;
import java.util.function.Supplier;
import org.unlaxer.Name;
import org.unlaxer.parser.Parser;
import org.unlaxer.parser.Parsers;
import org.unlaxer.parser.combinator.LazyOneOrMore;
public abstract class JavaStyleDelimitedLazyOneOrMore extends LazyOneOrMore {
JavaStyleDelimitedLazyChain chain;
public JavaStyleDelimitedLazyOneOrMore() {
super();
Parsers parser = Parsers.of(targetParser().get());
chain = new JavaStyleDelimitedLazyChain() {
@Override
public org.unlaxer.parser.Parsers getLazyParsers() {
return parser;
}
};
}
public JavaStyleDelimitedLazyOneOrMore(Name name) {
super(name);
Parsers parser = Parsers.of(targetParser().get());
chain = new JavaStyleDelimitedLazyChain() {
@Override
public org.unlaxer.parser.Parsers getLazyParsers() {
return parser;
}
};
}
@Override
public Supplier getLazyParser() {
return ()->chain;
}
@Override
public java.util.Optional getLazyTerminatorParser() {
return java.util.Optional.empty();
}
public abstract Supplier targetParser();
}