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

org.jtwig.plural.parse.parboiled.MessageParser 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 MessageParser extends BasicParser {
    public MessageParser(ParserContext context) {
        super(MessageParser.class, context);
    }

    @Override
    public Rule Rule() {
        return Sequence(
                ZeroOrMore(
                        FirstOf(
                                Escape(),
                                Other()
                        )
                ),
                push(match().replace("\\|", "|").trim())
        );
    }

    Rule Other() {
        return Sequence(
                TestNot("|"),
                ANY
        );
    }

    Rule Escape() {
        return String("\\|");
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy