Implement table semantic T0-T4: map/records/footnote get

- 1-col table stays a List; >=2-col becomes a column-oriented Map
  (1 data row -> scalar values, >=2 -> Map of Lists).
- First header @ / 行 / row opts into row-oriented List of Maps
  (marker column excluded); missing field cols is a diagnostic.
- Footnote index: `xs`[^1] (1-based list), `m`[^key] (map key), chained.
  Errors for [^0], out-of-range, missing key, duplicate headers.
- foreach walks list items or map keys; Map values now display as {k: v}.
- Sync both tree and bytecode backends; new gold + error fixtures, docs
  (markdown-mapping, roadmap, skill, public), and public 07/08 pages.
- Fix subtask-spawn fixture return value to child_ok (child-ok parses as
  subtraction).

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
cflmyandCursor committed 2026-08-10 09:50:21 +08:00
1 parent 3463628165
commit a23fdedfa2
37 files changed
+846 -51

No files matched your search

+2 -2
View File
@@ -1,11 +1,11 @@
---
title: Collections (tables)
description: GFM tables are collections
description: One-column tables are lists
---
# main
A Markdown table is a collection; loop to read each row.
A single-column Markdown table is a list; loop to read each item. Use `basket`[^1] for 1-based index.
`basket` =
+2 -2
View File
@@ -1,11 +1,11 @@
---
title: 集合(表)
description: GFM 表格即集合
description: 单列竖表即列表
---
# main
Markdown 表是集合;用循环读每一行。
单列 Markdown 表是列表;用循环读每一项。按下标用 `` `篮子`[^1] ``(1-based)。
`篮子` =
+22
View File
@@ -0,0 +1,22 @@
---
title: Maps (horizontal tables)
description: Multi-column tables are maps; footnote gets
---
# main
A multi-column table with one data row is a map. Read values with footnote keys.
`kinds` =
| apple | cucumber |
|-------|----------|
| fruit | vegetable |
*`k` = `kinds`[^apple] *
> print text=`k`
*`k` = `kinds`[^cucumber] *
> print text=`k`
+22
View File
@@ -0,0 +1,22 @@
---
title: 字典(横表)
description: 多列表是字典;脚注按键取元
---
# main
多列且仅一行数据的表是字典。用脚注键取元。
`分类` =
| 苹果 | 黄瓜 |
|------|------|
| 水果 | 蔬菜 |
*`种` = `分类`[^苹果] *
> 打印 内容=`种`
*`种` = `分类`[^黄瓜] *
> 打印 内容=`种`
+23
View File
@@ -0,0 +1,23 @@
---
title: Row records
description: First header @ / row makes a list of maps
---
# main
When the first header is `@` or `row`, each data row is a map (marker column is not a field).
`orders` =
| @ | name | qty |
|---|------|-----|
| 1 | apple | 2 |
| 2 | pear | 3 |
*`n` = `orders`[^1][^name] *
> print text=`n`
*`q` = `orders`[^2][^qty] *
> print text=`q`
+23
View File
@@ -0,0 +1,23 @@
---
title: 行向记录表
description: 首列表头「行」→ 每行一个字典
---
# main
首列表头为 `行`(或 `@` / `row`)时,每行数据是一个字典;标记列不进入字段。
`订单` =
| 行 | 品名 | 数量 |
|----|------|------|
| 1 | 苹果 | 2 |
| 2 | 梨 | 3 |
*`名` = `订单`[^1][^品名] *
> 打印 内容=`名`
*`量` = `订单`[^2][^数量] *
> 打印 内容=`量`