Search in sources :

Example 1 with LtlLexer

use of de.be4.ltl.core.parser.internal.LtlLexer in project probparsers by bendisposto.

the class LTLFormulaVisitor method parseLTLFormula.

public static Start parseLTLFormula(String ltlFormula) throws ParserException, LexerException, IOException {
    StringReader reader = new StringReader(ltlFormula);
    PushbackReader r = new PushbackReader(reader);
    Lexer l = new LtlLexer(r);
    Parser p = new Parser(l);
    Start ast = null;
    ast = p.parse();
    return ast;
}
Also used : Lexer(de.be4.ltl.core.parser.lexer.Lexer) LtlLexer(de.be4.ltl.core.parser.internal.LtlLexer) Start(de.be4.ltl.core.parser.node.Start) StringReader(java.io.StringReader) LtlLexer(de.be4.ltl.core.parser.internal.LtlLexer) PushbackReader(java.io.PushbackReader) Parser(de.be4.ltl.core.parser.parser.Parser) BParser(de.be4.classicalb.core.parser.BParser)

Example 2 with LtlLexer

use of de.be4.ltl.core.parser.internal.LtlLexer in project probparsers by bendisposto.

the class LtlParser method parseFormula.

protected Start parseFormula(final String formula) throws LtlParseException, IOException {
    StringReader reader = new StringReader(formula);
    PushbackReader r = new PushbackReader(reader);
    Lexer l = new LtlLexer(r);
    Parser p = new Parser(l);
    Start ast = null;
    try {
        ast = p.parse();
    } catch (ParserException e) {
        final UniversalToken token = UniversalToken.createToken(e.getToken());
        throw new LtlParseException(token, e.getLocalizedMessage());
    } catch (LexerException e) {
        throw new LtlParseException(null, e.getLocalizedMessage());
    }
    return ast;
}
Also used : ParserException(de.be4.ltl.core.parser.parser.ParserException) LtlLexer(de.be4.ltl.core.parser.internal.LtlLexer) Lexer(de.be4.ltl.core.parser.lexer.Lexer) UniversalToken(de.be4.ltl.core.parser.internal.UniversalToken) Start(de.be4.ltl.core.parser.node.Start) StringReader(java.io.StringReader) LexerException(de.be4.ltl.core.parser.lexer.LexerException) LtlLexer(de.be4.ltl.core.parser.internal.LtlLexer) PushbackReader(java.io.PushbackReader) Parser(de.be4.ltl.core.parser.parser.Parser)

Aggregations

LtlLexer (de.be4.ltl.core.parser.internal.LtlLexer)2 Lexer (de.be4.ltl.core.parser.lexer.Lexer)2 Start (de.be4.ltl.core.parser.node.Start)2 Parser (de.be4.ltl.core.parser.parser.Parser)2 PushbackReader (java.io.PushbackReader)2 StringReader (java.io.StringReader)2 BParser (de.be4.classicalb.core.parser.BParser)1 UniversalToken (de.be4.ltl.core.parser.internal.UniversalToken)1 LexerException (de.be4.ltl.core.parser.lexer.LexerException)1 ParserException (de.be4.ltl.core.parser.parser.ParserException)1