Phrase
Boolean expression evaluation purely written in Swift for macOS & Linux without any dependencies.
Usage
let expression = try Phrase("list != nil && list.count > 3")
expression.context = [
"list": [1,2,3,4,5]
]
if try expression.evaluate() {
...
} else {
...
}
Operators
Prefix-Operators
Operators which require a succeeding node
!
Infix-Operators
Operators which require a preceding and a succeeding node
Logical:
&&||
Equaltiy:
==!=
Comparing:
>>=<<=
Postfix-Operators
Operators which require a preceeding node
count
returns the element count of the preceeding array node
View on GitHub
Phrase Reference