Expand description
Pure Rust-source lexer shared by search, callgraph, and indexing tools. 供搜索、调用图与索引工具共用的纯 Rust 源码词法器。
Every function here is a text transformation only: callers own file I/O. 这里的所有函数只做文本变换,文件 I/O 由调用方负责。
Function discovery lives here; calls scans call sites inside an extracted
body and walk owns the recursive source traversal.
函数发现位于本页;calls 扫描已提取函数体内的调用点,walk 拥有递归源码遍历。
Structs§
- Source
Function - One Rust function discovered in a source file. 在源码文件中发现的一个 Rust 函数。
- Source
Walk - Which subtrees a source walk never enters. 源码遍历永不进入的子树。
Enums§
- Keep
- What a walk should do with one
.rsfile it found. 遍历发现一个.rs文件后应当做什么。
Constants§
- MAX_
DEPTH - How deep the walk nests before it assumes the tree is cyclic. 遍历在假定树存在环之前允许达到的深度。
Traits§
- Source
Tree - The filesystem facts a recursive source walk needs. 递归源码遍历所需的文件系统事实。
Functions§
- body_
calls - Match a real function call in a body, ignoring comments, strings and macros. 只匹配函数体里的真实调用,跳过注释、字符串和宏调用。
- collect_
rust_ sources - Every
.rsfile underroot, depth-first, in directory order.root下每个.rs文件,深度优先,按目录顺序。 - direct_
calls - List the distinct direct callees of one function body, in sorted order. 列出函数体内的直接调用目标(去重并排序)。
- function_
source_ range - Find the 0-based inclusive line range of a function by name. 按名称查找函数的 0 起始闭区间行范围。
- function_
symbols - Index function bodies without treating comments, strings, or macro text as Rust. 扫描函数体时屏蔽注释、字符串和宏文本,避免把它们误认成 Rust 函数。
- mask_
non_ code - Replace comments and quoted literals with spaces while preserving offsets. 用空格替换注释和引号字面量,同时保留原始偏移量。 Blank the contents of comments, string literals and character literals. 把注释、字符串字面量与字符字面量的内容抹成空白。
- registration_
kinds - Collect the deduplicated
kind:values used in registration declarations. 收集注册声明中出现过的kind:取值,去重并排序。