[WIP] Start implementing execution in the new TS version

This commit is contained in:
2026-02-09 18:09:47 -06:00
parent aaff8a5011
commit 82eda43dad
19 changed files with 378 additions and 10 deletions

View File

@@ -1,5 +1,7 @@
import {Command, ParseContext, StrTerm} from "./command.js";
import {LexInput} from "../lexer.js";
import {StrVM} from "../vm.js";
import {Awaitable} from "../../util/types.js";
export class Suffix extends Command<{ with: StrTerm }> {
attemptParse(context: ParseContext): { with: StrTerm } {
@@ -15,4 +17,10 @@ export class Suffix extends Command<{ with: StrTerm }> {
isParseCandidate(token: LexInput): boolean {
return this.isKeyword(token, 'suffix')
}
execute(vm: StrVM, data: { with: StrTerm }): Awaitable<StrVM> {
return vm.inPlace(ctx =>
ctx.replaceSubject(sub =>
sub.modify(s => `${s}${ctx.resolveString(data.with)}`)))
}
}