Skip to main content

Module utils

Module utils 

Source
Expand description

Utility functions for working with the ForgeScript AST

Structs§

AstStats
Calculate statistics about the AST

Functions§

calculate_stats
contains_javascript
Check if the AST contains any JavaScript expressions
count_nodes
Count the number of nodes in the AST
extract_function_names
Extract all function names from the AST
extract_text_nodes
Get all text nodes from the AST
flatten_ast
Flatten the AST into a linear sequence of nodes (depth-first)
format_ast
Pretty-print the AST to a string
get_source_slice
Get a slice of the source code for a given span
max_nesting_depth
Find the deepest nesting level in the AST