Files
oh-my-pi/packages/coding-agent/src/eval/eval.lark
T
can1357 028a442f18 feat(coding-agent): added parser support for t/rst in Cell eval
- Introduced canonical `*** Cell` headers with `t:` and `rst` attributes in eval prompts, schema, and docs.
- Updated parser and grammar to parse `*** Cell` blocks, stop on `*** End`/next header/EOF, and handle invalid `rst` with errors.
- Added quote-aware attribute tokenizers and split HTML eval parsing into `Cell` and legacy `Begin` handlers with `py` defaults.
- Expanded parsing behavior and tests for `rst` booleans, title aliases, abort boundaries, and stray-line skips between cells.
2026-05-12 10:01:56 +02:00

37 lines
1.2 KiB
Plaintext

// Canonical Eval input. Each cell is introduced by a single header line:
//
// *** Cell <LANG>:"<title>" [t:<duration>] [rst]
//
// Attribute order is fixed: language+title, then optional timeout, then
// optional reset flag. Title may be empty (`py:""`).
//
// Tokens:
//
// py:"..." | js:"..." language plus title (required)
// t:<digits>(ms|s|m)? per-cell timeout (default 30s)
// rst reset this language's kernel before running
//
// Everything between one header line and the next (or the optional trailing
// `*** End`, or end of input) is the cell's code, verbatim. The runtime
// parser additionally accepts content before the first header as an implicit
// default-language cell, but that is lenient fallback and MUST NOT be relied
// on.
start: cell+ end_marker
cell: cell_header code_line*
cell_header: "*** Cell" WS_INLINE LANG_TITLE (WS_INLINE T_ATTR)? (WS_INLINE RST_FLAG)? LF
end_marker: "*** End" LF?
code_line: CODE_TEXT LF | LF
CODE_TEXT: /([^*\r\n]|\*\*?[^*\r\n])+\*{0,2}|\*{1,2}/
LANG_TITLE: ("py" | "js") ":\"" /[^"\r\n]*/ "\""
T_ATTR: "t:" /\d+(ms|s|m)?/
RST_FLAG: "rst"
%import common.LF
%import common.WS_INLINE