🐛 fix(tsl-syntax-reference): route derived rules and bound section size

This commit is contained in:
csh
2026-08-20 15:49:41 +08:00
parent ca6830af9f
commit 5a8d95ebcf
7 changed files with 420 additions and 145 deletions
@@ -19,66 +19,82 @@
<!-- quickstart-rule: assignment -->
- 普通变量赋值使用 `:=``=` 在普通表达式里用于比较,不用于赋值。
Owner Section`syntax-06-004`
<!-- quickstart-rule: file-choice -->
- 未给后缀时,入口流程、脚本任务或一次性执行逻辑对应 `.tsl`;可复用交付物(函数、过程、类、模块或扩展文件)对应 `.tsf`;只是脚本内部封装函数或类时,仍按 `.tsl` 处理;仍不明确时向用户确认,不要把脚本入口和可复用模块合并成一个猜测文件。
Owner Section`syntax-02-002`
<!-- quickstart-rule: tsl-layout -->
- `.tsl` 脚本按两段理解:语句区在前并按顺序执行;声明区在后,可放 `function / procedure``type Name = class`。写 `.tsl` 时先写语句区,需要函数、过程或类时把声明区放在语句区之后。
Owner Section`syntax-02-002`
<!-- quickstart-rule: tsf-layout -->
-`.tsf` 时只写顶层函数 / 过程 / 类声明,或 `unit`;不要写成会直接顺序执行的脚本入口。
Owner Section`syntax-02-002`
<!-- quickstart-rule: tsf-filename -->
- `.tsf` 文件名(不含扩展名)必须与第一个顶层声明同名;第一个声明可以是同名 `function``type Name = class``unit`
Owner Section`syntax-02-002`
<!-- quickstart-rule: function-default -->
- 用户提示词里的“函数”默认对应 `function`,不要自动改写成 `procedure`
Owner Section`syntax-05-002`
<!-- quickstart-rule: procedure-explicit -->
- `procedure Name(...); begin ... end;` 只在用户明确要求 `procedure` / 过程时生成;不要因为没有返回值就自动改用 `procedure`
Owner Section`syntax-05-002`
<!-- quickstart-rule: class-shape -->
- 类定义统一按 `type Name = class ... end;` 写。
Owner Section`syntax-08-002`
<!-- quickstart-rule: object-creation -->
- 普通本地类实例化默认生成 `new ClassName()``createObject("ClassName")``createObject(ClassType)` 只在字符串类名、类类型变量或跨 `unit` 路径场景生成。
Owner Section`syntax-08-002`
<!-- quickstart-rule: unit-shape -->
- `unit` 是完整的顶层主体;常见完整形态是 `unit Name; interface ... implementation ... end.`
Owner Section`syntax-09-002`
<!-- quickstart-rule: unit-default -->
- 如果没有特殊需求,默认优先用完整形态;简写形态只在不需要显式区分 `interface` / `implementation` 时再用。
Owner Section`syntax-09-002`
<!-- quickstart-rule: named-arguments -->
- 调用时支持命名参数,写法是 `name: value`
Owner Section`syntax-05-002`
<!-- quickstart-rule: named-argument-order -->
- 一旦某次调用里开始使用命名参数,后面的参数就不能再退回位置参数。
Owner Section`syntax-05-002`
<!-- quickstart-rule: string-literal-default -->
- 普通单行文本默认使用 `"..."``'...'`;根据内容选择不冲突的引号,必要时再使用转义或连续同类引号。`%% ...%%` 仅用于多行文本、引号非常密集等原始字符串场景;不得因为内容是中文、非 ASCII 或较长就自动改用 `%%`
Owner Section`syntax-03-004`
<!-- quickstart-rule: string-prefix-by-type -->
- `U``L` 前缀只由目标字符串类型或已确认的 API 编码要求决定,不能因为内容是中文就自动添加;普通中文内容优先直接写成 `"中文内容"`
Owner Section`syntax-03-004`
<!-- quickstart-rule: index-origins -->
- `array(...)` 既可以写顺序数组,也可以写字符串键表;顺序数组和 `binary(...)` 二进制缓冲区下标从 `0` 开始,字符串下标从 `1` 开始。
Owner Section`syntax-03-002`
## 术语对照