jaskell.parsec.UDecimal 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-07.
* UDecimal 尝试将后续信息流解析成一个表示无符号浮点数的字符串,如果匹配失败就抛出异常.
*/
public class UDecimal implements Parsec {
private final Parsec uint = new UInt<>();
private final Parsec dot = new Ch<>('.');
@Override
public String parse(State s)
throws EOFException, ParsecException {
StringBuilder builder = new StringBuilder();
builder.append(uint.parse(s));
if (dot.exec(s).isOk()){
builder.append('.');
builder.append(uint.parse(s));
}
return builder.toString();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy