CondParser (CondParser v1.0.1) View Source
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
}