Skip to content

Document resyntax/grimoire/string-replacement#790

Merged
jackfirth merged 8 commits into
masterfrom
grimoire-string-replacement
Jul 9, 2026
Merged

Document resyntax/grimoire/string-replacement#790
jackfirth merged 8 commits into
masterfrom
grimoire-string-replacement

Conversation

@jackfirth

@jackfirth jackfirth commented Jul 7, 2026

Copy link
Copy Markdown
Owner

Continues the grimoire documentation effort (#785, #787, #789) by documenting the string replacement API — the lowest-level form that Resyntax's suggestions take before being written to files.

jackfirth and others added 3 commits July 5, 2026 21:06
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The string-too-short error in string-replacement-render was reported
under the name string-apply-replacement, a copy-paste slip.

Additionally, a replacement's required length now accounts for its end
position, not just the positions its copied pieces refer to. Applying
a replacement to a string shorter than the replaced region previously
skipped the friendly error and failed inside make-string with a
confusing contract violation.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@jackfirth jackfirth added the documentation Improvements or additions to documentation label Jul 7, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resyntax analyzed 5 files in this pull request and found no issues.

@coveralls

coveralls commented Jul 7, 2026

Copy link
Copy Markdown

Coverage Status

coverage: 93.995% (+0.1%) from 93.878% — grimoire-string-replacement into master

The pieces making up a string replacement's contents are now called
string pieces, with a string-piece struct supertype underneath both
kinds and a public string-piece? predicate. The pieces aren't
exclusively tied to replacements --- syntax-replacement uses their
spans directly when narrowing replacement focus --- so the
replacement-string-span operation is now string-piece-span, and
contracts say string-piece? instead of enumerating the two kinds.

Also converts copied-string from define-tuple-type to a plain struct,
matching inserted-string.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resyntax analyzed 5 files in this pull request and found no issues.

jackfirth and others added 2 commits July 8, 2026 23:47
The Narrowing the Focus of Replacements section now has a tag so the
string-replacement-normalize docs can point at it.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resyntax analyzed 5 files in this pull request and found no issues.

- string-replacement-normalize is now string-replacement-focus, tying
  it to the replacement focusing feature it implements and dissolving
  the confusing two-kinds-of-normalization vocabulary
- string-apply-replacement is now string-replacement-apply, joining
  the string-replacement-* naming family and taking the replacement
  first like every other operation
- string-replacement-render is now string-replacement-new-text,
  completing the accessor family: new-span is its length and new-end
  is where it ends
- file-apply-string-replacement! is now string-replacement-apply-to-file!

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resyntax analyzed 5 files in this pull request and found no issues.

string-replacement-focus previously returned replacements unchanged
when they didn't alter the string at all, contradicting the documented
behavior. Focusing a no-op replacement now shrinks it to the smallest
no-op replacement satisfying the preservation constraints: the region
between preserve-start and preserve-end (clamped to the original
region) with a single copied piece, degenerating to an empty
replacement at the constraint position (or at the original start when
no constraints are given).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@jackfirth jackfirth marked this pull request as ready for review July 9, 2026 07:36
@jackfirth jackfirth enabled auto-merge (squash) July 9, 2026 07:39
@jackfirth jackfirth merged commit cf9db51 into master Jul 9, 2026
7 checks passed
@jackfirth jackfirth deleted the grimoire-string-replacement branch July 9, 2026 07:39

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resyntax analyzed 5 files in this pull request and found no issues.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resyntax analyzed 0 files in this pull request and found no issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants