more flexible URI.parse: (url,filter) instead of (url,browser_override)
This commit is contained in:
parent
22223dd7d2
commit
6e10ff0414
|
@ -220,25 +220,25 @@ xrfragment_Parser.parse = function(key,value,resultMap) {
|
|||
Frag_h["#"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_PREDEFINED_VIEW;
|
||||
Frag_h["class"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING;
|
||||
Frag_h["src"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL;
|
||||
Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING_OBJ;
|
||||
Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING_OBJ | xrfragment_XRF.EMBED_OVERRIDE;
|
||||
Frag_h["href"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW;
|
||||
Frag_h["q"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_STRING;
|
||||
Frag_h["scale"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_INT;
|
||||
Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_VECTOR3;
|
||||
Frag_h["translate"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_VECTOR3;
|
||||
Frag_h["visible"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_INT;
|
||||
Frag_h["env"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_STRING;
|
||||
Frag_h["t"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.BROWSER_OVERRIDE;
|
||||
Frag_h["gravity"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3;
|
||||
Frag_h["physics"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3;
|
||||
Frag_h["fov"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_INT | xrfragment_XRF.BROWSER_OVERRIDE;
|
||||
Frag_h["clip"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.BROWSER_OVERRIDE;
|
||||
Frag_h["fog"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_STRING | xrfragment_XRF.BROWSER_OVERRIDE;
|
||||
Frag_h["q"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_STRING | xrfragment_XRF.EMBED_OVERRIDE;
|
||||
Frag_h["scale"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.EMBED_OVERRIDE;
|
||||
Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.EMBED_OVERRIDE;
|
||||
Frag_h["translate"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.EMBED_OVERRIDE;
|
||||
Frag_h["visible"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_INT | xrfragment_XRF.EMBED_OVERRIDE;
|
||||
Frag_h["env"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_STRING | xrfragment_XRF.EMBED_OVERRIDE;
|
||||
Frag_h["t"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.BROWSER_OVERRIDE | xrfragment_XRF.EMBED_OVERRIDE;
|
||||
Frag_h["gravity"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.EMBED_OVERRIDE;
|
||||
Frag_h["physics"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.EMBED_OVERRIDE;
|
||||
Frag_h["fov"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_INT | xrfragment_XRF.BROWSER_OVERRIDE | xrfragment_XRF.EMBED_OVERRIDE;
|
||||
Frag_h["clip"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.BROWSER_OVERRIDE | xrfragment_XRF.EMBED_OVERRIDE;
|
||||
Frag_h["fog"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_STRING | xrfragment_XRF.BROWSER_OVERRIDE | xrfragment_XRF.EMBED_OVERRIDE;
|
||||
Frag_h["namespace"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING;
|
||||
Frag_h["SPDX"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING;
|
||||
Frag_h["unit"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING;
|
||||
Frag_h["description"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING;
|
||||
Frag_h["session"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.BROWSER_OVERRIDE | xrfragment_XRF.PROMPT;
|
||||
Frag_h["session"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.BROWSER_OVERRIDE | xrfragment_XRF.EMBED_OVERRIDE | xrfragment_XRF.PROMPT;
|
||||
if(value.length == 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key)) {
|
||||
resultMap[key] = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.BROWSER_OVERRIDE);
|
||||
return true;
|
||||
|
@ -444,10 +444,13 @@ xrfragment_Query.prototype = {
|
|||
};
|
||||
var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { };
|
||||
xrfragment_URI.__name__ = true;
|
||||
xrfragment_URI.parse = function(qs,browser_override) {
|
||||
var fragment = qs.split("#");
|
||||
xrfragment_URI.parse = function(url,filter) {
|
||||
var store = { };
|
||||
if(url.indexOf("#") == -1) {
|
||||
return store;
|
||||
}
|
||||
var fragment = url.split("#");
|
||||
var splitArray = fragment[1].split("&");
|
||||
var resultMap = { };
|
||||
var _g = 0;
|
||||
var _g1 = splitArray.length;
|
||||
while(_g < _g1) {
|
||||
|
@ -460,21 +463,21 @@ xrfragment_URI.parse = function(qs,browser_override) {
|
|||
var s = regexPlus.split(splitByEqual[1]).join(" ");
|
||||
value = decodeURIComponent(s.split("+").join(" "));
|
||||
}
|
||||
var ok = xrfragment_Parser.parse(key,value,resultMap);
|
||||
var ok = xrfragment_Parser.parse(key,value,store);
|
||||
}
|
||||
if(browser_override) {
|
||||
if(filter != null && filter != 0) {
|
||||
var _g = 0;
|
||||
var _g1 = Reflect.fields(resultMap);
|
||||
var _g1 = Reflect.fields(store);
|
||||
while(_g < _g1.length) {
|
||||
var key = _g1[_g];
|
||||
++_g;
|
||||
var xrf = resultMap[key];
|
||||
if(!xrf.is(xrfragment_XRF.BROWSER_OVERRIDE)) {
|
||||
Reflect.deleteField(resultMap,key);
|
||||
var xrf = store[key];
|
||||
if(!xrf.is(filter)) {
|
||||
Reflect.deleteField(store,key);
|
||||
}
|
||||
}
|
||||
}
|
||||
return resultMap;
|
||||
return store;
|
||||
};
|
||||
var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags) {
|
||||
this.fragment = _fragment;
|
||||
|
@ -567,18 +570,19 @@ xrfragment_XRF.QUERY_OPERATOR = 4;
|
|||
xrfragment_XRF.PROMPT = 8;
|
||||
xrfragment_XRF.ROUNDROBIN = 16;
|
||||
xrfragment_XRF.BROWSER_OVERRIDE = 32;
|
||||
xrfragment_XRF.PV_OVERRIDE = 64;
|
||||
xrfragment_XRF.PV_EXECUTE = 128;
|
||||
xrfragment_XRF.T_COLOR = 256;
|
||||
xrfragment_XRF.T_INT = 512;
|
||||
xrfragment_XRF.T_FLOAT = 1024;
|
||||
xrfragment_XRF.T_VECTOR2 = 2048;
|
||||
xrfragment_XRF.T_VECTOR3 = 4096;
|
||||
xrfragment_XRF.T_URL = 8192;
|
||||
xrfragment_XRF.T_PREDEFINED_VIEW = 16384;
|
||||
xrfragment_XRF.T_STRING = 32768;
|
||||
xrfragment_XRF.T_STRING_OBJ = 65536;
|
||||
xrfragment_XRF.T_STRING_OBJ_PROP = 131072;
|
||||
xrfragment_XRF.EMBED_OVERRIDE = 64;
|
||||
xrfragment_XRF.PV_OVERRIDE = 128;
|
||||
xrfragment_XRF.PV_EXECUTE = 256;
|
||||
xrfragment_XRF.T_COLOR = 8192;
|
||||
xrfragment_XRF.T_INT = 16384;
|
||||
xrfragment_XRF.T_FLOAT = 32768;
|
||||
xrfragment_XRF.T_VECTOR2 = 65536;
|
||||
xrfragment_XRF.T_VECTOR3 = 131072;
|
||||
xrfragment_XRF.T_URL = 262144;
|
||||
xrfragment_XRF.T_PREDEFINED_VIEW = 524288;
|
||||
xrfragment_XRF.T_STRING = 1048576;
|
||||
xrfragment_XRF.T_STRING_OBJ = 2097152;
|
||||
xrfragment_XRF.T_STRING_OBJ_PROP = 4194304;
|
||||
xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$","");
|
||||
xrfragment_XRF.isInt = new EReg("^[0-9]+$","");
|
||||
xrfragment_XRF.isFloat = new EReg("^[0-9]+\\.[0-9]+$","");
|
||||
|
|
|
@ -1432,7 +1432,7 @@ __xrfragment_Parser.parse = function(key,value,resultMap)
|
|||
else
|
||||
Frag_h.src = value1;
|
||||
end;
|
||||
local value1 = _hx_bit.bor(_hx_bit.bor(_hx_bit.bor(__xrfragment_XRF.PV_OVERRIDE,__xrfragment_XRF.ROUNDROBIN),__xrfragment_XRF.T_VECTOR3),__xrfragment_XRF.T_STRING_OBJ);
|
||||
local value1 = _hx_bit.bor(_hx_bit.bor(_hx_bit.bor(_hx_bit.bor(__xrfragment_XRF.PV_OVERRIDE,__xrfragment_XRF.ROUNDROBIN),__xrfragment_XRF.T_VECTOR3),__xrfragment_XRF.T_STRING_OBJ),__xrfragment_XRF.EMBED_OVERRIDE);
|
||||
if (value1 == nil) then
|
||||
Frag_h.pos = __haxe_ds_StringMap.tnull;
|
||||
else
|
||||
|
@ -1444,73 +1444,73 @@ __xrfragment_Parser.parse = function(key,value,resultMap)
|
|||
else
|
||||
Frag_h.href = value1;
|
||||
end;
|
||||
local value1 = _hx_bit.bor(__xrfragment_XRF.PV_OVERRIDE,__xrfragment_XRF.T_STRING);
|
||||
local value1 = _hx_bit.bor(_hx_bit.bor(__xrfragment_XRF.PV_OVERRIDE,__xrfragment_XRF.T_STRING),__xrfragment_XRF.EMBED_OVERRIDE);
|
||||
if (value1 == nil) then
|
||||
Frag_h.q = __haxe_ds_StringMap.tnull;
|
||||
else
|
||||
Frag_h.q = value1;
|
||||
end;
|
||||
local value1 = _hx_bit.bor(_hx_bit.bor(_hx_bit.bor(__xrfragment_XRF.QUERY_OPERATOR,__xrfragment_XRF.PV_OVERRIDE),__xrfragment_XRF.ROUNDROBIN),__xrfragment_XRF.T_INT);
|
||||
local value1 = _hx_bit.bor(_hx_bit.bor(_hx_bit.bor(_hx_bit.bor(__xrfragment_XRF.QUERY_OPERATOR,__xrfragment_XRF.PV_OVERRIDE),__xrfragment_XRF.ROUNDROBIN),__xrfragment_XRF.T_VECTOR3),__xrfragment_XRF.EMBED_OVERRIDE);
|
||||
if (value1 == nil) then
|
||||
Frag_h.scale = __haxe_ds_StringMap.tnull;
|
||||
else
|
||||
Frag_h.scale = value1;
|
||||
end;
|
||||
local value1 = _hx_bit.bor(_hx_bit.bor(_hx_bit.bor(__xrfragment_XRF.QUERY_OPERATOR,__xrfragment_XRF.PV_OVERRIDE),__xrfragment_XRF.ROUNDROBIN),__xrfragment_XRF.T_VECTOR3);
|
||||
local value1 = _hx_bit.bor(_hx_bit.bor(_hx_bit.bor(_hx_bit.bor(__xrfragment_XRF.QUERY_OPERATOR,__xrfragment_XRF.PV_OVERRIDE),__xrfragment_XRF.ROUNDROBIN),__xrfragment_XRF.T_VECTOR3),__xrfragment_XRF.EMBED_OVERRIDE);
|
||||
if (value1 == nil) then
|
||||
Frag_h.rot = __haxe_ds_StringMap.tnull;
|
||||
else
|
||||
Frag_h.rot = value1;
|
||||
end;
|
||||
local value1 = _hx_bit.bor(_hx_bit.bor(_hx_bit.bor(__xrfragment_XRF.QUERY_OPERATOR,__xrfragment_XRF.PV_OVERRIDE),__xrfragment_XRF.ROUNDROBIN),__xrfragment_XRF.T_VECTOR3);
|
||||
local value1 = _hx_bit.bor(_hx_bit.bor(_hx_bit.bor(_hx_bit.bor(__xrfragment_XRF.QUERY_OPERATOR,__xrfragment_XRF.PV_OVERRIDE),__xrfragment_XRF.ROUNDROBIN),__xrfragment_XRF.T_VECTOR3),__xrfragment_XRF.EMBED_OVERRIDE);
|
||||
if (value1 == nil) then
|
||||
Frag_h.translate = __haxe_ds_StringMap.tnull;
|
||||
else
|
||||
Frag_h.translate = value1;
|
||||
end;
|
||||
local value1 = _hx_bit.bor(_hx_bit.bor(_hx_bit.bor(__xrfragment_XRF.QUERY_OPERATOR,__xrfragment_XRF.PV_OVERRIDE),__xrfragment_XRF.ROUNDROBIN),__xrfragment_XRF.T_INT);
|
||||
local value1 = _hx_bit.bor(_hx_bit.bor(_hx_bit.bor(_hx_bit.bor(__xrfragment_XRF.QUERY_OPERATOR,__xrfragment_XRF.PV_OVERRIDE),__xrfragment_XRF.ROUNDROBIN),__xrfragment_XRF.T_INT),__xrfragment_XRF.EMBED_OVERRIDE);
|
||||
if (value1 == nil) then
|
||||
Frag_h.visible = __haxe_ds_StringMap.tnull;
|
||||
else
|
||||
Frag_h.visible = value1;
|
||||
end;
|
||||
local value1 = _hx_bit.bor(_hx_bit.bor(__xrfragment_XRF.ASSET,__xrfragment_XRF.PV_OVERRIDE),__xrfragment_XRF.T_STRING);
|
||||
local value1 = _hx_bit.bor(_hx_bit.bor(_hx_bit.bor(__xrfragment_XRF.ASSET,__xrfragment_XRF.PV_OVERRIDE),__xrfragment_XRF.T_STRING),__xrfragment_XRF.EMBED_OVERRIDE);
|
||||
if (value1 == nil) then
|
||||
Frag_h.env = __haxe_ds_StringMap.tnull;
|
||||
else
|
||||
Frag_h.env = value1;
|
||||
end;
|
||||
local value1 = _hx_bit.bor(_hx_bit.bor(_hx_bit.bor(_hx_bit.bor(__xrfragment_XRF.ASSET,__xrfragment_XRF.PV_OVERRIDE),__xrfragment_XRF.ROUNDROBIN),__xrfragment_XRF.T_VECTOR2),__xrfragment_XRF.BROWSER_OVERRIDE);
|
||||
local value1 = _hx_bit.bor(_hx_bit.bor(_hx_bit.bor(_hx_bit.bor(_hx_bit.bor(__xrfragment_XRF.ASSET,__xrfragment_XRF.PV_OVERRIDE),__xrfragment_XRF.ROUNDROBIN),__xrfragment_XRF.T_VECTOR2),__xrfragment_XRF.BROWSER_OVERRIDE),__xrfragment_XRF.EMBED_OVERRIDE);
|
||||
if (value1 == nil) then
|
||||
Frag_h.t = __haxe_ds_StringMap.tnull;
|
||||
else
|
||||
Frag_h.t = value1;
|
||||
end;
|
||||
local value1 = _hx_bit.bor(_hx_bit.bor(__xrfragment_XRF.ASSET,__xrfragment_XRF.PV_OVERRIDE),__xrfragment_XRF.T_VECTOR3);
|
||||
local value1 = _hx_bit.bor(_hx_bit.bor(_hx_bit.bor(__xrfragment_XRF.ASSET,__xrfragment_XRF.PV_OVERRIDE),__xrfragment_XRF.T_VECTOR3),__xrfragment_XRF.EMBED_OVERRIDE);
|
||||
if (value1 == nil) then
|
||||
Frag_h.gravity = __haxe_ds_StringMap.tnull;
|
||||
else
|
||||
Frag_h.gravity = value1;
|
||||
end;
|
||||
local value1 = _hx_bit.bor(_hx_bit.bor(__xrfragment_XRF.ASSET,__xrfragment_XRF.PV_OVERRIDE),__xrfragment_XRF.T_VECTOR3);
|
||||
local value1 = _hx_bit.bor(_hx_bit.bor(_hx_bit.bor(__xrfragment_XRF.ASSET,__xrfragment_XRF.PV_OVERRIDE),__xrfragment_XRF.T_VECTOR3),__xrfragment_XRF.EMBED_OVERRIDE);
|
||||
if (value1 == nil) then
|
||||
Frag_h.physics = __haxe_ds_StringMap.tnull;
|
||||
else
|
||||
Frag_h.physics = value1;
|
||||
end;
|
||||
local value1 = _hx_bit.bor(_hx_bit.bor(_hx_bit.bor(__xrfragment_XRF.ASSET,__xrfragment_XRF.PV_OVERRIDE),__xrfragment_XRF.T_INT),__xrfragment_XRF.BROWSER_OVERRIDE);
|
||||
local value1 = _hx_bit.bor(_hx_bit.bor(_hx_bit.bor(_hx_bit.bor(__xrfragment_XRF.ASSET,__xrfragment_XRF.PV_OVERRIDE),__xrfragment_XRF.T_INT),__xrfragment_XRF.BROWSER_OVERRIDE),__xrfragment_XRF.EMBED_OVERRIDE);
|
||||
if (value1 == nil) then
|
||||
Frag_h.fov = __haxe_ds_StringMap.tnull;
|
||||
else
|
||||
Frag_h.fov = value1;
|
||||
end;
|
||||
local value1 = _hx_bit.bor(_hx_bit.bor(_hx_bit.bor(__xrfragment_XRF.ASSET,__xrfragment_XRF.PV_OVERRIDE),__xrfragment_XRF.T_VECTOR2),__xrfragment_XRF.BROWSER_OVERRIDE);
|
||||
local value1 = _hx_bit.bor(_hx_bit.bor(_hx_bit.bor(_hx_bit.bor(__xrfragment_XRF.ASSET,__xrfragment_XRF.PV_OVERRIDE),__xrfragment_XRF.T_VECTOR2),__xrfragment_XRF.BROWSER_OVERRIDE),__xrfragment_XRF.EMBED_OVERRIDE);
|
||||
if (value1 == nil) then
|
||||
Frag_h.clip = __haxe_ds_StringMap.tnull;
|
||||
else
|
||||
Frag_h.clip = value1;
|
||||
end;
|
||||
local value1 = _hx_bit.bor(_hx_bit.bor(_hx_bit.bor(__xrfragment_XRF.ASSET,__xrfragment_XRF.PV_OVERRIDE),__xrfragment_XRF.T_STRING),__xrfragment_XRF.BROWSER_OVERRIDE);
|
||||
local value1 = _hx_bit.bor(_hx_bit.bor(_hx_bit.bor(_hx_bit.bor(__xrfragment_XRF.ASSET,__xrfragment_XRF.PV_OVERRIDE),__xrfragment_XRF.T_STRING),__xrfragment_XRF.BROWSER_OVERRIDE),__xrfragment_XRF.EMBED_OVERRIDE);
|
||||
if (value1 == nil) then
|
||||
Frag_h.fog = __haxe_ds_StringMap.tnull;
|
||||
else
|
||||
|
@ -1540,7 +1540,7 @@ __xrfragment_Parser.parse = function(key,value,resultMap)
|
|||
else
|
||||
Frag_h.description = value1;
|
||||
end;
|
||||
local value1 = _hx_bit.bor(_hx_bit.bor(_hx_bit.bor(_hx_bit.bor(__xrfragment_XRF.ASSET,__xrfragment_XRF.T_URL),__xrfragment_XRF.PV_OVERRIDE),__xrfragment_XRF.BROWSER_OVERRIDE),__xrfragment_XRF.PROMPT);
|
||||
local value1 = _hx_bit.bor(_hx_bit.bor(_hx_bit.bor(_hx_bit.bor(_hx_bit.bor(__xrfragment_XRF.ASSET,__xrfragment_XRF.T_URL),__xrfragment_XRF.PV_OVERRIDE),__xrfragment_XRF.BROWSER_OVERRIDE),__xrfragment_XRF.EMBED_OVERRIDE),__xrfragment_XRF.PROMPT);
|
||||
if (value1 == nil) then
|
||||
Frag_h.session = __haxe_ds_StringMap.tnull;
|
||||
else
|
||||
|
@ -2027,26 +2027,43 @@ __xrfragment_Query.prototype.__class__ = __xrfragment_Query
|
|||
__xrfragment_URI.new = {}
|
||||
_hx_exports["xrfragment"]["URI"] = __xrfragment_URI
|
||||
__xrfragment_URI.__name__ = true
|
||||
__xrfragment_URI.parse = function(qs,browser_override)
|
||||
__xrfragment_URI.parse = function(url,filter)
|
||||
local store = _hx_e();
|
||||
local startIndex = nil;
|
||||
if (startIndex == nil) then
|
||||
startIndex = 1;
|
||||
else
|
||||
startIndex = startIndex + 1;
|
||||
end;
|
||||
local r = __lua_lib_luautf8_Utf8.find(url, "#", startIndex, true);
|
||||
if ((function()
|
||||
local _hx_1
|
||||
if ((r ~= nil) and (r > 0)) then
|
||||
_hx_1 = r - 1; else
|
||||
_hx_1 = -1; end
|
||||
return _hx_1
|
||||
end )() == -1) then
|
||||
do return store end;
|
||||
end;
|
||||
local idx = 1;
|
||||
local ret = _hx_tab_array({}, 0);
|
||||
while (idx ~= nil) do
|
||||
local newidx = 0;
|
||||
if (__lua_lib_luautf8_Utf8.len("#") > 0) then
|
||||
newidx = __lua_lib_luautf8_Utf8.find(qs, "#", idx, true);
|
||||
newidx = __lua_lib_luautf8_Utf8.find(url, "#", idx, true);
|
||||
else
|
||||
if (idx >= __lua_lib_luautf8_Utf8.len(qs)) then
|
||||
if (idx >= __lua_lib_luautf8_Utf8.len(url)) then
|
||||
newidx = nil;
|
||||
else
|
||||
newidx = idx + 1;
|
||||
end;
|
||||
end;
|
||||
if (newidx ~= nil) then
|
||||
local match = __lua_lib_luautf8_Utf8.sub(qs, idx, newidx - 1);
|
||||
local match = __lua_lib_luautf8_Utf8.sub(url, idx, newidx - 1);
|
||||
ret:push(match);
|
||||
idx = newidx + __lua_lib_luautf8_Utf8.len("#");
|
||||
else
|
||||
ret:push(__lua_lib_luautf8_Utf8.sub(qs, idx, __lua_lib_luautf8_Utf8.len(qs)));
|
||||
ret:push(__lua_lib_luautf8_Utf8.sub(url, idx, __lua_lib_luautf8_Utf8.len(url)));
|
||||
idx = nil;
|
||||
end;
|
||||
end;
|
||||
|
@ -2075,7 +2092,6 @@ __xrfragment_URI.parse = function(qs,browser_override)
|
|||
end;
|
||||
end;
|
||||
local splitArray = ret;
|
||||
local resultMap = _hx_e();
|
||||
local _g = 0;
|
||||
local _g1 = splitArray.length;
|
||||
while (_g < _g1) do
|
||||
|
@ -2111,21 +2127,21 @@ __xrfragment_URI.parse = function(qs,browser_override)
|
|||
if (splitByEqual.length > 1) then
|
||||
value = StringTools.urlDecode(regexPlus:split(splitByEqual[1]):join(" "));
|
||||
end;
|
||||
local ok = __xrfragment_Parser.parse(key, value, resultMap);
|
||||
local ok = __xrfragment_Parser.parse(key, value, store);
|
||||
end;
|
||||
if (browser_override) then
|
||||
if ((filter ~= nil) and (filter ~= 0)) then
|
||||
local _g = 0;
|
||||
local _g1 = Reflect.fields(resultMap);
|
||||
local _g1 = Reflect.fields(store);
|
||||
while (_g < _g1.length) do
|
||||
local key = _g1[_g];
|
||||
_g = _g + 1;
|
||||
local xrf = Reflect.field(resultMap, key);
|
||||
if (not xrf:is(__xrfragment_XRF.BROWSER_OVERRIDE)) then
|
||||
Reflect.deleteField(resultMap, key);
|
||||
local xrf = Reflect.field(store, key);
|
||||
if (not xrf:is(filter)) then
|
||||
Reflect.deleteField(store, key);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
do return resultMap end;
|
||||
do return store end;
|
||||
end
|
||||
|
||||
__xrfragment_XRF.new = function(_fragment,_flags)
|
||||
|
@ -2365,29 +2381,31 @@ local _hx_static_init = function()
|
|||
|
||||
__xrfragment_XRF.BROWSER_OVERRIDE = 32;
|
||||
|
||||
__xrfragment_XRF.PV_OVERRIDE = 64;
|
||||
__xrfragment_XRF.EMBED_OVERRIDE = 64;
|
||||
|
||||
__xrfragment_XRF.PV_EXECUTE = 128;
|
||||
__xrfragment_XRF.PV_OVERRIDE = 128;
|
||||
|
||||
__xrfragment_XRF.T_COLOR = 256;
|
||||
__xrfragment_XRF.PV_EXECUTE = 256;
|
||||
|
||||
__xrfragment_XRF.T_INT = 512;
|
||||
__xrfragment_XRF.T_COLOR = 8192;
|
||||
|
||||
__xrfragment_XRF.T_FLOAT = 1024;
|
||||
__xrfragment_XRF.T_INT = 16384;
|
||||
|
||||
__xrfragment_XRF.T_VECTOR2 = 2048;
|
||||
__xrfragment_XRF.T_FLOAT = 32768;
|
||||
|
||||
__xrfragment_XRF.T_VECTOR3 = 4096;
|
||||
__xrfragment_XRF.T_VECTOR2 = 65536;
|
||||
|
||||
__xrfragment_XRF.T_URL = 8192;
|
||||
__xrfragment_XRF.T_VECTOR3 = 131072;
|
||||
|
||||
__xrfragment_XRF.T_PREDEFINED_VIEW = 16384;
|
||||
__xrfragment_XRF.T_URL = 262144;
|
||||
|
||||
__xrfragment_XRF.T_STRING = 32768;
|
||||
__xrfragment_XRF.T_PREDEFINED_VIEW = 524288;
|
||||
|
||||
__xrfragment_XRF.T_STRING_OBJ = 65536;
|
||||
__xrfragment_XRF.T_STRING = 1048576;
|
||||
|
||||
__xrfragment_XRF.T_STRING_OBJ_PROP = 131072;
|
||||
__xrfragment_XRF.T_STRING_OBJ = 2097152;
|
||||
|
||||
__xrfragment_XRF.T_STRING_OBJ_PROP = 4194304;
|
||||
|
||||
__xrfragment_XRF.isColor = EReg.new("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$", "");
|
||||
|
||||
|
|
|
@ -220,25 +220,25 @@ xrfragment_Parser.parse = function(key,value,resultMap) {
|
|||
Frag_h["#"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_PREDEFINED_VIEW;
|
||||
Frag_h["class"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING;
|
||||
Frag_h["src"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL;
|
||||
Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING_OBJ;
|
||||
Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING_OBJ | xrfragment_XRF.EMBED_OVERRIDE;
|
||||
Frag_h["href"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW;
|
||||
Frag_h["q"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_STRING;
|
||||
Frag_h["scale"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_INT;
|
||||
Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_VECTOR3;
|
||||
Frag_h["translate"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_VECTOR3;
|
||||
Frag_h["visible"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_INT;
|
||||
Frag_h["env"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_STRING;
|
||||
Frag_h["t"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.BROWSER_OVERRIDE;
|
||||
Frag_h["gravity"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3;
|
||||
Frag_h["physics"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3;
|
||||
Frag_h["fov"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_INT | xrfragment_XRF.BROWSER_OVERRIDE;
|
||||
Frag_h["clip"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.BROWSER_OVERRIDE;
|
||||
Frag_h["fog"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_STRING | xrfragment_XRF.BROWSER_OVERRIDE;
|
||||
Frag_h["q"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_STRING | xrfragment_XRF.EMBED_OVERRIDE;
|
||||
Frag_h["scale"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.EMBED_OVERRIDE;
|
||||
Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.EMBED_OVERRIDE;
|
||||
Frag_h["translate"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.EMBED_OVERRIDE;
|
||||
Frag_h["visible"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_INT | xrfragment_XRF.EMBED_OVERRIDE;
|
||||
Frag_h["env"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_STRING | xrfragment_XRF.EMBED_OVERRIDE;
|
||||
Frag_h["t"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.BROWSER_OVERRIDE | xrfragment_XRF.EMBED_OVERRIDE;
|
||||
Frag_h["gravity"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.EMBED_OVERRIDE;
|
||||
Frag_h["physics"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.EMBED_OVERRIDE;
|
||||
Frag_h["fov"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_INT | xrfragment_XRF.BROWSER_OVERRIDE | xrfragment_XRF.EMBED_OVERRIDE;
|
||||
Frag_h["clip"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.BROWSER_OVERRIDE | xrfragment_XRF.EMBED_OVERRIDE;
|
||||
Frag_h["fog"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_STRING | xrfragment_XRF.BROWSER_OVERRIDE | xrfragment_XRF.EMBED_OVERRIDE;
|
||||
Frag_h["namespace"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING;
|
||||
Frag_h["SPDX"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING;
|
||||
Frag_h["unit"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING;
|
||||
Frag_h["description"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING;
|
||||
Frag_h["session"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.BROWSER_OVERRIDE | xrfragment_XRF.PROMPT;
|
||||
Frag_h["session"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.BROWSER_OVERRIDE | xrfragment_XRF.EMBED_OVERRIDE | xrfragment_XRF.PROMPT;
|
||||
if(value.length == 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key)) {
|
||||
resultMap[key] = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.BROWSER_OVERRIDE);
|
||||
return true;
|
||||
|
@ -444,10 +444,13 @@ xrfragment_Query.prototype = {
|
|||
};
|
||||
var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { };
|
||||
xrfragment_URI.__name__ = true;
|
||||
xrfragment_URI.parse = function(qs,browser_override) {
|
||||
var fragment = qs.split("#");
|
||||
xrfragment_URI.parse = function(url,filter) {
|
||||
var store = { };
|
||||
if(url.indexOf("#") == -1) {
|
||||
return store;
|
||||
}
|
||||
var fragment = url.split("#");
|
||||
var splitArray = fragment[1].split("&");
|
||||
var resultMap = { };
|
||||
var _g = 0;
|
||||
var _g1 = splitArray.length;
|
||||
while(_g < _g1) {
|
||||
|
@ -460,21 +463,21 @@ xrfragment_URI.parse = function(qs,browser_override) {
|
|||
var s = regexPlus.split(splitByEqual[1]).join(" ");
|
||||
value = decodeURIComponent(s.split("+").join(" "));
|
||||
}
|
||||
var ok = xrfragment_Parser.parse(key,value,resultMap);
|
||||
var ok = xrfragment_Parser.parse(key,value,store);
|
||||
}
|
||||
if(browser_override) {
|
||||
if(filter != null && filter != 0) {
|
||||
var _g = 0;
|
||||
var _g1 = Reflect.fields(resultMap);
|
||||
var _g1 = Reflect.fields(store);
|
||||
while(_g < _g1.length) {
|
||||
var key = _g1[_g];
|
||||
++_g;
|
||||
var xrf = resultMap[key];
|
||||
if(!xrf.is(xrfragment_XRF.BROWSER_OVERRIDE)) {
|
||||
Reflect.deleteField(resultMap,key);
|
||||
var xrf = store[key];
|
||||
if(!xrf.is(filter)) {
|
||||
Reflect.deleteField(store,key);
|
||||
}
|
||||
}
|
||||
}
|
||||
return resultMap;
|
||||
return store;
|
||||
};
|
||||
var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags) {
|
||||
this.fragment = _fragment;
|
||||
|
@ -567,18 +570,19 @@ xrfragment_XRF.QUERY_OPERATOR = 4;
|
|||
xrfragment_XRF.PROMPT = 8;
|
||||
xrfragment_XRF.ROUNDROBIN = 16;
|
||||
xrfragment_XRF.BROWSER_OVERRIDE = 32;
|
||||
xrfragment_XRF.PV_OVERRIDE = 64;
|
||||
xrfragment_XRF.PV_EXECUTE = 128;
|
||||
xrfragment_XRF.T_COLOR = 256;
|
||||
xrfragment_XRF.T_INT = 512;
|
||||
xrfragment_XRF.T_FLOAT = 1024;
|
||||
xrfragment_XRF.T_VECTOR2 = 2048;
|
||||
xrfragment_XRF.T_VECTOR3 = 4096;
|
||||
xrfragment_XRF.T_URL = 8192;
|
||||
xrfragment_XRF.T_PREDEFINED_VIEW = 16384;
|
||||
xrfragment_XRF.T_STRING = 32768;
|
||||
xrfragment_XRF.T_STRING_OBJ = 65536;
|
||||
xrfragment_XRF.T_STRING_OBJ_PROP = 131072;
|
||||
xrfragment_XRF.EMBED_OVERRIDE = 64;
|
||||
xrfragment_XRF.PV_OVERRIDE = 128;
|
||||
xrfragment_XRF.PV_EXECUTE = 256;
|
||||
xrfragment_XRF.T_COLOR = 8192;
|
||||
xrfragment_XRF.T_INT = 16384;
|
||||
xrfragment_XRF.T_FLOAT = 32768;
|
||||
xrfragment_XRF.T_VECTOR2 = 65536;
|
||||
xrfragment_XRF.T_VECTOR3 = 131072;
|
||||
xrfragment_XRF.T_URL = 262144;
|
||||
xrfragment_XRF.T_PREDEFINED_VIEW = 524288;
|
||||
xrfragment_XRF.T_STRING = 1048576;
|
||||
xrfragment_XRF.T_STRING_OBJ = 2097152;
|
||||
xrfragment_XRF.T_STRING_OBJ_PROP = 4194304;
|
||||
xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$","");
|
||||
xrfragment_XRF.isInt = new EReg("^[0-9]+$","");
|
||||
xrfragment_XRF.isFloat = new EReg("^[0-9]+\\.[0-9]+$","");
|
||||
|
|
|
@ -1297,25 +1297,25 @@ class xrfragment_Parser:
|
|||
Frag.h["#"] = (xrfragment_XRF.ASSET | xrfragment_XRF.T_PREDEFINED_VIEW)
|
||||
Frag.h["class"] = (xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING)
|
||||
Frag.h["src"] = (xrfragment_XRF.ASSET | xrfragment_XRF.T_URL)
|
||||
Frag.h["pos"] = (((xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN) | xrfragment_XRF.T_VECTOR3) | xrfragment_XRF.T_STRING_OBJ)
|
||||
Frag.h["pos"] = ((((xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN) | xrfragment_XRF.T_VECTOR3) | xrfragment_XRF.T_STRING_OBJ) | xrfragment_XRF.EMBED_OVERRIDE)
|
||||
Frag.h["href"] = ((xrfragment_XRF.ASSET | xrfragment_XRF.T_URL) | xrfragment_XRF.T_PREDEFINED_VIEW)
|
||||
Frag.h["q"] = (xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_STRING)
|
||||
Frag.h["scale"] = (((xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.ROUNDROBIN) | xrfragment_XRF.T_INT)
|
||||
Frag.h["rot"] = (((xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.ROUNDROBIN) | xrfragment_XRF.T_VECTOR3)
|
||||
Frag.h["translate"] = (((xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.ROUNDROBIN) | xrfragment_XRF.T_VECTOR3)
|
||||
Frag.h["visible"] = (((xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.ROUNDROBIN) | xrfragment_XRF.T_INT)
|
||||
Frag.h["env"] = ((xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.T_STRING)
|
||||
Frag.h["t"] = ((((xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.ROUNDROBIN) | xrfragment_XRF.T_VECTOR2) | xrfragment_XRF.BROWSER_OVERRIDE)
|
||||
Frag.h["gravity"] = ((xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.T_VECTOR3)
|
||||
Frag.h["physics"] = ((xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.T_VECTOR3)
|
||||
Frag.h["fov"] = (((xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.T_INT) | xrfragment_XRF.BROWSER_OVERRIDE)
|
||||
Frag.h["clip"] = (((xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.T_VECTOR2) | xrfragment_XRF.BROWSER_OVERRIDE)
|
||||
Frag.h["fog"] = (((xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.T_STRING) | xrfragment_XRF.BROWSER_OVERRIDE)
|
||||
Frag.h["q"] = ((xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_STRING) | xrfragment_XRF.EMBED_OVERRIDE)
|
||||
Frag.h["scale"] = ((((xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.ROUNDROBIN) | xrfragment_XRF.T_VECTOR3) | xrfragment_XRF.EMBED_OVERRIDE)
|
||||
Frag.h["rot"] = ((((xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.ROUNDROBIN) | xrfragment_XRF.T_VECTOR3) | xrfragment_XRF.EMBED_OVERRIDE)
|
||||
Frag.h["translate"] = ((((xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.ROUNDROBIN) | xrfragment_XRF.T_VECTOR3) | xrfragment_XRF.EMBED_OVERRIDE)
|
||||
Frag.h["visible"] = ((((xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.ROUNDROBIN) | xrfragment_XRF.T_INT) | xrfragment_XRF.EMBED_OVERRIDE)
|
||||
Frag.h["env"] = (((xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.T_STRING) | xrfragment_XRF.EMBED_OVERRIDE)
|
||||
Frag.h["t"] = (((((xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.ROUNDROBIN) | xrfragment_XRF.T_VECTOR2) | xrfragment_XRF.BROWSER_OVERRIDE) | xrfragment_XRF.EMBED_OVERRIDE)
|
||||
Frag.h["gravity"] = (((xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.T_VECTOR3) | xrfragment_XRF.EMBED_OVERRIDE)
|
||||
Frag.h["physics"] = (((xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.T_VECTOR3) | xrfragment_XRF.EMBED_OVERRIDE)
|
||||
Frag.h["fov"] = ((((xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.T_INT) | xrfragment_XRF.BROWSER_OVERRIDE) | xrfragment_XRF.EMBED_OVERRIDE)
|
||||
Frag.h["clip"] = ((((xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.T_VECTOR2) | xrfragment_XRF.BROWSER_OVERRIDE) | xrfragment_XRF.EMBED_OVERRIDE)
|
||||
Frag.h["fog"] = ((((xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.T_STRING) | xrfragment_XRF.BROWSER_OVERRIDE) | xrfragment_XRF.EMBED_OVERRIDE)
|
||||
Frag.h["namespace"] = (xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING)
|
||||
Frag.h["SPDX"] = (xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING)
|
||||
Frag.h["unit"] = (xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING)
|
||||
Frag.h["description"] = (xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING)
|
||||
Frag.h["session"] = ((((xrfragment_XRF.ASSET | xrfragment_XRF.T_URL) | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.BROWSER_OVERRIDE) | xrfragment_XRF.PROMPT)
|
||||
Frag.h["session"] = (((((xrfragment_XRF.ASSET | xrfragment_XRF.T_URL) | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.BROWSER_OVERRIDE) | xrfragment_XRF.EMBED_OVERRIDE) | xrfragment_XRF.PROMPT)
|
||||
if ((len(value) == 0) and (not (key in Frag.h))):
|
||||
value1 = xrfragment_XRF(key,(xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.BROWSER_OVERRIDE))
|
||||
setattr(resultMap,(("_hx_" + key) if ((key in python_Boot.keywords)) else (("_hx_" + key) if (((((len(key) > 2) and ((ord(key[0]) == 95))) and ((ord(key[1]) == 95))) and ((ord(key[(len(key) - 1)]) != 95)))) else key)),value1)
|
||||
|
@ -1527,11 +1527,14 @@ class xrfragment_URI:
|
|||
_hx_statics = ["parse"]
|
||||
|
||||
@staticmethod
|
||||
def parse(qs,browser_override):
|
||||
fragment = qs.split("#")
|
||||
def parse(url,_hx_filter):
|
||||
store = _hx_AnonObject({})
|
||||
startIndex = None
|
||||
if (((url.find("#") if ((startIndex is None)) else HxString.indexOfImpl(url,"#",startIndex))) == -1):
|
||||
return store
|
||||
fragment = url.split("#")
|
||||
_this = (fragment[1] if 1 < len(fragment) else None)
|
||||
splitArray = _this.split("&")
|
||||
resultMap = _hx_AnonObject({})
|
||||
_g = 0
|
||||
_g1 = len(splitArray)
|
||||
while (_g < _g1):
|
||||
|
@ -1545,17 +1548,17 @@ class xrfragment_URI:
|
|||
if (len(splitByEqual) > 1):
|
||||
_this1 = regexPlus.split((splitByEqual[1] if 1 < len(splitByEqual) else None))
|
||||
value = python_lib_urllib_Parse.unquote(" ".join([python_Boot.toString1(x1,'') for x1 in _this1]))
|
||||
ok = xrfragment_Parser.parse(key,value,resultMap)
|
||||
if browser_override:
|
||||
ok = xrfragment_Parser.parse(key,value,store)
|
||||
if ((_hx_filter is not None) and ((_hx_filter != 0))):
|
||||
_g = 0
|
||||
_g1 = python_Boot.fields(resultMap)
|
||||
_g1 = python_Boot.fields(store)
|
||||
while (_g < len(_g1)):
|
||||
key = (_g1[_g] if _g >= 0 and _g < len(_g1) else None)
|
||||
_g = (_g + 1)
|
||||
xrf = Reflect.field(resultMap,key)
|
||||
if (not xrf._hx_is(xrfragment_XRF.BROWSER_OVERRIDE)):
|
||||
Reflect.deleteField(resultMap,key)
|
||||
return resultMap
|
||||
xrf = Reflect.field(store,key)
|
||||
if (not xrf._hx_is(_hx_filter)):
|
||||
Reflect.deleteField(store,key)
|
||||
return store
|
||||
|
||||
|
||||
class xrfragment_XRF:
|
||||
|
@ -1563,7 +1566,7 @@ class xrfragment_XRF:
|
|||
__slots__ = ("fragment", "flags", "x", "y", "z", "color", "string", "int", "float", "args", "query")
|
||||
_hx_fields = ["fragment", "flags", "x", "y", "z", "color", "string", "int", "float", "args", "query"]
|
||||
_hx_methods = ["is", "validate", "guessType"]
|
||||
_hx_statics = ["ASSET", "PROP_BIND", "QUERY_OPERATOR", "PROMPT", "ROUNDROBIN", "BROWSER_OVERRIDE", "PV_OVERRIDE", "PV_EXECUTE", "T_COLOR", "T_INT", "T_FLOAT", "T_VECTOR2", "T_VECTOR3", "T_URL", "T_PREDEFINED_VIEW", "T_STRING", "T_STRING_OBJ", "T_STRING_OBJ_PROP", "isColor", "isInt", "isFloat", "isVector", "isUrl", "isUrlOrPretypedView", "isString", "set", "unset"]
|
||||
_hx_statics = ["ASSET", "PROP_BIND", "QUERY_OPERATOR", "PROMPT", "ROUNDROBIN", "BROWSER_OVERRIDE", "EMBED_OVERRIDE", "PV_OVERRIDE", "PV_EXECUTE", "T_COLOR", "T_INT", "T_FLOAT", "T_VECTOR2", "T_VECTOR3", "T_URL", "T_PREDEFINED_VIEW", "T_STRING", "T_STRING_OBJ", "T_STRING_OBJ_PROP", "isColor", "isInt", "isFloat", "isVector", "isUrl", "isUrlOrPretypedView", "isString", "set", "unset"]
|
||||
|
||||
def __init__(self,_fragment,_flags):
|
||||
self.query = None
|
||||
|
@ -1653,18 +1656,19 @@ xrfragment_XRF.QUERY_OPERATOR = 4
|
|||
xrfragment_XRF.PROMPT = 8
|
||||
xrfragment_XRF.ROUNDROBIN = 16
|
||||
xrfragment_XRF.BROWSER_OVERRIDE = 32
|
||||
xrfragment_XRF.PV_OVERRIDE = 64
|
||||
xrfragment_XRF.PV_EXECUTE = 128
|
||||
xrfragment_XRF.T_COLOR = 256
|
||||
xrfragment_XRF.T_INT = 512
|
||||
xrfragment_XRF.T_FLOAT = 1024
|
||||
xrfragment_XRF.T_VECTOR2 = 2048
|
||||
xrfragment_XRF.T_VECTOR3 = 4096
|
||||
xrfragment_XRF.T_URL = 8192
|
||||
xrfragment_XRF.T_PREDEFINED_VIEW = 16384
|
||||
xrfragment_XRF.T_STRING = 32768
|
||||
xrfragment_XRF.T_STRING_OBJ = 65536
|
||||
xrfragment_XRF.T_STRING_OBJ_PROP = 131072
|
||||
xrfragment_XRF.EMBED_OVERRIDE = 64
|
||||
xrfragment_XRF.PV_OVERRIDE = 128
|
||||
xrfragment_XRF.PV_EXECUTE = 256
|
||||
xrfragment_XRF.T_COLOR = 8192
|
||||
xrfragment_XRF.T_INT = 16384
|
||||
xrfragment_XRF.T_FLOAT = 32768
|
||||
xrfragment_XRF.T_VECTOR2 = 65536
|
||||
xrfragment_XRF.T_VECTOR3 = 131072
|
||||
xrfragment_XRF.T_URL = 262144
|
||||
xrfragment_XRF.T_PREDEFINED_VIEW = 524288
|
||||
xrfragment_XRF.T_STRING = 1048576
|
||||
xrfragment_XRF.T_STRING_OBJ = 2097152
|
||||
xrfragment_XRF.T_STRING_OBJ_PROP = 4194304
|
||||
xrfragment_XRF.isColor = EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$","")
|
||||
xrfragment_XRF.isInt = EReg("^[0-9]+$","")
|
||||
xrfragment_XRF.isFloat = EReg("^[0-9]+\\.[0-9]+$","")
|
||||
|
|
|
@ -62,10 +62,11 @@ input[type="submit"] {
|
|||
height: 29px;
|
||||
font-size: 14px;
|
||||
position: absolute;
|
||||
left: 280px;
|
||||
left: 200px;
|
||||
top: 9px;
|
||||
padding: 5px;
|
||||
width: 40%;
|
||||
max-width:550px;
|
||||
padding: 5px 0px 5px 0px;
|
||||
width: calc( 63% - 200px);
|
||||
background: #f0f0f0;
|
||||
border-color: #Ccc;
|
||||
}
|
||||
|
|
|
@ -30,15 +30,15 @@ class Test {
|
|||
var valid:Bool = false;
|
||||
var item:Dynamic = spec[i];
|
||||
if( item.fn == "query" ) q = new Query(item.data);
|
||||
if( item.fn == "url" ) res = URI.parse(item.data,false);
|
||||
if( item.fn == "url" ) res = URI.parse(item.data,0);
|
||||
if( item.expect.fn == "test" ) valid = item.expect.out == q.test( item.expect.input[0] );
|
||||
if( item.expect.fn == "testProperty" ) valid = item.expect.out == q.testProperty( item.expect.input[0], item.expect.input[1] );
|
||||
if( item.expect.fn == "testPropertyExclude" ) valid = item.expect.out == q.testProperty( item.expect.input[0], item.expect.input[1], true );
|
||||
if( item.expect.fn == "testParsed" ) valid = item.expect.out == res.exists(item.expect.input);
|
||||
if( item.expect.fn == "testPredefinedView" ) valid = res.exists(item.expect.input) && item.expect.out == res.get(item.expect.input).is( XRF.PV_EXECUTE) ;
|
||||
if( item.expect.fn == "testBrowserOverride" ) valid = item.expect.out == (URI.parse(item.data,true)).exists(item.expect.input);
|
||||
if( item.expect.fn == "testPropertyAssign" ) valid = res.exists(item.expect.input) && item.expect.out == res.get(item.expect.input).is( XRF.PROP_BIND) ;
|
||||
if( item.expect.fn == "testBrowserOverride" ) valid = item.expect.out == (URI.parse(item.data,true)).exists(item.expect.input);
|
||||
if( item.expect.fn == "testBrowserOverride" ) valid = item.expect.out == (URI.parse(item.data,XRF.BROWSER_OVERRIDE)).exists(item.expect.input);
|
||||
if( item.expect.fn == "testEmbedOverride" ) valid = item.expect.out == (URI.parse(item.data,XRF.EMBED_OVERRIDE)).exists(item.expect.input);
|
||||
if( item.expect.fn == "equal.string" ) valid = res.get(item.expect.input) && item.expect.out == res.get(item.expect.input).string;
|
||||
if( item.expect.fn == "equal.xy" ) valid = equalXY(res,item);
|
||||
if( item.expect.fn == "equal.xyz" ) valid = equalXYZ(res,item);
|
||||
|
@ -74,7 +74,7 @@ class Test {
|
|||
var Uri = xrfragment.URI;
|
||||
var url:String = "http://foo.com?foo=1#bar=flop&a=1,2&b=c|d|1,2,3";
|
||||
trace(url);
|
||||
trace( Uri.parse(url,false) );
|
||||
trace( Uri.parse(url,0) );
|
||||
}
|
||||
|
||||
static public function testQuery():Void {
|
||||
|
|
|
@ -6,6 +6,8 @@
|
|||
{"fn":"url","data":"http://foo.com?foo=1#pos=c|d|1,2,3", "expect":{ "fn":"equal.multi", "input":"pos","out":"c|d|1,2,3"},"label":"b equal.multi"},
|
||||
{"fn":"url","data":"http://foo.com?foo=1#t=2,500", "expect":{ "fn":"testBrowserOverride", "input":"t","out":true},"label":"browser URI can override t (defined in asset)"},
|
||||
{"fn":"url","data":"http://foo.com?foo=1#q=-bar", "expect":{ "fn":"testBrowserOverride", "input":"q","out":false},"label":"browser URI cannot override q (defined in asset)"},
|
||||
{"fn":"url","data":"http://foo.com?foo=1#scale=2,2,2", "expect":{ "fn":"testBrowserOverride", "input":"scale","out":false},"label":"scale does not have BROWSER_OVERRIDE set"},
|
||||
{"fn":"url","data":"http://foo.com?foo=1#scale=2,2,2", "expect":{ "fn":"testEmbedOverride", "input":"scale","out":true},"label":"embedded (src) URI can override scale"},
|
||||
{"fn":"url","data":"http://foo.com?foo=1#mypredefinedview", "expect":{ "fn":"testPredefinedView", "input":"mypredefinedview","out":true},"label":"test predefined view executed"},
|
||||
{"fn":"url","data":"http://foo.com?foo=1#mypredefinedview&another", "expect":{ "fn":"testPredefinedView", "input":"another","out":true},"label":"test predefined view executed (multiple)"},
|
||||
{"fn":"url","data":"http://foo.com?foo=1#mypredefinedview&another", "expect":{ "fn":"testPredefinedView", "input":"mypredefinedview","out":true},"label":"test predefined view executed (multiple)"},
|
||||
|
|
|
@ -25,7 +25,7 @@ class Parser {
|
|||
|
||||
// category: query selector / object manipulation
|
||||
Frag.set("q", XRF.PV_OVERRIDE | XRF.T_STRING | XRF.EMBED_OVERRIDE );
|
||||
Frag.set("scale", XRF.QUERY_OPERATOR | XRF.PV_OVERRIDE | XRF.ROUNDROBIN | XRF.T_INT | XRF.EMBED_OVERRIDE );
|
||||
Frag.set("scale", XRF.QUERY_OPERATOR | XRF.PV_OVERRIDE | XRF.ROUNDROBIN | XRF.T_VECTOR3 | XRF.EMBED_OVERRIDE );
|
||||
Frag.set("rot", XRF.QUERY_OPERATOR | XRF.PV_OVERRIDE | XRF.ROUNDROBIN | XRF.T_VECTOR3 | XRF.EMBED_OVERRIDE );
|
||||
Frag.set("translate", XRF.QUERY_OPERATOR | XRF.PV_OVERRIDE | XRF.ROUNDROBIN | XRF.T_VECTOR3 | XRF.EMBED_OVERRIDE );
|
||||
Frag.set("visible", XRF.QUERY_OPERATOR | XRF.PV_OVERRIDE | XRF.ROUNDROBIN | XRF.T_INT | XRF.EMBED_OVERRIDE );
|
||||
|
|
|
@ -42,10 +42,11 @@ import xrfragment.XRF;
|
|||
@:keep // <- avoids accidental removal by dead code elimination
|
||||
class URI {
|
||||
@:keep
|
||||
public static function parse(qs:String,browser_override:Bool):haxe.DynamicAccess<Dynamic> {
|
||||
var fragment:Array<String> = qs.split("#"); // 1. fragment URI starts with `#`
|
||||
public static function parse(url:String,filter:Int):haxe.DynamicAccess<Dynamic> {
|
||||
var store:haxe.DynamicAccess<Dynamic> = {}; // 1. store key/values into a associative array or dynamic object
|
||||
if( url.indexOf("#") == -1 ) return store;
|
||||
var fragment:Array<String> = url.split("#"); // 1. fragment URI starts with `#`
|
||||
var splitArray:Array<String> = fragment[1].split('&'); // 1. fragments are split by `&`
|
||||
var resultMap:haxe.DynamicAccess<Dynamic> = {}; // 1. store key/values into a associative array or dynamic object
|
||||
for (i in 0...splitArray.length) { // 1. loop thru each fragment
|
||||
|
||||
var splitByEqual = splitArray[i].split('='); // 1. for each fragment split on `=` to separate key/values
|
||||
|
@ -55,16 +56,16 @@ class URI {
|
|||
if (splitByEqual.length > 1) {
|
||||
value = StringTools.urlDecode(regexPlus.split(splitByEqual[1]).join(" "));
|
||||
}
|
||||
var ok:Bool = Parser.parse(key,value,resultMap); // 1. every recognized fragment key/value-pair is added to a central map/associative array/object
|
||||
var ok:Bool = Parser.parse(key,value,store); // 1. every recognized fragment key/value-pair is added to a central map/associative array/object
|
||||
}
|
||||
if( browser_override ){
|
||||
for (key in resultMap.keys()) {
|
||||
var xrf:XRF = resultMap.get(key);
|
||||
if( !xrf.is( XRF.BROWSER_OVERRIDE ) ){
|
||||
resultMap.remove(key);
|
||||
if( filter != null && filter != 0 ){
|
||||
for (key in store.keys()) {
|
||||
var xrf:XRF = store.get(key);
|
||||
if( !xrf.is( filter ) ){
|
||||
store.remove(key);
|
||||
}
|
||||
}
|
||||
}
|
||||
return resultMap;
|
||||
return store;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -136,7 +136,7 @@ StringTools.replace = function(s,sub,by) {
|
|||
var Test = function() { };
|
||||
Test.__name__ = true;
|
||||
Test.main = function() {
|
||||
Test.test([{ fn : "url", expect : { fn : "equal.xyz", input : "pos", out : false}, label : "equal.xyz: should trigger incompatible type)", data : "http://foo.com?foo=1#pos=1.2,2.2"},{ fn : "url", expect : { fn : "equal.xyz", input : "pos", out : "1.2,2.2,3"}, label : "equal.xyz", data : "http://foo.com?foo=1#pos=1.2,2.2,3"},{ fn : "url", expect : { fn : "equal.xy", input : "t", out : "1,100"}, label : "a equal.xy", data : "http://foo.com?foo=1#t=1,100"},{ fn : "url", expect : { fn : "testParsed", input : "prio", out : false}, label : "should trigger incompatible type", data : "http://foo.com?foo=1#prio=foo"},{ fn : "url", expect : { fn : "equal.multi", input : "pos", out : "c|d|1,2,3"}, label : "b equal.multi", data : "http://foo.com?foo=1#pos=c|d|1,2,3"},{ fn : "url", expect : { fn : "testBrowserOverride", input : "t", out : true}, label : "browser URI can override t (defined in asset)", data : "http://foo.com?foo=1#t=2,500"},{ fn : "url", expect : { fn : "testBrowserOverride", input : "q", out : false}, label : "browser URI cannot override q (defined in asset)", data : "http://foo.com?foo=1#q=-bar"},{ fn : "url", expect : { fn : "testPredefinedView", input : "mypredefinedview", out : true}, label : "test predefined view executed", data : "http://foo.com?foo=1#mypredefinedview"},{ fn : "url", expect : { fn : "testPredefinedView", input : "another", out : true}, label : "test predefined view executed (multiple)", data : "http://foo.com?foo=1#mypredefinedview&another"},{ fn : "url", expect : { fn : "testPredefinedView", input : "mypredefinedview", out : true}, label : "test predefined view executed (multiple)", data : "http://foo.com?foo=1#mypredefinedview&another"},{ fn : "url", expect : { fn : "testPropertyAssign", input : "cube.position.x", out : true}, label : "test data assign", data : "#cube.position.x=music.position.x"},{ fn : "url", expect : { fn : "testPropertyAssign", input : "cube.position.x", out : true}, label : "test one-way data bind", data : "#cube.position.x=@music.position.x"}]);
|
||||
Test.test([{ fn : "url", expect : { fn : "equal.xyz", input : "pos", out : false}, label : "equal.xyz: should trigger incompatible type)", data : "http://foo.com?foo=1#pos=1.2,2.2"},{ fn : "url", expect : { fn : "equal.xyz", input : "pos", out : "1.2,2.2,3"}, label : "equal.xyz", data : "http://foo.com?foo=1#pos=1.2,2.2,3"},{ fn : "url", expect : { fn : "equal.xy", input : "t", out : "1,100"}, label : "a equal.xy", data : "http://foo.com?foo=1#t=1,100"},{ fn : "url", expect : { fn : "testParsed", input : "prio", out : false}, label : "should trigger incompatible type", data : "http://foo.com?foo=1#prio=foo"},{ fn : "url", expect : { fn : "equal.multi", input : "pos", out : "c|d|1,2,3"}, label : "b equal.multi", data : "http://foo.com?foo=1#pos=c|d|1,2,3"},{ fn : "url", expect : { fn : "testBrowserOverride", input : "t", out : true}, label : "browser URI can override t (defined in asset)", data : "http://foo.com?foo=1#t=2,500"},{ fn : "url", expect : { fn : "testBrowserOverride", input : "q", out : false}, label : "browser URI cannot override q (defined in asset)", data : "http://foo.com?foo=1#q=-bar"},{ fn : "url", expect : { fn : "testBrowserOverride", input : "scale", out : false}, label : "scale does not have BROWSER_OVERRIDE set", data : "http://foo.com?foo=1#scale=2,2,2"},{ fn : "url", expect : { fn : "testEmbedOverride", input : "scale", out : true}, label : "embedded (src) URI can override scale", data : "http://foo.com?foo=1#scale=2,2,2"},{ fn : "url", expect : { fn : "testPredefinedView", input : "mypredefinedview", out : true}, label : "test predefined view executed", data : "http://foo.com?foo=1#mypredefinedview"},{ fn : "url", expect : { fn : "testPredefinedView", input : "another", out : true}, label : "test predefined view executed (multiple)", data : "http://foo.com?foo=1#mypredefinedview&another"},{ fn : "url", expect : { fn : "testPredefinedView", input : "mypredefinedview", out : true}, label : "test predefined view executed (multiple)", data : "http://foo.com?foo=1#mypredefinedview&another"},{ fn : "url", expect : { fn : "testPropertyAssign", input : "cube.position.x", out : true}, label : "test data assign", data : "#cube.position.x=music.position.x"},{ fn : "url", expect : { fn : "testPropertyAssign", input : "cube.position.x", out : true}, label : "test one-way data bind", data : "#cube.position.x=@music.position.x"}]);
|
||||
Test.test([{ fn : "query", expect : { fn : "testProperty", input : ["class","bar"], out : true}, data : "class:bar"},{ fn : "query", expect : { fn : "testProperty", input : ["class","bar"], out : true}, label : ".bar shorthand", data : ".bar"},{ fn : "query", expect : { fn : "testProperty", input : ["class","foo"], out : false}, data : ".bar -.foo"},{ fn : "query", expect : { fn : "testProperty", input : ["class","foo"], out : true}, data : ".bar -.foo .foo"},{ fn : "query", expect : { fn : "testProperty", input : ["class","bar"], out : true}, data : ".bar -.bar .bar"},{ fn : "query", expect : { fn : "testProperty", input : ["class","foo"], out : true}, label : "class:foo", data : ".foo -.foo .foo"},{ fn : "query", expect : { fn : "testProperty", input : ["class","foo"], out : true}, label : "class:foo", data : ".foo -.foo bar:5 .foo"},{ fn : "query", expect : { fn : "testProperty", input : ["class","foo"], out : true}, label : "class:foo", data : ".foo -.foo bar:>5 .foo"},{ fn : "query", expect : { fn : "testProperty", input : ["class","foo"], out : true}, label : "class:foo", data : ".foo -.foo bar:>5 .foo"},{ fn : "query", expect : { fn : "testProperty", input : ["class","foo"], out : true}, label : "class:foo", data : ".foo -.foo .foo"},{ fn : "query", expect : { fn : "testProperty", input : ["id","foo"], out : false}, label : "!id:foo", data : ".foo -.foo .foo"},{ fn : "query", expect : { fn : "testProperty", input : ["id","foo"], out : true}, label : "id:foo?", data : "foo -foo foo"}]);
|
||||
Test.test([{ fn : "query", expect : { fn : "testProperty", input : ["price","10"], out : true}, data : "price:>=5"},{ fn : "query", expect : { fn : "testProperty", input : ["price","10"], out : false}, data : "price:>=15"},{ fn : "query", expect : { fn : "testProperty", input : ["price","4"], out : false}, data : "price:>=5"},{ fn : "query", expect : { fn : "testProperty", input : ["price","0"], out : false}, data : "price:>=5"},{ fn : "query", expect : { fn : "testProperty", input : ["price","1"], out : false}, label : "price=1", data : "price:>=5 price:0"},{ fn : "query", expect : { fn : "testProperty", input : ["price","0"], out : true}, label : "price=0", data : "price:>=5 price:0"},{ fn : "query", expect : { fn : "testProperty", input : ["price","6"], out : true}, label : "price=6", data : "price:>=5 price:0"},{ fn : "query", expect : { fn : "testProperty", input : ["tag","foo"], out : true}, data : "tag:foo"},{ fn : "query", expect : { fn : "testProperty", input : ["tag","foo"], out : false}, data : "-tag:foo"},{ fn : "query", expect : { fn : "testPropertyExclude", input : ["tag","foo"], out : true}, label : "testExclude", data : "-tag:foo"},{ fn : "query", expect : { fn : "test", input : [{ price : 5}], out : true}, data : ".foo price:5 -tag:foo"},{ fn : "query", expect : { fn : "test", input : [{ tag : "foo", price : 5}], out : false}, data : ".foo price:5 -tag:foo"}]);
|
||||
if(Test.errors > 1) {
|
||||
|
@ -157,7 +157,7 @@ Test.test = function(spec) {
|
|||
q = new xrfragment_Query(item.data);
|
||||
}
|
||||
if(item.fn == "url") {
|
||||
res = xrfragment_URI.parse(item.data,false);
|
||||
res = xrfragment_URI.parse(item.data,0);
|
||||
}
|
||||
if(item.expect.fn == "test") {
|
||||
valid = item.expect.out == q.test(item.expect.input[0]);
|
||||
|
@ -174,17 +174,17 @@ Test.test = function(spec) {
|
|||
if(item.expect.fn == "testPredefinedView") {
|
||||
valid = Object.prototype.hasOwnProperty.call(res,item.expect.input) && item.expect.out == res[item.expect.input].is(xrfragment_XRF.PV_EXECUTE);
|
||||
}
|
||||
if(item.expect.fn == "testBrowserOverride") {
|
||||
var item1 = item.expect.out;
|
||||
var this1 = xrfragment_URI.parse(item.data,true);
|
||||
valid = item1 == Object.prototype.hasOwnProperty.call(this1,item.expect.input);
|
||||
}
|
||||
if(item.expect.fn == "testPropertyAssign") {
|
||||
valid = Object.prototype.hasOwnProperty.call(res,item.expect.input) && item.expect.out == res[item.expect.input].is(xrfragment_XRF.PROP_BIND);
|
||||
}
|
||||
if(item.expect.fn == "testBrowserOverride") {
|
||||
var item1 = item.expect.out;
|
||||
var this1 = xrfragment_URI.parse(item.data,xrfragment_XRF.BROWSER_OVERRIDE);
|
||||
valid = item1 == Object.prototype.hasOwnProperty.call(this1,item.expect.input);
|
||||
}
|
||||
if(item.expect.fn == "testEmbedOverride") {
|
||||
var item2 = item.expect.out;
|
||||
var this2 = xrfragment_URI.parse(item.data,true);
|
||||
var this2 = xrfragment_URI.parse(item.data,xrfragment_XRF.EMBED_OVERRIDE);
|
||||
valid = item2 == Object.prototype.hasOwnProperty.call(this2,item.expect.input);
|
||||
}
|
||||
if(item.expect.fn == "equal.string") {
|
||||
|
@ -330,25 +330,25 @@ xrfragment_Parser.parse = function(key,value,resultMap) {
|
|||
Frag_h["#"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_PREDEFINED_VIEW;
|
||||
Frag_h["class"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING;
|
||||
Frag_h["src"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL;
|
||||
Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING_OBJ;
|
||||
Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING_OBJ | xrfragment_XRF.EMBED_OVERRIDE;
|
||||
Frag_h["href"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW;
|
||||
Frag_h["q"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_STRING;
|
||||
Frag_h["scale"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_INT;
|
||||
Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_VECTOR3;
|
||||
Frag_h["translate"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_VECTOR3;
|
||||
Frag_h["visible"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_INT;
|
||||
Frag_h["env"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_STRING;
|
||||
Frag_h["t"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.BROWSER_OVERRIDE;
|
||||
Frag_h["gravity"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3;
|
||||
Frag_h["physics"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3;
|
||||
Frag_h["fov"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_INT | xrfragment_XRF.BROWSER_OVERRIDE;
|
||||
Frag_h["clip"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.BROWSER_OVERRIDE;
|
||||
Frag_h["fog"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_STRING | xrfragment_XRF.BROWSER_OVERRIDE;
|
||||
Frag_h["q"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_STRING | xrfragment_XRF.EMBED_OVERRIDE;
|
||||
Frag_h["scale"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.EMBED_OVERRIDE;
|
||||
Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.EMBED_OVERRIDE;
|
||||
Frag_h["translate"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.EMBED_OVERRIDE;
|
||||
Frag_h["visible"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_INT | xrfragment_XRF.EMBED_OVERRIDE;
|
||||
Frag_h["env"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_STRING | xrfragment_XRF.EMBED_OVERRIDE;
|
||||
Frag_h["t"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.BROWSER_OVERRIDE | xrfragment_XRF.EMBED_OVERRIDE;
|
||||
Frag_h["gravity"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.EMBED_OVERRIDE;
|
||||
Frag_h["physics"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.EMBED_OVERRIDE;
|
||||
Frag_h["fov"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_INT | xrfragment_XRF.BROWSER_OVERRIDE | xrfragment_XRF.EMBED_OVERRIDE;
|
||||
Frag_h["clip"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.BROWSER_OVERRIDE | xrfragment_XRF.EMBED_OVERRIDE;
|
||||
Frag_h["fog"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_STRING | xrfragment_XRF.BROWSER_OVERRIDE | xrfragment_XRF.EMBED_OVERRIDE;
|
||||
Frag_h["namespace"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING;
|
||||
Frag_h["SPDX"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING;
|
||||
Frag_h["unit"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING;
|
||||
Frag_h["description"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING;
|
||||
Frag_h["session"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.BROWSER_OVERRIDE | xrfragment_XRF.PROMPT;
|
||||
Frag_h["session"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.BROWSER_OVERRIDE | xrfragment_XRF.EMBED_OVERRIDE | xrfragment_XRF.PROMPT;
|
||||
if(value.length == 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key)) {
|
||||
resultMap[key] = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.BROWSER_OVERRIDE);
|
||||
return true;
|
||||
|
@ -554,10 +554,13 @@ xrfragment_Query.prototype = {
|
|||
};
|
||||
var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { };
|
||||
xrfragment_URI.__name__ = true;
|
||||
xrfragment_URI.parse = function(qs,browser_override) {
|
||||
var fragment = qs.split("#");
|
||||
xrfragment_URI.parse = function(url,filter) {
|
||||
var store = { };
|
||||
if(url.indexOf("#") == -1) {
|
||||
return store;
|
||||
}
|
||||
var fragment = url.split("#");
|
||||
var splitArray = fragment[1].split("&");
|
||||
var resultMap = { };
|
||||
var _g = 0;
|
||||
var _g1 = splitArray.length;
|
||||
while(_g < _g1) {
|
||||
|
@ -570,21 +573,21 @@ xrfragment_URI.parse = function(qs,browser_override) {
|
|||
var s = regexPlus.split(splitByEqual[1]).join(" ");
|
||||
value = decodeURIComponent(s.split("+").join(" "));
|
||||
}
|
||||
var ok = xrfragment_Parser.parse(key,value,resultMap);
|
||||
var ok = xrfragment_Parser.parse(key,value,store);
|
||||
}
|
||||
if(browser_override) {
|
||||
if(filter != null && filter != 0) {
|
||||
var _g = 0;
|
||||
var _g1 = Reflect.fields(resultMap);
|
||||
var _g1 = Reflect.fields(store);
|
||||
while(_g < _g1.length) {
|
||||
var key = _g1[_g];
|
||||
++_g;
|
||||
var xrf = resultMap[key];
|
||||
if(!xrf.is(xrfragment_XRF.BROWSER_OVERRIDE)) {
|
||||
Reflect.deleteField(resultMap,key);
|
||||
var xrf = store[key];
|
||||
if(!xrf.is(filter)) {
|
||||
Reflect.deleteField(store,key);
|
||||
}
|
||||
}
|
||||
}
|
||||
return resultMap;
|
||||
return store;
|
||||
};
|
||||
var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags) {
|
||||
this.fragment = _fragment;
|
||||
|
@ -678,18 +681,19 @@ xrfragment_XRF.QUERY_OPERATOR = 4;
|
|||
xrfragment_XRF.PROMPT = 8;
|
||||
xrfragment_XRF.ROUNDROBIN = 16;
|
||||
xrfragment_XRF.BROWSER_OVERRIDE = 32;
|
||||
xrfragment_XRF.PV_OVERRIDE = 64;
|
||||
xrfragment_XRF.PV_EXECUTE = 128;
|
||||
xrfragment_XRF.T_COLOR = 256;
|
||||
xrfragment_XRF.T_INT = 512;
|
||||
xrfragment_XRF.T_FLOAT = 1024;
|
||||
xrfragment_XRF.T_VECTOR2 = 2048;
|
||||
xrfragment_XRF.T_VECTOR3 = 4096;
|
||||
xrfragment_XRF.T_URL = 8192;
|
||||
xrfragment_XRF.T_PREDEFINED_VIEW = 16384;
|
||||
xrfragment_XRF.T_STRING = 32768;
|
||||
xrfragment_XRF.T_STRING_OBJ = 65536;
|
||||
xrfragment_XRF.T_STRING_OBJ_PROP = 131072;
|
||||
xrfragment_XRF.EMBED_OVERRIDE = 64;
|
||||
xrfragment_XRF.PV_OVERRIDE = 128;
|
||||
xrfragment_XRF.PV_EXECUTE = 256;
|
||||
xrfragment_XRF.T_COLOR = 8192;
|
||||
xrfragment_XRF.T_INT = 16384;
|
||||
xrfragment_XRF.T_FLOAT = 32768;
|
||||
xrfragment_XRF.T_VECTOR2 = 65536;
|
||||
xrfragment_XRF.T_VECTOR3 = 131072;
|
||||
xrfragment_XRF.T_URL = 262144;
|
||||
xrfragment_XRF.T_PREDEFINED_VIEW = 524288;
|
||||
xrfragment_XRF.T_STRING = 1048576;
|
||||
xrfragment_XRF.T_STRING_OBJ = 2097152;
|
||||
xrfragment_XRF.T_STRING_OBJ_PROP = 4194304;
|
||||
xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$","");
|
||||
xrfragment_XRF.isInt = new EReg("^[0-9]+$","");
|
||||
xrfragment_XRF.isFloat = new EReg("^[0-9]+\\.[0-9]+$","");
|
||||
|
|
|
@ -390,7 +390,7 @@ class Test:
|
|||
|
||||
@staticmethod
|
||||
def main():
|
||||
Test.test([_hx_AnonObject({'fn': "url", 'expect': _hx_AnonObject({'fn': "equal.xyz", 'input': "pos", 'out': False}), 'label': "equal.xyz: should trigger incompatible type)", 'data': "http://foo.com?foo=1#pos=1.2,2.2"}), _hx_AnonObject({'fn': "url", 'expect': _hx_AnonObject({'fn': "equal.xyz", 'input': "pos", 'out': "1.2,2.2,3"}), 'label': "equal.xyz", 'data': "http://foo.com?foo=1#pos=1.2,2.2,3"}), _hx_AnonObject({'fn': "url", 'expect': _hx_AnonObject({'fn': "equal.xy", 'input': "t", 'out': "1,100"}), 'label': "a equal.xy", 'data': "http://foo.com?foo=1#t=1,100"}), _hx_AnonObject({'fn': "url", 'expect': _hx_AnonObject({'fn': "testParsed", 'input': "prio", 'out': False}), 'label': "should trigger incompatible type", 'data': "http://foo.com?foo=1#prio=foo"}), _hx_AnonObject({'fn': "url", 'expect': _hx_AnonObject({'fn': "equal.multi", 'input': "pos", 'out': "c|d|1,2,3"}), 'label': "b equal.multi", 'data': "http://foo.com?foo=1#pos=c|d|1,2,3"}), _hx_AnonObject({'fn': "url", 'expect': _hx_AnonObject({'fn': "testBrowserOverride", 'input': "t", 'out': True}), 'label': "browser URI can override t (defined in asset)", 'data': "http://foo.com?foo=1#t=2,500"}), _hx_AnonObject({'fn': "url", 'expect': _hx_AnonObject({'fn': "testBrowserOverride", 'input': "q", 'out': False}), 'label': "browser URI cannot override q (defined in asset)", 'data': "http://foo.com?foo=1#q=-bar"}), _hx_AnonObject({'fn': "url", 'expect': _hx_AnonObject({'fn': "testPredefinedView", 'input': "mypredefinedview", 'out': True}), 'label': "test predefined view executed", 'data': "http://foo.com?foo=1#mypredefinedview"}), _hx_AnonObject({'fn': "url", 'expect': _hx_AnonObject({'fn': "testPredefinedView", 'input': "another", 'out': True}), 'label': "test predefined view executed (multiple)", 'data': "http://foo.com?foo=1#mypredefinedview&another"}), _hx_AnonObject({'fn': "url", 'expect': _hx_AnonObject({'fn': "testPredefinedView", 'input': "mypredefinedview", 'out': True}), 'label': "test predefined view executed (multiple)", 'data': "http://foo.com?foo=1#mypredefinedview&another"}), _hx_AnonObject({'fn': "url", 'expect': _hx_AnonObject({'fn': "testPropertyAssign", 'input': "cube.position.x", 'out': True}), 'label': "test data assign", 'data': "#cube.position.x=music.position.x"}), _hx_AnonObject({'fn': "url", 'expect': _hx_AnonObject({'fn': "testPropertyAssign", 'input': "cube.position.x", 'out': True}), 'label': "test one-way data bind", 'data': "#cube.position.x=@music.position.x"})])
|
||||
Test.test([_hx_AnonObject({'fn': "url", 'expect': _hx_AnonObject({'fn': "equal.xyz", 'input': "pos", 'out': False}), 'label': "equal.xyz: should trigger incompatible type)", 'data': "http://foo.com?foo=1#pos=1.2,2.2"}), _hx_AnonObject({'fn': "url", 'expect': _hx_AnonObject({'fn': "equal.xyz", 'input': "pos", 'out': "1.2,2.2,3"}), 'label': "equal.xyz", 'data': "http://foo.com?foo=1#pos=1.2,2.2,3"}), _hx_AnonObject({'fn': "url", 'expect': _hx_AnonObject({'fn': "equal.xy", 'input': "t", 'out': "1,100"}), 'label': "a equal.xy", 'data': "http://foo.com?foo=1#t=1,100"}), _hx_AnonObject({'fn': "url", 'expect': _hx_AnonObject({'fn': "testParsed", 'input': "prio", 'out': False}), 'label': "should trigger incompatible type", 'data': "http://foo.com?foo=1#prio=foo"}), _hx_AnonObject({'fn': "url", 'expect': _hx_AnonObject({'fn': "equal.multi", 'input': "pos", 'out': "c|d|1,2,3"}), 'label': "b equal.multi", 'data': "http://foo.com?foo=1#pos=c|d|1,2,3"}), _hx_AnonObject({'fn': "url", 'expect': _hx_AnonObject({'fn': "testBrowserOverride", 'input': "t", 'out': True}), 'label': "browser URI can override t (defined in asset)", 'data': "http://foo.com?foo=1#t=2,500"}), _hx_AnonObject({'fn': "url", 'expect': _hx_AnonObject({'fn': "testBrowserOverride", 'input': "q", 'out': False}), 'label': "browser URI cannot override q (defined in asset)", 'data': "http://foo.com?foo=1#q=-bar"}), _hx_AnonObject({'fn': "url", 'expect': _hx_AnonObject({'fn': "testBrowserOverride", 'input': "scale", 'out': False}), 'label': "scale does not have BROWSER_OVERRIDE set", 'data': "http://foo.com?foo=1#scale=2,2,2"}), _hx_AnonObject({'fn': "url", 'expect': _hx_AnonObject({'fn': "testEmbedOverride", 'input': "scale", 'out': True}), 'label': "embedded (src) URI can override scale", 'data': "http://foo.com?foo=1#scale=2,2,2"}), _hx_AnonObject({'fn': "url", 'expect': _hx_AnonObject({'fn': "testPredefinedView", 'input': "mypredefinedview", 'out': True}), 'label': "test predefined view executed", 'data': "http://foo.com?foo=1#mypredefinedview"}), _hx_AnonObject({'fn': "url", 'expect': _hx_AnonObject({'fn': "testPredefinedView", 'input': "another", 'out': True}), 'label': "test predefined view executed (multiple)", 'data': "http://foo.com?foo=1#mypredefinedview&another"}), _hx_AnonObject({'fn': "url", 'expect': _hx_AnonObject({'fn': "testPredefinedView", 'input': "mypredefinedview", 'out': True}), 'label': "test predefined view executed (multiple)", 'data': "http://foo.com?foo=1#mypredefinedview&another"}), _hx_AnonObject({'fn': "url", 'expect': _hx_AnonObject({'fn': "testPropertyAssign", 'input': "cube.position.x", 'out': True}), 'label': "test data assign", 'data': "#cube.position.x=music.position.x"}), _hx_AnonObject({'fn': "url", 'expect': _hx_AnonObject({'fn': "testPropertyAssign", 'input': "cube.position.x", 'out': True}), 'label': "test one-way data bind", 'data': "#cube.position.x=@music.position.x"})])
|
||||
Test.test([_hx_AnonObject({'fn': "query", 'expect': _hx_AnonObject({'fn': "testProperty", 'input': ["class", "bar"], 'out': True}), 'data': "class:bar"}), _hx_AnonObject({'fn': "query", 'expect': _hx_AnonObject({'fn': "testProperty", 'input': ["class", "bar"], 'out': True}), 'label': ".bar shorthand", 'data': ".bar"}), _hx_AnonObject({'fn': "query", 'expect': _hx_AnonObject({'fn': "testProperty", 'input': ["class", "foo"], 'out': False}), 'data': ".bar -.foo"}), _hx_AnonObject({'fn': "query", 'expect': _hx_AnonObject({'fn': "testProperty", 'input': ["class", "foo"], 'out': True}), 'data': ".bar -.foo .foo"}), _hx_AnonObject({'fn': "query", 'expect': _hx_AnonObject({'fn': "testProperty", 'input': ["class", "bar"], 'out': True}), 'data': ".bar -.bar .bar"}), _hx_AnonObject({'fn': "query", 'expect': _hx_AnonObject({'fn': "testProperty", 'input': ["class", "foo"], 'out': True}), 'label': "class:foo", 'data': ".foo -.foo .foo"}), _hx_AnonObject({'fn': "query", 'expect': _hx_AnonObject({'fn': "testProperty", 'input': ["class", "foo"], 'out': True}), 'label': "class:foo", 'data': ".foo -.foo bar:5 .foo"}), _hx_AnonObject({'fn': "query", 'expect': _hx_AnonObject({'fn': "testProperty", 'input': ["class", "foo"], 'out': True}), 'label': "class:foo", 'data': ".foo -.foo bar:>5 .foo"}), _hx_AnonObject({'fn': "query", 'expect': _hx_AnonObject({'fn': "testProperty", 'input': ["class", "foo"], 'out': True}), 'label': "class:foo", 'data': ".foo -.foo bar:>5 .foo"}), _hx_AnonObject({'fn': "query", 'expect': _hx_AnonObject({'fn': "testProperty", 'input': ["class", "foo"], 'out': True}), 'label': "class:foo", 'data': ".foo -.foo .foo"}), _hx_AnonObject({'fn': "query", 'expect': _hx_AnonObject({'fn': "testProperty", 'input': ["id", "foo"], 'out': False}), 'label': "!id:foo", 'data': ".foo -.foo .foo"}), _hx_AnonObject({'fn': "query", 'expect': _hx_AnonObject({'fn': "testProperty", 'input': ["id", "foo"], 'out': True}), 'label': "id:foo?", 'data': "foo -foo foo"})])
|
||||
Test.test([_hx_AnonObject({'fn': "query", 'expect': _hx_AnonObject({'fn': "testProperty", 'input': ["price", "10"], 'out': True}), 'data': "price:>=5"}), _hx_AnonObject({'fn': "query", 'expect': _hx_AnonObject({'fn': "testProperty", 'input': ["price", "10"], 'out': False}), 'data': "price:>=15"}), _hx_AnonObject({'fn': "query", 'expect': _hx_AnonObject({'fn': "testProperty", 'input': ["price", "4"], 'out': False}), 'data': "price:>=5"}), _hx_AnonObject({'fn': "query", 'expect': _hx_AnonObject({'fn': "testProperty", 'input': ["price", "0"], 'out': False}), 'data': "price:>=5"}), _hx_AnonObject({'fn': "query", 'expect': _hx_AnonObject({'fn': "testProperty", 'input': ["price", "1"], 'out': False}), 'label': "price=1", 'data': "price:>=5 price:0"}), _hx_AnonObject({'fn': "query", 'expect': _hx_AnonObject({'fn': "testProperty", 'input': ["price", "0"], 'out': True}), 'label': "price=0", 'data': "price:>=5 price:0"}), _hx_AnonObject({'fn': "query", 'expect': _hx_AnonObject({'fn': "testProperty", 'input': ["price", "6"], 'out': True}), 'label': "price=6", 'data': "price:>=5 price:0"}), _hx_AnonObject({'fn': "query", 'expect': _hx_AnonObject({'fn': "testProperty", 'input': ["tag", "foo"], 'out': True}), 'data': "tag:foo"}), _hx_AnonObject({'fn': "query", 'expect': _hx_AnonObject({'fn': "testProperty", 'input': ["tag", "foo"], 'out': False}), 'data': "-tag:foo"}), _hx_AnonObject({'fn': "query", 'expect': _hx_AnonObject({'fn': "testPropertyExclude", 'input': ["tag", "foo"], 'out': True}), 'label': "testExclude", 'data': "-tag:foo"}), _hx_AnonObject({'fn': "query", 'expect': _hx_AnonObject({'fn': "test", 'input': [_hx_AnonObject({'price': 5})], 'out': True}), 'data': ".foo price:5 -tag:foo"}), _hx_AnonObject({'fn': "query", 'expect': _hx_AnonObject({'fn': "test", 'input': [_hx_AnonObject({'tag': "foo", 'price': 5})], 'out': False}), 'data': ".foo price:5 -tag:foo"})])
|
||||
if (Test.errors > 1):
|
||||
|
@ -411,7 +411,7 @@ class Test:
|
|||
if (Reflect.field(item,"fn") == "query"):
|
||||
q = xrfragment_Query(Reflect.field(item,"data"))
|
||||
if (Reflect.field(item,"fn") == "url"):
|
||||
res = xrfragment_URI.parse(Reflect.field(item,"data"),False)
|
||||
res = xrfragment_URI.parse(Reflect.field(item,"data"),0)
|
||||
if (Reflect.field(Reflect.field(item,"expect"),"fn") == "test"):
|
||||
valid = (Reflect.field(Reflect.field(item,"expect"),"out") == q.test(HxOverrides.arrayGet(Reflect.field(Reflect.field(item,"expect"),"input"), 0)))
|
||||
if (Reflect.field(Reflect.field(item,"expect"),"fn") == "testProperty"):
|
||||
|
@ -422,12 +422,12 @@ class Test:
|
|||
valid = (Reflect.field(Reflect.field(item,"expect"),"out") == python_Boot.hasField(res,Reflect.field(Reflect.field(item,"expect"),"input")))
|
||||
if (Reflect.field(Reflect.field(item,"expect"),"fn") == "testPredefinedView"):
|
||||
valid = (python_Boot.hasField(res,Reflect.field(Reflect.field(item,"expect"),"input")) and (HxOverrides.eq(Reflect.field(Reflect.field(item,"expect"),"out"),Reflect.field(Reflect.field(res,Reflect.field(Reflect.field(item,"expect"),"input")),"is")(xrfragment_XRF.PV_EXECUTE))))
|
||||
if (Reflect.field(Reflect.field(item,"expect"),"fn") == "testBrowserOverride"):
|
||||
valid = (Reflect.field(Reflect.field(item,"expect"),"out") == python_Boot.hasField(xrfragment_URI.parse(Reflect.field(item,"data"),True),Reflect.field(Reflect.field(item,"expect"),"input")))
|
||||
if (Reflect.field(Reflect.field(item,"expect"),"fn") == "testPropertyAssign"):
|
||||
valid = (python_Boot.hasField(res,Reflect.field(Reflect.field(item,"expect"),"input")) and (HxOverrides.eq(Reflect.field(Reflect.field(item,"expect"),"out"),Reflect.field(Reflect.field(res,Reflect.field(Reflect.field(item,"expect"),"input")),"is")(xrfragment_XRF.PROP_BIND))))
|
||||
if (Reflect.field(Reflect.field(item,"expect"),"fn") == "testBrowserOverride"):
|
||||
valid = (Reflect.field(Reflect.field(item,"expect"),"out") == python_Boot.hasField(xrfragment_URI.parse(Reflect.field(item,"data"),True),Reflect.field(Reflect.field(item,"expect"),"input")))
|
||||
valid = (Reflect.field(Reflect.field(item,"expect"),"out") == python_Boot.hasField(xrfragment_URI.parse(Reflect.field(item,"data"),xrfragment_XRF.BROWSER_OVERRIDE),Reflect.field(Reflect.field(item,"expect"),"input")))
|
||||
if (Reflect.field(Reflect.field(item,"expect"),"fn") == "testEmbedOverride"):
|
||||
valid = (Reflect.field(Reflect.field(item,"expect"),"out") == python_Boot.hasField(xrfragment_URI.parse(Reflect.field(item,"data"),xrfragment_XRF.EMBED_OVERRIDE),Reflect.field(Reflect.field(item,"expect"),"input")))
|
||||
if (Reflect.field(Reflect.field(item,"expect"),"fn") == "equal.string"):
|
||||
valid = (Reflect.field(res,Reflect.field(Reflect.field(item,"expect"),"input")) and (HxOverrides.eq(Reflect.field(Reflect.field(item,"expect"),"out"),Reflect.field(Reflect.field(res,Reflect.field(Reflect.field(item,"expect"),"input")),"string"))))
|
||||
if (Reflect.field(Reflect.field(item,"expect"),"fn") == "equal.xy"):
|
||||
|
@ -1411,25 +1411,25 @@ class xrfragment_Parser:
|
|||
Frag.h["#"] = (xrfragment_XRF.ASSET | xrfragment_XRF.T_PREDEFINED_VIEW)
|
||||
Frag.h["class"] = (xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING)
|
||||
Frag.h["src"] = (xrfragment_XRF.ASSET | xrfragment_XRF.T_URL)
|
||||
Frag.h["pos"] = (((xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN) | xrfragment_XRF.T_VECTOR3) | xrfragment_XRF.T_STRING_OBJ)
|
||||
Frag.h["pos"] = ((((xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN) | xrfragment_XRF.T_VECTOR3) | xrfragment_XRF.T_STRING_OBJ) | xrfragment_XRF.EMBED_OVERRIDE)
|
||||
Frag.h["href"] = ((xrfragment_XRF.ASSET | xrfragment_XRF.T_URL) | xrfragment_XRF.T_PREDEFINED_VIEW)
|
||||
Frag.h["q"] = (xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_STRING)
|
||||
Frag.h["scale"] = (((xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.ROUNDROBIN) | xrfragment_XRF.T_INT)
|
||||
Frag.h["rot"] = (((xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.ROUNDROBIN) | xrfragment_XRF.T_VECTOR3)
|
||||
Frag.h["translate"] = (((xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.ROUNDROBIN) | xrfragment_XRF.T_VECTOR3)
|
||||
Frag.h["visible"] = (((xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.ROUNDROBIN) | xrfragment_XRF.T_INT)
|
||||
Frag.h["env"] = ((xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.T_STRING)
|
||||
Frag.h["t"] = ((((xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.ROUNDROBIN) | xrfragment_XRF.T_VECTOR2) | xrfragment_XRF.BROWSER_OVERRIDE)
|
||||
Frag.h["gravity"] = ((xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.T_VECTOR3)
|
||||
Frag.h["physics"] = ((xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.T_VECTOR3)
|
||||
Frag.h["fov"] = (((xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.T_INT) | xrfragment_XRF.BROWSER_OVERRIDE)
|
||||
Frag.h["clip"] = (((xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.T_VECTOR2) | xrfragment_XRF.BROWSER_OVERRIDE)
|
||||
Frag.h["fog"] = (((xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.T_STRING) | xrfragment_XRF.BROWSER_OVERRIDE)
|
||||
Frag.h["q"] = ((xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_STRING) | xrfragment_XRF.EMBED_OVERRIDE)
|
||||
Frag.h["scale"] = ((((xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.ROUNDROBIN) | xrfragment_XRF.T_VECTOR3) | xrfragment_XRF.EMBED_OVERRIDE)
|
||||
Frag.h["rot"] = ((((xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.ROUNDROBIN) | xrfragment_XRF.T_VECTOR3) | xrfragment_XRF.EMBED_OVERRIDE)
|
||||
Frag.h["translate"] = ((((xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.ROUNDROBIN) | xrfragment_XRF.T_VECTOR3) | xrfragment_XRF.EMBED_OVERRIDE)
|
||||
Frag.h["visible"] = ((((xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.ROUNDROBIN) | xrfragment_XRF.T_INT) | xrfragment_XRF.EMBED_OVERRIDE)
|
||||
Frag.h["env"] = (((xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.T_STRING) | xrfragment_XRF.EMBED_OVERRIDE)
|
||||
Frag.h["t"] = (((((xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.ROUNDROBIN) | xrfragment_XRF.T_VECTOR2) | xrfragment_XRF.BROWSER_OVERRIDE) | xrfragment_XRF.EMBED_OVERRIDE)
|
||||
Frag.h["gravity"] = (((xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.T_VECTOR3) | xrfragment_XRF.EMBED_OVERRIDE)
|
||||
Frag.h["physics"] = (((xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.T_VECTOR3) | xrfragment_XRF.EMBED_OVERRIDE)
|
||||
Frag.h["fov"] = ((((xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.T_INT) | xrfragment_XRF.BROWSER_OVERRIDE) | xrfragment_XRF.EMBED_OVERRIDE)
|
||||
Frag.h["clip"] = ((((xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.T_VECTOR2) | xrfragment_XRF.BROWSER_OVERRIDE) | xrfragment_XRF.EMBED_OVERRIDE)
|
||||
Frag.h["fog"] = ((((xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.T_STRING) | xrfragment_XRF.BROWSER_OVERRIDE) | xrfragment_XRF.EMBED_OVERRIDE)
|
||||
Frag.h["namespace"] = (xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING)
|
||||
Frag.h["SPDX"] = (xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING)
|
||||
Frag.h["unit"] = (xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING)
|
||||
Frag.h["description"] = (xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING)
|
||||
Frag.h["session"] = ((((xrfragment_XRF.ASSET | xrfragment_XRF.T_URL) | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.BROWSER_OVERRIDE) | xrfragment_XRF.PROMPT)
|
||||
Frag.h["session"] = (((((xrfragment_XRF.ASSET | xrfragment_XRF.T_URL) | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.BROWSER_OVERRIDE) | xrfragment_XRF.EMBED_OVERRIDE) | xrfragment_XRF.PROMPT)
|
||||
if ((len(value) == 0) and (not (key in Frag.h))):
|
||||
value1 = xrfragment_XRF(key,(xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.BROWSER_OVERRIDE))
|
||||
setattr(resultMap,(("_hx_" + key) if ((key in python_Boot.keywords)) else (("_hx_" + key) if (((((len(key) > 2) and ((ord(key[0]) == 95))) and ((ord(key[1]) == 95))) and ((ord(key[(len(key) - 1)]) != 95)))) else key)),value1)
|
||||
|
@ -1641,11 +1641,14 @@ class xrfragment_URI:
|
|||
_hx_statics = ["parse"]
|
||||
|
||||
@staticmethod
|
||||
def parse(qs,browser_override):
|
||||
fragment = qs.split("#")
|
||||
def parse(url,_hx_filter):
|
||||
store = _hx_AnonObject({})
|
||||
startIndex = None
|
||||
if (((url.find("#") if ((startIndex is None)) else HxString.indexOfImpl(url,"#",startIndex))) == -1):
|
||||
return store
|
||||
fragment = url.split("#")
|
||||
_this = (fragment[1] if 1 < len(fragment) else None)
|
||||
splitArray = _this.split("&")
|
||||
resultMap = _hx_AnonObject({})
|
||||
_g = 0
|
||||
_g1 = len(splitArray)
|
||||
while (_g < _g1):
|
||||
|
@ -1659,17 +1662,17 @@ class xrfragment_URI:
|
|||
if (len(splitByEqual) > 1):
|
||||
_this1 = regexPlus.split((splitByEqual[1] if 1 < len(splitByEqual) else None))
|
||||
value = python_lib_urllib_Parse.unquote(" ".join([python_Boot.toString1(x1,'') for x1 in _this1]))
|
||||
ok = xrfragment_Parser.parse(key,value,resultMap)
|
||||
if browser_override:
|
||||
ok = xrfragment_Parser.parse(key,value,store)
|
||||
if ((_hx_filter is not None) and ((_hx_filter != 0))):
|
||||
_g = 0
|
||||
_g1 = python_Boot.fields(resultMap)
|
||||
_g1 = python_Boot.fields(store)
|
||||
while (_g < len(_g1)):
|
||||
key = (_g1[_g] if _g >= 0 and _g < len(_g1) else None)
|
||||
_g = (_g + 1)
|
||||
xrf = Reflect.field(resultMap,key)
|
||||
if (not xrf._hx_is(xrfragment_XRF.BROWSER_OVERRIDE)):
|
||||
Reflect.deleteField(resultMap,key)
|
||||
return resultMap
|
||||
xrf = Reflect.field(store,key)
|
||||
if (not xrf._hx_is(_hx_filter)):
|
||||
Reflect.deleteField(store,key)
|
||||
return store
|
||||
|
||||
|
||||
class xrfragment_XRF:
|
||||
|
@ -1677,7 +1680,7 @@ class xrfragment_XRF:
|
|||
__slots__ = ("fragment", "flags", "x", "y", "z", "color", "string", "int", "float", "args", "query")
|
||||
_hx_fields = ["fragment", "flags", "x", "y", "z", "color", "string", "int", "float", "args", "query"]
|
||||
_hx_methods = ["is", "validate", "guessType"]
|
||||
_hx_statics = ["ASSET", "PROP_BIND", "QUERY_OPERATOR", "PROMPT", "ROUNDROBIN", "BROWSER_OVERRIDE", "PV_OVERRIDE", "PV_EXECUTE", "T_COLOR", "T_INT", "T_FLOAT", "T_VECTOR2", "T_VECTOR3", "T_URL", "T_PREDEFINED_VIEW", "T_STRING", "T_STRING_OBJ", "T_STRING_OBJ_PROP", "isColor", "isInt", "isFloat", "isVector", "isUrl", "isUrlOrPretypedView", "isString", "set", "unset"]
|
||||
_hx_statics = ["ASSET", "PROP_BIND", "QUERY_OPERATOR", "PROMPT", "ROUNDROBIN", "BROWSER_OVERRIDE", "EMBED_OVERRIDE", "PV_OVERRIDE", "PV_EXECUTE", "T_COLOR", "T_INT", "T_FLOAT", "T_VECTOR2", "T_VECTOR3", "T_URL", "T_PREDEFINED_VIEW", "T_STRING", "T_STRING_OBJ", "T_STRING_OBJ_PROP", "isColor", "isInt", "isFloat", "isVector", "isUrl", "isUrlOrPretypedView", "isString", "set", "unset"]
|
||||
|
||||
def __init__(self,_fragment,_flags):
|
||||
self.query = None
|
||||
|
@ -1768,18 +1771,19 @@ xrfragment_XRF.QUERY_OPERATOR = 4
|
|||
xrfragment_XRF.PROMPT = 8
|
||||
xrfragment_XRF.ROUNDROBIN = 16
|
||||
xrfragment_XRF.BROWSER_OVERRIDE = 32
|
||||
xrfragment_XRF.PV_OVERRIDE = 64
|
||||
xrfragment_XRF.PV_EXECUTE = 128
|
||||
xrfragment_XRF.T_COLOR = 256
|
||||
xrfragment_XRF.T_INT = 512
|
||||
xrfragment_XRF.T_FLOAT = 1024
|
||||
xrfragment_XRF.T_VECTOR2 = 2048
|
||||
xrfragment_XRF.T_VECTOR3 = 4096
|
||||
xrfragment_XRF.T_URL = 8192
|
||||
xrfragment_XRF.T_PREDEFINED_VIEW = 16384
|
||||
xrfragment_XRF.T_STRING = 32768
|
||||
xrfragment_XRF.T_STRING_OBJ = 65536
|
||||
xrfragment_XRF.T_STRING_OBJ_PROP = 131072
|
||||
xrfragment_XRF.EMBED_OVERRIDE = 64
|
||||
xrfragment_XRF.PV_OVERRIDE = 128
|
||||
xrfragment_XRF.PV_EXECUTE = 256
|
||||
xrfragment_XRF.T_COLOR = 8192
|
||||
xrfragment_XRF.T_INT = 16384
|
||||
xrfragment_XRF.T_FLOAT = 32768
|
||||
xrfragment_XRF.T_VECTOR2 = 65536
|
||||
xrfragment_XRF.T_VECTOR3 = 131072
|
||||
xrfragment_XRF.T_URL = 262144
|
||||
xrfragment_XRF.T_PREDEFINED_VIEW = 524288
|
||||
xrfragment_XRF.T_STRING = 1048576
|
||||
xrfragment_XRF.T_STRING_OBJ = 2097152
|
||||
xrfragment_XRF.T_STRING_OBJ_PROP = 4194304
|
||||
xrfragment_XRF.isColor = EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$","")
|
||||
xrfragment_XRF.isInt = EReg("^[0-9]+$","")
|
||||
xrfragment_XRF.isFloat = EReg("^[0-9]+\\.[0-9]+$","")
|
||||
|
|
Loading…
Reference in New Issue