simc-ast-builder
Version:
Parser and AST generator for SimulationCraft files
60 lines • 2.05 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.handleHunter = exports.handleHowlSummon = exports.handleBoarCharge = void 0;
const SimCVisitorError_1 = require("../../../errors/SimCVisitorError");
const fieldMaps_1 = require("../../../utils/fieldMaps");
/**
* Handler for hunter access contexts
* This handles access to hunter-specific properties
*/
const handleHunter = ({ ctx, parts, }) => {
if (parts.length < 2) {
throw new SimCVisitorError_1.SimCVisitorError("Hunter access requires a field", ctx);
}
const field = parts[1] || "";
const fieldDef = (0, fieldMaps_1.getFieldDef)(field);
return {
expressionType: fieldDef.type,
field: fieldDef,
kind: "expression",
nodeType: "hunter",
};
};
exports.handleHunter = handleHunter;
/**
* Handler for howl_summon access contexts
* This handles access to howl_summon-specific properties for Hunter
*/
const handleHowlSummon = ({ ctx, parts, }) => {
if (parts.length < 2) {
throw new SimCVisitorError_1.SimCVisitorError("Howl summon access requires a field", ctx);
}
const field = parts[1] || "";
const fieldDef = (0, fieldMaps_1.getFieldDef)(field);
return {
expressionType: fieldDef.type,
field: fieldDef,
kind: "expression",
nodeType: "howl_summon",
};
};
exports.handleHowlSummon = handleHowlSummon;
/**
* Handler for boar_charge access contexts
* This handles access to boar_charge-specific properties for Hunter
*/
const handleBoarCharge = ({ ctx, parts, }) => {
if (parts.length < 2) {
throw new SimCVisitorError_1.SimCVisitorError("Boar charge access requires a field", ctx);
}
const field = parts[1] || "";
const fieldDef = (0, fieldMaps_1.getFieldDef)(field);
return {
expressionType: fieldDef.type,
field: fieldDef,
kind: "expression",
nodeType: "boar_charge",
};
};
exports.handleBoarCharge = handleBoarCharge;
//# sourceMappingURL=HunterHandler.js.map