зеркало из https://github.com/mozilla/pjs.git
even more progress in the parser
This commit is contained in:
Родитель
40ccd5cdd2
Коммит
b537b4b070
|
@ -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:
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -851,6 +851,8 @@ PRInt32 nsParser::Tokenize(){
|
|||
mParserContext->mScanner->RewindToMark();
|
||||
}
|
||||
}
|
||||
if(result=kProcessComplete)
|
||||
result=NS_OK;
|
||||
DidTokenize();
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -851,6 +851,8 @@ PRInt32 nsParser::Tokenize(){
|
|||
mParserContext->mScanner->RewindToMark();
|
||||
}
|
||||
}
|
||||
if(result=kProcessComplete)
|
||||
result=NS_OK;
|
||||
DidTokenize();
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче