diff --git a/source/engine/grammar.ne b/source/engine/grammar.ne index 103c04153..a3bb326b8 100644 --- a/source/engine/grammar.ne +++ b/source/engine/grammar.ne @@ -18,7 +18,7 @@ Comparison -> Comparable _ ComparisonOperator _ Comparable {% d => ({ Comparable -> (int | CalcExpression | Variable | Constant) {% d => d[0][0] %} -ComparisonOperator -> ">" | "<" | ">=" | "<=" | "=" +ComparisonOperator -> ">" | "<" | ">=" | "<=" | "=" | "!=" NegatedVariable -> "≠" _ Variable {% d => ({category: 'negatedVariable', variable: d[2] }) %} diff --git a/source/engine/traverse.js b/source/engine/traverse.js index 563ec80e0..709ab1f43 100644 --- a/source/engine/traverse.js +++ b/source/engine/traverse.js @@ -201,12 +201,13 @@ let treat = (rules, rule) => rawNode => { '<=': 'lte', '>': 'gt', '>=': 'gte', - '=': 'equals' + '=': 'equals', + '!=': 'equals' }[node.operator], explanation = R.map(R.curry(evaluateNode)(situation,parsedRules),node.explanation), value1 = explanation[0].nodeValue, value2 = explanation[1].nodeValue, - operatorFunction = R[operatorFunctionName], + operatorFunction = operatorFunctionName == "!=" ? (a => b => !R.equals(a,b)) : R[operatorFunctionName], nodeValue = value1 == null || value2 == null ? null : operatorFunction(value1, value2)