Search in sources :

Example 46 with Node

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

the class StructuralTest method checkForInvalidSemicolonBeforeEnd.

@Test
public void checkForInvalidSemicolonBeforeEnd() throws Exception {
    String s = "MACHINE MissingSemicolon\nOPERATIONS\n Foo=BEGIN skip\n; END\nEND";
    try {
        getTreeAsString(s);
        fail("Invalid Semicolon was not detected");
    } catch (BCompoundException e) {
        final CheckException cause = (CheckException) e.getCause();
        Node node = cause.getNodes()[0];
        assertEquals(4, node.getStartPos().getLine());
        assertEquals(1, node.getStartPos().getPos());
        assertTrue(e.getMessage().contains("Invalid semicolon after last substitution"));
    }
}
Also used : CheckException(de.be4.classicalb.core.parser.exceptions.CheckException) Node(de.be4.classicalb.core.parser.node.Node) Ast2String(util.Ast2String) BCompoundException(de.be4.classicalb.core.parser.exceptions.BCompoundException) Test(org.junit.Test)

Example 47 with Node

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

the class PrologGenerator method caseAActionLtl.

@Override
public void caseAActionLtl(final AActionLtl node) {
    final Token token = node.getOperation();
    p.openTerm("action");
    helper.parseTransitionPredicate(UniversalToken.createToken(token));
    p.closeTerm();
}
Also used : Token(de.be4.ltl.core.parser.node.Token)

Example 48 with Node

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

the class PrologGenerator method caseAUnparsedLtl.

@Override
public void caseAUnparsedLtl(final AUnparsedLtl node) {
    final Token token = node.getPredicate();
    helper.caseUnparsed(UniversalToken.createToken(token));
}
Also used : Token(de.be4.ltl.core.parser.node.Token)

Example 49 with Node

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

the class PrologGenerator method caseAAndFair2Ltl.

@Override
public void caseAAndFair2Ltl(final AAndFair2Ltl node) {
    final PLtl left_node = node.getLeft();
    final PLtl right_node = node.getRight();
    helper.and_fair2(left_node, right_node, this);
}
Also used : PLtl(de.be4.ltl.core.parser.node.PLtl)

Example 50 with Node

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

the class PrologGenerator method caseAAndFair1Ltl.

@Override
public void caseAAndFair1Ltl(final AAndFair1Ltl node) {
    final PLtl left_node = node.getLeft();
    final PLtl right_node = node.getRight();
    helper.and_fair1(left_node, right_node, this);
}
Also used : PLtl(de.be4.ltl.core.parser.node.PLtl)

Aggregations

CheckException (de.be4.classicalb.core.parser.exceptions.CheckException)42 PExpression (de.be4.classicalb.core.parser.node.PExpression)30 ArrayList (java.util.ArrayList)30 Node (de.be4.classicalb.core.parser.node.Node)20 AIdentifierExpression (de.be4.classicalb.core.parser.node.AIdentifierExpression)16 TIdentifierLiteral (de.be4.classicalb.core.parser.node.TIdentifierLiteral)12 TPragmaIdOrString (de.be4.classicalb.core.parser.node.TPragmaIdOrString)11 VisitorException (de.be4.classicalb.core.parser.exceptions.VisitorException)8 HashSet (java.util.HashSet)8 Token (de.be4.ltl.core.parser.node.Token)7 Type (de.be4.classicalb.core.parser.IDefinitions.Type)6 IOException (java.io.IOException)6 ASTProlog (de.be4.classicalb.core.parser.analysis.prolog.ASTProlog)5 PositionedNode (de.hhu.stups.sablecc.patch.PositionedNode)5 LinkedList (java.util.LinkedList)5 BCompoundException (de.be4.classicalb.core.parser.exceptions.BCompoundException)4 LinkedHashMap (java.util.LinkedHashMap)4 Test (org.junit.Test)4 ClassicalPositionPrinter (de.be4.classicalb.core.parser.analysis.prolog.ClassicalPositionPrinter)3 NodeIdAssignment (de.be4.classicalb.core.parser.analysis.prolog.NodeIdAssignment)3