Token
A Python syntax token.
The Token class is accessible via the pudge.scanner module.
This class provides access to information about a named python object. Token objects are arranged into a hierarchy that should look exactly like the introspection object hierarchy.
Token objects have six important attributes:
-
type - The token's type.
This will be one of the following string values:
- 'file' - The token is a root file token. The name attribute contains the name of the file.
- 'def' - The token describes a function or method.
- 'class' - The token describes a class.
- '=' - The token describes an attribute
- name - The name of the file, class, function, or attribute
- indent - The indent level as an integer starting at 0.
- line - The line number that the token appears on.
- last_line - The line at which the token is no longer 'on the stack'
- children - list of child tokens.
Methods
See the source for more information.