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

+159 -1
View File
@@ -112,6 +112,60 @@ fn structure_collection() {
桃");
}
#[test]
fn structure_collection_map() {
assert_out(
"tests/structure/collection-map.mq.md",
"水果
蔬菜
数码用品
苹果
黄瓜
鼠标",
);
}
#[test]
fn structure_collection_map_list() {
assert_out(
"tests/structure/collection-map-list.mq.md",
"红富士
[红富士, 嘎啦]
黄瓜条",
);
}
#[test]
fn structure_footnote_index() {
assert_out(
"tests/structure/footnote-index.mq.md",
"苹果
梨
桃",
);
}
#[test]
fn structure_collection_records() {
assert_out(
"tests/structure/collection-records.mq.md",
"{品名: 苹果, 数量: 2}
苹果
3
{品名: 苹果, 数量: 2}
{品名: 梨, 数量: 3}",
);
}
#[test]
fn structure_collection_records_at() {
assert_out(
"tests/structure/collection-records-at.mq.md",
"apple
3",
);
}
#[test]
fn structure_import() {
assert_out(
@@ -358,6 +412,51 @@ fn error_div_zero() {
assert_err("tests/errors/div-zero.mq.md", "7:1", "division by zero");
}
#[test]
fn error_footnote_zero() {
assert_err(
"tests/errors/footnote-zero.mq.md",
"13:1",
"`[^0]` is invalid",
);
}
#[test]
fn error_footnote_oob() {
assert_err(
"tests/errors/footnote-oob.mq.md",
"13:1",
"out of range",
);
}
#[test]
fn error_footnote_missing_key() {
assert_err(
"tests/errors/footnote-missing-key.mq.md",
"13:1",
"missing map key",
);
}
#[test]
fn error_table_dup_header() {
assert_err(
"tests/errors/table-dup-header.mq.md",
"9:1",
"duplicate table header",
);
}
#[test]
fn error_table_row_marker_only() {
assert_err(
"tests/errors/table-row-marker-only.mq.md",
"9:1",
"row-oriented table needs field columns",
);
}
#[test]
fn error_bad_int() {
assert_err(
@@ -493,6 +592,65 @@ fn bytecode_collection() {
);
}
#[test]
fn bytecode_collection_map() {
assert_out_backend(
"tests/structure/collection-map.mq.md",
"bytecode",
"水果
蔬菜
数码用品
苹果
黄瓜
鼠标",
);
}
#[test]
fn bytecode_collection_map_list() {
assert_out_backend(
"tests/structure/collection-map-list.mq.md",
"bytecode",
"红富士
[红富士, 嘎啦]
黄瓜条",
);
}
#[test]
fn bytecode_footnote_index() {
assert_out_backend(
"tests/structure/footnote-index.mq.md",
"bytecode",
"苹果
梨
桃",
);
}
#[test]
fn bytecode_collection_records() {
assert_out_backend(
"tests/structure/collection-records.mq.md",
"bytecode",
"{品名: 苹果, 数量: 2}
苹果
3
{品名: 苹果, 数量: 2}
{品名: 梨, 数量: 3}",
);
}
#[test]
fn bytecode_collection_records_at() {
assert_out_backend(
"tests/structure/collection-records-at.mq.md",
"bytecode",
"apple
3",
);
}
#[test]
fn bytecode_print_keyword() {
assert_out_backend(
@@ -786,7 +944,7 @@ fn lib_writeback_get() {
#[test]
fn lib_subtask_spawn() {
assert_out("tests/lib/subtask-spawn.mq.md", "child-ok\ndone\nquiet-ok");
assert_out("tests/lib/subtask-spawn.mq.md", "child_ok\ndone\nquiet-ok");
}
#[test]