Package cssutils :: Module token :: Class Token |
[hide private]
[frames] | no frames]

# Class Token

source code

    object --+
             |
            Token

constants for Tokenizer and Parser to use values are just identifiers!

a CSS Token consisting of

line
  startline of the token
col
  startcol of the token
type
  of the token
value
  literal value of the token including backslashes
normalvalue

  normalized value of the token

  - no `\` like `c\olor`
  - for type Token.S normalvalue is always u' ' - a single space
  - lowercase

So e.g. a token t might be initialized with:

    t = Token(1, 1, Token.IDENT, u'c\olor')

resulting in a token with the following attributes:

    t.line == 1
    t.col == 1
    t.type == Token.IDENT
    t.value == u'c\olor'
    t.normalvalue == u'color'

includes some CSS3 parts
  http://www.w3.org/TR/css3-selectors/

Instance Methods | [hide private]
Inherited from `object`: `__delattr__`, `__getattribute__`, `__hash__`, `__new__`, `__reduce__`, `__reduce_ex__`, `__setattr__`, `__str__`
invalid} return INVALID;
__init__(self, line=1, col=1, type=None, value=`u'````'`) x.__init__(...) initializes x; see x.__class__.__doc__ for signature | source code
_getvalue(self) | source code
_setvalue(self, value) | source code
__eq__(self, token) how to compare a token to another | source code
__repr__(self) string representation of Token | source code

Class Variables | [hide private]
| EOF = ``u'``EOF``'``
| IDENT = ``u'``{ident}``'``
| ATKEYWORD = ``u'``@{ident}``'``
| IMPORT_SYM = ``u'``@import``'``
| PAGE_SYM = ``u'``@page``'``
| MEDIA_SYM = ``u'``@media``'``
| CHARSET_SYM = ``u'``@charset``'``
| NAMESPACE_SYM = ``u'``@namespace``'``
| STRING = ``u'``{string}``'``
| HASH = ``u'``HASH #{name}``'``
| NUMBER = ``u'``{num}``'``
| PERCENTAGE = ``u'``PERCENTAGE {num}%``'``
| DIMENSION = ``u'``DIMENSION {num}{ident}``'``
| URI = ``u'``url\\({w}{string}{w}\\)|url\\({w}([!#$%&*-~]|{nonascii``...``
| UNICODE_RANGE = ``u'``U\\+[0-9A-F?]{1,6}(-[0-9A-F]{1,6})?``'``
| CDO = ``u'``<!--``'``
| CDC = ``u'``-->``'``
| SEMICOLON = ``u'``;``'``
| LBRACE = ``u'``{``'``
| RBRACE = ``u'``}``'``
| LBRACKET = ``u'``[``'``
| RBRACKET = ``u'``]``'``
| LPARANTHESIS = ``u'``(``'``
| RPARANTHESIS = ``u'``)``'``
| S = ``u'``[ ]``'``
| COMMENT = ``u'``COMMENT``'``
| FUNCTION = ``u'``{ident}\\(``'``
| IMPORTANT_SYM = ``u'``!{w}important``'``
| DELIM = ``u'``DELIM``'``
| UNIVERSAL = ``u'``*``'``
| CLASS = ``u'``.``'``
| GREATER = ``u'``>``'``
| PLUS = ``u'``+``'``
| TILDE = ``u'``~``'``
| INCLUDES = ``u'``~=``'``
| DASHMATCH = ``u'``|=``'``
| PREFIXMATCH = ``u'``^=``'``
| SUFFIXMATCH = ``u'``$=``'``
| SUBSTRINGMATCH = ``u'``*=``'``
| PSEUDO_ELEMENT = ``u'``::``'``
| INVALID = ``u'``INVALID``'``
invalid} return INVALID;
| COMMA = ``u'``,``'``

Properties | [hide private]
Inherited from `object`: `__class__`
invalid} return INVALID;
| value value and normalized value

Method Details | [hide private]

### __init__(self, line=1, col=1, type=None, value=`u'````'`) (Constructor) | source code
x.__init__(...) initializes x; see x.__class__.__doc__ for signature Overrides: object.__init__ (inherited documentation)

### __repr__(self) (Representation operator) | source code
string representation of Token Overrides: object.__repr__

Class Variable Details | [hide private]

  ### URI Value:
      u'url\\({w}{string}{w}\\)|url\\({w}([!#$%&*-~]|{nonascii}|{escape})*{w
      }\\)'

Property Details | [hide private]

  ### value value and normalized value Get Method: cssutils.token.Token._getvalue(self) Set Method: cssutils.token.Token._setvalue(self, value) Delete Method:
      None