docs(frontend): specialize single-payload AST field explanations
This commit is contained in:
+11
-1
@@ -53,6 +53,16 @@ TYPE_NOTES = {
|
||||
FIELD_NOTES = {
|
||||
("AstDocument", "schema"): "协议身份,wire 按 AST_SCHEMA_ID 核对;不是源码内容哈希。",
|
||||
("AstDocument", "root"): "拥有的语法根,文档校验及编译从这里递归。",
|
||||
("AstRoot", "body"): "当前模式选中的模块、表达式或交互根载荷,compiler 按对应构造器生成入口代码。",
|
||||
("DeclKind", "definition"): "函数或类的完整声明,包含其名称、成员/参数及原文范围。",
|
||||
("StmtKind", "binding"): "let 新绑定,compiler 先分析/求右值,再登记目标初始化。",
|
||||
("StmtKind", "assignment"): "普通名称或成员赋值的完整节点,compiler 据构造器选择槽写入或属性写入。",
|
||||
("StmtKind", "statement"): "条件、循环或返回节点,compiler 按构造器处理路径、跳转或帧出口。",
|
||||
("StmtKind", "expression"): "语句位置的表达式;函数块丢弃结果,交互根可把它作为返回值。",
|
||||
("StmtKind", "declaration"): "交互根中的函数/类声明,compiler 预登记名称;嵌套声明当前被拒绝。",
|
||||
("ExprKind", "text"): "名称引用原文,由 compiler 名称分析解析到局部槽或全局名字表。",
|
||||
("ExprKind", "spelling"): "原始数字拼写,compiler 构造精确数值;不把文本先转为二进制浮点。",
|
||||
("ExprKind", "value"): "字符串解码后的拥有文本,原引号和转义仍可通过外层范围读取。",
|
||||
("Name", "text"): "拥有名称文本,不依赖输入缓冲存活。",
|
||||
("Program", "declarations"): "按源码顺序的声明;源码模块解析要求非空,文档结构本身不限制数量。",
|
||||
("Decl", "kind"): "函数/类声明载荷,JSON 和类型采用 kind/data 标签。",
|
||||
@@ -565,7 +575,7 @@ def editor_types(definitions, schema_id):
|
||||
# 每个构造器按稳定顺序生成,不合并名称相近但身份不同的分支。
|
||||
for variant in definition.variants:
|
||||
if definition.simple():
|
||||
# 拼接当前构造器的 kind 字面量和数据对象声明。
|
||||
# 无载荷简单枚举直接编码为字符串,不构造 kind/data 对象。
|
||||
value = json.dumps(variant.name)
|
||||
# 当前分支不是无载荷简单枚举,需要构造带 kind 及可选 data 的判别对象。
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user