use of de.be4.classicalb.core.parser.node.TIntegerLiteral in project probparsers by bendisposto.
the class ASTPrologTest method testPartition.
@Test
public void testPartition() {
final PExpression set = createId("set");
final PExpression one = new AIntegerExpression(new TIntegerLiteral("1"));
final PExpression two = new AIntegerExpression(new TIntegerLiteral("2"));
final PExpression three = new AIntegerExpression(new TIntegerLiteral("3"));
final APartitionPredicate pred = new APartitionPredicate(set, Arrays.asList(one, two, three));
final String expected = "partition($,identifier($,set),[integer($,1),integer($,2),integer($,3)])";
checkAST(0, expected, pred);
}
use of de.be4.classicalb.core.parser.node.TIntegerLiteral in project probparsers by bendisposto.
the class SourcePositionsTest method testTokenAsPositionedNode.
@Test
public void testTokenAsPositionedNode() throws Exception {
final String testMachine = "#EXPRESSION xx + 5";
final Start result = getAst(testMachine);
final AExpressionParseUnit exprParseUnit = (AExpressionParseUnit) result.getPParseUnit();
final AAddExpression addExpression = (AAddExpression) exprParseUnit.getExpression();
final AIntegerExpression intExpression = (AIntegerExpression) addExpression.getRight();
assertTrue(intExpression instanceof PositionedNode);
final PositionedNode intNode = (PositionedNode) intExpression;
assertNotNull(intNode.getStartPos());
assertNotNull(intNode.getEndPos());
final TIntegerLiteral intLiteral = intExpression.getLiteral();
assertTrue(intLiteral instanceof PositionedNode);
final PositionedNode posNode = (PositionedNode) intLiteral;
assertNotNull(posNode.getStartPos());
assertNotNull(posNode.getEndPos());
}
Aggregations