HappyDoc Generated Documentation HappyDoc3-r3_1/happydoclib/parseinfo/utils.py

HappyDoc3-r3_1 / happydoclib / parseinfo / utils.py 

Utility functions for parseinfo package.

Functions   
  findNode 
findNode (
        tree,
        node,
        response=None,
        )

Return a sequence of subtrees starting with node value of node.

  parseTreeToString 
parseTreeToString ( tree,  separator=' ' )

Convert a parse tree to a string which would have parsed in that way.

Given a parse tree, walk it to determine the original string which would have been parsed to produce that tree.

  drill 
drill ( tree,  depth )

Return the section of the parse tree that is depth nodes deep.

  lenientMatch 
lenientMatch (
        pattern,
        data,
        vars=None,
        dbg=0,
        )

Match `data' to `pattern', with variable extraction.

pattern
Pattern to match against, possibly containing variables.
data
Data to be checked and against which variables are extracted.
vars
Dictionary of variables which have already been found. If not provided, an empty dictionary is created.

The `pattern' value may contain variables of the form ['varname'] which are allowed to match anything. The value that is matched is returned as part of a dictionary which maps varname to the matched value. varname is not required to be a string object, but using strings makes patterns and the code which uses them more readable.

This function is based on the match() function, but is more lenient. The pattern does not have to completely describe the tree. Instead, it can be the top portion of the tree. Everything must match down to the leaves of the pattern. At that point, the matching stops. If a match was found at all, the return values indicate a match.

This function returns two values: a boolean indicating whether a match was found and a dictionary mapping variable names to their associated values.

  joinCodeSnippets 
joinCodeSnippets (
        first,
        second,
        separator,
        )

Join two code snippets into one string.

Use some general code content rules to try to make the resulting snippet look nice.

  match 
match (
        pattern,
        data,
        vars=None,
        dbg=0,
        )

Match `data' to `pattern', with variable extraction.

pattern
Pattern to match against, possibly containing variables.
data
Data to be checked and against which variables are extracted.
vars
Dictionary of variables which have already been found. If not provided, an empty dictionary is created.

The `pattern' value may contain variables of the form ['varname'] which are allowed to match anything. The value that is matched is returned as part of a dictionary which maps varname to the matched value. varname is not required to be a string object, but using strings makes patterns and the code which uses them more readable.

This function returns two values: a boolean indicating whether a match was found and a dictionary mapping variable names to their associated values.

Classes   

This document was automatically generated Tue Dec 5 08:31:01 2006 by HappyDoc version 3.1