Search in sources :

Example 1 with LTLParseException

use of de.prob.typechecker.exceptions.LTLParseException in project probparsers by bendisposto.

the class LTLFormulaVisitor method parseBPredicate.

private de.be4.classicalb.core.parser.node.Start parseBPredicate(String text) {
    String bPredicate = "#PREDICATE " + text;
    BParser parser = new BParser("Testing");
    de.be4.classicalb.core.parser.node.Start start = null;
    try {
        start = parser.parse(bPredicate, false);
    } catch (BCompoundException e) {
        throw new LTLParseException(e.getMessage());
    }
    return start;
}
Also used : LTLParseException(de.prob.typechecker.exceptions.LTLParseException) BParser(de.be4.classicalb.core.parser.BParser) BCompoundException(de.be4.classicalb.core.parser.exceptions.BCompoundException)

Example 2 with LTLParseException

use of de.prob.typechecker.exceptions.LTLParseException in project probparsers by bendisposto.

the class LTLFormulaVisitor method parseDefinition.

public void parseDefinition(AExpressionDefinitionDefinition def) {
    if (!(def.getRhs() instanceof AStringExpression)) {
        throw new LTLParseException("Error: LTL formula is not in a string representation.");
    }
    AStringExpression stringNode = (AStringExpression) def.getRhs();
    this.ltlFormula = stringNode.getContent().getText();
    try {
        this.ltlFormulaStart = parseLTLFormula(ltlFormula);
    } catch (Exception e) {
        String message = "Parsing definition " + name + " (line " + def.getStartPos().getLine() + "):\n";
        throw new LTLParseException(message + e.getMessage());
    }
}
Also used : LTLParseException(de.prob.typechecker.exceptions.LTLParseException) AStringExpression(de.be4.classicalb.core.parser.node.AStringExpression) LexerException(de.be4.ltl.core.parser.lexer.LexerException) ParserException(de.be4.ltl.core.parser.parser.ParserException) ScopeException(de.prob.typechecker.exceptions.ScopeException) LTLParseException(de.prob.typechecker.exceptions.LTLParseException) IOException(java.io.IOException) BCompoundException(de.be4.classicalb.core.parser.exceptions.BCompoundException)

Aggregations

BCompoundException (de.be4.classicalb.core.parser.exceptions.BCompoundException)2 LTLParseException (de.prob.typechecker.exceptions.LTLParseException)2 BParser (de.be4.classicalb.core.parser.BParser)1 AStringExpression (de.be4.classicalb.core.parser.node.AStringExpression)1 LexerException (de.be4.ltl.core.parser.lexer.LexerException)1 ParserException (de.be4.ltl.core.parser.parser.ParserException)1 ScopeException (de.prob.typechecker.exceptions.ScopeException)1 IOException (java.io.IOException)1