Commit 525ca570 authored by Alexander.Trofimov's avatar Alexander.Trofimov

fix matching operators

parent 780eebc3
...@@ -5776,18 +5776,17 @@ function parseNum( str ) { ...@@ -5776,18 +5776,17 @@ function parseNum( str ) {
return !isNaN( str ); return !isNaN( str );
} }
var matchingOperators = new RegExp("^ *[<=> ]+ *"); var matchingOperators = new RegExp("^(=|<>|<=|>=|<|>).*");
function matchingValue(oVal) { function matchingValue(oVal) {
var res; var res;
if(cElementType.string === oVal.type){ if (cElementType.string === oVal.type) {
var search, op; var search, op;
var val = oVal.getValue(); var val = oVal.getValue();
var match = val.match(matchingOperators); var match = val.match(matchingOperators);
if (match) { if (match) {
search = val.substr(match[0].length); search = val.substr(match[1].length);
op = match[0].replace(/\s/g, ""); op = match[1].replace(/\s/g, "");
} else { } else {
search = val; search = val;
op = null; op = null;
...@@ -5801,15 +5800,16 @@ function parseNum( str ) { ...@@ -5801,15 +5800,16 @@ function parseNum( str ) {
return res; return res;
} }
function matching(x, matchingInfo) { function matching(x, matchingInfo) {
var y = matchingInfo.val; var y = matchingInfo.val;
var operator = matchingInfo.op; var operator = matchingInfo.op;
var res = false, rS; var res = false, rS;
if (cElementType.string === y.type) { if (cElementType.string === y.type) {
if (cElementType.number === y.type && ('<' === operator || '>' === operator || '<=' === operator || '>=' === operator)) { if (cElementType.number === y.type &&
('<' === operator || '>' === operator || '<=' === operator || '>=' === operator)) {
var _funcVal = _func[x.type][y.type](x, y, operator); var _funcVal = _func[x.type][y.type](x, y, operator);
if(cElementType.error === _funcVal.type){ if (cElementType.error === _funcVal.type) {
return false; return false;
} }
return _funcVal.toBool(); return _funcVal.toBool();
...@@ -5833,7 +5833,7 @@ function parseNum( str ) { ...@@ -5833,7 +5833,7 @@ function parseNum( str ) {
res = rS; res = rS;
break; break;
} }
} else if(cElementType.number === y.type) { } else if (cElementType.number === y.type) {
rS = (x.type === y.type); rS = (x.type === y.type);
switch (operator) { switch (operator) {
case "<>": case "<>":
...@@ -5853,18 +5853,14 @@ function parseNum( str ) { ...@@ -5853,18 +5853,14 @@ function parseNum( str ) {
break; break;
case "=": case "=":
default: default:
if(cElementType.string === x.type){ if (cElementType.string === x.type) {
x = x.tocNumber(); x = x.tocNumber();
} }
res = (x.value === y.value); res = (x.value === y.value);
break; break;
} }
} else if(cElementType.bool === y.type) { } else if (cElementType.bool === y.type || cElementType.error === y.type) {
if(y.type === x.type && x.value === y.value){ if (y.type === x.type && x.value === y.value) {
res = true;
}
} else if(cElementType.error === y.type) {
if(y.type === x.type && x.value === y.value){
res = true; res = true;
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment