Move keyword recognition out of the Markdown mapper and into the single expression/statement parser: - add parse_payload_statement + PayloadStatement for if/else/while/end/ return/params/ordinary; keyword matching uses complete tokens, requires whitespace before a control expression, rejects trailing tokens/colons and reserves the statement words in expression positions - keep expression spans payload-relative so the frontend can rewrite them onto the file; malformed params(...) interiors stay owned by the signature parser (one sem.syntax diagnostic, not a duplicate) - simplify the frontend mapper to control-stack lowering and mapped semantic diagnostics only - emit sem.no_entry_function from run when no Exec H2 main exists - add else-under-while, params-in-quote, Knowledge-inertness and no-entry tests; update the corpus counts - make the EBNF parameter type annotation optional (params(n) is valid) Verified: cargo fmt --check, cargo clippy -D warnings and cargo test --workspace --locked: 501 passed, 0 failed, 2 ignored.
26 lines
409 B
Markdown
26 lines
409 B
Markdown
# @knowledge 使用说明
|
|
|
|
普通列表与引用是文档结构:
|
|
|
|
1. 第一步
|
|
2. 第二步
|
|
|
|
> 这是一段引用,不会调用任何函数。
|
|
|
|
## @exec 求和
|
|
|
|
普通列表和引用在 Exec 区域也只是容器,不产生语句:
|
|
|
|
1. 说明一
|
|
2. 说明二
|
|
|
|
> 引用说明。
|
|
|
|
`params(a: Int, b: Int)`
|
|
|
|
`return a + b`
|
|
|
|
## @knowledge 补充说明
|
|
|
|
这里的 `if x > 0` 与 **重点** 都只是文档。
|