CodeQL library for Java/Kotlin
codeql/java-all 0.8.12 (changelog, source)
Search

Module PrintAst

Provides queries to pretty-print a Java 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.code.java.PrintAst

Imports

java

Provides all default Java QL imports.

Predicates

edges

Holds if target is a child of source in the AST, and property key of the edge has the given value.

graphProperties

Holds if property key of the graph has the given value.

nodes

Holds if node belongs to the output tree, and its property key has the given value.

Classes

AnnotationPartNode

A node representing an Expr that is part of an annotation.

AnnotationsNode

A node representing the annotations of an Annotatable. Only rendered if there is at least one annotation.

BaseTypesNode

A node representing the base types of a Class or Interface that it extends or implements. Only redered if there is at least one such type.

CallableNode

A node representing a Callable, such as method declaration.

ClassInstanceExprNode

A node representing a ClassInstanceExpr.

ClassInterfaceNode

A node representing a Class or an Interface.

CompilationUnitNode

A node representing a CompilationUnit.

DocumentableNode

A node representing the documentation of a Documentable. Only rendered if there is at least one Javadoc attatched to it.

ElementNode

A node representing an AST node with an underlying Element.

ExprStmtNode

A node representing an Expr or a Stmt.

FieldDeclNode

A node representing a FieldDeclaration.

ForInitNode

A node representing the initializers of a ForStmt.

ForStmtNode

A node representing a ForStmt.

GenericCallableNode

A node representing the type parameters of a Callable. Only rendered when the callable in question is indeed generic.

GenericTypeNode

A node representing the type parameters of a Class or Interface. Only rendered when the type in question is indeed generic.

ImportNode

A node representing an Import.

ImportsNode

A node representing the Imports of a CompilationUnit. Only rendered if there is at least one import.

JavadocElementNode

A node representing a JavadocElement. Only rendered if it is part of the javadoc of some Documentable.

JavadocNode

A node representing a Javadoc. Only rendered if it is the javadoc of some Documentable.

KtInitializerNode

A node representing a KtInitializerAssignExpr.

LocalTypeDeclStmtNode

A node representing a LocalTypeDeclStmt.

LocalVarDeclExprNode

A node representing a LocalVariableDeclExpr.

LocalVarDeclSynthNode

A synthetic node holding a LocalVariableDeclExpr and its type access.

ParameterNode

A node representing a Parameter of a Callable.

ParametersNode

A node representing the parameters of a Callable. Only rendered if there is at least one parameter.

PrintAstConfiguration

The query can extend this class to control which elements are printed.

PrintAstNode

A node in the output tree.

RegExpTermNode

A node representing a regular expression term.

SingleLocalVarDeclParentNode

A node representing an element that can be the parent of up to one LocalVariableDeclExpr for which we want to use a synthetic node to variable declaration and its type access.

StringLiteralNode

A node representing a StringLiteral. If it is used as a regular expression, then it has a single child, the root of the parsed regular expression.

TopLevelPrintAstNode

A top-level AST node.

TypeVariableNode

A node representing a TypeVariable.

Aliases

RegexTreeView

Provides a class hierarchy corresponding to a parse tree of regular expressions.