import {Command, CommandData, ParseContext, StrTerm} from "./command.js"; import {Executable} from "../parse.js"; import {LexInput} from "../lexer.js"; export type OnData = { type: 'line'|'word', specific: StrTerm, exec: Executable, } export class On extends Command { async attemptParse(context: ParseContext): Promise { return { type: context.popKeywordInSet(['line', 'word']).value, specific: context.popTerm(), exec: await context.popExecutable(), } } getDisplayName(): string { return 'on' } isParseCandidate(token: LexInput): boolean { return this.isKeyword(token, 'on') } }