Add & register more basic commands
This commit is contained in:
18
src/vm/commands/contains.ts
Normal file
18
src/vm/commands/contains.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import { LexInput } from "../lexer.js";
|
||||
import {Command, ParseContext, StrTerm} from "./command.js";
|
||||
|
||||
export class Contains extends Command<{ find: StrTerm }> {
|
||||
attemptParse(context: ParseContext): { find: StrTerm } {
|
||||
return {
|
||||
find: context.popTerm(),
|
||||
}
|
||||
}
|
||||
|
||||
getDisplayName(): string {
|
||||
return 'contains'
|
||||
}
|
||||
|
||||
isParseCandidate(token: LexInput): boolean {
|
||||
return this.isKeyword(token, 'contains')
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user