API Reference for Enthought Tool Suite 3.0.1
Parsers for specific attributes
Normal color declaration
colorDeclaration = (none | currentColor | colourValue)
currentColor = CaselessLiteral('currentColor').setParseAction(lambda t: [ 'CURRENTCOLOR', () ])
#Paint values
none = CaselessLiteral('none').setParseAction(lambda t: [ 'NONE', () ])
paint value will parse into a (type, details) tuple. For none and currentColor, the details tuple will be the empty tuple for CSS color declarations, it will be (type, (R,G,B)) for URLs, it will be ("URL", ((url tuple), fallback)) The url tuple will be as returned by urlparse.urlsplit, and can be an empty tuple if the parser has an error The fallback will be another (type, details) tuple as a parsed colorDeclaration, but may be the empty tuple if it is not present
paintValue = (url | colorDeclaration)
url = ((CaselessLiteral('URL') + Literal('(').suppress()) + Group(SkipTo(urlEnd, include = True).setParseAction(parsePossibleURL)))
urlEnd = ((Literal(')').suppress() + Optional(Group(colorDeclaration), default = ())) + StringEnd())
| Local name | Refers to |
|---|---|
| alphas | pyparsing.alphas |
| CaselessLiteral | pyparsing.CaselessLiteral |
| colourValue | enthought.savage.svg.css.colour.colourValue |
| Combine | pyparsing.Combine |
| Group | pyparsing.Group |
| hexnums | pyparsing.hexnums |
| Literal | pyparsing.Literal |
| oneOf | pyparsing.oneOf |
| Optional | pyparsing.Optional |
| SkipTo | pyparsing.SkipTo |
| string | string |
| StringEnd | pyparsing.StringEnd |
| urlparse | urlparse |
| Word | pyparsing.Word |
© Copyright 2002-2008 Enthought, Inc.