Search in sources :

Example 1 with ClassicalBParser

use of de.be4.classicalb.core.parser.ClassicalBParser in project probparsers by bendisposto.

the class LtlConsoleParser method getExtensionParser.

public static ProBParserBase getExtensionParser(final String pattern) {
    final ProBParserBase result;
    if (pattern == null) {
        result = UNPARSED_PARSER_BASE;
    } else {
        final String[] langs = pattern.split(",");
        final ProBParserBase[] sublangs = new ProBParserBase[langs.length];
        for (int i = 0; i < langs.length; i++) {
            final String lang = langs[i];
            final ProBParserBase sub;
            if ("none".equals(lang)) {
                sub = UNPARSED_PARSER_BASE;
            } else if ("B".equals(lang)) {
                sub = new ClassicalBParser();
            } else
                throw new IllegalArgumentException("Unknown language " + lang);
            sublangs[i] = sub;
        }
        if (sublangs.length == 1) {
            result = sublangs[0];
        } else {
            result = new JoinedParserBase(sublangs);
        }
    }
    return result;
}
Also used : ClassicalBParser(de.be4.classicalb.core.parser.ClassicalBParser) JoinedParserBase(de.prob.parserbase.JoinedParserBase) ProBParserBase(de.prob.parserbase.ProBParserBase)

Aggregations

ClassicalBParser (de.be4.classicalb.core.parser.ClassicalBParser)1 JoinedParserBase (de.prob.parserbase.JoinedParserBase)1 ProBParserBase (de.prob.parserbase.ProBParserBase)1