Commit b7b52f88 authored by Tristan Cavelier's avatar Tristan Cavelier

jIO version up

parent 4a89f9c2
...@@ -6105,6 +6105,8 @@ var arrayExtend = function () { ...@@ -6105,6 +6105,8 @@ var arrayExtend = function () {
return true; return true;
} }
return false; return false;
}, parseQuotedString = function (string) {
return string.replace(/(?:\\(")|(\\[^"]))/g, '$1$2');
}, },
error_offsets = [], error_offsets = [],
error_lookaheads = [], error_lookaheads = [],
...@@ -6226,7 +6228,7 @@ case 17: ...@@ -6226,7 +6228,7 @@ case 17:
this.$ = mkSimpleQuery('', $$[$0]); this.$ = mkSimpleQuery('', $$[$0]);
break; break;
case 18: case 18:
this.$ = mkSimpleQuery('', $$[$0-1]); this.$ = mkSimpleQuery('', parseQuotedString($$[$0-1]));
break; break;
} }
}, },
...@@ -7445,6 +7447,16 @@ return new Parser; ...@@ -7445,6 +7447,16 @@ return new Parser;
"Argument 1 is not a search text or a parsable object"); "Argument 1 is not a search text or a parsable object");
}; };
function ensureString(value) {
if (value === undefined) { return "undefined"; }
if (value === null) { return "null"; }
return value.toString();
}
function renderSearchTextValue(value) {
return '"' + ensureString(value).replace(/"/g, '\\"') + '"';
}
function objectToSearchText(query) { function objectToSearchText(query) {
var i = 0, var i = 0,
query_list = null, query_list = null,
...@@ -7453,7 +7465,8 @@ return new Parser; ...@@ -7453,7 +7465,8 @@ return new Parser;
common_key = ""; common_key = "";
if (query.type === "simple") { if (query.type === "simple") {
return (query.key ? query.key + ": " : "") + return (query.key ? query.key + ": " : "") +
(query.operator || "") + ' "' + query.value + '"'; (query.operator || "") + ' ' +
renderSearchTextValue(query.value);
} }
if (query.type === "complex") { if (query.type === "complex") {
query_list = query.query_list; query_list = query.query_list;
...@@ -7484,7 +7497,7 @@ return new Parser; ...@@ -7484,7 +7497,7 @@ return new Parser;
for (i = 0; i < query_list.length; i += 1) { for (i = 0; i < query_list.length; i += 1) {
string_list.push( string_list.push(
(query_list[i].operator || "") + (query_list[i].operator || "") +
' "' + query_list[i].value + '"' ' ' + renderSearchTextValue(query_list[i].value)
); );
} }
} else { } else {
......
...@@ -6105,6 +6105,8 @@ var arrayExtend = function () { ...@@ -6105,6 +6105,8 @@ var arrayExtend = function () {
return true; return true;
} }
return false; return false;
}, parseQuotedString = function (string) {
return string.replace(/(?:\\(")|(\\[^"]))/g, '$1$2');
}, },
error_offsets = [], error_offsets = [],
error_lookaheads = [], error_lookaheads = [],
...@@ -6226,7 +6228,7 @@ case 17: ...@@ -6226,7 +6228,7 @@ case 17:
this.$ = mkSimpleQuery('', $$[$0]); this.$ = mkSimpleQuery('', $$[$0]);
break; break;
case 18: case 18:
this.$ = mkSimpleQuery('', $$[$0-1]); this.$ = mkSimpleQuery('', parseQuotedString($$[$0-1]));
break; break;
} }
}, },
...@@ -7445,6 +7447,16 @@ return new Parser; ...@@ -7445,6 +7447,16 @@ return new Parser;
"Argument 1 is not a search text or a parsable object"); "Argument 1 is not a search text or a parsable object");
}; };
function ensureString(value) {
if (value === undefined) { return "undefined"; }
if (value === null) { return "null"; }
return value.toString();
}
function renderSearchTextValue(value) {
return '"' + ensureString(value).replace(/"/g, '\\"') + '"';
}
function objectToSearchText(query) { function objectToSearchText(query) {
var i = 0, var i = 0,
query_list = null, query_list = null,
...@@ -7453,7 +7465,8 @@ return new Parser; ...@@ -7453,7 +7465,8 @@ return new Parser;
common_key = ""; common_key = "";
if (query.type === "simple") { if (query.type === "simple") {
return (query.key ? query.key + ": " : "") + return (query.key ? query.key + ": " : "") +
(query.operator || "") + ' "' + query.value + '"'; (query.operator || "") + ' ' +
renderSearchTextValue(query.value);
} }
if (query.type === "complex") { if (query.type === "complex") {
query_list = query.query_list; query_list = query.query_list;
...@@ -7484,7 +7497,7 @@ return new Parser; ...@@ -7484,7 +7497,7 @@ return new Parser;
for (i = 0; i < query_list.length; i += 1) { for (i = 0; i < query_list.length; i += 1) {
string_list.push( string_list.push(
(query_list[i].operator || "") + (query_list[i].operator || "") +
' "' + query_list[i].value + '"' ' ' + renderSearchTextValue(query_list[i].value)
); );
} }
} else { } else {
......
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