⚙️ Fournit un opérateur d'inégalité
parent
f8624916be
commit
1426af4f6b
|
@ -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] }) %}
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue