@scalenc/nc-format
Version:
Library for handling TRUMPF NC file format.
48 lines • 2.74 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.FlowControlInstruction = exports.FlowControlInstructionType = void 0;
var FlowControlInstructionType;
(function (FlowControlInstructionType) {
/// <summary>Begin of an `IF` section: `IF condition`</summary>
FlowControlInstructionType[FlowControlInstructionType["IF"] = 0] = "IF";
/// <summary>`ELSE` branch of an `IF` section</summary>
FlowControlInstructionType[FlowControlInstructionType["ELSE"] = 1] = "ELSE";
/// <summary>End of an `IF` section</summary>
FlowControlInstructionType[FlowControlInstructionType["ENDIF"] = 2] = "ENDIF";
/// <summary>Begin of a `WHILE` section: `WHILE condition`</summary>
FlowControlInstructionType[FlowControlInstructionType["WHILE"] = 3] = "WHILE";
/// <summary>End of a `WHILE` section</summary>
FlowControlInstructionType[FlowControlInstructionType["ENDWHILE"] = 4] = "ENDWHILE";
/// <summary>Begin of a `REPEAT UNTIL` section</summary>
FlowControlInstructionType[FlowControlInstructionType["REPEAT"] = 5] = "REPEAT";
/// <summary>End of a `REPEAT UNTIL` section: `UNTIL condition`</summary>
FlowControlInstructionType[FlowControlInstructionType["UNTIL"] = 6] = "UNTIL";
/// <summary>Begin of a infinite `LOOP` section</summary>
FlowControlInstructionType[FlowControlInstructionType["LOOP"] = 7] = "LOOP";
/// <summary>End of a infinite `LOOP` section</summary>
FlowControlInstructionType[FlowControlInstructionType["ENDLOOP"] = 8] = "ENDLOOP";
/// <summary>Begin of a `FOR` section: `FOR variable, initial value, final value`</summary>
FlowControlInstructionType[FlowControlInstructionType["FOR"] = 9] = "FOR";
/// <summary>End of a `FOR` section</summary>
FlowControlInstructionType[FlowControlInstructionType["ENDFOR"] = 10] = "ENDFOR";
})(FlowControlInstructionType = exports.FlowControlInstructionType || (exports.FlowControlInstructionType = {}));
/// This class represents a flow control instruction such as `IF`, `WHILE`, `UNTIL`, `FOR`, ...
class FlowControlInstruction {
type;
expressions;
constructor(
/// The type of the flow control instruction.
type,
/// The list of arguments to the instruction.
/// For an `IF`, `WHILE`, `UNTIL` instruction, a single expression is expected as the condition.
/// For an `FOR` instruction, three expressions are expected: the variable, the initial value, and the final value.
expressions) {
this.type = type;
this.expressions = expressions;
}
visit(visitor) {
visitor.onFlowControlInstruction(this);
}
}
exports.FlowControlInstruction = FlowControlInstruction;
//# sourceMappingURL=FlowControlInstruction.js.map