Skip to main content

Module syntax

Module syntax 

Source
Expand description

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

Two grammars live here: the registration-face parser in face and the host-entry declarations in entries. The module tree mirrors that split. 这里有两种语法:位于 face 的注册面解析器,以及位于 entries 的宿主入口声明。 模块树与这一分工一致。

Modules§

entries
Host-entry grammars: application!, graft_plan! and static_graft_plan!. 宿主入口语法:application!、graft_plan! 与 static_graft_plan!。
face
Registration-face parser shared by build-time checks and live authoring. 构建期检查与实时编辑共用的注册面解析器。

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. 声明为何解析不了;位置已知时一并给出。
GraftExpressions
Rust expressions used by a typed graft cut, in source order. 类型化 graft 切口使用的 Rust 表达式,按源码顺序。
GraftSyntax
A host-declared external graft cut discovered before code generation. 在代码生成前从宿主入口发现的一条外部 graft 切口。
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§

application_entries
Return the host entry paths declared with application!(entry = ...). 返回通过 application!(entry = ...) 声明的宿主入口路径。
compact_tokens
Render a token stream as compact Rust source text. 把 token 流渲染成紧凑的 Rust 源码文本。
graft_entries
Parse static and dynamic graft declarations without executing them. 解析静态和动态 graft 声明,不执行宏。
guard_nesting
Refuse a source whose nesting would overflow syn, for callers that parse text themselves. 对自行解析文本的调用方:拒绝一份嵌套会让 syn 栈溢出的源码。
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. 收集可执行表达式使用的路径,排除导入、注释、字符串和注册宏元数据。