private String nextToken(ExtInputStreamReader r,boolean readNewline,boolean ignoreCommas,boolean ignoreColons,boolean ignoreWhiteSpaces) throws IOException {
  boolean newline=false;
  StringBuilder currentToken=new StringBuilder();
  char c=r.readCharFromReader();
  while (((byte)c) != -1 && isWhiteSpace(c)) {
    newline=newline || (c == 10 || c == 13 || c == ';' || ((c == ',') && (!ignoreCommas)) || (c == '>') || (c == '+'));
    if (!readNewline && newline) {
      return null;
    }
    c=r.readCharFromReader();
  }
  if (c == ';' && readNewline) {
    c=r.readCharFromReader();
    while (((byte)c) != -1 && isWhiteSpace(c)) {
      newline=newline || (c == 10 || c == 13 || c == ';' || ((c == ',') && (!ignoreCommas)) || (c == '>') || (c == '+'));
      c=r.readCharFromReader();
    }
  }
  char segment='\0';
  while (((byte)c) != -1 && ((!isWhiteSpace(c)) || (segment != '\0') || (ignoreWhiteSpaces)) && c != ';' && ((c != ':') || (segment != '\0') || (ignoreColons)) && ((c != ',') || (segment != '\0') || (ignoreCommas)) && (((c != '>') && (c != '+')) || (segment != '\0'))) {
    if ((segment == '\0') && (c == '/')) {
      c=handleCSSComment(r);
    }
    if ((c == '}' || c == '{' || c == '*') && (segment == '\0')) {
      newline=true;
      if (currentToken.length() == 0) {
        if (!readNewline) {
          r.unreadChar(c);
          return null;
        }
        return "" + c;
      }
      r.unreadChar(c);
      break;
    }
    currentToken.append(c);
    if (c == '(') {
      segment=')';
    }
 else     if ((segment == '\0') && ((c == '\"') || (c == '\''))) {
      segment=c;
    }
 else     if (c == segment) {
      segment='\0';
    }
    c=r.readCharFromReader();
  }
  if (((c == ',') && (!ignoreCommas)) || (c == '>') || (c == '+')) {
    currentToken.append(c);
  }
  if ((!readNewline) && (c == ';') && (currentToken.length() != 0)) {
    r.unreadChar(c);
  }
  if (currentToken.length() == 0) {
    return null;
  }
  return currentToken.toString();
}

private String nextToken ( ExtInputStreamReader r , boolean readNewline , boolean ignoreCommas , boolean ignoreColons , boolean ignoreWhiteSpaces ) throws IOException { boolean newline = false ; StringBuilder currentToken = new StringBuilder ( ) ; char c = r . readCharFromReader ( ) ; while ( ( ( byte ) c ) != - 1 && isWhiteSpace ( c ) ) { newline = newline || ( c == 10 || c == 13 || c == ';' || ( ( c == ',' ) && ( ! ignoreCommas ) ) || ( c == '>' ) || ( c == '+' ) ) ; if ( ! readNewline && newline ) { return null ; } c = r . readCharFromReader ( ) ; } if ( c == ';' && readNewline ) { c = r . readCharFromReader ( ) ; while ( ( ( byte ) c ) != - 1 && isWhiteSpace ( c ) ) { newline = newline || ( c == 10 || c == 13 || c == ';' || ( ( c == ',' ) && ( ! ignoreCommas ) ) || ( c == '>' ) || ( c == '+' ) ) ; c = r . readCharFromReader ( ) ; } } char segment = '\0' ; while ( ( ( byte ) c ) != - 1 && ( ( ! isWhiteSpace ( c ) ) || ( segment != '\0' ) || ( ignoreWhiteSpaces ) ) && c != ';' && ( ( c != ':' ) || ( segment != '\0' ) || ( ignoreColons ) ) && ( ( c != ',' ) || ( segment != '\0' ) || ( ignoreCommas ) ) && ( ( ( c != '>' ) && ( c != '+' ) ) || ( segment != '\0' ) ) ) { if ( ( segment == '\0' ) && ( c == '/' ) ) { c = handleCSSComment ( r ) ; } if ( ( c == '}' || c == '{' || c == '*' ) && ( segment == '\0' ) ) { newline = true ; if ( currentToken . length ( ) == 0 ) { if ( ! readNewline ) { r . unreadChar ( c ) ; return null ; } return "" + c ; } r . unreadChar ( c ) ; break ; } currentToken . append ( c ) ; if ( c == '(' ) { segment = ')' ; } else if ( ( segment == '\0' ) && ( ( c == '\"' ) || ( c == '\'' ) ) ) { segment = c ; } else if ( c == segment ) { segment = '\0' ; } c = r . readCharFromReader ( ) ; } if ( ( ( c == ',' ) && ( ! ignoreCommas ) ) || ( c == '>' ) || ( c == '+' ) ) { currentToken . append ( c ) ; } if ( ( ! readNewline ) && ( c == ';' ) && ( currentToken . length ( ) != 0 ) ) { r . unreadChar ( c ) ; } if ( currentToken . length ( ) == 0 ) { return null ; } return currentToken . toString ( ) ; }
reads the next css token from the reader
