knit_script.knit_script_interpreter.statements.instruction_statements module
Statements that produce knitout for machine level instructions.
This module provides statement classes for machine-level operations that generate specific knitout instructions. It includes statements for pausing machine execution and other machine control operations that operate at the machine level rather than on specific needles.
- class Pause_Statement(parser_node)[source]
Bases:
Statement
An instruction that pauses the knitting machine.
Generates a pause instruction in the knitout, causing the machine to stop execution until manually resumed. This is useful for manual interventions, inspection points, or when operator input is required during the knitting process.
The pause statement provides a way to create breakpoints in the knitting process where the machine will halt and wait for operator intervention before continuing with the remaining instructions.
- Parameters:
parser_node (
LRStackNode
)
- __init__(parser_node)[source]
Initialize a pause statement.
- Parameters:
parser_node (LRStackNode) – The parser node from the abstract syntax tree.
- execute(context)[source]
Execute the pause by writing a pause instruction to knitout.
Generates a pause instruction and adds it to the knitout output, which will cause the knitting machine to halt execution at this point.
- Parameters:
context (Knit_Script_Context) – The current execution context of the knit script interpreter.
- Return type:
- __str__()[source]
Return string representation of the pause statement.
- Returns:
A string indicating this is a pause operation.
- Return type:
- __repr__()[source]
Return detailed string representation of the pause statement.
- Returns:
Same as __str__ for this class.
- Return type:
- property line_number: int
Get the line number of the symbol that generated this statement.
- Returns:
The line number where this element appears in the source file.
- Return type:
- property location: Location
Get the location of this symbol in KnitScript file.
- Returns:
The location of this symbol in the source file, including file name, line number, and position information.
- Return type:
Location