Understand the Ematch data model and logical composition
mainThe ematch discipline uses an array of interconnected match sequences to implement complex logical expressions (AND, OR, etc.).
Logical Composition:
- Precedence: Implemented via a special
EmatchContainerkind. A container references a sequence beyond the current marker, causing the current position to be pushed onto a stack. Matching continues in the new sequence until a marker is reached, at which point the position is restored from the stack. - Flags: Logical combinations are managed using flags like
EmatchRelAndandEmatchRelOr. - Order of Operations: In userspace, the array is encapsulated such that logical combinations update flags and use containers. For example, an expression like
A AND (B1 OR B2) AND C AND Dis transformed into a flat array where the container handles the jump to theB1 OR B2sequence and returns to the main sequence after completion.
Mental Model:
Think of an Ematch as a tree of matches flattened into a linear array where EmatchContainer acts as a jump/subroutine mechanism to handle nested logic.