🐛 fix(tsl-syntax-reference): repair routing for colloquial queries

- split 03's overloaded 字符串边界规则: substring read/replace/delete/insert
  now sit in 字符串子串读写 with their own tags, so `截取子串` / `子串` /
  `字符串区间` stop returning only weak candidates, which SKILL.md tells the
  agent to treat as a fact gap even though the fact is on the page
- tag the remaining 03 section for wide strings, encoding conversion and
  binary buffers; those queries used to land on the neighbouring concat
  section, or on 23's binary-function overload
- add 异常处理 to 07's try-except and rename 21's H3 to 无效输入替换参数: the
  matrix ErrDefine section owned that phrase and outranked try-except by
  92 to a weak 11, while its own text says NAN is not an error position
- tag 03's like section for 正则表达式 and 08 for 调用父类方法 / 定义类; all
  three reached the wrong section on the right page, and 定义类 could not
  reach 最小类与声明位置 at all because the per-page cap was already full
- drop the redundant 可直接照写示例 under 03's 禁止项 and state the closed
  interval rule as a bullet instead; a positive example does not belong in
  the prohibition list

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
csh
2026-07-30 21:33:29 +08:00
co-authored by Claude Opus 5
parent 68a3b852b0
commit 948a3ed85b
4 changed files with 14 additions and 22 deletions
@@ -164,7 +164,7 @@ C
### 字符串边界规则
<!-- tags: 原始字符串, 多行字符串, 引号怎么转义, 字符串里带引号, 长文本 -->
<!-- tags: 原始字符串, 多行字符串, 引号怎么转义, 字符串里带引号, 长文本, 宽字符串, 宽串前缀, utf8 转换, 编码转换, 字符码拼接, 二进制缓冲区, 字节读写 -->
原始字符串 `%%` 的空白分隔、标识符和多行:
@@ -303,6 +303,12 @@ writeLn(b[1] = "1");
- 说明二进制缓冲区的 `[]` 下标从 `0` 开始
- 也说明二进制缓冲区项可以直接按单字节读写
### 字符串子串读写
<!-- tags: 取子串, 截取子串, 字符串区间, 替换子串, 删除子串, 插入子串, 插入字符串, 取字符串的一段 -->
字符串子串统一用 `s[start:end]` 区间访问,`end` 包含在结果里;同一形态既能读取,也能替换、删除和插入。
字符串子串读取:
代码块身份:可直接照写示例
@@ -398,7 +404,7 @@ A=1 B=2.34 C=AAA
### 字符串 `like` 模式匹配
<!-- tags: 通配符匹配, 正则匹配, 模糊匹配, 判断是否符合模式 -->
<!-- tags: 通配符匹配, 正则匹配, 正则表达式, 模糊匹配, 判断是否符合模式 -->
`like` 用于判断字符串是否符合指定模式(支持通配符和正则表达式):
@@ -510,6 +516,7 @@ items := array(1, 2, 3);
-`s[0]` 访问字符串首字符。
- 误以为 `array(...)` 只能写顺序数组,不能写字符串键表。
- 误以为字符串区间和数组一样从 `0` 开始。
- 把字符串区间当成数组切片式的半开区间;`s[1:3]` 返回 `ABC` 而不是 `AB`,结束位会被包含进结果,正向示例见本页“字符串子串读写”。
-`s[index:0] := ...` 误解成“替换到第 0 位”。
- 把二进制缓冲区也按字符串的 `1` 基下标去理解。
- 在普通字符串示例里默认切到原始字符串、宽串 / UTF8 前缀、字符码或编码转换,却没有按本页字符串边界规则确认。
@@ -531,18 +538,3 @@ writeLn(s[0]);
```text
String index out of bounds
```
代码块身份:可直接照写示例
```tsl
s := "ABCDE";
writeLn(s[1:3]);
```
不要把上面这个区间访问类比成数组切片的半开区间。按文档输出,它返回 `ABC`,不是 `AB`;字符串区间的结束位会被包含进结果。
代码块身份:输出片段
```text
ABC
```
@@ -305,7 +305,7 @@ mid
### `try ... except`
<!-- tags: 捕获异常, 出错处理, 抓错误, 异常不中断 -->
<!-- tags: 捕获异常, 异常处理, 出错处理, 抓错误, 异常不中断 -->
代码块身份:可直接照写示例
@@ -59,7 +59,7 @@
### 最小类与声明位置
<!-- tags: 定义一个类, 类怎么写, 最短类, 类放在哪, 类骨架 -->
<!-- tags: 定义一个类, 定义类, 类怎么写, 最短类, 类放在哪, 类骨架 -->
最短类骨架:
@@ -897,7 +897,7 @@ end;
### 重载、继承与析构
<!-- tags: 继承, 父类子类, 方法重载, 同名不同参, 析构, 对象销毁时 -->
<!-- tags: 继承, 父类子类, 方法重载, 同名不同参, 析构, 对象销毁时, 调用父类方法, 父类同名方法, inherited -->
`overload` 方法:
@@ -656,9 +656,9 @@ writeLn(a[0][0]);
- `:*=``:/=``:\=``:^=` 分别是矩阵乘、除、左除、乘方的复合赋值形式
- `a :*= b` 等价于 `a := a :* b`
### 基础函数的矩阵广播与异常处理参数
### 基础函数的矩阵广播与无效输入替换参数
<!-- tags: 对整个矩阵取整, 函数作用于每个元素, 广播, 出错时给默认值 -->
<!-- tags: 对整个矩阵取整, 函数作用于每个元素, 广播, 出错时给默认值, 无效输入替换, errdefine, errreplace -->
多参数基础函数支持逐参数广播: