Files
oh-my-pi/packages/hashline/src/grammar.lark
T
can1357 25299693c9 feat(hashline): updated grammar and documentation for unified put and cut syntax
- Update Lark grammar to support the unified put, cut, move, and remove operations.
- Update documentation and prompts to reflect canonical inclusive range separators and named register rules.
2026-07-31 00:28:54 +02:00

28 lines
717 B
Plaintext

start: begin_patch file_patch+ end_patch
begin_patch: "*** Begin Patch" LF
end_patch: "*** End Patch" LF?
file_patch: file_header hunk+
file_header: "[" filename "#" file_hash "]" LF
file_hash: /[0-9A-F]{4}/
filename: /[^#\r\n]+/
hunk: put_hunk | cut_hunk | rem_hunk | mv_hunk
put_hunk: "PUT " put_locator ":" LF body+
| "PUT " put_locator register LF
| "PUT " gap_locator LF
cut_hunk: "CUT " cut_locator register? LF
rem_hunk: "REM" LF
mv_hunk: "MV " filename LF
put_locator: range | LID "*" | gap_locator
cut_locator: range | LID "*"
gap_locator: "<" LID | ">" LID | ">" LID "*" | ">$"
register: " @" /[A-Za-z0-9_-]+/
range: LID ".=" LID
LID: /[1-9]\d*/
body: "+" /(.*)/ LF
%import common.LF