summaryrefslogtreecommitdiffstats
path: root/CONTEXT.md
diff options
context:
space:
mode:
Diffstat (limited to 'CONTEXT.md')
-rw-r--r--CONTEXT.md41
1 files changed, 35 insertions, 6 deletions
diff --git a/CONTEXT.md b/CONTEXT.md
index 7514a6f..c6bd5f9 100644
--- a/CONTEXT.md
+++ b/CONTEXT.md
@@ -375,6 +375,12 @@ Resolved this session:
375 All other commands reject input keywords with a syntax error — a 375 All other commands reject input keywords with a syntax error — a
376 command declares whether it takes input. `USE`/`TIL` are general 376 command declares whether it takes input. `USE`/`TIL` are general
377 building blocks; more consumers will come later. 377 building blocks; more consumers will come later.
378- **`cat <path> TIL <marker>` is sugar for `cat USE <path> TIL
379 <marker>`** (refined this session): the paths are the input source,
380 truncated at the first marker line across the combined stream —
381 `cat a b TIL m` reads `a` then `b` and stops at the first `m` line.
382 The single-source reading is unambiguous, so path args + `TIL` is
383 valid; path args + `USE` stays a syntax error (two input sources).
378- **Keywords: uppercase-only, aliases valid.** `WRITE`==`WRITING`, 384- **Keywords: uppercase-only, aliases valid.** `WRITE`==`WRITING`,
379 `TIL`==`UNTIL`, `USE`==`USING`; lowercase forms are ordinary text, so 385 `TIL`==`UNTIL`, `USE`==`USING`; lowercase forms are ordinary text, so
380 `echo use the force` can never redirect. Keywords are reserved 386 `echo use the force` can never redirect. Keywords are reserved
@@ -404,8 +410,9 @@ Assumed edge semantics (flag if wrong):
404 is silent, as `echo >` behaved before. 410 is silent, as `echo >` behaved before.
405- `-p` pauses terminal output only; with a file sink it is a no-op. 411- `-p` pauses terminal output only; with a file sink it is a no-op.
406- `-h N` / `-t N` require N ≥ 1; otherwise syntax error. 412- `-h N` / `-t N` require N ≥ 1; otherwise syntax error.
407- `cat p USE s` (path args *and* an input keyword) is a syntax error — 413- `cat p USE s` (path args *and* an explicit source keyword) is a
408 the input source is ambiguous. `cat USE s` and path-less `cat TIL m` 414 syntax error — the input source is ambiguous. `cat USE s`, path-less
415 `cat TIL m`, and `cat <path> TIL m` (sugar for `USE <path> TIL m`)
409 are the valid input forms. 416 are the valid input forms.
410- ADR 0002 (`docs/adr/0002-keyword-redirection-and-post-filters.md`) 417- ADR 0002 (`docs/adr/0002-keyword-redirection-and-post-filters.md`)
411 captures the keyword-redirection + post-filter decision; the ADR is 418 captures the keyword-redirection + post-filter decision; the ADR is
@@ -455,10 +462,16 @@ Everything above is now implemented in `shell/src/lib.rs`:
455 truncates and writes from offset 0, `TO` appends at current size. 462 truncates and writes from offset 0, `TO` appends at current size.
456 Diagnostics (errors, usage) always go to the terminal, never into 463 Diagnostics (errors, usage) always go to the terminal, never into
457 the pipeline or a file. 464 the pipeline or a file.
458- **Input consumers** — `cat`/`hexdump`, path-less only: no keyword = 465- **Input consumers** — `cat`/`hexdump`: no keyword = keyboard until
459 keyboard until ^D, `USE f` = file, `TIL m` = keyboard heredoc, 466 ^D, `USE f` = file, `TIL m` = keyboard heredoc, `USE f TIL m` =
460 `USE f TIL m` = file truncated at the exact marker line (marker and 467 file truncated at the exact marker line (marker and everything
461 everything after discarded). Other commands reject input keywords. 468 after discarded), and `cat <path> TIL m` / `hexdump <path> TIL m` =
469 the paths as source, truncated at the first marker across the
470 combined stream. Other commands reject input keywords.
471- **Ordering enforcement** — `USE`/`TIL` must precede the filters and
472 the output keyword; filters must precede the output keyword;
473 distinct messages for each violation ("must come before the
474 filters" / "must come before the output keyword").
462- **^D** — EOF everywhere, at the prompt it is a no-op (fresh 475- **^D** — EOF everywhere, at the prompt it is a no-op (fresh
463 prompt); ^C keeps line-cancel / stream-abort; `poweroff`/`exit` 476 prompt); ^C keeps line-cancel / stream-abort; `poweroff`/`exit`
464 are the only shutdown verbs. 477 are the only shutdown verbs.
@@ -474,9 +487,25 @@ Bugs found by QEMU verification and fixed:
4742. `cat USE f TIL m` leaked everything after the marker — the 4872. `cat USE f TIL m` leaked everything after the marker — the
475 final-partial-line emit ran even after the marker break; fixed 488 final-partial-line emit ran even after the marker break; fixed
476 with a `stopped` flag in `cat_file_until`/`hexdump_file_until`. 489 with a `stopped` flag in `cat_file_until`/`hexdump_file_until`.
4903. `cat file TO out TIL m` blamed the filters — the `trailing` flag
491 was set by both filters and the output keyword, so the "must come
492 before the filters" error fired for the output keyword too; the
493 parser now distinguishes them (`TO dst TIL m` → "TIL must come
494 before the output keyword"). Also: filters after the output
495 keyword (`TO dst -h 2`) were silently accepted — now a syntax
496 error.
4974. `cat file TIL m` was rejected as ambiguous — path args + `TIL` is
498 now sugar for `USE <path> TIL <marker>` (single source, truncated
499 at the marker); path args + `USE` remains a syntax error.
477 500
478Verified: 26 grammar checks pass on a fresh disk *and* on a reused 501Verified: 26 grammar checks pass on a fresh disk *and* on a reused
479one (rewriting existing files), `make test-disk` round trip is 502one (rewriting existing files), `make test-disk` round trip is
480fsck-clean, the `-p` pager pauses at screenfuls and resumes on 503fsck-clean, the `-p` pager pauses at screenfuls and resumes on
481keypress, `-h` stops `/dev/mem` at exactly N lines, and ^C flushes a 504keypress, `-h` stops `/dev/mem` at exactly N lines, and ^C flushes a
482`-t` window on an infinite stream. 505`-t` window on an infinite stream.
506
507Follow-up verification (this session): 10 checks pass in QEMU for the
508`cat <path> TIL <marker>` sugar — truncation at the marker, combined
509multi-path stream truncated at the first marker, filters after the
510sugar (`-h 1`), the heredoc round trip, all four ordering-error
511messages, and the `USE`-with-paths ambiguity message; fsck clean.