25 lines
605 B
TypeScript
25 lines
605 B
TypeScript
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 {
|
|
return this.isKeyword(token, 'clear')
|
|
}
|
|
|
|
attemptParse(context: ParseContext): {} {
|
|
return {}
|
|
}
|
|
|
|
getDisplayName(): string {
|
|
return 'clear'
|
|
}
|
|
|
|
execute(vm: StrVM): Awaitable<StrVM> {
|
|
return vm.inPlace(ctx =>
|
|
ctx.replaceSubject(sub =>
|
|
sub.replaceWith('')))
|
|
}
|
|
}
|