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/
Inherited from object :
__delattr__ ,
__getattribute__ ,
__hash__ ,
__new__ ,
__reduce__ ,
__reduce_ex__ ,
__setattr__ ,
__str__
|
|
__init__(self,
line=1,
col=1,
type=None,
value=u'
' )
x.__init__(...) initializes x; see x.__class__.__doc__ for
signature |
source code
|
|
|
|
|
|
|
__eq__(self,
token)
how to compare a token to another |
source code
|
|
|
|
|
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 '
|
|
COMMA = u' , '
|
Inherited from object :
__class__
|
|
value
value and normalized value
|
__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)
|
string representation of Token
- Overrides:
object.__repr__
|
URI
- Value:
u' url\\({w}{string}{w}\\)|url\\({w}([!#$%&*-~]|{nonascii}|{escape})*{w
}\\) '
|
|