You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A flow expression can implement just about any type of *flow logic*. Mainly for, but not limited to, **Parser** and **DSL** (domain specific language) construction.
4
+
5
+
Flow expressions are constructed from the various FexElements (*building blocks*) via a fluent API. These FexElements define the logical flow and operation of the expression in a very readable and maintainable format.
6
+
7
+
> A running Flow Expression operates on a user supplied **Context**, which is any environment that manages and provides input/content/state.
8
+
>
9
+
> For a Parser, the context would be a **Scanner** that manages text scanning and provides <i>Tokens</i> to operate on.<br/>
10
+
>
11
+
> A comprehensive [FexScanner](Docs/FexScannerExt.md) is provided (derived from *ScriptScanner* in the [Scanners](https://github.com/PromicSW/scanners) repo/library) but you can roll your own if required.
12
+
13
+
## FexElements perform several types of functions:
14
+
15
+
> Please see the [Fex Element reference](Docs/FexElementsRef.md) section for full details.<br>
16
+
> Also [FexScanner context extensions](Docs/FexScannerExt.md) for extensions specific to the FexScanner context.
17
+
18
+
-**Operators (Op):** Perform a operation on the context, returning a success status (true/false).
19
+
- Certain Op's produce and record a value for later use via one of the Action elements.
20
+
- An Op can operate on the context directly, but typically *Operator Extension methods* are defined to create re-usable (and more readable) operators specific to the context used.
21
+
- There is also a facility to attach Pre-Operations to operators (e.g skip spaces when scanning etc.)
22
+
-**Sequence(Seq):** A sequence is the primary construct used in flow expressions and defines a series of steps (1..n) to complete:
23
+
- A step is any FexElement.
24
+
- All steps is a sequence must complete else the sequence fails.
25
+
- A step(s) may be optional and there are several rules governing this.
26
+
-**Flow Control:** These elements control the flow of an expression:
27
+
- Opt: Optional sequence.
28
+
- OneOf: One of a set of sequences must pass.
29
+
- NotOneOf: Inverse of OneOf.
30
+
- Rep...: Repeat sequences.
31
+
32
+
-**Actions:** Perform actions based on the current state of the production to check values or perform any other actions required on the context:
33
+
- Actions don't affect the validity of a sequence.
34
+
- There are general actions and those that operate on a value recorded by and operator.
35
+
- An Action can operate on the context directly, but typically *Action Extension methods* are defined to create re-usable (and more readable) actions specific to the context used.
36
+
-**Error reporting:** Elements for error handling and reporting.
37
+
-**Tracing:** Tracing elements primarily for debugging purposes.
0 commit comments