jaskell.parsec.Decimal 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-08.
* Decimal 尝试将后续的信息解析为 Decimal ,直到第一个无效信息为止.如果获取的信息不足以组成一个有效的浮点数,抛出异常.
*/
public class Decimal implements Parsec {
private final Parsec sign = new Ch<>('-');
private final UDecimal decimal = new UDecimal<>();
@Override
public String parse(State s)
throws EOFException, ParsecException {
if (sign.exec(s).isOk()) {
return "-" + decimal.parse(s);
} else {
return decimal.parse(s);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy