in dom/src/main/java/org/apache/james/mime4j/field/address/LenientAddressParser.java [268:303]
public Address parseAddress(
final ByteSequence buf, final ParserCursor cursor, final BitSet delimiters) {
BitSet bitset = RawFieldParser.INIT_BITSET(COLON, AT, OPENING_BRACKET);
if (delimiters != null) {
bitset.or(delimiters);
}
String openingText = this.parser.parseValue(buf, cursor, bitset);
if (cursor.atEnd()) {
return createMailbox(openingText);
}
int pos = cursor.getPos();
char current = (char) (buf.byteAt(pos) & 0xff);
if (current == OPENING_BRACKET) {
// name <localPart @ domain> form
return parseMailboxAddress(openingText, buf, cursor);
} else if (current == AT) {
// localPart @ domain form
cursor.updatePos(pos + 1);
String domain = parseDomain(buf, cursor, delimiters);
return new Mailbox(null, null, openingText, domain);
} else if (current == COLON) {
// group-name: localPart @ domain, name <localPart @ domain>; form
cursor.updatePos(pos + 1);
List<Mailbox> mboxes = parseMailboxes(buf, cursor, SEMICOLON_ONLY);
if (!cursor.atEnd()) {
pos = cursor.getPos();
current = (char) (buf.byteAt(pos) & 0xff);
if (current == SEMICOLON) {
cursor.updatePos(pos + 1);
}
}
return new Group(openingText, mboxes);
} else {
return createMailbox(openingText);
}
}