org.unlaxer.tinyexpression.parser.javalang.ImportsParser 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 java.util.function.Supplier;
import java.util.stream.Collectors;
import org.unlaxer.Token;
import org.unlaxer.parser.Parser;
import org.unlaxer.parser.combinator.LazyZeroOrMore;
import org.unlaxer.util.annotation.TokenExtractor;
import org.unlaxer.util.annotation.TokenExtractor.Timing;
public class ImportsParser extends LazyZeroOrMore{
@Override
public Supplier getLazyParser() {
return ImportParser::new;
}
@Override
public Optional getLazyTerminatorParser() {
return Optional.empty();
}
@TokenExtractor(timings = Timing.CreateOperatorOperandTree)
public static List extractImports(Token thisParserParsed){
return thisParserParsed.getAstNodeChildren().stream()
.map(ImportParser::extractImport)
.collect(Collectors.toList());
}
}