🎨 style(syntax): normalize naming conventions

Align all TSL syntax documentation examples with docs/tsl/naming.md:

- Classes/types: PascalCase, drop Hungarian prefix (THuman→Human)
- Parameters/locals: snake_case with meaningful names (isLeft→is_left, maxb→max_b)
- Private members: snake_case_ with trailing underscore (real_part_, imaginary_part_)
- Public members: PascalCase (value→Value)
- Top-level functions: PascalCase (test→Test)
- Module constants: kPascalCase (kernel_dll→kKernelDll)

Affected: 01-24 syntax docs (23 files)
Verified: 150+ code blocks locally tested, output unchanged
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
csh
2026-07-07 16:34:19 +08:00
co-authored by Claude Fable 5
parent 23c35fdfda
commit 014c23d386
23 changed files with 2009 additions and 352 deletions
+21 -21
View File
@@ -28,7 +28,7 @@
- `debugRunEnv(0)``debugRunEnv(1)` 可直接调用;它们面向调试客户端的副作用,不作为本页输出事实。
- `debugRunEnvDo Func(...)` 可直接写,并且会返回被调用函数的结果。
- `mtic` 会生成一个计时起点;`mtoc``mtoc(tick)` 都会返回秒数。
- `setProfiler(...)``getProfilerInfo(...)` 的参数规格见 [../reference/catalog/system.md](../reference/catalog/system.md);本页只保留性能分析器行为示例。
- `setProfiler(...)``getProfilerInfo(...)` 的参数规格见 [../codegen/builtin/system.md](../codegen/builtin/system.md);本页只保留性能分析器行为示例。
- `setProfiler(7)` 配合 `getProfilerInfo(1)`,可以在不弹窗的情况下拿到性能分析器信息。
- `__line__` 会返回所在代码行号。
- `__stack_frame` 会返回调用栈帧数组;最小 `toStn(...)` 观察结果里,每一项是 `(line, "function")` 这一类二元组。
@@ -108,9 +108,9 @@ writeLn("before");
a := Inner(3);
writeLn("after");
function Inner(bb);
function Inner(value);
begin
debugReturn bb;
debugReturn value;
end;
```
@@ -144,8 +144,8 @@ writeLn(1);
代码块身份:可直接照写示例
```tsl
r := debugRunEnvDo Demo(2);
writeLn(r);
result := debugRunEnvDo Demo(2);
writeLn(result);
function Demo(x);
begin
@@ -165,17 +165,17 @@ end;
代码块身份:可直接照写示例
```tsl
t1 := mtic;
s := 0;
tick1 := mtic;
sum := 0;
for i := 0 to 9999 do
s := s + i;
te1 := mtoc(t1);
t2 := mtic;
sum := sum + i;
elapsed1 := mtoc(tick1);
tick2 := mtic;
for j := 0 to 9999 do
s := s + j;
te2 := mtoc;
writeLn(te1 >= 0);
writeLn(te2 >= 0);
sum := sum + j;
elapsed2 := mtoc;
writeLn(elapsed1 >= 0);
writeLn(elapsed2 >= 0);
```
结果说明:
@@ -189,9 +189,9 @@ writeLn(te2 >= 0);
```tsl
setProfiler(7);
a := 99;
b := intToStr(a);
c := rand(10, 1);
value := 99;
str := intToStr(value);
random := rand(10, 1);
info := getProfilerInfo(1);
writeLn(ifArray(info));
writeLn(length(info) > 0);
@@ -210,8 +210,8 @@ writeLn(length(info) > 0);
代码块身份:可直接照写示例
```tsl
a := __line__;
writeLn(a);
line_number := __line__;
writeLn(line_number);
```
结果说明:
@@ -224,8 +224,8 @@ writeLn(a);
代码块身份:可直接照写示例
```tsl
s := Outer();
writeLn(toStn(s));
stack := Outer();
writeLn(toStn(stack));
function Inner();
begin