System.err.println("Can't have two parent tests in one test on line " + rule.line + "\nTry splitting it up.");
System.exit(1);
}
for (int testInt : test.ors) {
ArrayList<Token> newTokenList = copyTokenList(tokensList);
CgContextualTest childTest = rule.test_map.get(testInt);
if (childTest.isNormalTest()) {
Token childTestToken = getTokenFromNormalTest(childTest);
newTokenList.add(childTestToken);
} else if (childTest.isLinkedTest()) {
ArrayList<CgContextualTest> linkedTests = new ArrayList<CgContextualTest>();
CgContextualTest curTest = childTest;
while (curTest.next != 0) { // while there are still more tests to link to
linkedTests.add(curTest);
curTest = rule.test_map.get(curTest.next);
}
linkedTests.add(curTest); // add the last linked test
Token headLinkedToken = getLinkedTokens(linkedTests); // modifies the offsets for the linked tests
newTokenList.add(headLinkedToken);
}
outerList.add(newTokenList);
}
} else if (test.isLinkedTest()) {
// add all the linked tests to a list
ArrayList<CgContextualTest> linkedTests = new ArrayList<CgContextualTest>();
CgContextualTest curTest = test;
while (curTest.next != 0) { // while there are still more tests to link to
linkedTests.add(curTest);
curTest = rule.test_map.get(curTest.next);
}
linkedTests.add(curTest); // add the last linked test