improved newline handling in tables

git-svn-id: svn://10.0.0.236/trunk@516 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
rickg
1998-04-22 19:46:40 +00:00
parent 3ef2b1f04d
commit ab6648a9f7
8 changed files with 4 additions and 68 deletions

View File

@@ -234,7 +234,6 @@ CToken* CHTMLTokenizerDelegate::ConsumeEntity(PRUnichar aChar,CScanner& aScanner
return result;
}
#ifdef TOKENIZE_WHITESPACE
/**-------------------------------------------------------
* This method is called just after whitespace has been
* consumed and we know we're at the start a whitespace run.
@@ -250,7 +249,6 @@ CToken* CHTMLTokenizerDelegate::ConsumeWhitespace(PRUnichar aChar,CScanner& aSca
anErrorCode=result->Consume(aChar,aScanner);
return result;
}
#endif
/**-------------------------------------------------------
* This method is called just after a "<!" has been consumed
@@ -287,7 +285,6 @@ CToken* CHTMLTokenizerDelegate::ConsumeText(const nsString& aString,CScanner& aS
return result;
}
#ifdef TOKENIZE_CRLF
/**-------------------------------------------------------
* This method is called just after a newline has been consumed.
*
@@ -304,7 +301,6 @@ CToken* CHTMLTokenizerDelegate::ConsumeNewline(PRUnichar aChar,CScanner& aScanne
}
return result;
}
#endif
/**-------------------------------------------------------
* This method repeatedly called by the tokenizer.
@@ -333,18 +329,14 @@ CToken* CHTMLTokenizerDelegate::GetToken(CScanner& aScanner,PRInt32& anErrorCode
return ConsumeEntity(aChar,aScanner,anErrorCode);
case kLessThan:
return ConsumeTag(aChar,aScanner,anErrorCode);
#ifdef TOKENIZE_CRLF
case kCR: case kLF:
return ConsumeNewline(aChar,aScanner,anErrorCode);
case kNotFound:
break;
#endif
default:
#ifdef TOKENIZE_WHITESPACE
if(nsString::IsSpace(aChar))
return ConsumeWhitespace(aChar,aScanner,anErrorCode);
else
#endif
{
nsAutoString temp(aChar);
return ConsumeText(temp,aScanner,anErrorCode);

View File

@@ -67,13 +67,9 @@ class CHTMLTokenizerDelegate : public ITokenizerDelegate {
void ConsumeAttributes(PRUnichar aChar,CScanner& aScanner,PRInt32& anErrorCode);
CToken* ConsumeText(const nsString& aString,CScanner& aScanner,PRInt32& anErrorCode);
CToken* ConsumeEntity(PRUnichar aChar,CScanner& aScanner,PRInt32& anErrorCode);
#ifdef TOKENIZE_WHITESPACE
CToken* ConsumeWhitespace(PRUnichar aChar,CScanner& aScanner,PRInt32& anErrorCode);
#endif
CToken* ConsumeComment(PRUnichar aChar,CScanner& aScanner,PRInt32& anErrorCode);
#ifdef TOKENIZE_CRLF
CToken* ConsumeNewline(PRUnichar aChar,CScanner& aScanner,PRInt32& anErrorCode);
#endif
//the only special case method...
virtual CToken* ConsumeContentToEndTag(const nsString& aString,PRUnichar aChar,CScanner& aScanner,PRInt32& anErrorCode);

View File

@@ -523,16 +523,8 @@ PRInt32 CTextToken::GetTokenType(void) {
* @return error result
*------------------------------------------------------*/
PRInt32 CTextToken::Consume(PRUnichar aChar, CScanner& aScanner) {
#ifdef TOKENIZE_CRLF
static nsAutoString terminals("&<\r\n");
#else
static nsAutoString terminals("&<");
#endif
PRInt32 result=aScanner.ReadUntil(mTextValue,terminals,PR_FALSE);
#ifndef TOKENIZE_CRLF
mTextValue.StripChars("\r");
#endif
static nsAutoString terminals("&<\r\n");
PRInt32 result=aScanner.ReadUntil(mTextValue,terminals,PR_FALSE);
return result;
};
@@ -607,7 +599,6 @@ PRInt32 CCommentToken::GetTokenType(void) {
return eToken_comment;
}
#ifdef TOKENIZE_CRLF
/**-------------------------------------------------------
* default constructor
*
@@ -656,7 +647,6 @@ PRInt32 CNewlineToken::Consume(PRUnichar aChar, CScanner& aScanner) {
mTextValue.StripChars("\r");
return result;
};
#endif /* TOKENIZE_CRLF */
/**-------------------------------------------------------
* default constructor
@@ -834,7 +824,6 @@ void CAttributeToken::DebugDumpSource(ostream& out) {
out<<">";
}
#ifdef TOKENIZE_WHITESPACE
/**-------------------------------------------------------
* default constructor
*
@@ -884,7 +873,6 @@ PRInt32 CWhitespaceToken::Consume(PRUnichar aChar, CScanner& aScanner) {
mTextValue.StripChars("\r");
return result;
};
#endif /* TOKENIZE_WHITESPACE */
/**-------------------------------------------------------
* default constructor

View File

@@ -35,10 +35,6 @@
#include "nsToken.h"
#include <iostream.h>
// If you define these to true then crlf sequences and whitespace come
// through the scanner as seperate tokens.
#undef TOKENIZE_CRLF
#undef TOKENIZE_WHITESPACE
class CScanner;
@@ -222,7 +218,6 @@ class CEntityToken : public CHTMLToken {
*
* @update gess 3/25/98
*/ //---------------------------------------------------
#ifdef TOKENIZE_WHITESPACE
class CWhitespaceToken: public CHTMLToken {
public:
CWhitespaceToken(const nsString& aString);
@@ -230,7 +225,6 @@ class CWhitespaceToken: public CHTMLToken {
virtual const char* GetClassName(void);
virtual PRInt32 GetTokenType(void);
};
#endif
/** -----------------------------------------------------
* Text tokens contain the normalized form of html text.
@@ -278,7 +272,6 @@ class CAttributeToken: public CHTMLToken {
*
* @update gess 3/25/98
*/ //---------------------------------------------------
#ifdef TOKENIZE_CRLF
class CNewlineToken: public CHTMLToken {
public:
CNewlineToken(const nsString& aString);
@@ -286,7 +279,6 @@ class CNewlineToken: public CHTMLToken {
virtual const char* GetClassName(void);
virtual PRInt32 GetTokenType(void);
};
#endif
/** -----------------------------------------------------