Search in sources :

Example 1 with TypeErrorException

use of de.bmoth.parser.ast.TypeErrorException in project bmoth by hhu-stups.

the class Parser method getFormulaAsSemanticAst.

public static FormulaNode getFormulaAsSemanticAst(String inputString) throws ParserException {
    Parser parser = new Parser();
    try {
        FormulaContext formulaContext;
        formulaContext = parser.parseFormula(inputString);
        List<String> warnings = CSTAnalyser.analyseConcreteSyntaxTree(formulaContext);
        FormulaNode formulaNode = parser.getFormulaAst(formulaContext);
        formulaNode.setWarnings(warnings);
        TypeChecker.typecheckFormulaNode(formulaNode);
        return formulaNode;
    } catch (ParseErrorException | TypeErrorException | ScopeException e) {
        throw new ParserException(e);
    }
}
Also used : FormulaNode(de.bmoth.parser.ast.nodes.FormulaNode) TypeErrorException(de.bmoth.parser.ast.TypeErrorException) FormulaContext(de.bmoth.antlr.BMoThParser.FormulaContext) BMoThParser(de.bmoth.antlr.BMoThParser)

Example 2 with TypeErrorException

use of de.bmoth.parser.ast.TypeErrorException in project bmoth by hhu-stups.

the class Parser method getLTLFormulaAsSemanticAst.

public static LTLFormula getLTLFormulaAsSemanticAst(String inputString) throws ParserException {
    Parser parser = new Parser();
    try {
        LtlStartContext context;
        context = parser.parseLTLFormula(inputString);
        LTLFormula ltlFormulaAst = parser.getLTLFormulaAst(context);
        TypeChecker.typecheckLTLFormulaNode(ltlFormulaAst);
        return ltlFormulaAst;
    } catch (ParseErrorException | ScopeException | TypeErrorException e) {
        throw new ParserException(e);
    }
}
Also used : LTLFormula(de.bmoth.parser.ast.nodes.ltl.LTLFormula) TypeErrorException(de.bmoth.parser.ast.TypeErrorException) LtlStartContext(de.bmoth.antlr.BMoThParser.LtlStartContext) BMoThParser(de.bmoth.antlr.BMoThParser)

Example 3 with TypeErrorException

use of de.bmoth.parser.ast.TypeErrorException in project bmoth by hhu-stups.

the class Parser method getMachineAsSemanticAst.

public static MachineNode getMachineAsSemanticAst(String inputString) throws ParserException {
    Parser parser = new Parser();
    try {
        StartContext start = parser.parseMachine(inputString);
        List<String> warnings = CSTAnalyser.analyseConcreteSyntaxTree(start);
        MachineNode machineNode = parser.getMachineAst(start);
        machineNode.setWarnings(warnings);
        TypeChecker.typecheckMachineNode(machineNode);
        return machineNode;
    } catch (ParseErrorException | TypeErrorException | ScopeException e) {
        throw new ParserException(e);
    }
}
Also used : StartContext(de.bmoth.antlr.BMoThParser.StartContext) LtlStartContext(de.bmoth.antlr.BMoThParser.LtlStartContext) TypeErrorException(de.bmoth.parser.ast.TypeErrorException) BMoThParser(de.bmoth.antlr.BMoThParser) MachineNode(de.bmoth.parser.ast.nodes.MachineNode)

Aggregations

BMoThParser (de.bmoth.antlr.BMoThParser)3 TypeErrorException (de.bmoth.parser.ast.TypeErrorException)3 LtlStartContext (de.bmoth.antlr.BMoThParser.LtlStartContext)2 FormulaContext (de.bmoth.antlr.BMoThParser.FormulaContext)1 StartContext (de.bmoth.antlr.BMoThParser.StartContext)1 FormulaNode (de.bmoth.parser.ast.nodes.FormulaNode)1 MachineNode (de.bmoth.parser.ast.nodes.MachineNode)1 LTLFormula (de.bmoth.parser.ast.nodes.ltl.LTLFormula)1