private static Position nextTokenPos(Position pos,Token[][] spec){
  if (pos == null) {
    return null;
  }
  int nextItem=pos.item + 1;
  if ((nextItem < spec[pos.line].length) && ((pos.line < pcalEnd.line) || (nextItem < pcalEnd.item))) {
    return new Position(pos.line,nextItem);
  }
  int nextLine=pos.line + 1;
  while ((nextLine < spec.length) && (spec[nextLine].length == 0)) {
    nextLine++;
  }
  if ((nextLine < spec.length) && ((nextLine < pcalEnd.line) || ((nextLine == pcalEnd.line) && (0 < pcalEnd.item)))) {
    return new Position(nextLine,0);
  }
  return null;
}

private static Position nextTokenPos ( Position pos , Token [ ] [ ] spec ) { if ( pos == null ) { return null ; } int nextItem = pos . item + 1 ; if ( ( nextItem < spec [ pos . line ] . length ) && ( ( pos . line < pcalEnd . line ) || ( nextItem < pcalEnd . item ) ) ) { return new Position ( pos . line , nextItem ) ; } int nextLine = pos . line + 1 ; while ( ( nextLine < spec . length ) && ( spec [ nextLine ] . length == 0 ) ) { nextLine ++ ; } if ( ( nextLine < spec . length ) && ( ( nextLine < pcalEnd . line ) || ( ( nextLine == pcalEnd . line ) && ( 0 < pcalEnd . item ) ) ) ) { return new Position ( nextLine , 0 ) ; } return null ; }
returns the position of the next token after position pos in specification spec if that token exists and is in the pluscal algorithm ; otherwise , it returns null . for convenience it returns null if called with a null pos argument .
