Files
str/src/vm/commands/word.ts

24 lines
574 B
TypeScript
Raw Normal View History

import {Command, CommandData, ParseContext, StrLVal} from "./command.js";
import {Executable} from "../parse.js";
import {LexInput} from "../lexer.js";
export type WordData = {
exec: Executable<CommandData>,
}
export class Word extends Command<WordData> {
async attemptParse(context: ParseContext): Promise<WordData> {
return {
exec: await context.popExecutable(),
}
}
getDisplayName(): string {
return 'word'
}
isParseCandidate(token: LexInput): boolean {
return this.isKeyword(token, 'word')
}
}