use of de.be4.classicalb.core.parser.node.ASequenceSubstitution in project probparsers by bendisposto.
the class ASTBuilder method createSequenceSubstitution.
public static PSubstitution createSequenceSubstitution(PSubstitution sub1, PSubstitution sub2, PSubstitution... subs) {
List<PSubstitution> subList = new ArrayList<>();
subList.add(sub1);
subList.add(sub2);
for (PSubstitution pSubstitution : subs) {
subList.add(pSubstitution);
}
return new ASequenceSubstitution(subList);
}
use of de.be4.classicalb.core.parser.node.ASequenceSubstitution in project probparsers by bendisposto.
the class SourcePositionsTest method testSequenceSubst.
@Test
public void testSequenceSubst() throws Exception {
final String testMachine = "#SUBSTITUTION skip; x:=5; skip";
final Start result = getAst(testMachine);
final ASubstitutionParseUnit substParseUnit = (ASubstitutionParseUnit) result.getPParseUnit();
assertEquals(1, substParseUnit.getStartPos().getLine());
assertEquals(1, substParseUnit.getStartPos().getPos());
assertEquals(1, substParseUnit.getEndPos().getLine());
assertEquals(testMachine.length() + 1, substParseUnit.getEndPos().getPos());
final ASequenceSubstitution sequenceSubst = (ASequenceSubstitution) substParseUnit.getSubstitution();
assertEquals(1, sequenceSubst.getStartPos().getLine());
assertEquals(15, sequenceSubst.getStartPos().getPos());
assertEquals(1, sequenceSubst.getEndPos().getLine());
assertEquals(testMachine.length() + 1, sequenceSubst.getEndPos().getPos());
}
Aggregations