Skip to main content

Module preprocess

Module preprocess 

Source
Expand description

Include handling: parse files and build a tree of (path, source, AST) with circular include detection.

Paths are resolved relative to the directory of the current file (or the current working directory when parsing from stdin). Circular includes are detected and reported as errors. No source expansion: each file keeps its own AST.

Structs§

IncludeTree
One file in the include tree: path, source, parsed root, and parsed included files in order.

Enums§

IncludeError
Error from the include preprocessor.

Functions§

all_files
Flatten the tree into (path, source) for all files (root first, then includes depth-first).
build_include_tree
Build the include tree: parse source as the main file, resolve each include("path"), load and parse those files (with circular include detection), and return the tree.
collect_include_path_ranges
Collect (start_byte, end_byte, path_string) for each include("...") in the file. Used by the LSP to provide document links and go-to-definition on include paths.