jaskell.expression.parser.Param 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.expression.parser;
import static jaskell.parsec.common.Combinator.attempt;
import static jaskell.parsec.common.Combinator.choice;
import static jaskell.parsec.common.Combinator.many;
import static jaskell.parsec.common.Txt.digit;
import static jaskell.parsec.common.Txt.joining;
import static jaskell.parsec.common.Txt.letter;
import jaskell.expression.Expression;
import jaskell.expression.Parameter;
import jaskell.parsec.ParsecException;
import jaskell.parsec.common.Parsec;
import jaskell.parsec.common.State;
import java.io.EOFException;
/**
* TODO
*
* @author mars
* @version 1.0.0
* @since 2020/06/10 17:54
*/
public class Param implements Parsec {
private final Parsec head = letter();
private final Parsec tail = many(choice(attempt(head), digit())).bind(joining());
private final Parsec parser = s -> head.parse(s) + tail.parse(s);
@Override
public Expression parse(State s) throws EOFException, ParsecException {
return new Parameter(parser.parse(s));
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy