use of de.be4.ltl.core.parser.node.Start in project probparsers by bendisposto.
the class PositionAspectTest method testComposedNode.
@Test
public void testComposedNode() throws Exception {
final String testMachine = "#EXPRESSION x+1";
final BParser parser = new BParser("testcase");
final Start startNode = parser.parse(testMachine, true);
// test top node
final PExpression expression = ((AExpressionParseUnit) startNode.getPParseUnit()).getExpression();
SourcePosition startPos = expression.getStartPos();
SourcePosition endPos = expression.getEndPos();
assertNotNull(startNode);
assertNotNull(endPos);
assertEquals(1, startPos.getLine());
assertEquals(13, startPos.getPos());
assertEquals(1, endPos.getLine());
assertEquals(16, endPos.getPos());
// test left child: 13-14
final PExpression leftExpr = ((AAddExpression) expression).getLeft();
startPos = leftExpr.getStartPos();
endPos = leftExpr.getEndPos();
assertNotNull(startNode);
assertNotNull(endPos);
assertEquals(1, startPos.getLine());
assertEquals(13, startPos.getPos());
assertEquals(1, endPos.getLine());
assertEquals(14, endPos.getPos());
// test right child: 15-16
final PExpression rightExpr = ((AAddExpression) expression).getRight();
startPos = rightExpr.getStartPos();
endPos = rightExpr.getEndPos();
assertNotNull(startNode);
assertNotNull(endPos);
assertEquals(1, startPos.getLine());
assertEquals(15, startPos.getPos());
assertEquals(1, endPos.getLine());
assertEquals(16, endPos.getPos());
}
use of de.be4.ltl.core.parser.node.Start in project probparsers by bendisposto.
the class PositionAspectTest method testNodeSubclassOfPositionedNode.
@Test
public void testNodeSubclassOfPositionedNode() throws Exception {
final String testMachine = "#EXPRESSION 1+2";
final BParser parser = new BParser("testcase");
final Start startNode = parser.parse(testMachine, true);
assertTrue(startNode instanceof PositionedNode);
}
use of de.be4.ltl.core.parser.node.Start in project probparsers by bendisposto.
the class ByteOrderMarkTests method testParsable.
@Test
public void testParsable() throws Exception {
final BParser parser = new BParser(machine.getName());
Start start = parser.parseFile(machine, false);
start.apply(new PositionTester());
assertNotNull(start);
}
use of de.be4.ltl.core.parser.node.Start in project probparsers by bendisposto.
the class DefinitionsOrderTest method testLinearOrder.
@Test
public void testLinearOrder() throws IOException, BCompoundException {
machine = new File(PATH + "DefinitionsOccurInLinearOrder.mch");
final BParser parser = new BParser(machine.getName());
Start start = parser.parseFile(machine, false);
assertNotNull(start);
}
use of de.be4.ltl.core.parser.node.Start in project probparsers by bendisposto.
the class StructuralTest method testClause1.
@Test
public void testClause1() throws Exception {
final String testMachine = "MACHINE SimplyStructure END";
// System.out.println("Parsing: \"" + testMachine + "\":");
final BParser parser = new BParser("testcase");
final Start startNode = parser.parse(testMachine, true);
assertNotNull(startNode);
// TODO more tests
}
Aggregations