Backing out my changes to see if it fixes the orangeness

This commit is contained in:
harishd%netscape.com 2002-12-13 00:28:47 +00:00
Родитель f37146e332
Коммит ce9ab21c6b
10 изменённых файлов: 514 добавлений и 502 удалений

Просмотреть файл

@ -97,10 +97,14 @@ const PRUnichar* GetTagName(PRInt32 aTag);
*/ */
class CHTMLToken : public CToken { class CHTMLToken : public CToken {
public: public:
virtual ~CHTMLToken(); virtual ~CHTMLToken();
CHTMLToken(eHTMLTags aTag);
virtual const PRUint16 GetContainerInfo() { return NS_HTMLTOKENS_UNKNOWNFORM; } CHTMLToken(eHTMLTags aTag);
virtual void SetContainerInfo(PRUint16 aInfo) { }
virtual eContainerInfo GetContainerInfo(void) const {return eFormUnknown;}
virtual void SetContainerInfo(eContainerInfo aInfo) { }
protected:
}; };
/** /**
@ -113,36 +117,47 @@ class CStartToken: public CHTMLToken {
CTOKEN_IMPL_SIZEOF CTOKEN_IMPL_SIZEOF
public: public:
CStartToken(eHTMLTags aTag=eHTMLTag_unknown); CStartToken(eHTMLTags aTag=eHTMLTag_unknown);
CStartToken(const nsAString& aString); CStartToken(const nsAString& aString);
CStartToken(const nsAString& aName,eHTMLTags aTag); CStartToken(const nsAString& aName,eHTMLTags aTag);
virtual nsresult Consume(PRUnichar aChar,nsScanner& aScanner,PRInt32 aMode); virtual nsresult Consume(PRUnichar aChar,nsScanner& aScanner,PRInt32 aMode);
virtual PRInt32 GetTypeID(void); virtual PRInt32 GetTypeID(void);
virtual const char* GetClassName(void); virtual const char* GetClassName(void);
virtual PRInt32 GetTokenType(void); virtual PRInt32 GetTokenType(void);
virtual const nsAString& GetStringValue();
virtual void GetSource(nsAString& anOutputString); virtual PRBool IsEmpty(void);
virtual void AppendSourceTo(nsAString& anOutputString); virtual void SetEmpty(PRBool aValue);
virtual void SetAttributeCount(PRInt16 aCount) { mAttrCount = aCount; }
virtual PRInt16 GetAttributeCount(void) { return mAttrCount; }
virtual void SetEmpty(PRBool aValue);
virtual PRBool IsEmpty(void) { return mFlags & NS_HTMLTOKENS_EMPTYTOKEN; }
//the following info is used to set well-formedness state on start tags...
virtual void SetContainerInfo(PRUint16 aInfo);
virtual const PRUint16 GetContainerInfo() { return mFlags; }
virtual PRBool IsWellFormed(void) const { return mFlags & NS_HTMLTOKENS_WELLFORMED; }
#ifdef DEBUG #ifdef DEBUG
virtual void DebugDumpSource(nsOutputStream& out); virtual void DebugDumpSource(nsOutputStream& out);
#endif #endif
virtual const nsAString& GetStringValue();
virtual void GetSource(nsString& anOutputString);
virtual void AppendSourceTo(nsAString& anOutputString);
nsString mTextValue; //the following info is used to set well-formedness state on start tags...
nsString mTrailingContent; virtual eContainerInfo GetContainerInfo(void) const {return mContainerInfo;}
virtual void SetContainerInfo(eContainerInfo aContainerInfo) {mContainerInfo=aContainerInfo;}
virtual PRBool IsWellFormed(void) const {return PRBool(eWellFormed==mContainerInfo);}
/*
* Get and set the ID attribute atom for this element.
* See http://www.w3.org/TR/1998/REC-xml-19980210#sec-attribute-types
* for the definition of an ID attribute.
*
*/
virtual nsresult GetIDAttributeAtom(nsIAtom** aResult);
virtual nsresult SetIDAttributeAtom(nsIAtom* aID);
nsString mTextValue;
nsString mTrailingContent;
protected: protected:
PRInt16 mAttrCount; eContainerInfo mContainerInfo;
nsCOMPtr<nsIAtom> mIDAttributeAtom;
PRPackedBool mEmpty;
#ifdef DEBUG #ifdef DEBUG
PRPackedBool mAttributed; PRPackedBool mAttributed;
#endif #endif
}; };
@ -158,22 +173,22 @@ class CEndToken: public CHTMLToken {
CTOKEN_IMPL_SIZEOF CTOKEN_IMPL_SIZEOF
public: public:
CEndToken(eHTMLTags aTag); CEndToken(eHTMLTags aTag);
CEndToken(const nsAString& aString); CEndToken(const nsAString& aString);
CEndToken(const nsAString& aName,eHTMLTags aTag); CEndToken(const nsAString& aName,eHTMLTags aTag);
virtual nsresult Consume(PRUnichar aChar,nsScanner& aScanner,PRInt32 aMode);
virtual nsresult Consume(PRUnichar aChar,nsScanner& aScanner,PRInt32 aMode); virtual PRInt32 GetTypeID(void);
virtual PRInt32 GetTypeID(void); virtual const char* GetClassName(void);
virtual const char* GetClassName(void); virtual PRInt32 GetTokenType(void);
virtual PRInt32 GetTokenType(void);
virtual const nsAString& GetStringValue();
virtual void GetSource(nsAString& anOutputString);
virtual void AppendSourceTo(nsAString& anOutputString);
#ifdef DEBUG #ifdef DEBUG
virtual void DebugDumpSource(nsOutputStream& out); virtual void DebugDumpSource(nsOutputStream& out);
#endif #endif
virtual const nsAString& GetStringValue();
virtual void GetSource(nsString& anOutputString);
virtual void AppendSourceTo(nsAString& anOutputString);
protected: protected:
nsString mTextValue; nsString mTextValue;
}; };
@ -189,19 +204,18 @@ class CCommentToken: public CHTMLToken {
CTOKEN_IMPL_SIZEOF CTOKEN_IMPL_SIZEOF
public: public:
CCommentToken(); CCommentToken();
CCommentToken(const nsAString& aString); CCommentToken(const nsAString& aString);
virtual nsresult Consume(PRUnichar aChar,nsScanner& aScanner,PRInt32 aMode);
virtual nsresult Consume(PRUnichar aChar,nsScanner& aScanner,PRInt32 aMode); virtual const char* GetClassName(void);
virtual const char* GetClassName(void); virtual PRInt32 GetTokenType(void);
virtual PRInt32 GetTokenType(void);
virtual const nsAString& GetStringValue(void); virtual const nsAString& GetStringValue(void);
virtual void AppendSourceTo(nsAString& anOutputString); virtual void AppendSourceTo(nsAString& anOutputString);
nsresult ConsumeStrictComment(nsScanner& aScanner);
nsresult ConsumeQuirksComment(nsScanner& aScanner);
protected: protected:
nsresult ConsumeStrictComment(nsScanner& aScanner);
nsresult ConsumeQuirksComment(nsScanner& aScanner);
nsSlidingSubstring mComment; // does not include MDO & MDC nsSlidingSubstring mComment; // does not include MDO & MDC
nsSlidingSubstring mCommentDecl; // includes MDO & MDC nsSlidingSubstring mCommentDecl; // includes MDO & MDC
}; };
@ -220,22 +234,21 @@ class CEntityToken : public CHTMLToken {
public: public:
CEntityToken(); CEntityToken();
CEntityToken(const nsAString& aString); CEntityToken(const nsAString& aString);
virtual const char* GetClassName(void);
virtual const char* GetClassName(void); virtual PRInt32 GetTokenType(void);
virtual PRInt32 GetTokenType(void); PRInt32 TranslateToUnicodeStr(nsString& aString);
virtual nsresult Consume(PRUnichar aChar,nsScanner& aScanner,PRInt32 aMode); virtual nsresult Consume(PRUnichar aChar,nsScanner& aScanner,PRInt32 aMode);
virtual const nsAString& GetStringValue(void); static nsresult ConsumeEntity(PRUnichar aChar,nsString& aString,nsScanner& aScanner);
virtual void GetSource(nsAString& anOutputString); static PRInt32 TranslateToUnicodeStr(PRInt32 aValue,nsString& aString);
virtual void AppendSourceTo(nsAString& anOutputString);
PRInt32 TranslateToUnicodeStr(nsString& aString);
static nsresult ConsumeEntity(PRUnichar aChar,nsString& aString,nsScanner& aScanner);
#ifdef DEBUG #ifdef DEBUG
virtual void DebugDumpSource(nsOutputStream& out); virtual void DebugDumpSource(nsOutputStream& out);
#endif #endif
virtual const nsAString& GetStringValue(void);
virtual void GetSource(nsString& anOutputString);
virtual void AppendSourceTo(nsAString& anOutputString);
protected: protected:
nsString mTextValue; nsString mTextValue;
}; };
@ -250,16 +263,15 @@ class CWhitespaceToken: public CHTMLToken {
CTOKEN_IMPL_SIZEOF CTOKEN_IMPL_SIZEOF
public: public:
CWhitespaceToken(); CWhitespaceToken();
CWhitespaceToken(const nsAString& aString); CWhitespaceToken(const nsAString& aString);
virtual nsresult Consume(PRUnichar aChar,nsScanner& aScanner,PRInt32 aMode);
virtual nsresult Consume(PRUnichar aChar,nsScanner& aScanner,PRInt32 aMode); virtual const char* GetClassName(void);
virtual const char* GetClassName(void); virtual PRInt32 GetTokenType(void);
virtual PRInt32 GetTokenType(void);
virtual const nsAString& GetStringValue(void); virtual const nsAString& GetStringValue(void);
protected: protected:
nsString mTextValue; nsString mTextValue;
}; };
/** /**
@ -273,23 +285,21 @@ class CTextToken: public CHTMLToken {
CTOKEN_IMPL_SIZEOF CTOKEN_IMPL_SIZEOF
public: public:
CTextToken(); CTextToken();
CTextToken(const nsAString& aString); CTextToken(const nsAString& aString);
virtual nsresult Consume(PRUnichar aChar,nsScanner& aScanner,PRInt32 aMode);
virtual nsresult Consume(PRUnichar aChar,nsScanner& aScanner,PRInt32 aMode); nsresult ConsumeUntil(PRUnichar aChar,PRBool aIgnoreComments,nsScanner& aScanner,
virtual const char* GetClassName(void); nsString& aEndTagName,PRInt32 aMode,PRBool& aFlushTokens);
virtual PRInt32 GetTokenType(void); virtual const char* GetClassName(void);
virtual PRInt32 GetTokenType(void);
virtual PRInt32 GetTextLength(void);
virtual void CopyTo(nsAString& aStr);
virtual const nsAString& GetStringValue(void); virtual const nsAString& GetStringValue(void);
virtual void Bind(nsScanner* aScanner, nsReadingIterator<PRUnichar>& aStart, nsReadingIterator<PRUnichar>& aEnd);
nsresult ConsumeUntil(PRUnichar aChar,PRBool aIgnoreComments,nsScanner& aScanner, virtual void Bind(const nsAString& aStr);
nsString& aEndTagName,PRInt32 aMode,PRBool& aFlushTokens);
PRInt32 GetTextLength(void);
void CopyTo(nsAString& aStr);
void Bind(nsScanner* aScanner, nsReadingIterator<PRUnichar>& aStart, nsReadingIterator<PRUnichar>& aEnd);
void Bind(const nsAString& aStr);
protected: protected:
nsSlidingSubstring mTextValue; nsSlidingSubstring mTextValue;
}; };
@ -312,7 +322,7 @@ public:
virtual const nsAString& GetStringValue(void); virtual const nsAString& GetStringValue(void);
protected: protected:
nsString mTextValue; nsString mTextValue;
}; };
@ -328,13 +338,13 @@ class CMarkupDeclToken : public CHTMLToken {
public: public:
CMarkupDeclToken(); CMarkupDeclToken();
CMarkupDeclToken(const nsAString& aString); CMarkupDeclToken(const nsAString& aString);
virtual nsresult Consume(PRUnichar aChar,nsScanner& aScanner,PRInt32 aMode); virtual nsresult Consume(PRUnichar aChar,nsScanner& aScanner,PRInt32 aMode);
virtual const char* GetClassName(void); virtual const char* GetClassName(void);
virtual PRInt32 GetTokenType(void); virtual PRInt32 GetTokenType(void);
virtual const nsAString& GetStringValue(void); virtual const nsAString& GetStringValue(void);
protected: protected:
nsSlidingSubstring mTextValue; nsSlidingSubstring mTextValue;
}; };
@ -350,32 +360,32 @@ class CAttributeToken: public CHTMLToken {
CTOKEN_IMPL_SIZEOF CTOKEN_IMPL_SIZEOF
public: public:
CAttributeToken(); CAttributeToken();
CAttributeToken(const nsAString& aString); CAttributeToken(const nsAString& aString);
CAttributeToken(const nsAString& aKey, const nsAString& aString); CAttributeToken(const nsAString& aKey, const nsAString& aString);
~CAttributeToken() {} ~CAttributeToken() {}
virtual nsresult Consume(PRUnichar aChar,nsScanner& aScanner,PRInt32 aMode);
virtual nsresult Consume(PRUnichar aChar,nsScanner& aScanner,PRInt32 aMode); virtual const char* GetClassName(void);
virtual const char* GetClassName(void); virtual PRInt32 GetTokenType(void);
virtual PRInt32 GetTokenType(void); virtual const nsAString& GetKey(void) {return mTextKey;}
virtual const nsAString& GetStringValue(void); virtual void SetKey(const nsAString& aKey);
virtual void GetSource(nsAString& anOutputString); virtual void BindKey(nsScanner* aScanner, nsReadingIterator<PRUnichar>& aStart, nsReadingIterator<PRUnichar>& aEnd);
virtual void AppendSourceTo(nsAString& anOutputString); virtual const nsAString& GetValue(void) {return mTextValue;}
virtual void SanitizeKey();
const nsAString& GetKey(void) {return mTextKey;}
void SetKey(const nsAString& aKey);
void BindKey(nsScanner* aScanner, nsReadingIterator<PRUnichar>& aStart, nsReadingIterator<PRUnichar>& aEnd);
const nsAString& GetValue(void) {return mTextValue;}
void SanitizeKey();
#ifdef DEBUG #ifdef DEBUG
virtual void DebugDumpToken(nsOutputStream& out); virtual void DebugDumpToken(nsOutputStream& out);
void DebugDumpSource(nsOutputStream& out); #endif
virtual const nsAString& GetStringValue(void);
virtual void GetSource(nsString& anOutputString);
virtual void AppendSourceTo(nsAString& anOutputString);
#ifdef DEBUG
virtual void DebugDumpSource(nsOutputStream& out);
#endif #endif
PRPackedBool mHasEqualWithoutValue; PRPackedBool mHasEqualWithoutValue;
protected: protected:
#ifdef DEBUG #ifdef DEBUG
PRPackedBool mLastAttribute; PRPackedBool mLastAttribute;
#endif #endif
nsAutoString mTextValue; nsAutoString mTextValue;
nsSlidingSubstring mTextKey; nsSlidingSubstring mTextKey;
@ -392,15 +402,14 @@ class CNewlineToken: public CHTMLToken {
CTOKEN_IMPL_SIZEOF CTOKEN_IMPL_SIZEOF
public: public:
CNewlineToken(); CNewlineToken();
virtual nsresult Consume(PRUnichar aChar,nsScanner& aScanner,PRInt32 aMode);
virtual const char* GetClassName(void);
virtual PRInt32 GetTokenType(void);
virtual const nsAString& GetStringValue(void);
virtual nsresult Consume(PRUnichar aChar,nsScanner& aScanner,PRInt32 aMode); static void AllocNewline();
virtual const char* GetClassName(void); static void FreeNewline();
virtual PRInt32 GetTokenType(void);
virtual const nsAString& GetStringValue(void);
static void AllocNewline();
static void FreeNewline();
}; };
@ -421,10 +430,10 @@ class CScriptToken: public CHTMLToken {
CScriptToken(const nsAString& aString); CScriptToken(const nsAString& aString);
virtual const char* GetClassName(void); virtual const char* GetClassName(void);
virtual PRInt32 GetTokenType(void); virtual PRInt32 GetTokenType(void);
virtual const nsAString& GetStringValue(void); virtual const nsAString& GetStringValue(void);
protected: protected:
nsString mTextValue; nsString mTextValue;
}; };
@ -444,10 +453,10 @@ class CStyleToken: public CHTMLToken {
CStyleToken(const nsAString& aString); CStyleToken(const nsAString& aString);
virtual const char* GetClassName(void); virtual const char* GetClassName(void);
virtual PRInt32 GetTokenType(void); virtual PRInt32 GetTokenType(void);
virtual const nsAString& GetStringValue(void); virtual const nsAString& GetStringValue(void);
protected: protected:
nsString mTextValue; nsString mTextValue;
}; };
@ -505,16 +514,16 @@ class CDoctypeDeclToken: public CHTMLToken {
CTOKEN_IMPL_SIZEOF CTOKEN_IMPL_SIZEOF
public: public:
CDoctypeDeclToken(eHTMLTags aTag=eHTMLTag_unknown); CDoctypeDeclToken(eHTMLTags aTag=eHTMLTag_unknown);
CDoctypeDeclToken(const nsAString& aString,eHTMLTags aTag=eHTMLTag_unknown); CDoctypeDeclToken(const nsAString& aString,eHTMLTags aTag=eHTMLTag_unknown);
virtual nsresult Consume(PRUnichar aChar,nsScanner& aScanner,PRInt32 aMode);
virtual const char* GetClassName(void);
virtual PRInt32 GetTokenType(void);
virtual const nsAString& GetStringValue(void);
virtual void SetStringValue(const nsAString& aStr);
nsresult Consume(PRUnichar aChar,nsScanner& aScanner,PRInt32 aMode);
const char* GetClassName(void);
PRInt32 GetTokenType(void);
void SetStringValue(const nsAString& aStr);
const nsAString& GetStringValue(void);
protected: protected:
nsString mTextValue; nsString mTextValue;
}; };
#endif #endif

Просмотреть файл

@ -75,17 +75,18 @@
#include "nsFileSpec.h" #include "nsFileSpec.h"
#include "nsFixedSizeAllocator.h" #include "nsFixedSizeAllocator.h"
#define NS_HTMLTOKENS_UNKNOWNFORM 0x00000001
#define NS_HTMLTOKENS_WELLFORMED 0x00000002
#define NS_HTMLTOKENS_MALFORMED 0x00000004
#define NS_HTMLTOKENS_EMPTYTOKEN 0x00000008
#define NS_HTMLTOKENS_NOT_AN_ENTITY \ #define NS_HTMLTOKENS_NOT_AN_ENTITY \
NS_ERROR_GENERATE_SUCCESS(NS_ERROR_MODULE_HTMLPARSER,2000) NS_ERROR_GENERATE_SUCCESS(NS_ERROR_MODULE_HTMLPARSER,2000)
class nsScanner; class nsScanner;
class nsTokenAllocator; class nsTokenAllocator;
enum eContainerInfo {
eWellFormed,
eMalformed,
eFormUnknown
};
/** /**
* Implement the SizeOf() method; leaf classes derived from CToken * Implement the SizeOf() method; leaf classes derived from CToken
* must declare this. * must declare this.
@ -182,7 +183,7 @@ class CToken {
* @update gess5/11/98 * @update gess5/11/98
* @return reference to string containing string value * @return reference to string containing string value
*/ */
virtual void GetSource(nsAString& anOutputString); virtual void GetSource(nsString& anOutputString);
/** @update harishd 03/23/00 /** @update harishd 03/23/00
* @return reference to string containing string value * @return reference to string containing string value
@ -210,8 +211,6 @@ class CToken {
*/ */
virtual PRInt16 GetAttributeCount(void); virtual PRInt16 GetAttributeCount(void);
virtual void SetAttributeCount(PRInt16 aValue) { }
/** /**
* Causes token to consume data from given scanner. * Causes token to consume data from given scanner.
* Note that behavior varies wildly between CToken subclasses. * Note that behavior varies wildly between CToken subclasses.
@ -236,14 +235,6 @@ class CToken {
* @param out is the output stream where token should write itself * @param out is the output stream where token should write itself
*/ */
virtual void DebugDumpSource(nsOutputStream& out); virtual void DebugDumpSource(nsOutputStream& out);
/**
* Getter which retrieves the class name for this token
* This method is only used for debug purposes.
* @update gess5/11/98
* @return const char* containing class name
*/
virtual const char* GetClassName(void);
#endif #endif
/** /**
@ -253,6 +244,15 @@ class CToken {
*/ */
virtual PRInt32 GetTokenType(void); virtual PRInt32 GetTokenType(void);
/**
* Getter which retrieves the class name for this token
* This method is only used for debug purposes.
* @update gess5/11/98
* @return const char* containing class name
*/
virtual const char* GetClassName(void);
/** /**
* For tokens who care, this can tell us whether the token is * For tokens who care, this can tell us whether the token is
* well formed or not. * well formed or not.
@ -289,6 +289,8 @@ class CToken {
mLineNumber = mLineNumber == 0 ? aLineNumber : mLineNumber; mLineNumber = mLineNumber == 0 ? aLineNumber : mLineNumber;
} }
void SetAttributeCount(PRInt16 aValue) { mAttrCount = aValue; }
/** /**
* perform self test. * perform self test.
* @update gess5/11/98 * @update gess5/11/98
@ -305,11 +307,11 @@ protected:
*/ */
virtual size_t SizeOf() const = 0; virtual size_t SizeOf() const = 0;
PRInt32 mTypeID; PRInt32 mTypeID;
PRInt32 mUseCount; PRInt32 mUseCount;
PRInt32 mNewlineCount; PRInt32 mNewlineCount;
PRInt32 mLineNumber; PRInt32 mLineNumber;
PRUint16 mFlags; PRInt16 mAttrCount;
}; };

Просмотреть файл

@ -354,15 +354,15 @@ nsresult nsHTMLTokenizer::ScanDocStructure(PRBool aFinalChunk) {
//*** start by finding the first start tag that hasn't been reviewed. //*** start by finding the first start tag that hasn't been reviewed.
while (mTokenScanPos > 0) { while(mTokenScanPos>0) {
theRootToken=(CHTMLToken*)mTokenDeque.ObjectAt(mTokenScanPos); theRootToken=(CHTMLToken*)mTokenDeque.ObjectAt(mTokenScanPos);
if ( theRootToken) { if(theRootToken) {
eHTMLTokenTypes theType=eHTMLTokenTypes(theRootToken->GetTokenType()); eHTMLTokenTypes theType=eHTMLTokenTypes(theRootToken->GetTokenType());
if (eToken_start == theType) { if(eToken_start==theType) {
if (theRootToken->GetContainerInfo() & NS_HTMLTOKENS_UNKNOWNFORM) { if(eFormUnknown==theRootToken->GetContainerInfo()) {
break; break;
} }
} }
} }
mTokenScanPos--; mTokenScanPos--;
} }
@ -414,16 +414,16 @@ nsresult nsHTMLTokenizer::ScanDocStructure(PRBool aFinalChunk) {
if(theTag==theLastToken->GetTypeID()) { if(theTag==theLastToken->GetTypeID()) {
theStack.Pop(); //yank it for real theStack.Pop(); //yank it for real
theStackDepth--; theStackDepth--;
theLastToken->SetContainerInfo(NS_HTMLTOKENS_WELLFORMED); theLastToken->SetContainerInfo(eWellFormed);
//in addition, let's look above this container to see if we can find //in addition, let's look above this container to see if we can find
//any tags that are already marked malformed. If so, pop them too! //any tags that are already marked malformed. If so, pop them too!
theLastToken= NS_STATIC_CAST(CHTMLToken*, theStack.Peek()); theLastToken= NS_STATIC_CAST(CHTMLToken*, theStack.Peek());
while (theLastToken) { while(theLastToken) {
if (theRootToken->GetContainerInfo() & NS_HTMLTOKENS_MALFORMED) { if(eMalformed==theRootToken->GetContainerInfo()) {
theStack.Pop(); //yank the malformed token for real. theStack.Pop(); //yank the malformed token for real.
theLastToken = NS_STATIC_CAST(CHTMLToken*, theStack.Peek()); theLastToken= NS_STATIC_CAST(CHTMLToken*, theStack.Peek());
continue; continue;
} }
break; break;
@ -434,11 +434,11 @@ nsresult nsHTMLTokenizer::ScanDocStructure(PRBool aFinalChunk) {
//be malformed. If the tag is a block, we don't really care (but we'll //be malformed. If the tag is a block, we don't really care (but we'll
//mark it anyway). If it's an inline we DO care, especially if the //mark it anyway). If it's an inline we DO care, especially if the
//inline tried to contain a block (that's when RS handling kicks in). //inline tried to contain a block (that's when RS handling kicks in).
if (theTagIsInline) { if(theTagIsInline) {
PRInt32 theIndex = FindLastIndexOfTag(theTag,theStack); PRInt32 theIndex=FindLastIndexOfTag(theTag,theStack);
if (kNotFound != theIndex) { if(kNotFound!=theIndex) {
theToken = (CHTMLToken*)theStack.ObjectAt(theIndex); theToken=(CHTMLToken*)theStack.ObjectAt(theIndex);
theToken->SetContainerInfo(NS_HTMLTOKENS_MALFORMED); theToken->SetContainerInfo(eMalformed);
} }
//otherwise we ignore an out-of-place end tag. //otherwise we ignore an out-of-place end tag.
} }

Просмотреть файл

@ -90,29 +90,51 @@ CHTMLToken::~CHTMLToken() {
* @param * @param
* @return * @return
*/ */
CStartToken::CStartToken(eHTMLTags aTag) : CHTMLToken(aTag) CStartToken::CStartToken(eHTMLTags aTag) : CHTMLToken(aTag) {
{ mEmpty=PR_FALSE;
mContainerInfo=eFormUnknown;
#ifdef DEBUG #ifdef DEBUG
mAttributed = PR_FALSE; mAttributed = PR_FALSE;
#endif #endif
} }
CStartToken::CStartToken(const nsAString& aName) : CHTMLToken(eHTMLTag_unknown) CStartToken::CStartToken(const nsAString& aName) : CHTMLToken(eHTMLTag_unknown) {
{ mEmpty=PR_FALSE;
mContainerInfo=eFormUnknown;
mTextValue.Assign(aName); mTextValue.Assign(aName);
#ifdef DEBUG #ifdef DEBUG
mAttributed = PR_FALSE; mAttributed = PR_FALSE;
#endif #endif
} }
CStartToken::CStartToken(const nsAString& aName,eHTMLTags aTag) : CHTMLToken(aTag) CStartToken::CStartToken(const nsAString& aName,eHTMLTags aTag) : CHTMLToken(aTag) {
{ mEmpty=PR_FALSE;
mContainerInfo=eFormUnknown;
mTextValue.Assign(aName); mTextValue.Assign(aName);
#ifdef DEBUG #ifdef DEBUG
mAttributed = PR_FALSE; mAttributed = PR_FALSE;
#endif #endif
} }
nsresult CStartToken::GetIDAttributeAtom(nsIAtom** aResult)
{
NS_ENSURE_ARG_POINTER(aResult);
*aResult = mIDAttributeAtom;
NS_IF_ADDREF(*aResult);
return NS_OK;
}
nsresult CStartToken::SetIDAttributeAtom(nsIAtom* aID)
{
NS_ENSURE_ARG(aID);
mIDAttributeAtom = aID;
return NS_OK;
}
/* /*
* This method returns the typeid (the tag type) for this token. * This method returns the typeid (the tag type) for this token.
* *
@ -120,9 +142,7 @@ CStartToken::CStartToken(const nsAString& aName,eHTMLTags aTag) : CHTMLToken(aTa
* @param * @param
* @return * @return
*/ */
PRInt32 PRInt32 CStartToken::GetTypeID(){
CStartToken::GetTypeID()
{
if(eHTMLTag_unknown==mTypeID) { if(eHTMLTag_unknown==mTypeID) {
mTypeID = nsHTMLTags::LookupTag(mTextValue); mTypeID = nsHTMLTags::LookupTag(mTextValue);
} }
@ -136,9 +156,7 @@ CStartToken::GetTypeID()
* @param * @param
* @return * @return
*/ */
const char* const char* CStartToken::GetClassName(void) {
CStartToken::GetClassName(void)
{
return "start"; return "start";
} }
@ -149,29 +167,10 @@ CStartToken::GetClassName(void)
* @param * @param
* @return * @return
*/ */
PRInt32 CStartToken::GetTokenType(void) PRInt32 CStartToken::GetTokenType(void) {
{
return eToken_start; return eToken_start;
} }
void CStartToken::SetContainerInfo(PRUint16 aInfo)
{
if (aInfo & NS_HTMLTOKENS_UNKNOWNFORM) {
mFlags &= ~(NS_HTMLTOKENS_MALFORMED | NS_HTMLTOKENS_WELLFORMED);
mFlags |= NS_HTMLTOKENS_UNKNOWNFORM;
}
else if (aInfo & NS_HTMLTOKENS_WELLFORMED) {
mFlags &= ~(NS_HTMLTOKENS_UNKNOWNFORM | NS_HTMLTOKENS_MALFORMED);
mFlags |= NS_HTMLTOKENS_WELLFORMED;
}
else if (aInfo & NS_HTMLTOKENS_MALFORMED) {
mFlags &= ~(NS_HTMLTOKENS_UNKNOWNFORM | NS_HTMLTOKENS_WELLFORMED);
mFlags |= NS_HTMLTOKENS_MALFORMED;
}
else {
NS_WARNING("invalid container info!");
}
}
/* /*
* *
* *
@ -179,16 +178,22 @@ void CStartToken::SetContainerInfo(PRUint16 aInfo)
* @param * @param
* @return * @return
*/ */
void CStartToken::SetEmpty(PRBool aValue) void CStartToken::SetEmpty(PRBool aValue) {
{ mEmpty=aValue;
if (aValue) {
mFlags |= NS_HTMLTOKENS_EMPTYTOKEN;
}
else {
mFlags &= ~NS_HTMLTOKENS_EMPTYTOKEN;
}
} }
/*
*
*
* @update gess 3/25/98
* @param
* @return
*/
PRBool CStartToken::IsEmpty(void) {
return mEmpty;
}
/* /*
* Consume the identifier portion of the start tag * Consume the identifier portion of the start tag
* *
@ -263,7 +268,7 @@ const nsAString& CStartToken::GetStringValue()
* @param anOutputString will recieve the result * @param anOutputString will recieve the result
* @return nada * @return nada
*/ */
void CStartToken::GetSource(nsAString& anOutputString){ void CStartToken::GetSource(nsString& anOutputString){
anOutputString.Append(PRUnichar('<')); anOutputString.Append(PRUnichar('<'));
/* /*
* Watch out for Bug 15204 * Watch out for Bug 15204
@ -367,9 +372,7 @@ nsresult CEndToken::Consume(PRUnichar aChar, nsScanner& aScanner,PRInt32 aFlag)
* @param * @param
* @return eHTMLTag id of this endtag * @return eHTMLTag id of this endtag
*/ */
PRInt32 PRInt32 CEndToken::GetTypeID(){
CEndToken::GetTypeID()
{
if(eHTMLTag_unknown==mTypeID) { if(eHTMLTag_unknown==mTypeID) {
mTypeID = nsHTMLTags::LookupTag(mTextValue); mTypeID = nsHTMLTags::LookupTag(mTextValue);
switch(mTypeID) { switch(mTypeID) {
@ -436,7 +439,7 @@ const nsAString& CEndToken::GetStringValue()
* @param anOutputString will recieve the result * @param anOutputString will recieve the result
* @return nada * @return nada
*/ */
void CEndToken::GetSource(nsAString& anOutputString){ void CEndToken::GetSource(nsString& anOutputString){
anOutputString.Append(NS_LITERAL_STRING("</")); anOutputString.Append(NS_LITERAL_STRING("</"));
if(mTextValue.Length()>0) if(mTextValue.Length()>0)
anOutputString.Append(mTextValue); anOutputString.Append(mTextValue);
@ -1521,7 +1524,7 @@ const nsAString& CAttributeToken::GetStringValue(void)
* @param anOutputString will recieve the result * @param anOutputString will recieve the result
* @return nada * @return nada
*/ */
void CAttributeToken::GetSource(nsAString& anOutputString){ void CAttributeToken::GetSource(nsString& anOutputString){
anOutputString.Truncate(); anOutputString.Truncate();
AppendSourceTo(anOutputString); AppendSourceTo(anOutputString);
} }
@ -2223,7 +2226,7 @@ const nsAString& CEntityToken::GetStringValue(void)
* @param anOutputString will recieve the result * @param anOutputString will recieve the result
* @return nada * @return nada
*/ */
void CEntityToken::GetSource(nsAString& anOutputString){ void CEntityToken::GetSource(nsString& anOutputString){
anOutputString.Append(NS_LITERAL_STRING("&")); anOutputString.Append(NS_LITERAL_STRING("&"));
anOutputString+=mTextValue; anOutputString+=mTextValue;
//anOutputString+=";"; //anOutputString+=";";

Просмотреть файл

@ -59,23 +59,22 @@ int CToken::GetTokenCount(){return TokenCount-DelTokenCount;}
* *
* @update gess 7/21/98 * @update gess 7/21/98
*/ */
CToken::CToken(PRInt32 aTag) CToken::CToken(PRInt32 aTag) {
: mNewlineCount(0),
mLineNumber(0),
mTypeID(aTag),
mUseCount(1),
mFlags(NS_HTMLTOKENS_UNKNOWNFORM)
// Note that the use count starts with 1 instead of 0. This
// is because of the assumption that any token created is in
// use and therefore does not require an explicit addref, or
// rather IF_HOLD. This will make sure that tokens created
// on the stack do not accidently hit the arena recycler.
{
// Tokens are allocated through the arena ( not heap allocated..yay ). // Tokens are allocated through the arena ( not heap allocated..yay ).
// We, therefore, don't need this macro anymore.. // We, therefore, don't need this macro anymore..
#ifdef MATCH_CTOR_DTOR #ifdef MATCH_CTOR_DTOR
MOZ_COUNT_CTOR(CToken); MOZ_COUNT_CTOR(CToken);
#endif #endif
mAttrCount=0;
mNewlineCount=0;
mLineNumber = 0;
mTypeID=aTag;
// Note that the use count starts with 1 instead of 0. This
// is because of the assumption that any token created is in
// use and therefore does not require an explicit addref, or
// rather IF_HOLD. This, also, will make sure that tokens created
// on the stack do not accidently hit the arena recycler.
mUseCount=1;
#ifdef NS_DEBUG #ifdef NS_DEBUG
++TokenCount; ++TokenCount;
@ -128,7 +127,7 @@ void CToken::DebugDumpToken(nsOutputStream& anOutputStream) {
for(i=0;i<theLen;++i){ for(i=0;i<theLen;++i){
anOutputStream << NS_ConvertUCS2toUTF8(GetStringValue()).get(); anOutputStream << NS_ConvertUCS2toUTF8(GetStringValue()).get();
} }
anOutputStream << " TypeID: " << mTypeID << " AttrCount: " << 0 << nsEndl; anOutputStream << " TypeID: " << mTypeID << " AttrCount: " << mAttrCount << nsEndl;
} }
/** /**
@ -141,19 +140,6 @@ void CToken::DebugDumpToken(nsOutputStream& anOutputStream) {
void CToken::DebugDumpSource(nsOutputStream& anOutputStream) { void CToken::DebugDumpSource(nsOutputStream& anOutputStream) {
anOutputStream << NS_ConvertUCS2toUTF8(GetStringValue()).get(); anOutputStream << NS_ConvertUCS2toUTF8(GetStringValue()).get();
} }
/**
* retrieve this tokens classname.
*
* @update gess 3/25/98
* @return char* containing name of class
*/
const char*
CToken::GetClassName(void)
{
return "token";
}
#endif #endif
@ -163,7 +149,7 @@ CToken::GetClassName(void)
* @update gess5/11/98 * @update gess5/11/98
* @return reference to string containing string value * @return reference to string containing string value
*/ */
void CToken::GetSource(nsAString& anOutputString){ void CToken::GetSource(nsString& anOutputString){
anOutputString.Assign(GetStringValue()); anOutputString.Assign(GetStringValue());
} }
@ -193,9 +179,7 @@ void CToken::SetTypeID(PRInt32 aTypeID) {
* @update gess 3/25/98 * @update gess 3/25/98
* @return int containing ordinal value * @return int containing ordinal value
*/ */
PRInt32 PRInt32 CToken::GetTypeID(void) {
CToken::GetTypeID(void)
{
return mTypeID; return mTypeID;
} }
@ -205,10 +189,8 @@ CToken::GetTypeID(void)
* @update gess 3/25/98 * @update gess 3/25/98
* @return int containing attribute count * @return int containing attribute count
*/ */
PRInt16 PRInt16 CToken::GetAttributeCount(void) {
CToken::GetAttributeCount(void) return mAttrCount;
{
return 0;
} }
@ -219,18 +201,28 @@ CToken::GetAttributeCount(void)
* @update gess 3/25/98 * @update gess 3/25/98
* @return int value containing token type. * @return int value containing token type.
*/ */
PRInt32 PRInt32 CToken::GetTokenType(void) {
CToken::GetTokenType(void)
{
return -1; return -1;
} }
/**
* retrieve this tokens classname.
*
* @update gess 3/25/98
* @return char* containing name of class
*/
const char* CToken::GetClassName(void) {
return "token";
}
/** /**
* *
* @update gess 3/25/98 * @update gess 3/25/98
*/ */
void CToken::SelfTest(void) void CToken::SelfTest(void) {
{ #ifdef _DEBUG
#endif
} }

Просмотреть файл

@ -97,10 +97,14 @@ const PRUnichar* GetTagName(PRInt32 aTag);
*/ */
class CHTMLToken : public CToken { class CHTMLToken : public CToken {
public: public:
virtual ~CHTMLToken(); virtual ~CHTMLToken();
CHTMLToken(eHTMLTags aTag);
virtual const PRUint16 GetContainerInfo() { return NS_HTMLTOKENS_UNKNOWNFORM; } CHTMLToken(eHTMLTags aTag);
virtual void SetContainerInfo(PRUint16 aInfo) { }
virtual eContainerInfo GetContainerInfo(void) const {return eFormUnknown;}
virtual void SetContainerInfo(eContainerInfo aInfo) { }
protected:
}; };
/** /**
@ -113,36 +117,47 @@ class CStartToken: public CHTMLToken {
CTOKEN_IMPL_SIZEOF CTOKEN_IMPL_SIZEOF
public: public:
CStartToken(eHTMLTags aTag=eHTMLTag_unknown); CStartToken(eHTMLTags aTag=eHTMLTag_unknown);
CStartToken(const nsAString& aString); CStartToken(const nsAString& aString);
CStartToken(const nsAString& aName,eHTMLTags aTag); CStartToken(const nsAString& aName,eHTMLTags aTag);
virtual nsresult Consume(PRUnichar aChar,nsScanner& aScanner,PRInt32 aMode); virtual nsresult Consume(PRUnichar aChar,nsScanner& aScanner,PRInt32 aMode);
virtual PRInt32 GetTypeID(void); virtual PRInt32 GetTypeID(void);
virtual const char* GetClassName(void); virtual const char* GetClassName(void);
virtual PRInt32 GetTokenType(void); virtual PRInt32 GetTokenType(void);
virtual const nsAString& GetStringValue();
virtual void GetSource(nsAString& anOutputString); virtual PRBool IsEmpty(void);
virtual void AppendSourceTo(nsAString& anOutputString); virtual void SetEmpty(PRBool aValue);
virtual void SetAttributeCount(PRInt16 aCount) { mAttrCount = aCount; }
virtual PRInt16 GetAttributeCount(void) { return mAttrCount; }
virtual void SetEmpty(PRBool aValue);
virtual PRBool IsEmpty(void) { return mFlags & NS_HTMLTOKENS_EMPTYTOKEN; }
//the following info is used to set well-formedness state on start tags...
virtual void SetContainerInfo(PRUint16 aInfo);
virtual const PRUint16 GetContainerInfo() { return mFlags; }
virtual PRBool IsWellFormed(void) const { return mFlags & NS_HTMLTOKENS_WELLFORMED; }
#ifdef DEBUG #ifdef DEBUG
virtual void DebugDumpSource(nsOutputStream& out); virtual void DebugDumpSource(nsOutputStream& out);
#endif #endif
virtual const nsAString& GetStringValue();
virtual void GetSource(nsString& anOutputString);
virtual void AppendSourceTo(nsAString& anOutputString);
nsString mTextValue; //the following info is used to set well-formedness state on start tags...
nsString mTrailingContent; virtual eContainerInfo GetContainerInfo(void) const {return mContainerInfo;}
virtual void SetContainerInfo(eContainerInfo aContainerInfo) {mContainerInfo=aContainerInfo;}
virtual PRBool IsWellFormed(void) const {return PRBool(eWellFormed==mContainerInfo);}
/*
* Get and set the ID attribute atom for this element.
* See http://www.w3.org/TR/1998/REC-xml-19980210#sec-attribute-types
* for the definition of an ID attribute.
*
*/
virtual nsresult GetIDAttributeAtom(nsIAtom** aResult);
virtual nsresult SetIDAttributeAtom(nsIAtom* aID);
nsString mTextValue;
nsString mTrailingContent;
protected: protected:
PRInt16 mAttrCount; eContainerInfo mContainerInfo;
nsCOMPtr<nsIAtom> mIDAttributeAtom;
PRPackedBool mEmpty;
#ifdef DEBUG #ifdef DEBUG
PRPackedBool mAttributed; PRPackedBool mAttributed;
#endif #endif
}; };
@ -158,22 +173,22 @@ class CEndToken: public CHTMLToken {
CTOKEN_IMPL_SIZEOF CTOKEN_IMPL_SIZEOF
public: public:
CEndToken(eHTMLTags aTag); CEndToken(eHTMLTags aTag);
CEndToken(const nsAString& aString); CEndToken(const nsAString& aString);
CEndToken(const nsAString& aName,eHTMLTags aTag); CEndToken(const nsAString& aName,eHTMLTags aTag);
virtual nsresult Consume(PRUnichar aChar,nsScanner& aScanner,PRInt32 aMode);
virtual nsresult Consume(PRUnichar aChar,nsScanner& aScanner,PRInt32 aMode); virtual PRInt32 GetTypeID(void);
virtual PRInt32 GetTypeID(void); virtual const char* GetClassName(void);
virtual const char* GetClassName(void); virtual PRInt32 GetTokenType(void);
virtual PRInt32 GetTokenType(void);
virtual const nsAString& GetStringValue();
virtual void GetSource(nsAString& anOutputString);
virtual void AppendSourceTo(nsAString& anOutputString);
#ifdef DEBUG #ifdef DEBUG
virtual void DebugDumpSource(nsOutputStream& out); virtual void DebugDumpSource(nsOutputStream& out);
#endif #endif
virtual const nsAString& GetStringValue();
virtual void GetSource(nsString& anOutputString);
virtual void AppendSourceTo(nsAString& anOutputString);
protected: protected:
nsString mTextValue; nsString mTextValue;
}; };
@ -189,19 +204,18 @@ class CCommentToken: public CHTMLToken {
CTOKEN_IMPL_SIZEOF CTOKEN_IMPL_SIZEOF
public: public:
CCommentToken(); CCommentToken();
CCommentToken(const nsAString& aString); CCommentToken(const nsAString& aString);
virtual nsresult Consume(PRUnichar aChar,nsScanner& aScanner,PRInt32 aMode);
virtual nsresult Consume(PRUnichar aChar,nsScanner& aScanner,PRInt32 aMode); virtual const char* GetClassName(void);
virtual const char* GetClassName(void); virtual PRInt32 GetTokenType(void);
virtual PRInt32 GetTokenType(void);
virtual const nsAString& GetStringValue(void); virtual const nsAString& GetStringValue(void);
virtual void AppendSourceTo(nsAString& anOutputString); virtual void AppendSourceTo(nsAString& anOutputString);
nsresult ConsumeStrictComment(nsScanner& aScanner);
nsresult ConsumeQuirksComment(nsScanner& aScanner);
protected: protected:
nsresult ConsumeStrictComment(nsScanner& aScanner);
nsresult ConsumeQuirksComment(nsScanner& aScanner);
nsSlidingSubstring mComment; // does not include MDO & MDC nsSlidingSubstring mComment; // does not include MDO & MDC
nsSlidingSubstring mCommentDecl; // includes MDO & MDC nsSlidingSubstring mCommentDecl; // includes MDO & MDC
}; };
@ -220,22 +234,21 @@ class CEntityToken : public CHTMLToken {
public: public:
CEntityToken(); CEntityToken();
CEntityToken(const nsAString& aString); CEntityToken(const nsAString& aString);
virtual const char* GetClassName(void);
virtual const char* GetClassName(void); virtual PRInt32 GetTokenType(void);
virtual PRInt32 GetTokenType(void); PRInt32 TranslateToUnicodeStr(nsString& aString);
virtual nsresult Consume(PRUnichar aChar,nsScanner& aScanner,PRInt32 aMode); virtual nsresult Consume(PRUnichar aChar,nsScanner& aScanner,PRInt32 aMode);
virtual const nsAString& GetStringValue(void); static nsresult ConsumeEntity(PRUnichar aChar,nsString& aString,nsScanner& aScanner);
virtual void GetSource(nsAString& anOutputString); static PRInt32 TranslateToUnicodeStr(PRInt32 aValue,nsString& aString);
virtual void AppendSourceTo(nsAString& anOutputString);
PRInt32 TranslateToUnicodeStr(nsString& aString);
static nsresult ConsumeEntity(PRUnichar aChar,nsString& aString,nsScanner& aScanner);
#ifdef DEBUG #ifdef DEBUG
virtual void DebugDumpSource(nsOutputStream& out); virtual void DebugDumpSource(nsOutputStream& out);
#endif #endif
virtual const nsAString& GetStringValue(void);
virtual void GetSource(nsString& anOutputString);
virtual void AppendSourceTo(nsAString& anOutputString);
protected: protected:
nsString mTextValue; nsString mTextValue;
}; };
@ -250,16 +263,15 @@ class CWhitespaceToken: public CHTMLToken {
CTOKEN_IMPL_SIZEOF CTOKEN_IMPL_SIZEOF
public: public:
CWhitespaceToken(); CWhitespaceToken();
CWhitespaceToken(const nsAString& aString); CWhitespaceToken(const nsAString& aString);
virtual nsresult Consume(PRUnichar aChar,nsScanner& aScanner,PRInt32 aMode);
virtual nsresult Consume(PRUnichar aChar,nsScanner& aScanner,PRInt32 aMode); virtual const char* GetClassName(void);
virtual const char* GetClassName(void); virtual PRInt32 GetTokenType(void);
virtual PRInt32 GetTokenType(void);
virtual const nsAString& GetStringValue(void); virtual const nsAString& GetStringValue(void);
protected: protected:
nsString mTextValue; nsString mTextValue;
}; };
/** /**
@ -273,23 +285,21 @@ class CTextToken: public CHTMLToken {
CTOKEN_IMPL_SIZEOF CTOKEN_IMPL_SIZEOF
public: public:
CTextToken(); CTextToken();
CTextToken(const nsAString& aString); CTextToken(const nsAString& aString);
virtual nsresult Consume(PRUnichar aChar,nsScanner& aScanner,PRInt32 aMode);
virtual nsresult Consume(PRUnichar aChar,nsScanner& aScanner,PRInt32 aMode); nsresult ConsumeUntil(PRUnichar aChar,PRBool aIgnoreComments,nsScanner& aScanner,
virtual const char* GetClassName(void); nsString& aEndTagName,PRInt32 aMode,PRBool& aFlushTokens);
virtual PRInt32 GetTokenType(void); virtual const char* GetClassName(void);
virtual PRInt32 GetTokenType(void);
virtual PRInt32 GetTextLength(void);
virtual void CopyTo(nsAString& aStr);
virtual const nsAString& GetStringValue(void); virtual const nsAString& GetStringValue(void);
virtual void Bind(nsScanner* aScanner, nsReadingIterator<PRUnichar>& aStart, nsReadingIterator<PRUnichar>& aEnd);
nsresult ConsumeUntil(PRUnichar aChar,PRBool aIgnoreComments,nsScanner& aScanner, virtual void Bind(const nsAString& aStr);
nsString& aEndTagName,PRInt32 aMode,PRBool& aFlushTokens);
PRInt32 GetTextLength(void);
void CopyTo(nsAString& aStr);
void Bind(nsScanner* aScanner, nsReadingIterator<PRUnichar>& aStart, nsReadingIterator<PRUnichar>& aEnd);
void Bind(const nsAString& aStr);
protected: protected:
nsSlidingSubstring mTextValue; nsSlidingSubstring mTextValue;
}; };
@ -312,7 +322,7 @@ public:
virtual const nsAString& GetStringValue(void); virtual const nsAString& GetStringValue(void);
protected: protected:
nsString mTextValue; nsString mTextValue;
}; };
@ -328,13 +338,13 @@ class CMarkupDeclToken : public CHTMLToken {
public: public:
CMarkupDeclToken(); CMarkupDeclToken();
CMarkupDeclToken(const nsAString& aString); CMarkupDeclToken(const nsAString& aString);
virtual nsresult Consume(PRUnichar aChar,nsScanner& aScanner,PRInt32 aMode); virtual nsresult Consume(PRUnichar aChar,nsScanner& aScanner,PRInt32 aMode);
virtual const char* GetClassName(void); virtual const char* GetClassName(void);
virtual PRInt32 GetTokenType(void); virtual PRInt32 GetTokenType(void);
virtual const nsAString& GetStringValue(void); virtual const nsAString& GetStringValue(void);
protected: protected:
nsSlidingSubstring mTextValue; nsSlidingSubstring mTextValue;
}; };
@ -350,32 +360,32 @@ class CAttributeToken: public CHTMLToken {
CTOKEN_IMPL_SIZEOF CTOKEN_IMPL_SIZEOF
public: public:
CAttributeToken(); CAttributeToken();
CAttributeToken(const nsAString& aString); CAttributeToken(const nsAString& aString);
CAttributeToken(const nsAString& aKey, const nsAString& aString); CAttributeToken(const nsAString& aKey, const nsAString& aString);
~CAttributeToken() {} ~CAttributeToken() {}
virtual nsresult Consume(PRUnichar aChar,nsScanner& aScanner,PRInt32 aMode);
virtual nsresult Consume(PRUnichar aChar,nsScanner& aScanner,PRInt32 aMode); virtual const char* GetClassName(void);
virtual const char* GetClassName(void); virtual PRInt32 GetTokenType(void);
virtual PRInt32 GetTokenType(void); virtual const nsAString& GetKey(void) {return mTextKey;}
virtual const nsAString& GetStringValue(void); virtual void SetKey(const nsAString& aKey);
virtual void GetSource(nsAString& anOutputString); virtual void BindKey(nsScanner* aScanner, nsReadingIterator<PRUnichar>& aStart, nsReadingIterator<PRUnichar>& aEnd);
virtual void AppendSourceTo(nsAString& anOutputString); virtual const nsAString& GetValue(void) {return mTextValue;}
virtual void SanitizeKey();
const nsAString& GetKey(void) {return mTextKey;}
void SetKey(const nsAString& aKey);
void BindKey(nsScanner* aScanner, nsReadingIterator<PRUnichar>& aStart, nsReadingIterator<PRUnichar>& aEnd);
const nsAString& GetValue(void) {return mTextValue;}
void SanitizeKey();
#ifdef DEBUG #ifdef DEBUG
virtual void DebugDumpToken(nsOutputStream& out); virtual void DebugDumpToken(nsOutputStream& out);
void DebugDumpSource(nsOutputStream& out); #endif
virtual const nsAString& GetStringValue(void);
virtual void GetSource(nsString& anOutputString);
virtual void AppendSourceTo(nsAString& anOutputString);
#ifdef DEBUG
virtual void DebugDumpSource(nsOutputStream& out);
#endif #endif
PRPackedBool mHasEqualWithoutValue; PRPackedBool mHasEqualWithoutValue;
protected: protected:
#ifdef DEBUG #ifdef DEBUG
PRPackedBool mLastAttribute; PRPackedBool mLastAttribute;
#endif #endif
nsAutoString mTextValue; nsAutoString mTextValue;
nsSlidingSubstring mTextKey; nsSlidingSubstring mTextKey;
@ -392,15 +402,14 @@ class CNewlineToken: public CHTMLToken {
CTOKEN_IMPL_SIZEOF CTOKEN_IMPL_SIZEOF
public: public:
CNewlineToken(); CNewlineToken();
virtual nsresult Consume(PRUnichar aChar,nsScanner& aScanner,PRInt32 aMode);
virtual const char* GetClassName(void);
virtual PRInt32 GetTokenType(void);
virtual const nsAString& GetStringValue(void);
virtual nsresult Consume(PRUnichar aChar,nsScanner& aScanner,PRInt32 aMode); static void AllocNewline();
virtual const char* GetClassName(void); static void FreeNewline();
virtual PRInt32 GetTokenType(void);
virtual const nsAString& GetStringValue(void);
static void AllocNewline();
static void FreeNewline();
}; };
@ -421,10 +430,10 @@ class CScriptToken: public CHTMLToken {
CScriptToken(const nsAString& aString); CScriptToken(const nsAString& aString);
virtual const char* GetClassName(void); virtual const char* GetClassName(void);
virtual PRInt32 GetTokenType(void); virtual PRInt32 GetTokenType(void);
virtual const nsAString& GetStringValue(void); virtual const nsAString& GetStringValue(void);
protected: protected:
nsString mTextValue; nsString mTextValue;
}; };
@ -444,10 +453,10 @@ class CStyleToken: public CHTMLToken {
CStyleToken(const nsAString& aString); CStyleToken(const nsAString& aString);
virtual const char* GetClassName(void); virtual const char* GetClassName(void);
virtual PRInt32 GetTokenType(void); virtual PRInt32 GetTokenType(void);
virtual const nsAString& GetStringValue(void); virtual const nsAString& GetStringValue(void);
protected: protected:
nsString mTextValue; nsString mTextValue;
}; };
@ -505,16 +514,16 @@ class CDoctypeDeclToken: public CHTMLToken {
CTOKEN_IMPL_SIZEOF CTOKEN_IMPL_SIZEOF
public: public:
CDoctypeDeclToken(eHTMLTags aTag=eHTMLTag_unknown); CDoctypeDeclToken(eHTMLTags aTag=eHTMLTag_unknown);
CDoctypeDeclToken(const nsAString& aString,eHTMLTags aTag=eHTMLTag_unknown); CDoctypeDeclToken(const nsAString& aString,eHTMLTags aTag=eHTMLTag_unknown);
virtual nsresult Consume(PRUnichar aChar,nsScanner& aScanner,PRInt32 aMode);
virtual const char* GetClassName(void);
virtual PRInt32 GetTokenType(void);
virtual const nsAString& GetStringValue(void);
virtual void SetStringValue(const nsAString& aStr);
nsresult Consume(PRUnichar aChar,nsScanner& aScanner,PRInt32 aMode);
const char* GetClassName(void);
PRInt32 GetTokenType(void);
void SetStringValue(const nsAString& aStr);
const nsAString& GetStringValue(void);
protected: protected:
nsString mTextValue; nsString mTextValue;
}; };
#endif #endif

Просмотреть файл

@ -75,17 +75,18 @@
#include "nsFileSpec.h" #include "nsFileSpec.h"
#include "nsFixedSizeAllocator.h" #include "nsFixedSizeAllocator.h"
#define NS_HTMLTOKENS_UNKNOWNFORM 0x00000001
#define NS_HTMLTOKENS_WELLFORMED 0x00000002
#define NS_HTMLTOKENS_MALFORMED 0x00000004
#define NS_HTMLTOKENS_EMPTYTOKEN 0x00000008
#define NS_HTMLTOKENS_NOT_AN_ENTITY \ #define NS_HTMLTOKENS_NOT_AN_ENTITY \
NS_ERROR_GENERATE_SUCCESS(NS_ERROR_MODULE_HTMLPARSER,2000) NS_ERROR_GENERATE_SUCCESS(NS_ERROR_MODULE_HTMLPARSER,2000)
class nsScanner; class nsScanner;
class nsTokenAllocator; class nsTokenAllocator;
enum eContainerInfo {
eWellFormed,
eMalformed,
eFormUnknown
};
/** /**
* Implement the SizeOf() method; leaf classes derived from CToken * Implement the SizeOf() method; leaf classes derived from CToken
* must declare this. * must declare this.
@ -182,7 +183,7 @@ class CToken {
* @update gess5/11/98 * @update gess5/11/98
* @return reference to string containing string value * @return reference to string containing string value
*/ */
virtual void GetSource(nsAString& anOutputString); virtual void GetSource(nsString& anOutputString);
/** @update harishd 03/23/00 /** @update harishd 03/23/00
* @return reference to string containing string value * @return reference to string containing string value
@ -210,8 +211,6 @@ class CToken {
*/ */
virtual PRInt16 GetAttributeCount(void); virtual PRInt16 GetAttributeCount(void);
virtual void SetAttributeCount(PRInt16 aValue) { }
/** /**
* Causes token to consume data from given scanner. * Causes token to consume data from given scanner.
* Note that behavior varies wildly between CToken subclasses. * Note that behavior varies wildly between CToken subclasses.
@ -236,14 +235,6 @@ class CToken {
* @param out is the output stream where token should write itself * @param out is the output stream where token should write itself
*/ */
virtual void DebugDumpSource(nsOutputStream& out); virtual void DebugDumpSource(nsOutputStream& out);
/**
* Getter which retrieves the class name for this token
* This method is only used for debug purposes.
* @update gess5/11/98
* @return const char* containing class name
*/
virtual const char* GetClassName(void);
#endif #endif
/** /**
@ -253,6 +244,15 @@ class CToken {
*/ */
virtual PRInt32 GetTokenType(void); virtual PRInt32 GetTokenType(void);
/**
* Getter which retrieves the class name for this token
* This method is only used for debug purposes.
* @update gess5/11/98
* @return const char* containing class name
*/
virtual const char* GetClassName(void);
/** /**
* For tokens who care, this can tell us whether the token is * For tokens who care, this can tell us whether the token is
* well formed or not. * well formed or not.
@ -289,6 +289,8 @@ class CToken {
mLineNumber = mLineNumber == 0 ? aLineNumber : mLineNumber; mLineNumber = mLineNumber == 0 ? aLineNumber : mLineNumber;
} }
void SetAttributeCount(PRInt16 aValue) { mAttrCount = aValue; }
/** /**
* perform self test. * perform self test.
* @update gess5/11/98 * @update gess5/11/98
@ -305,11 +307,11 @@ protected:
*/ */
virtual size_t SizeOf() const = 0; virtual size_t SizeOf() const = 0;
PRInt32 mTypeID; PRInt32 mTypeID;
PRInt32 mUseCount; PRInt32 mUseCount;
PRInt32 mNewlineCount; PRInt32 mNewlineCount;
PRInt32 mLineNumber; PRInt32 mLineNumber;
PRUint16 mFlags; PRInt16 mAttrCount;
}; };

Просмотреть файл

@ -354,15 +354,15 @@ nsresult nsHTMLTokenizer::ScanDocStructure(PRBool aFinalChunk) {
//*** start by finding the first start tag that hasn't been reviewed. //*** start by finding the first start tag that hasn't been reviewed.
while (mTokenScanPos > 0) { while(mTokenScanPos>0) {
theRootToken=(CHTMLToken*)mTokenDeque.ObjectAt(mTokenScanPos); theRootToken=(CHTMLToken*)mTokenDeque.ObjectAt(mTokenScanPos);
if ( theRootToken) { if(theRootToken) {
eHTMLTokenTypes theType=eHTMLTokenTypes(theRootToken->GetTokenType()); eHTMLTokenTypes theType=eHTMLTokenTypes(theRootToken->GetTokenType());
if (eToken_start == theType) { if(eToken_start==theType) {
if (theRootToken->GetContainerInfo() & NS_HTMLTOKENS_UNKNOWNFORM) { if(eFormUnknown==theRootToken->GetContainerInfo()) {
break; break;
} }
} }
} }
mTokenScanPos--; mTokenScanPos--;
} }
@ -414,16 +414,16 @@ nsresult nsHTMLTokenizer::ScanDocStructure(PRBool aFinalChunk) {
if(theTag==theLastToken->GetTypeID()) { if(theTag==theLastToken->GetTypeID()) {
theStack.Pop(); //yank it for real theStack.Pop(); //yank it for real
theStackDepth--; theStackDepth--;
theLastToken->SetContainerInfo(NS_HTMLTOKENS_WELLFORMED); theLastToken->SetContainerInfo(eWellFormed);
//in addition, let's look above this container to see if we can find //in addition, let's look above this container to see if we can find
//any tags that are already marked malformed. If so, pop them too! //any tags that are already marked malformed. If so, pop them too!
theLastToken= NS_STATIC_CAST(CHTMLToken*, theStack.Peek()); theLastToken= NS_STATIC_CAST(CHTMLToken*, theStack.Peek());
while (theLastToken) { while(theLastToken) {
if (theRootToken->GetContainerInfo() & NS_HTMLTOKENS_MALFORMED) { if(eMalformed==theRootToken->GetContainerInfo()) {
theStack.Pop(); //yank the malformed token for real. theStack.Pop(); //yank the malformed token for real.
theLastToken = NS_STATIC_CAST(CHTMLToken*, theStack.Peek()); theLastToken= NS_STATIC_CAST(CHTMLToken*, theStack.Peek());
continue; continue;
} }
break; break;
@ -434,11 +434,11 @@ nsresult nsHTMLTokenizer::ScanDocStructure(PRBool aFinalChunk) {
//be malformed. If the tag is a block, we don't really care (but we'll //be malformed. If the tag is a block, we don't really care (but we'll
//mark it anyway). If it's an inline we DO care, especially if the //mark it anyway). If it's an inline we DO care, especially if the
//inline tried to contain a block (that's when RS handling kicks in). //inline tried to contain a block (that's when RS handling kicks in).
if (theTagIsInline) { if(theTagIsInline) {
PRInt32 theIndex = FindLastIndexOfTag(theTag,theStack); PRInt32 theIndex=FindLastIndexOfTag(theTag,theStack);
if (kNotFound != theIndex) { if(kNotFound!=theIndex) {
theToken = (CHTMLToken*)theStack.ObjectAt(theIndex); theToken=(CHTMLToken*)theStack.ObjectAt(theIndex);
theToken->SetContainerInfo(NS_HTMLTOKENS_MALFORMED); theToken->SetContainerInfo(eMalformed);
} }
//otherwise we ignore an out-of-place end tag. //otherwise we ignore an out-of-place end tag.
} }

Просмотреть файл

@ -90,29 +90,51 @@ CHTMLToken::~CHTMLToken() {
* @param * @param
* @return * @return
*/ */
CStartToken::CStartToken(eHTMLTags aTag) : CHTMLToken(aTag) CStartToken::CStartToken(eHTMLTags aTag) : CHTMLToken(aTag) {
{ mEmpty=PR_FALSE;
mContainerInfo=eFormUnknown;
#ifdef DEBUG #ifdef DEBUG
mAttributed = PR_FALSE; mAttributed = PR_FALSE;
#endif #endif
} }
CStartToken::CStartToken(const nsAString& aName) : CHTMLToken(eHTMLTag_unknown) CStartToken::CStartToken(const nsAString& aName) : CHTMLToken(eHTMLTag_unknown) {
{ mEmpty=PR_FALSE;
mContainerInfo=eFormUnknown;
mTextValue.Assign(aName); mTextValue.Assign(aName);
#ifdef DEBUG #ifdef DEBUG
mAttributed = PR_FALSE; mAttributed = PR_FALSE;
#endif #endif
} }
CStartToken::CStartToken(const nsAString& aName,eHTMLTags aTag) : CHTMLToken(aTag) CStartToken::CStartToken(const nsAString& aName,eHTMLTags aTag) : CHTMLToken(aTag) {
{ mEmpty=PR_FALSE;
mContainerInfo=eFormUnknown;
mTextValue.Assign(aName); mTextValue.Assign(aName);
#ifdef DEBUG #ifdef DEBUG
mAttributed = PR_FALSE; mAttributed = PR_FALSE;
#endif #endif
} }
nsresult CStartToken::GetIDAttributeAtom(nsIAtom** aResult)
{
NS_ENSURE_ARG_POINTER(aResult);
*aResult = mIDAttributeAtom;
NS_IF_ADDREF(*aResult);
return NS_OK;
}
nsresult CStartToken::SetIDAttributeAtom(nsIAtom* aID)
{
NS_ENSURE_ARG(aID);
mIDAttributeAtom = aID;
return NS_OK;
}
/* /*
* This method returns the typeid (the tag type) for this token. * This method returns the typeid (the tag type) for this token.
* *
@ -120,9 +142,7 @@ CStartToken::CStartToken(const nsAString& aName,eHTMLTags aTag) : CHTMLToken(aTa
* @param * @param
* @return * @return
*/ */
PRInt32 PRInt32 CStartToken::GetTypeID(){
CStartToken::GetTypeID()
{
if(eHTMLTag_unknown==mTypeID) { if(eHTMLTag_unknown==mTypeID) {
mTypeID = nsHTMLTags::LookupTag(mTextValue); mTypeID = nsHTMLTags::LookupTag(mTextValue);
} }
@ -136,9 +156,7 @@ CStartToken::GetTypeID()
* @param * @param
* @return * @return
*/ */
const char* const char* CStartToken::GetClassName(void) {
CStartToken::GetClassName(void)
{
return "start"; return "start";
} }
@ -149,29 +167,10 @@ CStartToken::GetClassName(void)
* @param * @param
* @return * @return
*/ */
PRInt32 CStartToken::GetTokenType(void) PRInt32 CStartToken::GetTokenType(void) {
{
return eToken_start; return eToken_start;
} }
void CStartToken::SetContainerInfo(PRUint16 aInfo)
{
if (aInfo & NS_HTMLTOKENS_UNKNOWNFORM) {
mFlags &= ~(NS_HTMLTOKENS_MALFORMED | NS_HTMLTOKENS_WELLFORMED);
mFlags |= NS_HTMLTOKENS_UNKNOWNFORM;
}
else if (aInfo & NS_HTMLTOKENS_WELLFORMED) {
mFlags &= ~(NS_HTMLTOKENS_UNKNOWNFORM | NS_HTMLTOKENS_MALFORMED);
mFlags |= NS_HTMLTOKENS_WELLFORMED;
}
else if (aInfo & NS_HTMLTOKENS_MALFORMED) {
mFlags &= ~(NS_HTMLTOKENS_UNKNOWNFORM | NS_HTMLTOKENS_WELLFORMED);
mFlags |= NS_HTMLTOKENS_MALFORMED;
}
else {
NS_WARNING("invalid container info!");
}
}
/* /*
* *
* *
@ -179,16 +178,22 @@ void CStartToken::SetContainerInfo(PRUint16 aInfo)
* @param * @param
* @return * @return
*/ */
void CStartToken::SetEmpty(PRBool aValue) void CStartToken::SetEmpty(PRBool aValue) {
{ mEmpty=aValue;
if (aValue) {
mFlags |= NS_HTMLTOKENS_EMPTYTOKEN;
}
else {
mFlags &= ~NS_HTMLTOKENS_EMPTYTOKEN;
}
} }
/*
*
*
* @update gess 3/25/98
* @param
* @return
*/
PRBool CStartToken::IsEmpty(void) {
return mEmpty;
}
/* /*
* Consume the identifier portion of the start tag * Consume the identifier portion of the start tag
* *
@ -263,7 +268,7 @@ const nsAString& CStartToken::GetStringValue()
* @param anOutputString will recieve the result * @param anOutputString will recieve the result
* @return nada * @return nada
*/ */
void CStartToken::GetSource(nsAString& anOutputString){ void CStartToken::GetSource(nsString& anOutputString){
anOutputString.Append(PRUnichar('<')); anOutputString.Append(PRUnichar('<'));
/* /*
* Watch out for Bug 15204 * Watch out for Bug 15204
@ -367,9 +372,7 @@ nsresult CEndToken::Consume(PRUnichar aChar, nsScanner& aScanner,PRInt32 aFlag)
* @param * @param
* @return eHTMLTag id of this endtag * @return eHTMLTag id of this endtag
*/ */
PRInt32 PRInt32 CEndToken::GetTypeID(){
CEndToken::GetTypeID()
{
if(eHTMLTag_unknown==mTypeID) { if(eHTMLTag_unknown==mTypeID) {
mTypeID = nsHTMLTags::LookupTag(mTextValue); mTypeID = nsHTMLTags::LookupTag(mTextValue);
switch(mTypeID) { switch(mTypeID) {
@ -436,7 +439,7 @@ const nsAString& CEndToken::GetStringValue()
* @param anOutputString will recieve the result * @param anOutputString will recieve the result
* @return nada * @return nada
*/ */
void CEndToken::GetSource(nsAString& anOutputString){ void CEndToken::GetSource(nsString& anOutputString){
anOutputString.Append(NS_LITERAL_STRING("</")); anOutputString.Append(NS_LITERAL_STRING("</"));
if(mTextValue.Length()>0) if(mTextValue.Length()>0)
anOutputString.Append(mTextValue); anOutputString.Append(mTextValue);
@ -1521,7 +1524,7 @@ const nsAString& CAttributeToken::GetStringValue(void)
* @param anOutputString will recieve the result * @param anOutputString will recieve the result
* @return nada * @return nada
*/ */
void CAttributeToken::GetSource(nsAString& anOutputString){ void CAttributeToken::GetSource(nsString& anOutputString){
anOutputString.Truncate(); anOutputString.Truncate();
AppendSourceTo(anOutputString); AppendSourceTo(anOutputString);
} }
@ -2223,7 +2226,7 @@ const nsAString& CEntityToken::GetStringValue(void)
* @param anOutputString will recieve the result * @param anOutputString will recieve the result
* @return nada * @return nada
*/ */
void CEntityToken::GetSource(nsAString& anOutputString){ void CEntityToken::GetSource(nsString& anOutputString){
anOutputString.Append(NS_LITERAL_STRING("&")); anOutputString.Append(NS_LITERAL_STRING("&"));
anOutputString+=mTextValue; anOutputString+=mTextValue;
//anOutputString+=";"; //anOutputString+=";";

Просмотреть файл

@ -59,23 +59,22 @@ int CToken::GetTokenCount(){return TokenCount-DelTokenCount;}
* *
* @update gess 7/21/98 * @update gess 7/21/98
*/ */
CToken::CToken(PRInt32 aTag) CToken::CToken(PRInt32 aTag) {
: mNewlineCount(0),
mLineNumber(0),
mTypeID(aTag),
mUseCount(1),
mFlags(NS_HTMLTOKENS_UNKNOWNFORM)
// Note that the use count starts with 1 instead of 0. This
// is because of the assumption that any token created is in
// use and therefore does not require an explicit addref, or
// rather IF_HOLD. This will make sure that tokens created
// on the stack do not accidently hit the arena recycler.
{
// Tokens are allocated through the arena ( not heap allocated..yay ). // Tokens are allocated through the arena ( not heap allocated..yay ).
// We, therefore, don't need this macro anymore.. // We, therefore, don't need this macro anymore..
#ifdef MATCH_CTOR_DTOR #ifdef MATCH_CTOR_DTOR
MOZ_COUNT_CTOR(CToken); MOZ_COUNT_CTOR(CToken);
#endif #endif
mAttrCount=0;
mNewlineCount=0;
mLineNumber = 0;
mTypeID=aTag;
// Note that the use count starts with 1 instead of 0. This
// is because of the assumption that any token created is in
// use and therefore does not require an explicit addref, or
// rather IF_HOLD. This, also, will make sure that tokens created
// on the stack do not accidently hit the arena recycler.
mUseCount=1;
#ifdef NS_DEBUG #ifdef NS_DEBUG
++TokenCount; ++TokenCount;
@ -128,7 +127,7 @@ void CToken::DebugDumpToken(nsOutputStream& anOutputStream) {
for(i=0;i<theLen;++i){ for(i=0;i<theLen;++i){
anOutputStream << NS_ConvertUCS2toUTF8(GetStringValue()).get(); anOutputStream << NS_ConvertUCS2toUTF8(GetStringValue()).get();
} }
anOutputStream << " TypeID: " << mTypeID << " AttrCount: " << 0 << nsEndl; anOutputStream << " TypeID: " << mTypeID << " AttrCount: " << mAttrCount << nsEndl;
} }
/** /**
@ -141,19 +140,6 @@ void CToken::DebugDumpToken(nsOutputStream& anOutputStream) {
void CToken::DebugDumpSource(nsOutputStream& anOutputStream) { void CToken::DebugDumpSource(nsOutputStream& anOutputStream) {
anOutputStream << NS_ConvertUCS2toUTF8(GetStringValue()).get(); anOutputStream << NS_ConvertUCS2toUTF8(GetStringValue()).get();
} }
/**
* retrieve this tokens classname.
*
* @update gess 3/25/98
* @return char* containing name of class
*/
const char*
CToken::GetClassName(void)
{
return "token";
}
#endif #endif
@ -163,7 +149,7 @@ CToken::GetClassName(void)
* @update gess5/11/98 * @update gess5/11/98
* @return reference to string containing string value * @return reference to string containing string value
*/ */
void CToken::GetSource(nsAString& anOutputString){ void CToken::GetSource(nsString& anOutputString){
anOutputString.Assign(GetStringValue()); anOutputString.Assign(GetStringValue());
} }
@ -193,9 +179,7 @@ void CToken::SetTypeID(PRInt32 aTypeID) {
* @update gess 3/25/98 * @update gess 3/25/98
* @return int containing ordinal value * @return int containing ordinal value
*/ */
PRInt32 PRInt32 CToken::GetTypeID(void) {
CToken::GetTypeID(void)
{
return mTypeID; return mTypeID;
} }
@ -205,10 +189,8 @@ CToken::GetTypeID(void)
* @update gess 3/25/98 * @update gess 3/25/98
* @return int containing attribute count * @return int containing attribute count
*/ */
PRInt16 PRInt16 CToken::GetAttributeCount(void) {
CToken::GetAttributeCount(void) return mAttrCount;
{
return 0;
} }
@ -219,18 +201,28 @@ CToken::GetAttributeCount(void)
* @update gess 3/25/98 * @update gess 3/25/98
* @return int value containing token type. * @return int value containing token type.
*/ */
PRInt32 PRInt32 CToken::GetTokenType(void) {
CToken::GetTokenType(void)
{
return -1; return -1;
} }
/**
* retrieve this tokens classname.
*
* @update gess 3/25/98
* @return char* containing name of class
*/
const char* CToken::GetClassName(void) {
return "token";
}
/** /**
* *
* @update gess 3/25/98 * @update gess 3/25/98
*/ */
void CToken::SelfTest(void) void CToken::SelfTest(void) {
{ #ifdef _DEBUG
#endif
} }