[WIP] Start implementing execution in the new TS version
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
import {Command, ParseContext} from "./command.js";
|
||||
import {LexInput} from "../lexer.js";
|
||||
import {StrVM} from "../vm.js";
|
||||
import {Awaitable} from "../../util/types.js";
|
||||
|
||||
export class Clear extends Command<{}> {
|
||||
isParseCandidate(token: LexInput): boolean {
|
||||
@@ -13,4 +15,10 @@ export class Clear extends Command<{}> {
|
||||
getDisplayName(): string {
|
||||
return 'clear'
|
||||
}
|
||||
|
||||
execute(vm: StrVM): Awaitable<StrVM> {
|
||||
return vm.inPlace(ctx =>
|
||||
ctx.replaceSubject(sub =>
|
||||
sub.replaceWith('')))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user