even more progress in the parser

This commit is contained in:
rickg%netscape.com 1998-07-25 00:05:29 +00:00
parent b6f70ddf26
commit a6035c39f1
16 changed files with 112 additions and 8 deletions

View File

@ -2933,6 +2933,11 @@ nsresult CNavDTD::ConsumeToken(CToken*& aToken){
result=theScanner->GetChar(theChar);
switch(result) {
case kEOF:
//We convert from eof to complete here, because we never really tried to get data.
//All we did was try to see if data was available, which it wasn't.
//It's important to return process complete, so that controlling logic can know that
//everything went well, but we're done with token processing.
result=kProcessComplete;
break;
case kInterrupted:

View File

@ -119,6 +119,15 @@ class nsIParserNode {
* @return int (unicode char or unicode index from table)
*/
virtual PRInt32 TranslateToUnicodeStr(nsString& aString) const = 0;
/**
* This getter retrieves the line number from the input source where
* the token occured. Lines are interpreted as occuring between \n characters.
* @update gess7/24/98
* @return int containing the line number the token was found on
*/
virtual PRUint16 GetSourceLineNumber(void)=0;
};
#endif

View File

@ -851,6 +851,8 @@ PRInt32 nsParser::Tokenize(){
mParserContext->mScanner->RewindToMark();
}
}
if(result=kProcessComplete)
result=NS_OK;
DidTokenize();
return result;
}

View File

@ -203,4 +203,13 @@ PRInt32 nsCParserNode::TranslateToUnicodeStr(nsString& aString) const
return -1;
}
/**
* This getter retrieves the line number from the input source where
* the token occured. Lines are interpreted as occuring between \n characters.
* @update gess7/24/98
* @return int containing the line number the token was found on
*/
PRUint16 nsCParserNode::GetSourceLineNumber(void){
return mToken->GetSourceLineNumber();
}

View File

@ -146,6 +146,13 @@ class nsCParserNode : public nsIParserNode {
*/
virtual void SetSkippedContent(CToken* aToken);
/**
* This getter retrieves the line number from the input source where
* the token occured. Lines are interpreted as occuring between \n characters.
* @update gess7/24/98
* @return int containing the line number the token was found on
*/
virtual PRUint16 GetSourceLineNumber(void);
protected:
PRInt32 mAttributeCount;

View File

@ -50,6 +50,7 @@ const PRInt32 kContextMismatch = 10003;
const PRInt32 kBadFilename = 10004;
const PRInt32 kBadURL = 10005;
const PRInt32 kInterrupted = 10006;
const PRInt32 kProcessComplete = 10007;
const PRInt32 kNotFound = -1;
const PRInt32 kNoError = NS_OK;

View File

@ -27,7 +27,7 @@
CToken::CToken(PRInt32 aTag) : mTextValue() {
mTypeID=aTag;
mStringInit=PR_FALSE;
mUnused=PR_FALSE;
mLineNumber=1;
mAttrCount=0;
}
@ -40,7 +40,7 @@ CToken::CToken(PRInt32 aTag) : mTextValue() {
CToken::CToken(const nsString& aName) : mTextValue(aName) {
mTypeID=0;
mStringInit=PR_TRUE;
mUnused=PR_FALSE;
mLineNumber=1;
mAttrCount=0;
}
@ -53,7 +53,7 @@ CToken::CToken(const nsString& aName) : mTextValue(aName) {
CToken::CToken(const char* aName) : mTextValue(aName) {
mTypeID=0;
mStringInit=PR_TRUE;
mUnused=PR_FALSE;
mLineNumber=1;
mAttrCount=0;
}
@ -204,6 +204,16 @@ const char* CToken::GetClassName(void) {
return "token";
}
/**
* This getter retrieves the line number from the input source where
* the token occured. Lines are interpreted as occuring between \n characters.
* @update gess7/24/98
* @return int containing the line number the token was found on
*/
PRUint16 CToken::GetSourceLineNumber(void){
return mLineNumber;
}
/**
*
* @update gess 3/25/98

View File

@ -167,6 +167,15 @@ class CToken {
*/
virtual const char* GetClassName(void);
/**
* This getter retrieves the line number from the input source where
* the token occured. Lines are interpreted as occuring between \n characters.
* @update gess7/24/98
* @return int containing the line number the token was found on
*/
virtual PRUint16 GetSourceLineNumber(void);
/**
* perform self test.
* @update gess5/11/98
@ -177,7 +186,7 @@ protected:
PRInt32 mTypeID;
PRInt16 mAttrCount;
PRBool mStringInit;
PRBool mUnused;
PRUint16 mLineNumber;
nsAutoString mTextValue;
};

View File

@ -2933,6 +2933,11 @@ nsresult CNavDTD::ConsumeToken(CToken*& aToken){
result=theScanner->GetChar(theChar);
switch(result) {
case kEOF:
//We convert from eof to complete here, because we never really tried to get data.
//All we did was try to see if data was available, which it wasn't.
//It's important to return process complete, so that controlling logic can know that
//everything went well, but we're done with token processing.
result=kProcessComplete;
break;
case kInterrupted:

View File

@ -119,6 +119,15 @@ class nsIParserNode {
* @return int (unicode char or unicode index from table)
*/
virtual PRInt32 TranslateToUnicodeStr(nsString& aString) const = 0;
/**
* This getter retrieves the line number from the input source where
* the token occured. Lines are interpreted as occuring between \n characters.
* @update gess7/24/98
* @return int containing the line number the token was found on
*/
virtual PRUint16 GetSourceLineNumber(void)=0;
};
#endif

View File

@ -851,6 +851,8 @@ PRInt32 nsParser::Tokenize(){
mParserContext->mScanner->RewindToMark();
}
}
if(result=kProcessComplete)
result=NS_OK;
DidTokenize();
return result;
}

View File

@ -203,4 +203,13 @@ PRInt32 nsCParserNode::TranslateToUnicodeStr(nsString& aString) const
return -1;
}
/**
* This getter retrieves the line number from the input source where
* the token occured. Lines are interpreted as occuring between \n characters.
* @update gess7/24/98
* @return int containing the line number the token was found on
*/
PRUint16 nsCParserNode::GetSourceLineNumber(void){
return mToken->GetSourceLineNumber();
}

View File

@ -146,6 +146,13 @@ class nsCParserNode : public nsIParserNode {
*/
virtual void SetSkippedContent(CToken* aToken);
/**
* This getter retrieves the line number from the input source where
* the token occured. Lines are interpreted as occuring between \n characters.
* @update gess7/24/98
* @return int containing the line number the token was found on
*/
virtual PRUint16 GetSourceLineNumber(void);
protected:
PRInt32 mAttributeCount;

View File

@ -50,6 +50,7 @@ const PRInt32 kContextMismatch = 10003;
const PRInt32 kBadFilename = 10004;
const PRInt32 kBadURL = 10005;
const PRInt32 kInterrupted = 10006;
const PRInt32 kProcessComplete = 10007;
const PRInt32 kNotFound = -1;
const PRInt32 kNoError = NS_OK;

View File

@ -27,7 +27,7 @@
CToken::CToken(PRInt32 aTag) : mTextValue() {
mTypeID=aTag;
mStringInit=PR_FALSE;
mUnused=PR_FALSE;
mLineNumber=1;
mAttrCount=0;
}
@ -40,7 +40,7 @@ CToken::CToken(PRInt32 aTag) : mTextValue() {
CToken::CToken(const nsString& aName) : mTextValue(aName) {
mTypeID=0;
mStringInit=PR_TRUE;
mUnused=PR_FALSE;
mLineNumber=1;
mAttrCount=0;
}
@ -53,7 +53,7 @@ CToken::CToken(const nsString& aName) : mTextValue(aName) {
CToken::CToken(const char* aName) : mTextValue(aName) {
mTypeID=0;
mStringInit=PR_TRUE;
mUnused=PR_FALSE;
mLineNumber=1;
mAttrCount=0;
}
@ -204,6 +204,16 @@ const char* CToken::GetClassName(void) {
return "token";
}
/**
* This getter retrieves the line number from the input source where
* the token occured. Lines are interpreted as occuring between \n characters.
* @update gess7/24/98
* @return int containing the line number the token was found on
*/
PRUint16 CToken::GetSourceLineNumber(void){
return mLineNumber;
}
/**
*
* @update gess 3/25/98

View File

@ -167,6 +167,15 @@ class CToken {
*/
virtual const char* GetClassName(void);
/**
* This getter retrieves the line number from the input source where
* the token occured. Lines are interpreted as occuring between \n characters.
* @update gess7/24/98
* @return int containing the line number the token was found on
*/
virtual PRUint16 GetSourceLineNumber(void);
/**
* perform self test.
* @update gess5/11/98
@ -177,7 +186,7 @@ protected:
PRInt32 mTypeID;
PRInt16 mAttrCount;
PRBool mStringInit;
PRBool mUnused;
PRUint16 mLineNumber;
nsAutoString mTextValue;
};