All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.jtwig.plural.parse.parboiled.NumberParser Maven / Gradle / Ivy

There is a newer version: 5.87.0.RELEASE
Show newest version
package org.jtwig.plural.parse.parboiled;

import org.parboiled.Rule;

public class NumberParser extends BasicParser {
    public NumberParser(ParserContext context) {
        super(NumberParser.class, context);
    }

    @Override
    public Rule Rule() {
        return Sequence(
                Sequence(
                        Optional("-"),
                        OneOrMore(CharRange('0', '9'))
                ),
                push(Integer.parseInt(match()))
        );
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy