Replace StringRange w/ an actual StrRVal + more command implementations
This commit is contained in:
@@ -38,16 +38,15 @@ export class Quote extends Command<{ with?: StrTerm }> {
|
||||
}
|
||||
|
||||
execute(vm: StrVM, data: { with?: StrTerm }): Awaitable<StrVM> {
|
||||
return vm.inPlace(ctx =>
|
||||
ctx.replaceSubject(sub =>
|
||||
sub.modify(s => {
|
||||
let quote = '\''
|
||||
if ( data.with ) {
|
||||
quote = ctx.resolveString(data.with)
|
||||
}
|
||||
return vm.tapInPlace(ctx =>
|
||||
ctx.replaceSubjectAsString(sub => {
|
||||
let quote = '\''
|
||||
if ( data.with ) {
|
||||
quote = ctx.resolveString(data.with)
|
||||
}
|
||||
|
||||
s = stripQuotemarkLayer(s)
|
||||
return `${quote}${s}${quote}`
|
||||
})))
|
||||
sub = stripQuotemarkLayer(sub)
|
||||
return `${quote}${sub}${quote}`
|
||||
}))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user