📝 docs(tsl): clarify syntax constraints and enhance test infrastructure
- Add TSF file naming constraint to syntax/02_core_model.md - Clarify semicolon rules: syntax facts vs style preferences - Separate control flow end semicolon rules (syntax allows both) - Add function body semicolon requirements to syntax/05_functions_and_calls.md - Move style preferences to code_style.md (control flow end semicolons) - Remove cross-references from syntax docs to maintain independence - Enhance Gitea workflow emoji for better CI output readability - Fix CI test path from tests/ to test/ - Organize agent test results under test/agent/result/ directory - Add complete Chinese translation of test cases (test_cases_zh.md) - Clean up .gitignore to use unified test/agent/result/ directory - Remove obsolete agent test artifacts (REPORTS_LOCATION.md, old results) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
+8
-16
@@ -4,9 +4,9 @@
|
||||
是否可直接用于生成代码:仅部分
|
||||
是否含可直接照写示例:否
|
||||
是否含不可照写反例:否
|
||||
遇到不确定时:[code_style.md](code_style.md)、[syntax/index.md](syntax/index.md)、[syntax/02_core_model.md](syntax/02_core_model.md)
|
||||
遇到不确定时:命名对象不明看 [syntax/02_core_model.md](syntax/02_core_model.md);代码组织看 [code_style.md](code_style.md);语法事实看 [syntax/index.md](syntax/index.md)
|
||||
|
||||
本页记录本仓库/作者的命名偏好,不代表 TSL 语法事实。命名偏好与 Google C++ Style Guide 的实体形状思路对齐:通过名字的“形状”快速判断实体类型(类型/函数/变量/常量等),减少阅读成本。
|
||||
本页记录本仓库/作者的命名偏好,不代表 TSL 语法事实。本页只规定命名后的实体如何取名,不承担文件模型、顶层声明、执行顺序等语法判断。命名偏好与 Google C++ Style Guide 的实体形状思路对齐:通过名字的“形状”快速判断实体类型(类型/函数/变量/常量等),减少阅读成本。
|
||||
|
||||
以下出现的 `<...>` 形式只表示命名或注释模板占位,不是源码字面量。
|
||||
|
||||
@@ -49,8 +49,7 @@
|
||||
|
||||
## 3. 类型命名(Type Names)
|
||||
|
||||
AI 先按 `.tsl` 可执行脚本与 `.tsf` 模块/函数扩展判断文件模型。`.tsl` 里的语句区按顺序执行,函数/类声明区放在语句区之后;`.tsf` 用于可复用顶层声明并部署到解释器 `funcext`。本页只覆盖“需要命名的顶层实体”,不覆盖脚本语句本身;文件模型判断本身以
|
||||
`docs/tsl/syntax/02_core_model.md` 为准。
|
||||
文件模型和顶层声明规则以 `docs/tsl/syntax/02_core_model.md` 为准。本页只覆盖“需要命名的顶层实体”,不覆盖脚本语句本身。
|
||||
|
||||
- **类与单元**使用
|
||||
`PascalCase`,不带下划线;名称应为名词/名词短语(通常单数),避免动词开头。
|
||||
@@ -65,20 +64,13 @@ AI 先按 `.tsl` 可执行脚本与 `.tsf` 模块/函数扩展判断文件模型
|
||||
|
||||
## 4. 文件命名与顶层声明(File Names)
|
||||
|
||||
TSL 的语法要求(仅 `.tsf`):每个 `.tsf`
|
||||
文件只能有一个顶层声明,且**文件基名必须与该顶层声明名字一致**。
|
||||
文件模型、可写顶层声明、声明与文件关系以
|
||||
`docs/tsl/syntax/02_core_model.md` 为准;本节只给已经确定要命名的文件/实体提供命名偏好。
|
||||
|
||||
- 更可靠的判断方式仍然是先看顶层内容,而不是只看扩展名;命名偏好只是补充“命名后的实体如何取名”,不替代文件模型判断。
|
||||
- 先用核心模型页判断目标是否存在需要命名的顶层实体;不要从本页反推
|
||||
`.tsl` / `.tsf` 可写结构。
|
||||
- 需要命名的顶层实体可以是 `function / procedure`、`type Name = class`、`unit`。
|
||||
- `.tsf` 代码文件:用于库/模块等“顶层声明”的首选承载文件;顶层声明可为
|
||||
`function / procedure`、`type Name = class`、`unit`,文件基名需与之同名。
|
||||
- `.tsl` 脚本文件:用于入口/编排层;允许直接写语句(如
|
||||
`a := 1; echo a;`),也可能出现顶层 `function / procedure` 骨架
|
||||
这类示例脚本外壳;如果同时出现脚本语句和函数/类声明,语句区在前,声明区在后;但风格上不把 `.tsl` 当成可复用顶层声明的默认落点,也不要求文件基名与函数名一致;可复用逻辑优先下沉到
|
||||
`.tsf`(见 `docs/tsl/code_style.md`)。
|
||||
- 注:`.tsf` 也是 TSL 源文件,命名/风格与 `.tsl` 遵循同一套规则。
|
||||
- **硬规则(仅
|
||||
`.tsf`)**:重命名顶层声明时必须同步重命名文件基名,否则语法/加载规则无法识别;批量重命名时也必须把这两处一起改掉。
|
||||
- 批量重命名时,把文件基名和顶层实体名作为同一组维护,避免检索和协作断裂。
|
||||
|
||||
命名建议:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user