parser.ST.totuple()

ST.totuple(line_info=False, col_info=False) Same as st2tuple(st, line_info, col_info).

parser.ST.tolist()

ST.tolist(line_info=False, col_info=False) Same as st2list(st, line_info, col_info).

parser.ST.issuite()

ST.issuite() Same as issuite(st).

parser.ST.isexpr()

ST.isexpr() Same as isexpr(st).

parser.ST.compile()

ST.compile(filename='') Same as compilest(st, filename).

parser.sequence2st()

parser.sequence2st(sequence) This function accepts a parse tree represented as a sequence and builds an internal representation if possible. If it can validate that the tree conforms to the Python grammar and all nodes are valid node types in the host version of Python, an ST object is created from the internal representation and returned to the called. If there is a problem creating the internal representation, or if the tree cannot be validated, a ParserError exception is raised. An ST obj

parser.ParserError

exception parser.ParserError Exception raised when a failure occurs within the parser module. This is generally produced for validation failures rather than the built-in SyntaxError raised during normal parsing. The exception argument is either a string describing the reason of the failure or a tuple containing a sequence causing the failure from a parse tree passed to sequence2st() and an explanatory string. Calls to sequence2st() need to be able to handle either type of exception, while ca

parser.issuite()

parser.issuite(st) This function mirrors isexpr() in that it reports whether an ST object represents an 'exec' form, commonly known as a “suite.” It is not safe to assume that this function is equivalent to not isexpr(st), as additional syntactic fragments may be supported in the future.

parser.isexpr()

parser.isexpr(st) When st represents an 'eval' form, this function returns true, otherwise it returns false. This is useful, since code objects normally cannot be queried for this information using existing built-in functions. Note that the code objects created by compilest() cannot be queried like this either, and are identical to those created by the built-in compile() function.

parser.expr()

parser.expr(source) The expr() function parses the parameter source as if it were an input to compile(source, 'file.py', 'eval'). If the parse succeeds, an ST object is created to hold the internal parse tree representation, otherwise an appropriate exception is raised.