if (doneIndex == null) { doneIndex = single; doneIndexLast = single; } else { doneIndexLast.next = single; }  while (doneIndexLast.next != null) { doneIndexLast = doneIndexLast.next; }
doneIndex.addTail(single);
    private REMatch matchRest(CharIndexed input, final REMatch newMatch) {	REMatch current, single;	REMatch doneIndex = null;	REMatch doneIndexLast = null;	// Test all possible matches for this number of repeats	for (current = newMatch; current != null; current = current.next) {	    // clone() separates a single match from the chain	    single = (REMatch) current.clone();	    if (next(input, single)) {		// chain results to doneIndex		if (doneIndex == null) {		    doneIndex = single;		    doneIndexLast = single;		} else {		    doneIndexLast.next = single;		}		// Find new doneIndexLast		while (doneIndexLast.next != null) {		    doneIndexLast = doneIndexLast.next;		}	    }	}	return doneIndex;    }