pub enum ObservationExpression {
Observation {
expression: Box<ComparisonExpression>,
span: Span,
},
And(Vec<ObservationExpression>),
Or(Vec<ObservationExpression>),
FollowedBy(Vec<ObservationExpression>),
Qualified {
expression: Box<ObservationExpression>,
qualifier: Qualifier,
span: Span,
},
}Expand description
Observation-level expression tree.
FOLLOWEDBY/AND/OR combine observations; qualifiers attach to a sub-expression.
§Chain nodes
And, Or and FollowedBy are n-ary: a chain such as a OR b OR c is a
single node holding every operand in source order, so the tree’s depth does
not grow with the length of a chain. Nodes produced by parse
uphold two invariants:
- the operand list has at least two elements;
- the first operand is never a node of the same operator. Left-nested
chains are flattened (
(a OR b) OR canda OR b OR care bothOr([a, b, c])), while a right-nested group keeps its own node (a OR (b OR c)isOr([a, Or([b, c])])).
A chain Op([a, b, c]) means the left-associative (a op b) op c.
In JSON a two-operand chain serializes as {"Or": [l, r]}, and longer
chains as longer arrays.
Variants§
Observation
A single [ comparisonExpr ] observation.
Fields
expression: Box<ComparisonExpression>The comparison expression inside the brackets.
And(Vec<ObservationExpression>)
AND of two or more observation expressions (see chain nodes).
Or(Vec<ObservationExpression>)
OR of two or more observation expressions (see chain nodes).
FollowedBy(Vec<ObservationExpression>)
FOLLOWEDBY of two or more observation expressions: each operand’s
observations precede the next’s (see chain nodes).
Qualified
A sub-expression with a postfix Qualifier attached.
Trait Implementations§
Source§impl Clone for ObservationExpression
impl Clone for ObservationExpression
Source§fn clone(&self) -> ObservationExpression
fn clone(&self) -> ObservationExpression
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more