pub enum Expr {
Show 14 variants
Int(i128),
Double(f64),
Bool(bool),
Ident(String),
Unary {
op: UnOp,
operand: Box<Expr>,
},
Binary {
op: BinOp,
lhs: Box<Expr>,
rhs: Box<Expr>,
},
Ternary {
cond: Box<Expr>,
then: Box<Expr>,
els: Box<Expr>,
},
Call {
name: String,
args: Vec<Expr>,
},
Index {
base: Box<Expr>,
index: Box<Expr>,
},
Field {
base: Box<Expr>,
name: String,
},
Assign {
lhs: Box<Expr>,
op: AssignOp,
rhs: Box<Expr>,
},
Step {
step: Step,
prefix: bool,
operand: Box<Expr>,
},
Comma(Vec<Expr>),
Verbatim(String),
}Expand description
An expression: what a declaration, a function body or a transition label is built from.
Compound forms print fully parenthesised. UPPAAL’s precedence table is not
C’s — T_MIN/T_MAX and the bit operators sit in places a reader does not
expect — so the printer never relies on it.
Variants§
Int(i128)
An integer literal.
Double(f64)
A floating-point literal.
Bool(bool)
true / false.
Ident(String)
A bare identifier.
Unary
op operand.
Binary
lhs op rhs.
Ternary
cond ? then : els.
Fields
Call
f(a, b).
Index
base[index].
Field
base.name.
Assign
lhs op rhs: an assignment is an expression in UTAP, as in C.
Fields
Step
++x, x++, --x or x--.
Fields
Comma(Vec<Expr>)
a, b, c: the comma list (ExprList), as an update label is.
Verbatim(String)
Pre-rendered UPPAAL text, spliced in as written.
The escape hatch for what the enum cannot hold: one of the
placeholder comments the transpiler emits where a foreign call has no
usable contract (/* io.f() */ 0). Everything that can be
structured should be.