Module PrintAst
Provides queries to pretty-print a Python AST as a graph.
By default, this will print the AST for all elements in the database. To change this behavior,
extend PrintAstConfiguration
and override shouldPrint
to hold for only the elements
you wish to view the AST for.
Import path
import semmle.python.PrintAst
Imports
RegexTreeView | Provides a class hierarchy corresponding to a parse tree of regular expressions. |
Yaml | Provides classes for working with YAML data. |
python |
Predicates
edges | Holds if |
graphProperties | Holds if property |
nodes | Holds if |
Classes
AstElementNode | An |
CallArgumentsNode | A synthetic print node for the arguments to |
CallPrintNode | A print node for a |
ClassNode | A print node for classes. |
ExceptNode | A print node for |
ForPrintNode | A print node for |
FunctionDefNode | A print node for a |
FunctionNode | A print node for a |
FunctionParamsNode | A print node for the parameters in |
IfNode | A print node for |
ParameterNode | A print node for a |
PrintAstConfiguration | The query can extend this class to control which elements are printed. |
PrintAstNode | A node in the output tree. |
StmtListNode | A print node for |
StringLiteralNode | A print node for a |
TopLevelPrintAstNode | A top-level AST node. |
TryNode | A print node for |
WhilePrintNode | A print node for |
WithNode | A print node for |
Modules
PrintYaml | Classes for printing YAML AST. |