| Home | Trees | Index | Help |
|
|---|
|
|
Tokens are an intermediate data structure used while
constructing the structuring DOM tree for a formatted docstring. There
are five types of Token:
The text contained in each Token is stored in the
contents variable. The string in this variable has been
normalized. For paragraphs, this means that it has been converted into a
single line of text, with newline/indentation replaced by single spaces.
For literal blocks and doctest blocks, this means that the appropriate
amount of leading whitespace has been removed from each line.
Token has an indentation level associated with it,
stored in the indent variable. This indentation level is
used by the structuring procedure to assemble hierarchical blocks.
|
|||
|
__init__(self,
tag,
startline,
contents,
indent,
level=None)
Create a new Token.
|
|||
string
|
__repr__(self) | ||
| xml.dom.minidom.Element | to_dom(self, doc) | ||
|
|||
| PARA | The tag value for paragraph Tokens. |
||
| LBLOCK | The tag value for literal Tokens. |
||
| DTBLOCK | The tag value for doctest Tokens. |
||
| HEADING | The tag value for heading Tokens. |
||
| BULLET | The tag value for bullet Tokens. |
||
|
|||
| contents | The normalized text contained in this Token. |
||
| indent | The indentation level of this Token (in number of
leading spaces). |
||
| level | The heading-level of this Token if it is a heading;
None, otherwise. |
||
| startline | The line on which this Token begins. |
||
| tag | This Token's type. |
||
|
|||
Token.
|
|
|
|
|||
PARAThetag value for paragraph Tokens.
|
LBLOCKThetag value for literal Tokens.
|
DTBLOCKThetag value for doctest Tokens.
|
HEADINGThetag value for heading Tokens.
|
BULLETThetag value for bullet Tokens. This
tag value is also used for field tag Tokens,
since fields function syntactically the same as list items.
|
|
|||
contentsThe normalized text contained in thisToken.
|
indentThe indentation level of thisToken (in number of leading
spaces). A value of None indicates an unknown indentation;
this is used for list items and fields that begin with one-line
paragraphs.
|
levelThe heading-level of thisToken if it is a heading;
None, otherwise. Valid heading levels are 0, 1, and 2.
|
startlineThe line on which thisToken begins. This line number is
only used for issuing errors.
|
tagThisToken's type. Possible values are
Token.PARA (paragraph), Token.LBLOCK (literal
block), Token.DTBLOCK (doctest block),
Token.HEADINGC, and Token.BULLETC.
|
| Home | Trees | Index | Help |
|
|---|
| Generated by Epydoc 3.0alpha2 on Tue Apr 11 17:36:52 2006 | http://epydoc.sf.net |