Assert.assertEquals("[{call, xyz, '*'}, {call, xyz, '*'}, {call, xyz, '*'}, {call, [wibble], '*'}, {call, [wibble], '*'}, {call, [wibble], '*'}, {call, xyz, '*'}, {call, xyz, '*'}, {call, xyz, '*'}, {cast, wibble}, {cast, stop}, {cast, xyz}, {cast, xyz3}, {info, wibble}, {info, xyz}]",
mod.behaviour.alphabet.toString());
}
*/
protected static ListSignature parseList(StringBuffer specbuf, boolean definitelyNotEmpty,char terminal) {
ListSignature lsig = null;
List<Signature> elems = new LinkedList<Signature>();
boolean empty = !definitelyNotEmpty;
while (specbuf.charAt(0) != terminal) {
elems.add(parseSignature(specbuf));
bufTrimmer(specbuf);
if (specbuf.charAt(0) == ',') {
// More items...
specbuf.delete(0, 1);
bufTrimmer(specbuf);
}
if (specbuf.length() >= 3) {
if (specbuf.substring(0, 3).equals("...")) {
// Undefined list continuation
specbuf.delete(0, 3);
bufTrimmer(specbuf);
empty = false;
// Almost certainly now ends...
}
}
}
specbuf.delete(0, 1);
if (elems.isEmpty())
lsig = new ListSignature(new OtpErlangList(
empty?new OtpErlangObject[0]:new OtpErlangObject[]{ListSignature.NonEmptyAtom}),
new OtpErlangList());
else
lsig = new ListSignature(new OtpErlangList(),new OtpErlangList(elems.toArray(new OtpErlangObject[0])));
return lsig;
}