knitout_interpreter.knitout_language.knitout_actions module
Actions for reducing in Knitout Parser
- typed_action(func)[source]
Wrapper that applies @action decorator while preserving types.
- Parameters:
func (F) – Function to be decorated with the action decorator.
- Returns:
Wrapped function.
- Return type:
F
- no_op(_, __, value, com)[source]
Extracts the content of a no op comment
- Parameters:
_ (LRStackNode) – The stack node element being processed by this action.
__ (list) – A list of values found for this action.
value (Knitout_Instruction) – The no-op commented instruction.
com (str | None) – Additional comment to the instruction
- Returns:
The No-op comment for the given instruction.
- Return type:
- break_point(_, __, content)[source]
Extracts the content of a break point with a comment.
- Parameters:
- Returns:
The breakpoint.
- Return type:
- comment_line(_, __, content)[source]
Extracts the content of a comment.
- Parameters:
- Returns:
The comment line.
- Return type:
- code_line(_, __, c, com)[source]
Creates a knitout line with optional comment.
- Parameters:
_ (LRStackNode) – The stack node element being processed by this action.
__ (list) – A list of values found for this action.
c (Knitout_Line | None) – The knitout line to execute, if any.
com (str | None) – The comment to append to the knitout line.
- Returns:
The knitout line created or None if no values are given.
- Return type:
Knitout_Line | None
- magic_string(_, __, v)[source]
Creates a knitout version line.
- Parameters:
- Returns:
The version line knitout line.
- Return type:
- header_line(_, __, h_op)[source]
Returns a header line operation.
- Parameters:
_ (LRStackNode) – The stack node element being processed by this action.
__ (list) – A list of values found for this action.
h_op (Knitout_Header_Line) – Operation on the line.
- Returns:
The header operation.
- Return type:
- machine_op(_, __, m)[source]
Creates a machine header line.
- Parameters:
- Returns:
The machine declaration operation.
- Return type:
- gauge_op(_, __, g)[source]
Creates a gauge header line.
- Parameters:
- Returns:
The gauge header.
- Return type:
- yarn_op(_, __, cid, color)[source]
Creates a yarn header line.
- Parameters:
- Returns:
Comment of yarn declaration.
- Return type:
- carriers_op(_, __, CS)[source]
Creates a carriers header line.
- Parameters:
_ (LRStackNode) – The stack node element being processed by this action.
__ (list) – A list of values found for this action.
CS (Yarn_Carrier_Set) – The carriers that are available.
- Returns:
Carrier declaration.
- Return type:
- position_op(_, __, p)[source]
Creates a position header line.
- Parameters:
- Returns:
The position declaration.
- Return type:
- in_op(_, __, c)[source]
Creates an in instruction.
- Parameters:
- Returns:
In operation on a carrier set.
- Return type:
- inhook_op(_, __, c)[source]
Creates an inhook instruction.
- Parameters:
- Returns:
Inhook operation on carrier set.
- Return type:
- releasehook_op(_, __, c)[source]
Creates a releasehook instruction.
- Parameters:
- Returns:
Releasehook operation on carrier set.
- Return type:
- out_op(_, __, c)[source]
Creates an out instruction.
- Parameters:
- Returns:
Out operation on the carrier set.
- Return type:
- outhook_op(_, __, c)[source]
Creates an outhook instruction.
- Parameters:
- Returns:
Outhook operation on the carrier set.
- Return type:
- rack_op(_, __, R)[source]
Creates a rack instruction.
- Parameters:
- Returns:
Rack operation.
- Return type:
- knit_op(_, __, D, N, CS)[source]
Creates a knit instruction.
- Parameters:
- Returns:
Knit operation.
- Return type:
- tuck_op(_, __, D, N, CS)[source]
Creates a tuck instruction.
- Parameters:
- Returns:
Tuck operation.
- Return type:
- miss_op(_, __, D, N, CS)[source]
Creates a miss instruction.
- Parameters:
- Returns:
Miss operation.
- Return type:
- kick_op(_, __, D, N, CS)[source]
Creates a kick instruction.
- Parameters:
- Returns:
The specified Kick Operation.
- Return type:
- split_op(_, __, D, N, N2, CS)[source]
Creates a split instruction.
- Parameters:
- Returns:
Split operation.
- Return type:
- drop_op(_, __, N)[source]
Creates a drop instruction.
- Parameters:
_ (LRStackNode) – The stack node element being processed by this action.
__ (list) – A list of values found for this action.
N (Needle_Specification) – Needle to drop from.
- Returns:
Drop operation.
- Return type:
- xfer_op(_, __, N, N2)[source]
Creates a transfer instruction.
- Parameters:
_ (LRStackNode) – The stack node element being processed by this action.
__ (list) – A list of values found for this action.
N (Needle_Specification) – Needle to transfer from.
N2 (Needle_Specification) – Needle to transfer to.
- Returns:
Xfer operation.
- Return type:
- pause_op(_, __)[source]
Creates a pause instruction.
- Parameters:
_ (LRStackNode) – The stack node element being processed by this action.
__ (list) – A list of values found for this action.
- Returns:
Pause operation.
- Return type: