interpreter
Submodules
Structs
PaxIdentifier
Symbol reference in a PAXEL expression.
Properties
name
Type: String
Implementations
new
pub fn new(name: &str) -> Self
Construct an identifier from its source spelling.
PaxInfix
Binary infix operation with left and right expression operands.
Implementations
lhs
pub fn lhs(&self) -> &PaxExpression
Left-hand expression.
operator_name
pub fn operator_name(&self) -> &str
Name of the infix operator.
rhs
pub fn rhs(&self) -> &PaxExpression
Right-hand expression.
PaxNullCoalesce
Short-circuiting fallback expression. Some(value) ?? fallback evaluates to
value, None ?? fallback evaluates the fallback, and non-option left
operands pass through unchanged.
Implementations
lhs
pub fn lhs(&self) -> &PaxExpression
Left-hand expression.
rhs
pub fn rhs(&self) -> &PaxExpression
Right-hand fallback expression.
PaxOperator
Parsed operator token, stored by display name.
Implementations
name
pub fn name(&self) -> &str
Source spelling for this operator.
new
pub fn new(name: impl Into<String>) -> Self
Construct an operator from its source spelling.
PaxPostfix
Postfix operation node.
Implementations
lhs
pub fn lhs(&self) -> &PaxExpression
Left-hand expression.
operator_name
pub fn operator_name(&self) -> &str
Name of the postfix operator.
PaxPrefix
Prefix operation such as numeric negation or boolean not.
Implementations
operator_name
pub fn operator_name(&self) -> &str
Name of the prefix operator.
rhs
pub fn rhs(&self) -> &PaxExpression
Right-hand expression.
PaxTernary
Conditional expression with a boolean condition and selected true/false branch.
Implementations
condition
pub fn condition(&self) -> &PaxExpression
Condition expression.
else_branch
pub fn else_branch(&self) -> &PaxExpression
Expression evaluated when the condition is false.
then_branch
pub fn then_branch(&self) -> &PaxExpression
Expression evaluated when the condition is true.
Enums
PaxAccessor
Access path applied after an identifier, such as .field, .0, or [index].
Variants
Tuple(usize)
List(PaxExpression)
Struct(String)
PaxExpression
PAXEL expression AST node.
Variants
Primary(Box<PaxPrimary>)
Prefix(Box<PaxPrefix>)
Infix(Box<PaxInfix>)
Postfix(Box<PaxPostfix>)
Ternary(Box<PaxTernary>)
NullCoalesce(Box<PaxNullCoalesce>)
Implementations
infix
pub fn infix(lhs: PaxExpression, operator: impl Into<String>, rhs: PaxExpression) -> Self
Construct an infix expression.
null_coalesce
pub fn null_coalesce(lhs: PaxExpression, rhs: PaxExpression) -> Self
Construct a null-coalescing expression.
postfix
pub fn postfix(lhs: PaxExpression, operator: impl Into<String>) -> Self
Construct a postfix expression.
prefix
pub fn prefix(operator: impl Into<String>, rhs: PaxExpression) -> Self
Construct a prefix expression.
ternary
pub fn ternary(condition: PaxExpression, then_branch: PaxExpression, else_branch: PaxExpression) -> Self
Construct a ternary expression.
PaxPrimary
Primary expression forms: literals, symbols, object/list/tuple literals, calls, and ranges.
Variants
Literal(PaxValue)
Grouped(Box<PaxExpression>, Option<PaxUnit>)
Identifier(PaxIdentifier, Vec<PaxAccessor>)
Object(Vec<(String, PaxExpression)>)
FunctionOrEnum(String, String, Vec<PaxExpression>)
Range(PaxExpression, PaxExpression)
Tuple(Vec<PaxExpression>)
List(Vec<PaxExpression>)
PaxUnit
Unit suffix attached to a grouped numeric expression.
Variants
Percent
Pixels
Radians
Degrees
Milliseconds
Seconds
Frames
Functions
compute_paxel
pub fn compute_paxel(expr: &str, idr: Rc<dyn IdentifierResolver>) -> Result<PaxValue, String>
Compute a pax expression to a PaxValue
parse_pax_expression
pub fn parse_pax_expression(expr: &str) -> Result<PaxExpression, String>
Parse a pax expression into a computable AST
parse_pax_expression_from_pair
pub fn parse_pax_expression_from_pair(expr: Pair<'_, Rule>) -> Result<PaxExpression, String>
Parse an already-produced pest pair into a PAXEL expression AST.