summaryrefslogtreecommitdiff
path: root/src/sam_edit.zig
Commit message (Collapse)AuthorAge
* Edit's w and the other left-out sam commands fail EIO in words, never ↵Gabriel Schneider44 hours
| | | | | | | | | | | | | EOPNOTSUPP, and /os refuses a rename or a chmod as not permitted, EACCES "w is not supported in pardes" read through a mount as EOPNOTSUPP, as if the file system lacked an operation, and a chmod under /os was answered "invalid truncate", EINVAL. An Edit command pardes leaves out now says so in words 9ns reads as EIO, and a rename or mode change of an /os file is "permission denied", EACCES. fs.md's Failure section and /os entry say both. Co-Authored-By: Claude Opus 5.5 <[email protected]>
* A pattern anchoring some alternatives with ^ and not others is refused with ↵Gabriel Schneider44 hours
| | | | | | | | | | | | why, not a bare bad regular expression `^def|x` and `foo$|^zèbre` were refused with a bare "bad regular expression", the same words as a syntax error, so a script could not tell what to change. They now say "an alternation anchors every branch with ^ or none (^a|^b, not ^a|b)", through addr and Edit alike. fs.md states the rule and that a `$` does not count toward it (`foo$|bar` is fine). Co-Authored-By: Claude Opus 5.5 <[email protected]>
* A class with non-ASCII runes matches them: [éa-z] is taken as (é|[a-z]), a ↵Gabriel Schneider44 hours
| | | | | | | | range up to 256 runes spelled out mvzr's classes hold bytes, and it refused a multibyte member as a bad expression. Rewriting the class before compiling, as ^a|^b already is, needs no mvzr patch; runes that differ only in their last byte go as one alternative (\xc3[\xa0-\xbf] for [à-ÿ]) so a 256-rune range fits the 512-operation limit, which counts the pattern as rewritten. A wider range and [^é] are refused, naming why. Co-Authored-By: Claude Opus 5.5 <[email protected]>
* A bad command inside an Edit block written whole is named, not the } after itGabriel Schneider44 hours
| | | | | | A command in a { block that failed to parse ended the block there, so its } was taken as a control message of its own and the write failed unknown control message "}". A { block not yet closed now runs to its } whatever fails to parse in it, and the error names the command (Edit: unknown command z), as the line-by-line path does. Co-Authored-By: Claude Opus 5.5 <[email protected]>
* An Edit x gives each of its searches the step budget, and a search that ↵Gabriel Schneider44 hours
| | | | | | | | spends it says it took too much time The budget was the compiled pattern's, spent over every search an x made: Edit ,x/x+/c/z/ over 100k lines ran out and failed, blamed on backtracking. Each search now starts with the whole budget, and one that spends it says regular expression search took too much time, gave up. (Not "too long": 9ns reads those words as ENAMETOOLONG.) Co-Authored-By: Claude Opus 5.5 <[email protected]>
* A pattern up to 512 characters compiles; a longer one is refused naming the ↵Gabriel Schneider44 hours
| | | | | | | | limit mvzr's Regex holds 64 operations, so a pattern much past 64 bytes was refused as bad regular expression. pardes now compiles into mvzr's SizedRegex(512, 64), and a pattern that is too long (told apart from a malformed one by compiling it with room) says it is longer than mvzr's 512 operations. Co-Authored-By: Claude Opus 5.5 <[email protected]>
* A pattern with a newline and an anchor mvzr would misread is refused EINVAL, ↵Gabriel Schneider44 hours
| | | | | | | | as the doc says Its words named no malformed input, so 9ns read the refusal as EIO, and Edit's failed EIO directly. It now says bad regular expression: ..., and Edit's failure with those words is EINVAL too. Co-Authored-By: Claude Opus 5.5 <[email protected]>
* An a, c or i text with no . line fails the Edit, as an open { doesGabriel Schneider44 hours
| | | | | | | | | | sam takes the end of input as a text block's end, so a block cut short (a write that lost its tail, an open closed early) inserted half of itself. An Edit whose a, c or i text never meets its . line now fails with "a, c or i text not ended by a . line" and changes nothing, as an unclosed { does; at a close, logged as an err. Co-Authored-By: Claude Opus 5.5 <[email protected]>
* An Edit text block is found in linear time: only a . line is parsed againGabriel Schneider44 hours
| | | | | | | | | | | Finding where an Edit block ends parsed the whole block again for every line, copying it into the scratch arena each time: a 10k-line $a block took minutes and tens of GB. sam_edit.waitsFor says what the block waits for, and while that is a text block's . line, only such a line is parsed again (editEnd, shared by Messages and completeEnd), its copy freed. A 10k-line block now takes well under a second and 50 MB of scratch. Co-Authored-By: Claude Opus 5.5 <[email protected]>
* Edit's x, y and s match whole runes, as addresses doGabriel Schneider44 hours
| | | | | | | | | | | mvzr matches bytes, and only the addr path widened a match to runes, so ,x/./a/|/ on é split it into invalid UTF-8 and ,s/./X/g gave a combining sequence four X's. Edit's matches now go through the same rune alignment (and an empty match steps a rune, not a byte). runeStart no longer walks a stray continuation byte back onto the ASCII before it: an invalid byte is a place of its own. Co-Authored-By: Claude Opus 5.5 <[email protected]>
* Edit's refusals name the pattern, not the line, and say when dot is emptyGabriel Schneider44 hours
| | | | | | | | | | | A ctl Edit that missed answered `Edit: no match for regexp "Edit /nomatch/d"`, quoting the whole program; it now names the address that missed (`no match for regexp /nomatch/`) and quotes no line after. An s on an empty dot says `no substitution: dot is empty`. A \\1 is blamed only once its pattern has matched, as before. tags.md says & is special in s and not in c, a or i, as in sam. Co-Authored-By: Claude Opus 5.5 <[email protected]>
* A write of an Edit block reaches Edit whole, on a pane's ctl, the root's and ↵Gabriel Schneider44 hours
| | | | | | | | exec Every write was split into lines, so a { group or an a/c/i text block written to ctl or exec became lines of their own: i/.../ and } ran as shell command panes that exited 127. An Edit line now takes the lines after it while its group is open or its text block waits for its . line (sam_edit.needsMore, asking sam's parser), on all three; the root ctl takes Edit at the active pane. s/re/text/N counts as sN/re/text/ does. The docs and the skill show a block written by heredoc or env printf, since bash's printf writes line by line, and take round 5's doc list: get refusing once, the (xN) on a repeated err, limit bounding only a forward search's end, line:col's clamping, and $NINE_MOUNT under 9ns --unix. Co-Authored-By: Claude Opus 5.5 <[email protected]>
* An Edit with an unclosed { is refused, not runGabriel Schneider44 hours
| | | | | | Edit ,x/area_of/{ answered ok and did nothing: the group ran out of text and ran what it had. sam reads on for the }; an Edit has nothing more to read, so it now fails with unmatched `{', in the words sam uses for the other side. Co-Authored-By: Claude Opus 5.5 <[email protected]>
* ^ in a pattern with \n matches at every line start, and a ^ or $ that cannot ↵Gabriel Schneider44 hours
| | | | | | | | work is refused A pattern naming a newline runs over the whole text, where mvzr's ^ is only the text's start: /^def .*\n/ from #0 failed, and Edit ,x/^def .*\n/.../ silently did nothing. A leading ^ is now tried at each line start from the search's own; $ just before \n is dropped, as it changes nothing; any other ^ or $ in such a pattern is refused with why, since mvzr would read it as the text's ends. ^ inside an alternation holds only where a search starts, an mvzr limit, documented. Co-Authored-By: Claude Opus 5.5 <[email protected]>
* Edit runs sam's command language on a pane's body, as acme's Edit does, in ↵Gabriel Schneider44 hours
one undo step Over 9P a rename everywhere was a loop of addr and data writes. Edit, from a tag, a pane ctl or exec, parses sam's commands as acme's edit.c does and runs them as ecmd.c does against the text as it was, collecting the changes in order as elog.c logs them and applying them at once: addresses (the addr file's, line:col included), x y g v c a i d s p = m t, u alone, and { }. One undo step; any error, in acme's words, changes nothing, fails a ctl write and is logged. p and = print to the directory's +Errors. Left out, and said: the file commands, the pipes, \1-\9 (mvzr keeps no submatches), and changes out of sequence, which acme applies with a warning. Co-Authored-By: Claude Opus 5.5 <[email protected]>