org.unlaxer.tinyexpression.parser.javalang.JavaStyleDelimitedLazyChain 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.javalang;
import java.util.List;
import java.util.Optional;
import org.unlaxer.Name;
import org.unlaxer.RecursiveMode;
import org.unlaxer.parser.Parser;
import org.unlaxer.parser.Parsers;
import org.unlaxer.parser.combinator.LazyChain;
import org.unlaxer.reducer.TagBasedReducer.NodeKind;
public abstract class JavaStyleDelimitedLazyChain extends LazyChain {
private static final long serialVersionUID = -324234946352474224L;
public JavaStyleDelimitedLazyChain() {
super();
}
public JavaStyleDelimitedLazyChain(Name name) {
super(name);
}
@Override
public Optional getNotAstNodeSpecifier() {
return Optional.empty();
}
static final JavaStyleDelimitor delimitor = new JavaStyleDelimitor();
static {
delimitor.addTag(NodeKind.notNode.getTag());
}
@Override
public void prepareChildren(Parsers childrenContainer) {
if(childrenContainer.isEmpty()){
List lazyParsers = getLazyParsers();
childrenContainer.add(delimitor);
for (Parser parser : lazyParsers) {
childrenContainer.add(parser);
childrenContainer.add(delimitor);
}
}
}
}