mask |= SELECTOR_ID; aSelectorResult->mID.Append(tk->mIdent); if (!GetToken(aErrorCode, PR_FALSE)) {  return PR_TRUE;
if ((1 < tk->mIdent.Length()) && (nsString::IsAlpha(tk->mIdent.CharAt(1)))) { mask |= SELECTOR_ID; aSelectorResult->mID.Append(tk->mIdent); if (!GetToken(aErrorCode, PR_FALSE)) {  return PR_TRUE; } } else { return PR_FALSE;
PRBool CSSParserImpl::ParseSelector(PRInt32* aErrorCode,                                    Selector* aSelectorResult){  PRUint32 mask = 0;  aSelectorResult->mTag.Truncate(0);  aSelectorResult->mClass.Truncate(0);  aSelectorResult->mID.Truncate(0);  aSelectorResult->mPseudoClass.Truncate(0);  aSelectorResult->mPseudoElement.Truncate(0);  nsCSSToken* tk = &mToken;  if (!GetToken(aErrorCode, PR_TRUE)) {    return PR_FALSE;  }  if (eCSSToken_Ident == tk->mType) {    // tag    mask |= SELECTOR_TAG;    aSelectorResult->mTag.Append(tk->mIdent);    if (!GetToken(aErrorCode, PR_FALSE)) {      // premature eof is ok (here!)      return PR_TRUE;    }  }  if (eCSSToken_ID == tk->mType) {    // #id    mask |= SELECTOR_ID;    aSelectorResult->mID.Append(tk->mIdent);    if (!GetToken(aErrorCode, PR_FALSE)) {      // premature eof is ok (here!)      return PR_TRUE;    }  }  if ((eCSSToken_Symbol == tk->mType) && ('.' == tk->mSymbol)) {    // .class    if (!GetToken(aErrorCode, PR_FALSE)) {      return PR_FALSE;    }    if (eCSSToken_Ident != tk->mType) {      // malformed selector      UngetToken();      return PR_FALSE;    }    mask |= SELECTOR_CLASS;    aSelectorResult->mClass.Append(tk->mIdent);    if (!GetToken(aErrorCode, PR_FALSE)) {      // premature eof is ok (here!)      return PR_TRUE;    }  }  if ((eCSSToken_Symbol == tk->mType) && (':' == tk->mSymbol)) {    // :pseudo    if (!GetToken(aErrorCode, PR_FALSE)) {      // premature eof      return PR_FALSE;    }    if (eCSSToken_Ident != tk->mType) {      // malformed selector      UngetToken();      return PR_FALSE;    }    if (IsPseudoClass(tk->mIdent)) {      mask |= SELECTOR_PSEUDO_CLASS;      aSelectorResult->mPseudoClass.Append(tk->mIdent);    }    else {      mask |= SELECTOR_PSEUDO_ELEMENT;      aSelectorResult->mPseudoElement.Append(':');  // keep the colon      aSelectorResult->mPseudoElement.Append(tk->mIdent);    }    if (!GetToken(aErrorCode, PR_FALSE)) {      // premature eof is ok (here!)      return PR_TRUE;    }  }  if ((eCSSToken_Symbol == tk->mType) && (':' == tk->mSymbol)) {    // :pseudo    if (!GetToken(aErrorCode, PR_FALSE)) {      // premature eof      return PR_FALSE;    }    if (eCSSToken_Ident != tk->mType) {      // malformed selector      UngetToken();      return PR_FALSE;    }    if (! IsPseudoClass(tk->mIdent)) {      mask |= SELECTOR_PSEUDO_ELEMENT;      aSelectorResult->mPseudoElement.Truncate(0);      aSelectorResult->mPseudoElement.Append(':');  // keep the colon      aSelectorResult->mPseudoElement.Append(tk->mIdent);    }    tk = nsnull;  }  if (nsnull != tk) {    UngetToken();  }  if (mask == 0) {    return PR_FALSE;  }  aSelectorResult->mMask = mask;  return PR_TRUE;}