Introduce TermOperator helper and refactor execute()s to use replaceSubjectMatchingTerm

This commit is contained in:
2026-02-09 23:49:30 -06:00
parent feba84051a
commit f36621c646
25 changed files with 243 additions and 159 deletions

View File

@@ -38,8 +38,8 @@ export class Quote extends Command<{ with?: StrTerm }> {
}
execute(vm: StrVM, data: { with?: StrTerm }): Awaitable<StrVM> {
return vm.tapInPlace(ctx =>
ctx.replaceSubjectAsString(sub => {
return vm.replaceContextMatchingTerm(ctx => ({
string: sub => {
let quote = '\''
if ( data.with ) {
quote = ctx.resolveString(data.with)
@@ -47,6 +47,7 @@ export class Quote extends Command<{ with?: StrTerm }> {
sub = stripQuotemarkLayer(sub)
return `${quote}${sub}${quote}`
}))
}
}))
}
}