Add & register more basic commands
This commit is contained in:
24
src/vm/commands/indent.ts
Normal file
24
src/vm/commands/indent.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import {Command, ParseContext, StrTerm} from "./command.js";
|
||||
import {LexInput} from "../lexer.js";
|
||||
|
||||
export type IndentData = {
|
||||
type: 'space'|'tab',
|
||||
level?: StrTerm,
|
||||
}
|
||||
|
||||
export class Indent extends Command<IndentData> {
|
||||
attemptParse(context: ParseContext): IndentData {
|
||||
return {
|
||||
type: context.popKeywordInSet(['space', 'tab']).value,
|
||||
level: context.popOptionalTerm(),
|
||||
}
|
||||
}
|
||||
|
||||
isParseCandidate(token: LexInput): boolean {
|
||||
return this.isKeyword(token, 'indent')
|
||||
}
|
||||
|
||||
getDisplayName(): string {
|
||||
return 'indent'
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user