CondParser
CondParser reads conditions like
(':foo' or ("toto" == true AND (12 != 13 OR false))) and true and transform them
either in an ast with parse/1, or in json with to_json/1.
Ast looks like this:
{:and_op,
{:or_op, ":foo",
{:and_op,
{:eq_op, "toto", true},
{:or_op,
{:not_eq_op, 12, 13},
false
}
}
},
true
}Json looks like this:
{
"left": {
"left": ":foo",
"op": "or",
"right": {
"left": { "left": "toto", "op": "eq", "right": true },
"op": "and",
"right": {
"left": { "left": 12, "op": "not_eq", "right": 13 },
"op": "or",
"right": false
}
}
},
"op": "and",
"right": true
}Installation
The package can be installed
by adding cond_parser to your list of dependencies in mix.exs:
def deps do
[
{:cond_parser, "~> 1.0.0"}
]
endDocumentation
Documentation can be found in hexdoc
Tests
You can run tests with:
mix test