fix(search): reject empty phrases and phrases glued to other text
The lexer now keeps token offsets and rejects what the grammar never allowed but the token rules accepted: - an empty phrase: "" (matched every card), tag:"" - a phrase touching a word or another phrase: a"b", "a"b, "a""b" - whitespace between a qualifier and its phrase value: tag: "x" key:"value" stays the only legal contact; parentheses still delimit phrases. Listed in PLAN 6.1/6.2 and USAGE.
This commit is contained in:
1 parent
9277e2a331
commit
1d744ba504
4 files changed
+124
-12
No files matched your search
+4
-2
@@ -16,7 +16,7 @@
|
||||
- 网络共享明确不支持;命令行参数边界;macOS 无参启动行为写入文档(§2.3、§4.1、附录)
|
||||
- 补充:导出转义规则、卡片列表虚拟化、模态窗口 FlowDirection、`Resources` 类名使用规则、CI osx-x64 运行器(§5、§7、§8)
|
||||
- 依赖:Avalonia 11.3.6 → 11.3.22,Semi.Avalonia 11.2.1.10 → 11.3.22(§7)
|
||||
- 实现回补:搜索括号嵌套上限 64 层(§6.2);初始化中途锁冲突进锁冲突页、数据库文件缺失不静默新建(§4.4)
|
||||
- 实现回补:搜索括号嵌套上限 64 层,空短语、短语紧贴文本、`key:` 后空白均为非法(§6.1、§6.2);导出表格单元格转义 `\`(§5.8);初始化中途锁冲突进锁冲突页、数据库文件缺失不静默新建(§4.4)
|
||||
- 里程碑:标注 M0–M4 已完成,新增 **M4R(v1.9 回补)**(§9)
|
||||
|
||||
## 1. 项目概述
|
||||
@@ -279,10 +279,11 @@ key := tag | title | content | id | column
|
||||
value := word | phrase (tag/title/content/column)
|
||||
| '#'? digit+ (id:十进制正整数,可带前缀 #)
|
||||
word := 一个或多个字符,不含空白及 ( ) " : \ ;且不等于 AND / OR
|
||||
phrase := '"' 任意文本 '"' (内部支持转义:\" → 字面引号,\\ → 字面反斜杠)
|
||||
phrase := '"' 一个或多个字符 '"' (内部支持转义:\" → 字面引号,\\ → 字面反斜杠)
|
||||
```
|
||||
|
||||
- 裸词中出现 `:` 时其左侧必须是合法 key,否则为"未知限定符"错误;含 `:` `(` `)` `\` 等字符的搜索值须用引号(如 `"http://x"`)
|
||||
- 短语不得为空(`""`);短语与相邻裸词/短语之间须有空白或括号(`a"b"`、`"a"b`、`"a""b"` 非法),唯一例外是紧贴 key 的限定符值 `key:"…"`;`key:` 与短语值之间不得有空白(`tag: "x"` 非法)
|
||||
|
||||
### 6.2 语义
|
||||
|
||||
@@ -297,6 +298,7 @@ phrase := '"' 任意文本 '"' (内部支持转义:\" → 字面引号,
|
||||
- 运算符悬空(`bug AND`)、连续运算符(`a AND OR b`)
|
||||
- 限定符无值(`tag:`)、限定符值为裸 `AND`/`OR`(`tag:AND`,须写 `tag:"AND"`)
|
||||
- 短语引号未闭合、无效转义(`tag:"a\x"`)、裸词中出现 `\`
|
||||
- 空短语(`""`、`tag:""`);短语紧贴其他文本(`a"b"`、`"a"b`);`key:` 与短语值之间有空白(`tag: "x"`)
|
||||
- 未知限定符 key(合法 key 仅 tag / title / content / id / column)
|
||||
- `id:` 值不是十进制正整数(`id:abc`、`id:0`、`id:"61"`)
|
||||
- 错误对话框:模态、父窗口居中;文案 = 资源模板"查询表达式有误,详情:{0}"(i18n),{0} 处拼接解析器返回的**非 i18n 英文错误描述串**(对位置信息无要求)
|
||||
|
||||
Reference in new issue
Block a user