CAML Ain't Markup Language
Caml simply adds a layer of conditional logic when deserialising a YAML file.
CAML supports basic logical expressions, which can be resolved by passing in an instance of IMatcher, such as the built in ConfigurableMatcher.
The simplest expressions are literals. A literal is a string which will be evaluated to true or false by the IMatcher instance at runtime.
- monday
workday: true
- tuesday
workday: true
- wednesday
workday: true
- thursday
workday: true
- friday
workday: true
- saturday
workday: false
- sunday
workday: falseThe default expression is a special literal which will always evaluate to true, this is useful to reduce verbosity in a yaml file
- default
workday: true
- saturday
workday: false
- sunday
workday: falseFunctions can be used to pass one or more values to the IMatcher at runtime
- day(monday, tuesday, wednesday, thursday, friday)
workday: true
- day(saturday, sunday)
workday: falseLogical operators can be used to combine expressions
The NOT operator ! will negate the result of the expression it is applied to.
note if ! is the first character in an expression, the expression will need to be defined using yaml quotation format.
- "!day(saturday, sunday)"
workday: trueThe AND operator & will evaluate true if both expressions evaluate to true. Otherwise, the result is false.
The operation is conditional, so the second expression will not be evaluated if the first expression evaluates to false.
The OR operator | will evaluate true if either expressions evaluate to true. Otherwise, the result is false.
The operation is conditional, so the second expression will not be evaluated if the first expression evaluates to true.
The XOR operator ^ will evaluate true if exactly one expression evaluates to true. Otherwise, the result is false.
The operation is not conditional, so the both expressions will be evaluated.
Expressions can be grouped by surrounding them in parentheses. This allows more flexibility when combining expressions
- (monday | tuesday) & !day(thursday)