Refactor parser for some added flexibility.

This commit is contained in:
2021-05-17 19:59:21 -07:00
parent 09e10e94b5
commit 03eddfcd74
9 changed files with 279 additions and 61 deletions

35
terms/terms.ts Normal file
View File

@ -0,0 +1,35 @@
import * as actions from "./actions.ts";
import { Action } from "./Term.ts";
const inventory: Action = {
action: actions.checkInventory,
canPrecedeVariable: false,
category: "action",
constant: "inventory",
precedesCategories: [],
precedesConstants: [],
};
const look: Action = {
action: actions.look,
canPrecedeVariable: false,
category: "action",
constant: "look",
precedesCategories: [],
precedesConstants: [],
};
const take: Action = {
action: actions.pickUpItem,
category: "action",
canPrecedeVariable: true,
constant: "take",
precedesCategories: [],
precedesConstants: [],
};
export const terms = {
[inventory.constant]: inventory,
[look.constant]: look,
[take.constant]: take,
};