Skip to main content

Module face

Module face 

Source
Expand description

Registration-face parser shared by build-time checks and live authoring. 构建期检查与实时编辑共用的注册面解析器。

This page owns the face grammar: finding declarations in a Rust file, exposing their fields, and splicing a replacement macro back into the source. The lexical helpers live in tokens and the field-value decoders in fields; both are re-exported here, so syntax::* keeps its one namespace. 本页拥有注册面语法:在 Rust 文件中发现声明、暴露其字段,并把替换用宏拼回源码。 词法辅助函数位于 tokens,字段取值解码位于 fields;两者都在此再导出, syntax::* 因此仍只有一个命名空间。

Structs§

FaceSyntax
Parsed registration declaration, independent of the macro that consumes it. 已解析的注册声明,与消费它的宏实现无关。
FaceSyntaxError
Why a declaration could not be parsed, and where when that is known. 声明为何解析不了;位置已知时一并给出。
SourceReferences
Paths one file’s executable expressions mention, and how much the scan could actually see. 一个文件的可执行表达式提到的路径,以及这次扫描实际能看到多少。
SyntaxLocation
A position inside a parsed source file, one-based in both axes. 已解析源文件里的位置,两个轴都从 1 开始。

Enums§

ParentSyntax
How a declaration names its parent, kept as written rather than resolved. 声明如何命名其父级,按原文保留而不在此解析。

Functions§

compact_tokens
Render a token stream as compact Rust source text. 把 token 流渲染成紧凑的 Rust 源码文本。
is_face_source
Whether source declares a registration face. 源码是否声明了注册面。
parse_face
Parse exactly one face, returning None when the file has no declaration. 解析唯一注册面;文件没有声明时返回 None。
parse_faces
Parse every NichLink face declaration in one Rust source file. 解析一个 Rust 源文件中的全部 NichLink 注册面声明。
replace_face_macro
Replace only the registration macro, preserving the surrounding Rust code. 只替换注册宏,保留同一文件里的其余 Rust 实现。
source_references
Collect paths used by executable expressions, excluding imports, comments, strings, and registration-macro metadata. 收集可执行表达式使用的路径,排除导入、注释、字符串和注册宏元数据。