Skip to content

feat(send-receive): add Send and Receive from_csv_token - #161

Merged
ssweber merged 1 commit into
mainfrom
feat/sr-from-csv
Nov 20, 2026
Merged

ssweber merged 1 commit into
mainfrom
feat/sr-from-csv

Conversation

@ssweber

@ssweber ssweber commented Nov 20, 2026

Copy link
Copy Markdown
Owner

Adds Send.from_csv_token(token) and Receive.from_csv_token(token), which Sam approved. Each reads a send(...) or receive(...) CSV token and returns the instruction, as Coil.from_csv_token() does for out(...). pyrung currently reaches into the internal CSV parser for this: csv.ast.AfCall, csv.token_parser.parse_af_token and send_receive.parse_af_call. These two methods replace those imports.

Behaviour

  • Parsing: both methods use the same parser that read_csv runs on an AF cell.
  • Errors: they raise the same CsvReadError or FieldError that read_csv raises for that cell, without the location.
  • Wrong token: a token of the other class raises CsvReadError, which names the method to use instead.

Tests

  • Every Send and Receive in the coverage goldens round-trips, read from both the .csv and the decoded .bin.
  • Every Send and Receive that an editor-grid case builds round-trips: 370 instructions.
  • from_csv_token matches read_csv on the same AF cell, for the instruction it returns and for seven bad tokens: the same class, code and message.
  • The reviewer separately swept 2466 constructed shapes. All of them round-trip.

Known gap, queued separately

Send and Receive tokens silently drop the following. read_csv behaves the same way today. Coil and Copy refuse these, and a follow-up branch will refuse them for Send and Receive too.

  • positional arguments;
  • unknown keywords, such as sucess=C2;
  • the other class's keywords;
  • a duplicate keyword.

Gate

  • make lint: passed.
  • make docs-build: passed.
  • make test: 18849 passed, 139 skipped.

Send.from_csv_token() and Receive.from_csv_token() read a send(...) or
receive(...) CSV token and return the instruction, as
Coil.from_csv_token() does for out(...). They use the parser read_csv
runs on an AF cell, and raise the same CsvReadError or FieldError that
read_csv raises for that cell. A token of the other class raises
CsvReadError and names the method to use instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ssweber
ssweber merged commit 8b2209a into main Nov 20, 2026
7 checks passed
@ssweber
ssweber deleted the feat/sr-from-csv branch November 20, 2026 00:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant