Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V0.3.3 tilde #66

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
{
"name": "rql",
"version": "0.3.3",
"author": "Kris Zyp",
"version": "0.3.3-2",
"author": "Kris Zyp/Simon Ruetzler",
"contributors": [
"Vladimir Dronnikov <dronnikov@gmail.com>"
"Vladimir Dronnikov <dronnikov@gmail.com>",
"Simon Ruetzler <sruetzler@arigo-software.de>"
],
"keywords": [
"resource",
Expand Down
32 changes: 16 additions & 16 deletions parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@ function parse(/*String|Object*/query, parameters){
}
if(query.indexOf("/") > -1){ // performance guard
// convert slash delimited text to arrays
query = query.replace(/[\+\*\$\-:\w%\._]*\/[\+\*\$\-:\w%\._\/]*/g, function(slashed){
query = query.replace(/[\+\*\$\-:\w%\._~]*\/[\+\*\$\-:\w%\._~\/]*/g, function(slashed){
return "(" + slashed.replace(/\//g, ",") + ")";
});
}
// convert FIQL to normalized call syntax form
query = query.replace(/(\([\+\*\$\-:\w%\._,]+\)|[\+\*\$\-:\w%\._]*|)([<>!]?=(?:[\w]*=)?|>|<)(\([\+\*\$\-:\w%\._,]+\)|[\+\*\$\-:\w%\._]*|)/g,
query = query.replace(/(\([\+\*\$\-:\w%\._~,]+\)|[\+\*\$\-:\w%\._~]*|)([<>!]?=(?:[\w]*=)?|>|<)(\([\+\*\$\-:\w%\._~,]+\)|[\+\*\$\-:\w%\._~]*|)/g,
//<--------- property -----------><------ operator -----><---------------- value ------------------>
function(t, property, operator, value){
if(operator.length < 3){
Expand All @@ -68,7 +68,7 @@ function parse(/*String|Object*/query, parameters){
if(query.charAt(0)=="?"){
query = query.substring(1);
}
var leftoverCharacters = query.replace(/(\))|([&\|,])?([\+\*\$\-:\w%\._]*)(\(?)/g,
var leftoverCharacters = query.replace(/(\))|([&\|,])?([\+\*\$\-:\w%\._~]*)(\(?)/g,
// <-closedParan->|<-delim-- propertyOrValue -----(> |
function(t, closedParan, delim, propertyOrValue, openParan){
if(delim){
Expand Down Expand Up @@ -175,19 +175,19 @@ exports.commonOperatorMap = {
}
function stringToValue(string, parameters){
var converter = exports.converters['default'];
if(string.charAt(0) === "$"){
var param_index = parseInt(string.substring(1)) - 1;
return param_index >= 0 && parameters ? parameters[param_index] : undefined;
}
if(string.indexOf(":") > -1){
var parts = string.split(":",2);
converter = exports.converters[parts[0]];
if(!converter){
throw new URIError("Unknown converter " + parts[0]);
}
string = parts[1];
}
return converter(string);
if(string.charAt(0) === "$"){
var param_index = parseInt(string.substring(1)) - 1;
return param_index >= 0 && parameters ? parameters[param_index] : undefined;
}
var parts = /^(\w+):(.*)$/.exec(string);
if (parts && parts[1]) {
converter = exports.converters[parts[1]];
if(!converter){
throw new URIError("Unknown converter " + parts[0]);
}
string = parts[2];
}
return converter(string);
};

var autoConverted = exports.autoConverted = {
Expand Down