/**
  * Pops the output list currently at the top of the output list stack and discards it, and appends
  * the given replacement list to the output list immediately underneath.
  *
  * @param replacement A list of tokens to be appended to the output list currently immediately
  *     under the top of the stack.
  * @throws EmptyStackException if there is currently only one output list on the stack.
  */
 public synchronized void mergeOutputList(List replacement) {
   logger.debug3("Merging with replacement");
   listStack.pop(); // discard result
   List newTop = (List) listStack.peek();
   newTop.addAll(replacement);
 }
 /**
  * Pops the output list currently at the top of the output list stack and appends it to the end of
  * the output list immediately underneath.
  *
  * @throws EmptyStackException if there is currently only one output list on the stack.
  * @see #mergeOutputList(List)
  */
 public synchronized void mergeOutputList() {
   logger.debug3("Merging");
   List oldTop = (List) listStack.pop();
   List newTop = (List) listStack.peek();
   newTop.addAll(oldTop);
 }