import {Command, ParseContext, StrTerm} from "./command.js"; import {LexInput} from "../lexer.js"; export type TrimData = { type?: 'start'|'end'|'both'|'left'|'right'|'lines', char?: StrTerm, } export class Trim extends Command { attemptParse(context: ParseContext): TrimData { return { type: context.popOptionalKeywordInSet(['start', 'end', 'both', 'left', 'right', 'lines'])?.value, char: context.popOptionalTerm(), } } getDisplayName(): string { return 'trim' } isParseCandidate(token: LexInput): boolean { return this.isKeyword(token, 'trim') } }