CodeQL library for JavaScript/TypeScript
codeql/javascript-all 1.1.3 (changelog, source)
Search

Module PrintAst

Provides queries to pretty-print a JavaScript 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.javascript.PrintAst

Imports

javascript

Provides classes for working with JavaScript programs, as well as JSON, YAML and HTML.

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

PrintAstConfiguration

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

PrintAstNode

A node in the output tree.

TopLevelPrintAstNode

A top-level AST node.

Modules

PrintHtml

Classes for printing HTML AST.

PrintYaml

Classes for printing YAML AST.