25 lines
551 B
TypeScript
25 lines
551 B
TypeScript
import {Command, ParseContext, StrTerm} from "./command.js";
|
|
import {LexInput} from "../lexer.js";
|
|
|
|
export type RSubData = {
|
|
offset: StrTerm,
|
|
length?: StrTerm,
|
|
}
|
|
|
|
export class RSub extends Command<RSubData> {
|
|
attemptParse(context: ParseContext): RSubData {
|
|
return {
|
|
offset: context.popTerm(),
|
|
length: context.popOptionalTerm(),
|
|
}
|
|
}
|
|
|
|
getDisplayName(): string {
|
|
return 'rsub'
|
|
}
|
|
|
|
isParseCandidate(token: LexInput): boolean {
|
|
return this.isKeyword(token, 'rsub')
|
|
}
|
|
}
|