//System.out.flush();
Signature sig;
String spec = specbuf.toString();
if (spec.startsWith("_")) {
specbuf.delete(0, 1);
sig = new AnySignature(new OtpErlangList());
} else if (spec.matches("^[0-9].*")) {
// Integer literal
// Floats are not supported atm...
String val = "";
while ((specbuf.length() > 0) && (specbuf.substring(0, 1).matches("[0-9]"))) {
val += "" + specbuf.substring(0, 1);
specbuf.delete(0, 1);
}
// handle ranges...
if (specbuf.toString().startsWith("..")) {
int lowerValue = Integer.parseInt(val);
specbuf.delete(0, 2);
val = "";
while ((specbuf.length() > 0) && (specbuf.substring(0, 1).matches("[0-9]"))) {
val += "" + specbuf.substring(0, 1);
specbuf.delete(0, 1);
}
int upperValue = Integer.parseInt(val);
sig = new IntSignature(new OtpErlangList(),new OtpErlangList(new OtpErlangObject[]{
new OtpErlangInt(lowerValue),new OtpErlangInt(upperValue)
}));
} else {
sig = new LiteralSignature(val);
}
} else if (spec.startsWith("any()")) {
specbuf.delete(0, 5);
sig = new AnySignature(new OtpErlangList());
} else if (spec.startsWith("integer()")) {
specbuf.delete(0, 9);
sig = new IntSignature(new OtpErlangList());
} else if (spec.startsWith("non_neg_integer()")) {
specbuf.delete(0, 17);