prefix
Create a prefix operator, given a binding power and a function that evaluates the node.
def prefix(
bp: int,
func: callable
) - > class
Create a prefix operator, given a binding power and a function that evaluates the node.
Parameters
| Name | Type | Description |
|---|---|---|
| bp | int | The binding power (precedence level) assigned to the prefix operator, determining how tightly it binds to the following expression. |
| func | callable | A function used to evaluate the operator node; it should accept a context and the operand node, returning the result or False on failure. |
Returns
| Type | Description |
|---|---|
class | A new Operator class inheriting from TokenBase that handles null denotation (nud) and evaluation logic for prefix operations. |