Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Static Protected Attributes
nsCSSScanner Class Reference

#include <nsCSSScanner.h>

Collaboration diagram for nsCSSScanner:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 nsCSSScanner ()
 ~nsCSSScanner ()
void Init (nsIUnicharInputStream *aInput, nsIURI *aURI, PRUint32 aLineNumber)
void Close ()
 NS_HIDDEN_ (void) AddToError(const nsSubstring &aErrorText)
 NS_HIDDEN_ (void) OutputError()
 NS_HIDDEN_ (void) ClearError()
 NS_HIDDEN_ (void) ReportUnexpected(const char *aMessage)
 NS_HIDDEN_ (void) ReportUnexpectedParams(const char *aMessage
 NS_HIDDEN_ (void) ReportUnexpectedEOF(const char *aLookingFor)
 NS_HIDDEN_ (void) ReportUnexpectedToken(nsCSSToken &tok
 NS_HIDDEN_ (void) ReportUnexpectedTokenParams(nsCSSToken &tok
PRUint32 GetLineNumber ()
PRBool Next (nsresult &aErrorCode, nsCSSToken &aTokenResult)
PRBool NextURL (nsresult &aErrorCode, nsCSSToken &aTokenResult)

Static Public Member Functions

static PRBool InitGlobals ()
static void ReleaseGlobals ()
static PRBool IsIdentStart (PRInt32 aChar, const PRUint8 *aLexTable)
static PRBool StartsIdent (PRInt32 aFirstChar, PRInt32 aSecondChar, const PRUint8 *aLexTable)
static const PRUint8GetLexTable ()

Public Attributes

const PRUnichar ** aParams
const PRUnichar PRUint32 aParamsLength
const char * aMessage
const char const PRUnichar ** aParams
const char const PRUnichar PRUint32 aParamsLength

Protected Member Functions

PRInt32 Read (nsresult &aErrorCode)
PRInt32 Peek (nsresult &aErrorCode)
void Unread ()
void Pushback (PRUnichar aChar)
PRBool LookAhead (nsresult &aErrorCode, PRUnichar aChar)
PRBool EatWhiteSpace (nsresult &aErrorCode)
PRBool EatNewline (nsresult &aErrorCode)
void ParseAndAppendEscape (nsresult &aErrorCode, nsString &aOutput)
PRBool ParseIdent (nsresult &aErrorCode, PRInt32 aChar, nsCSSToken &aResult)
PRBool ParseAtKeyword (nsresult &aErrorCode, PRInt32 aChar, nsCSSToken &aResult)
PRBool ParseNumber (nsresult &aErrorCode, PRInt32 aChar, nsCSSToken &aResult)
PRBool ParseRef (nsresult &aErrorCode, PRInt32 aChar, nsCSSToken &aResult)
PRBool ParseString (nsresult &aErrorCode, PRInt32 aChar, nsCSSToken &aResult)
PRBool SkipCComment (nsresult &aErrorCode)
PRBool GatherIdent (nsresult &aErrorCode, PRInt32 aChar, nsString &aIdent)

Static Protected Member Functions

static void BuildLexTable ()
static PRBool CheckLexTable (PRInt32 aChar, PRUint8 aBit, PRUint8 *aLexTable)

Protected Attributes

nsCOMPtr< nsIUnicharInputStreammInput
PRUnicharmBuffer
PRInt32 mOffset
PRInt32 mCount
PRUnicharmPushback
PRInt32 mPushbackCount
PRInt32 mPushbackSize
PRInt32 mLastRead
PRUnichar mLocalPushback [4]
PRUint32 mLineNumber
nsXPIDLCString mFileName
nsCOMPtr< nsIURImURI
PRUint32 mErrorLineNumber
PRUint32 mColNumber
PRUint32 mErrorColNumber
nsFixedString mError
PRUnichar mErrorBuf [200]

Static Protected Attributes

static const PRUint8 IS_DIGIT = 0x01
static const PRUint8 IS_HEX_DIGIT = 0x02
static const PRUint8 START_IDENT = 0x04
static const PRUint8 IS_IDENT = 0x08
static const PRUint8 IS_WHITESPACE = 0x10
static PRUint8 gLexTable [256]

Detailed Description

Definition at line 127 of file nsCSSScanner.h.


Constructor & Destructor Documentation

Definition at line 183 of file nsCSSScanner.cpp.

  : mError(mErrorBuf, NS_ARRAY_LENGTH(mErrorBuf), 0)
#endif
{
  MOZ_COUNT_CTOR(nsCSSScanner);
  if (!gLexTableSetup) {
    // XXX need a monitor
    BuildLexTable();
  }
  mBuffer = new PRUnichar[BUFFER_SIZE];
  mPushback = mLocalPushback;
  mPushbackSize = 4;
  // No need to init the other members, since they represent state
  // which can get cleared.  We'll init them every time Init() is
  // called.
}

Definition at line 201 of file nsCSSScanner.cpp.

{
  MOZ_COUNT_DTOR(nsCSSScanner);
  Close();
  if (nsnull != mBuffer) {
    delete [] mBuffer;
    mBuffer = nsnull;
  }
  if (mLocalPushback != mPushback) {
    delete [] mPushback;
  }
}

Here is the call graph for this function:


Member Function Documentation

void nsCSSScanner::BuildLexTable ( ) [static, protected]

Definition at line 81 of file nsCSSScanner.cpp.

{
  gLexTableSetup = PR_TRUE;

  PRUint8* lt = gLexTable;
  int i;
  lt[CSS_ESCAPE] = START_IDENT;
  lt['-'] |= IS_IDENT;
  lt['_'] |= IS_IDENT | START_IDENT;
  // XXX add in other whitespace chars
  lt[' '] |= IS_WHITESPACE;   // space
  lt['\t'] |= IS_WHITESPACE;  // horizontal tab
  lt['\v'] |= IS_WHITESPACE;  // vertical tab
  lt['\r'] |= IS_WHITESPACE;  // carriage return
  lt['\n'] |= IS_WHITESPACE;  // line feed
  lt['\f'] |= IS_WHITESPACE;  // form feed
  for (i = 161; i <= 255; i++) {
    lt[i] |= IS_IDENT | START_IDENT;
  }
  for (i = '0'; i <= '9'; i++) {
    lt[i] |= IS_DIGIT | IS_HEX_DIGIT | IS_IDENT;
  }
  for (i = 'A'; i <= 'Z'; i++) {
    if ((i >= 'A') && (i <= 'F')) {
      lt[i] |= IS_HEX_DIGIT;
      lt[i+32] |= IS_HEX_DIGIT;
    }
    lt[i] |= IS_IDENT | START_IDENT;
    lt[i+32] |= IS_IDENT | START_IDENT;
  }
}
static PRBool nsCSSScanner::CheckLexTable ( PRInt32  aChar,
PRUint8  aBit,
PRUint8 aLexTable 
) [static, protected]

Here is the caller graph for this function:

PRBool nsCSSScanner::EatNewline ( nsresult aErrorCode) [protected]
PRBool nsCSSScanner::EatWhiteSpace ( nsresult aErrorCode) [protected]
PRBool nsCSSScanner::GatherIdent ( nsresult aErrorCode,
PRInt32  aChar,
nsString aIdent 
) [protected]
static const PRUint8* nsCSSScanner::GetLexTable ( ) [inline, static]

Definition at line 188 of file nsCSSScanner.h.

                                             {
    return gLexTable;
  }

Definition at line 164 of file nsCSSScanner.h.

{ return mLineNumber; }

Here is the caller graph for this function:

void nsCSSScanner::Init ( nsIUnicharInputStream aInput,
nsIURI aURI,
PRUint32  aLineNumber 
)

Here is the caller graph for this function:

static PRBool nsCSSScanner::InitGlobals ( ) [static]
static PRBool nsCSSScanner::IsIdentStart ( PRInt32  aChar,
const PRUint8 aLexTable 
) [inline, static]

Definition at line 174 of file nsCSSScanner.h.

  {
    return aChar >= 0 &&
      (aChar >= 256 || (aLexTable[aChar] & START_IDENT) != 0);
  }

Here is the caller graph for this function:

PRBool nsCSSScanner::LookAhead ( nsresult aErrorCode,
PRUnichar  aChar 
) [protected]
PRBool nsCSSScanner::Next ( nsresult aErrorCode,
nsCSSToken aTokenResult 
)

Here is the caller graph for this function:

PRBool nsCSSScanner::NextURL ( nsresult aErrorCode,
nsCSSToken aTokenResult 
)

Here is the caller graph for this function:

void nsCSSScanner::ParseAndAppendEscape ( nsresult aErrorCode,
nsString aOutput 
) [protected]
PRBool nsCSSScanner::ParseAtKeyword ( nsresult aErrorCode,
PRInt32  aChar,
nsCSSToken aResult 
) [protected]
PRBool nsCSSScanner::ParseIdent ( nsresult aErrorCode,
PRInt32  aChar,
nsCSSToken aResult 
) [protected]
PRBool nsCSSScanner::ParseNumber ( nsresult aErrorCode,
PRInt32  aChar,
nsCSSToken aResult 
) [protected]
PRBool nsCSSScanner::ParseRef ( nsresult aErrorCode,
PRInt32  aChar,
nsCSSToken aResult 
) [protected]
PRBool nsCSSScanner::ParseString ( nsresult aErrorCode,
PRInt32  aChar,
nsCSSToken aResult 
) [protected]
PRInt32 nsCSSScanner::Peek ( nsresult aErrorCode) [protected]
void nsCSSScanner::Pushback ( PRUnichar  aChar) [protected]
PRInt32 nsCSSScanner::Read ( nsresult aErrorCode) [protected]
static void nsCSSScanner::ReleaseGlobals ( ) [static]

Here is the caller graph for this function:

PRBool nsCSSScanner::SkipCComment ( nsresult aErrorCode) [protected]
static PRBool nsCSSScanner::StartsIdent ( PRInt32  aFirstChar,
PRInt32  aSecondChar,
const PRUint8 aLexTable 
) [inline, static]

Definition at line 181 of file nsCSSScanner.h.

  {
    return IsIdentStart(aFirstChar, aLexTable) ||
      (aFirstChar == '-' && IsIdentStart(aSecondChar, aLexTable));
  }

Here is the call graph for this function:

void nsCSSScanner::Unread ( ) [protected]

Member Data Documentation

Definition at line 156 of file nsCSSScanner.h.

Definition at line 149 of file nsCSSScanner.h.

Definition at line 159 of file nsCSSScanner.h.

Definition at line 149 of file nsCSSScanner.h.

Definition at line 159 of file nsCSSScanner.h.

PRUint8 nsCSSScanner::gLexTable [static, protected]

Definition at line 241 of file nsCSSScanner.h.

const PRUint8 nsCSSScanner::IS_DIGIT = 0x01 [static, protected]

Definition at line 235 of file nsCSSScanner.h.

const PRUint8 nsCSSScanner::IS_HEX_DIGIT = 0x02 [static, protected]

Definition at line 236 of file nsCSSScanner.h.

const PRUint8 nsCSSScanner::IS_IDENT = 0x08 [static, protected]

Definition at line 238 of file nsCSSScanner.h.

const PRUint8 nsCSSScanner::IS_WHITESPACE = 0x10 [static, protected]

Definition at line 239 of file nsCSSScanner.h.

Definition at line 217 of file nsCSSScanner.h.

Definition at line 230 of file nsCSSScanner.h.

Definition at line 219 of file nsCSSScanner.h.

nsFixedString nsCSSScanner::mError [protected]

Definition at line 231 of file nsCSSScanner.h.

Definition at line 232 of file nsCSSScanner.h.

Definition at line 230 of file nsCSSScanner.h.

Definition at line 230 of file nsCSSScanner.h.

Definition at line 228 of file nsCSSScanner.h.

Definition at line 216 of file nsCSSScanner.h.

Definition at line 223 of file nsCSSScanner.h.

Definition at line 226 of file nsCSSScanner.h.

Definition at line 224 of file nsCSSScanner.h.

Definition at line 218 of file nsCSSScanner.h.

Definition at line 220 of file nsCSSScanner.h.

Definition at line 221 of file nsCSSScanner.h.

Definition at line 222 of file nsCSSScanner.h.

Definition at line 229 of file nsCSSScanner.h.

const PRUint8 nsCSSScanner::START_IDENT = 0x04 [static, protected]

Definition at line 237 of file nsCSSScanner.h.


The documentation for this class was generated from the following files: