jaskell.parsec.Many1 Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jaskell-java8 Show documentation
Show all versions of jaskell-java8 Show documentation
This is a utils library for java 8 project.
It include parsec combinators and sql generators library.
package jaskell.parsec;
import java.io.EOFException;
import java.util.ArrayList;
import java.util.List;
/**
* Created by Mars Liu on 2016-01-03.
* Many1 匹配给定算子 1 到多次.
*/
public class Many1
implements Parsec, Status, Tran> {
private final Parsec parser;
@Override
public List parse(State s) throws EOFException, ParsecException {
List re = new ArrayList<>();
re.add(this.parser.parse(s));
Parsec p = new Try<>(parser);
try{
while (true){
re.add(p.parse(s));
}
} catch (Exception e){
return re;
}
}
public Many1(Parsec parsec){
this.parser = parsec;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy