26 lines
636 B
TypeScript
26 lines
636 B
TypeScript
|
|
import {Command, CommandData, ParseContext, StrLVal} from "./command.js";
|
||
|
|
import {Executable} from "../parse.js";
|
||
|
|
import {LexInput} from "../lexer.js";
|
||
|
|
|
||
|
|
export type OverData = {
|
||
|
|
subject: StrLVal,
|
||
|
|
exec: Executable<CommandData>,
|
||
|
|
}
|
||
|
|
|
||
|
|
export class Over extends Command<OverData> {
|
||
|
|
async attemptParse(context: ParseContext): Promise<OverData> {
|
||
|
|
return {
|
||
|
|
subject: context.popLVal(),
|
||
|
|
exec: await context.popExecutable(),
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
getDisplayName(): string {
|
||
|
|
return 'over'
|
||
|
|
}
|
||
|
|
|
||
|
|
isParseCandidate(token: LexInput): boolean {
|
||
|
|
return this.isKeyword(token, 'over')
|
||
|
|
}
|
||
|
|
}
|