simc-ast-builder
Version:
Parser and AST generator for SimulationCraft files
42 lines • 1.4 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.handleStagger = exports.handleMonk = void 0;
const SimCVisitorError_1 = require("../../../errors/SimCVisitorError");
const fieldMaps_1 = require("../../../utils/fieldMaps");
/**
* Handler for monk access contexts
* This handles access to monk-specific properties
*/
const handleMonk = ({ ctx, parts }) => {
if (parts.length < 2) {
throw new SimCVisitorError_1.SimCVisitorError("Monk 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: "monk",
};
};
exports.handleMonk = handleMonk;
/**
* Handler for stagger access contexts
* This handles access to stagger-specific properties for Monk Brewmaster
*/
const handleStagger = ({ ctx, parts, }) => {
if (parts.length < 2) {
throw new SimCVisitorError_1.SimCVisitorError("Stagger 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: "stagger",
};
};
exports.handleStagger = handleStagger;
//# sourceMappingURL=MonkHandler.js.map