Add chunk command, add limit param to split command

This commit is contained in:
2026-04-06 09:22:13 -05:00
parent 055babc9f3
commit 32aa8dc3d1
4 changed files with 121 additions and 4 deletions

View File

@@ -1,4 +1,4 @@
import {Command, CommandData, ParseContext, StrLVal} from "./command.js";
import {Command, CommandData, ParseContext, StrLVal, wrapString} from "./command.js";
import {Executable} from "../parse.js";
import {LexInput} from "../lexer.js";
import {StrVM} from "../vm.js";
@@ -26,7 +26,7 @@ export class Over extends Command<OverData> {
async execute(vm: StrVM, data: OverData): Promise<StrVM> {
return vm.tapInPlace(async parentCtx => {
const oldValue = parentCtx.resolveRequired(data.subject)
const oldValue = parentCtx.resolve(data.subject) || wrapString('')
const newValue = await vm.runInChild(async (child, childCtx) => {
await childCtx.replaceSubject(() => oldValue)
await data.exec.command.execute(child, data.exec.data)