SPRAAK
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
Data Structures | Functions
spr_pydoc_filter Namespace Reference

Data Structures

class  ModuleInfo
 Represents a parsed python file. More...
 
class  ClassInfo
 Represents a parsed class. More...
 
class  FunctionInfo
 Represents a parsed function. More...
 
class  ParamInfo
 Represents a function parameter. More...
 

Functions

def match_tree
 Utility function to find specific sub-trees of the parse tree. More...
 
def search_tree
 Utility function to find all subtrees starting with a specific node name. More...
 
def conv
 Utility function that converts token and symbol id numbers to readable strings. More...
 
def pprint_ast
 Utility function to dump a parse tree to stdout. More...
 
def split_comment
 Looks for an optional spr_* tag at the start of a comment. More...
 
def is_empty_line
 
def ws_len
 
def parse_endlist_line
 
def parse_itemlist_line
 
def convert_comment_lists
 
def tag_from_name
 Matches access level tags to functions based on naming convention. More...
 
def ast_to_tok
 Walks a parse tree and returns a list of all encountered token nodes. More...
 
def convert
 Convert python source code. More...
 
def main
 Main function. More...
 

Function Documentation

def spr_pydoc_filter.match_tree (   pat,
  tree 
)

Utility function to find specific sub-trees of the parse tree.

Parameters
patList of symbol and token ids that should be matched.
treeThe parse tree to search in.
def spr_pydoc_filter.search_tree (   symb,
  tree 
)

Utility function to find all subtrees starting with a specific node name.

Parameters
symbSymbol or token id to search for.
treeThe parse tree to search in.
def spr_pydoc_filter.conv (   ast)

Utility function that converts token and symbol id numbers to readable strings.

Used mainly for debuging.

Returns
A parse tree with strings.
Parameters
astThe parse tree with ids.
def spr_pydoc_filter.pprint_ast (   ast)

Utility function to dump a parse tree to stdout.

Parameters
astThe parse tree to be dumped.
def spr_pydoc_filter.split_comment (   comment)

Looks for an optional spr_* tag at the start of a comment.

Returns
A tuple with the tag (or None) and the comment without the tag.
Parameters
commentThe comment that needs splitting.
def spr_pydoc_filter.is_empty_line (   line)
def spr_pydoc_filter.ws_len (   ws)
def spr_pydoc_filter.parse_endlist_line (   line)
def spr_pydoc_filter.parse_itemlist_line (   line)
def spr_pydoc_filter.convert_comment_lists (   comment)
def spr_pydoc_filter.tag_from_name (   name)

Matches access level tags to functions based on naming convention.

  • Names starting with a single underscore are tagged private. (Unless they start and end with a double underscore)
  • All other names are tagged as public.
Returns
The access level for the given function or method.
Parameters
nameA name of a function or method.
def spr_pydoc_filter.ast_to_tok (   ast,
  tok = None 
)

Walks a parse tree and returns a list of all encountered token nodes.

Returns
A list of token nodes.
Parameters
astA parse tree.
tokAn optional list in which the token nodes will be collected.
def spr_pydoc_filter.convert (   fname,
  stdout = None,
  tag_mask = None 
)

Convert python source code.

Convert python source code to a format supported by doxygen.

Parameters
fnameThe file name holding the source code.
stdoutThe file object to which the converted code should be written. Defaults to stdout.
tag_maskA list of access level tags used to filter what should be documented. Defaults to all.
def spr_pydoc_filter.main ( )

Main function.

Expects one command-line argument, the input python file.