work in progress [might break]
This commit is contained in:
parent
23c5256a06
commit
078522ebee
|
@ -243,15 +243,19 @@ xrfragment_Parser.parse = function(key,value,resultMap) {
|
|||
Frag_h["unit"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING;
|
||||
Frag_h["description"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING;
|
||||
Frag_h["src_session"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.BROWSER_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);
|
||||
return true;
|
||||
}
|
||||
if(Object.prototype.hasOwnProperty.call(Frag_h,key)) {
|
||||
var v = new xrfragment_XRF(key,Frag_h[key]);
|
||||
if(!v.validate(value)) {
|
||||
console.log("src/xrfragment/Parser.hx:66:","[ i ] fragment '" + key + "' has incompatible value (" + value + ")");
|
||||
console.log("src/xrfragment/Parser.hx:70:","[ i ] fragment '" + key + "' has incompatible value (" + value + ")");
|
||||
return false;
|
||||
}
|
||||
resultMap[key] = v;
|
||||
} else {
|
||||
console.log("src/xrfragment/Parser.hx:70:","[ i ] fragment '" + key + "' does not exist or has no type typed (yet)");
|
||||
console.log("src/xrfragment/Parser.hx:74:","[ i ] fragment '" + key + "' does not exist or has no type typed (yet)");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
@ -451,11 +455,12 @@ xrfragment_URI.parse = function(qs,browser_override) {
|
|||
var splitByEqual = splitArray[i].split("=");
|
||||
var regexPlus = new EReg("\\+","g");
|
||||
var key = splitByEqual[0];
|
||||
var value = "";
|
||||
if(splitByEqual.length > 1) {
|
||||
var s = regexPlus.split(splitByEqual[1]).join(" ");
|
||||
var value = decodeURIComponent(s.split("+").join(" "));
|
||||
var ok = xrfragment_Parser.parse(key,value,resultMap);
|
||||
value = decodeURIComponent(s.split("+").join(" "));
|
||||
}
|
||||
var ok = xrfragment_Parser.parse(key,value,resultMap);
|
||||
}
|
||||
if(browser_override) {
|
||||
var _g = 0;
|
||||
|
@ -552,18 +557,19 @@ js_Boot.__toStr = ({ }).toString;
|
|||
xrfragment_Parser.error = "";
|
||||
xrfragment_XRF.ASSET = 1;
|
||||
xrfragment_XRF.ASSET_OBJ = 2;
|
||||
xrfragment_XRF.PV_OVERRIDE = 4;
|
||||
xrfragment_XRF.QUERY_OPERATOR = 8;
|
||||
xrfragment_XRF.PROMPT = 16;
|
||||
xrfragment_XRF.ROUNDROBIN = 32;
|
||||
xrfragment_XRF.BROWSER_OVERRIDE = 64;
|
||||
xrfragment_XRF.T_INT = 256;
|
||||
xrfragment_XRF.T_VECTOR2 = 1024;
|
||||
xrfragment_XRF.T_VECTOR3 = 2048;
|
||||
xrfragment_XRF.T_URL = 4096;
|
||||
xrfragment_XRF.T_PREDEFINED_VIEW = 8192;
|
||||
xrfragment_XRF.T_STRING = 16384;
|
||||
xrfragment_XRF.T_STRING_OBJ = 32768;
|
||||
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_INT = 512;
|
||||
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.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]+$","");
|
||||
|
|
|
@ -1570,6 +1570,11 @@ __xrfragment_Parser.parse = function(key,value,resultMap)
|
|||
else
|
||||
Frag_h.src_session = value1;
|
||||
end;
|
||||
if ((__lua_lib_luautf8_Utf8.len(value) == 0) and (Frag_h[key] == nil)) then
|
||||
local value = __xrfragment_XRF.new(key, __xrfragment_XRF.PV_EXECUTE);
|
||||
resultMap[key] = value;
|
||||
do return true end;
|
||||
end;
|
||||
if (Frag_h[key] ~= nil) then
|
||||
local ret = Frag_h[key];
|
||||
if (ret == __haxe_ds_StringMap.tnull) then
|
||||
|
@ -1577,12 +1582,12 @@ __xrfragment_Parser.parse = function(key,value,resultMap)
|
|||
end;
|
||||
local v = __xrfragment_XRF.new(key, ret);
|
||||
if (not v:validate(value)) then
|
||||
__haxe_Log.trace(Std.string(Std.string(Std.string(Std.string("[ i ] fragment '") .. Std.string(key)) .. Std.string("' has incompatible value (")) .. Std.string(value)) .. Std.string(")"), _hx_o({__fields__={fileName=true,lineNumber=true,className=true,methodName=true},fileName="src/xrfragment/Parser.hx",lineNumber=66,className="xrfragment.Parser",methodName="parse"}));
|
||||
__haxe_Log.trace(Std.string(Std.string(Std.string(Std.string("[ i ] fragment '") .. Std.string(key)) .. Std.string("' has incompatible value (")) .. Std.string(value)) .. Std.string(")"), _hx_o({__fields__={fileName=true,lineNumber=true,className=true,methodName=true},fileName="src/xrfragment/Parser.hx",lineNumber=70,className="xrfragment.Parser",methodName="parse"}));
|
||||
do return false end;
|
||||
end;
|
||||
resultMap[key] = v;
|
||||
else
|
||||
__haxe_Log.trace(Std.string(Std.string("[ i ] fragment '") .. Std.string(key)) .. Std.string("' does not exist or has no type typed (yet)"), _hx_o({__fields__={fileName=true,lineNumber=true,className=true,methodName=true},fileName="src/xrfragment/Parser.hx",lineNumber=70,className="xrfragment.Parser",methodName="parse"}));
|
||||
__haxe_Log.trace(Std.string(Std.string("[ i ] fragment '") .. Std.string(key)) .. Std.string("' does not exist or has no type typed (yet)"), _hx_o({__fields__={fileName=true,lineNumber=true,className=true,methodName=true},fileName="src/xrfragment/Parser.hx",lineNumber=74,className="xrfragment.Parser",methodName="parse"}));
|
||||
do return false end;
|
||||
end;
|
||||
do return true end;
|
||||
|
@ -2071,10 +2076,11 @@ __xrfragment_URI.parse = function(qs,browser_override)
|
|||
local splitByEqual = ret;
|
||||
local regexPlus = EReg.new("\\+", "g");
|
||||
local key = splitByEqual[0];
|
||||
local value = "";
|
||||
if (splitByEqual.length > 1) then
|
||||
local value = StringTools.urlDecode(regexPlus:split(splitByEqual[1]):join(" "));
|
||||
local ok = __xrfragment_Parser.parse(key, value, resultMap);
|
||||
value = StringTools.urlDecode(regexPlus:split(splitByEqual[1]):join(" "));
|
||||
end;
|
||||
local ok = __xrfragment_Parser.parse(key, value, resultMap);
|
||||
end;
|
||||
if (browser_override) then
|
||||
local _g = 0;
|
||||
|
@ -2313,29 +2319,31 @@ local _hx_static_init = function()
|
|||
|
||||
__xrfragment_XRF.ASSET_OBJ = 2;
|
||||
|
||||
__xrfragment_XRF.PV_OVERRIDE = 4;
|
||||
__xrfragment_XRF.QUERY_OPERATOR = 4;
|
||||
|
||||
__xrfragment_XRF.QUERY_OPERATOR = 8;
|
||||
__xrfragment_XRF.PROMPT = 8;
|
||||
|
||||
__xrfragment_XRF.PROMPT = 16;
|
||||
__xrfragment_XRF.ROUNDROBIN = 16;
|
||||
|
||||
__xrfragment_XRF.ROUNDROBIN = 32;
|
||||
__xrfragment_XRF.BROWSER_OVERRIDE = 32;
|
||||
|
||||
__xrfragment_XRF.BROWSER_OVERRIDE = 64;
|
||||
__xrfragment_XRF.PV_OVERRIDE = 64;
|
||||
|
||||
__xrfragment_XRF.T_INT = 256;
|
||||
__xrfragment_XRF.PV_EXECUTE = 128;
|
||||
|
||||
__xrfragment_XRF.T_VECTOR2 = 1024;
|
||||
__xrfragment_XRF.T_INT = 512;
|
||||
|
||||
__xrfragment_XRF.T_VECTOR3 = 2048;
|
||||
__xrfragment_XRF.T_VECTOR2 = 2048;
|
||||
|
||||
__xrfragment_XRF.T_URL = 4096;
|
||||
__xrfragment_XRF.T_VECTOR3 = 4096;
|
||||
|
||||
__xrfragment_XRF.T_PREDEFINED_VIEW = 8192;
|
||||
__xrfragment_XRF.T_URL = 8192;
|
||||
|
||||
__xrfragment_XRF.T_STRING = 16384;
|
||||
__xrfragment_XRF.T_PREDEFINED_VIEW = 16384;
|
||||
|
||||
__xrfragment_XRF.T_STRING_OBJ = 32768;
|
||||
__xrfragment_XRF.T_STRING = 32768;
|
||||
|
||||
__xrfragment_XRF.T_STRING_OBJ = 65536;
|
||||
|
||||
__xrfragment_XRF.isColor = EReg.new("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$", "");
|
||||
|
||||
|
|
|
@ -1320,6 +1320,10 @@ class xrfragment_Parser:
|
|||
Frag.h["unit"] = (xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING)
|
||||
Frag.h["description"] = (xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING)
|
||||
Frag.h["src_session"] = ((((xrfragment_XRF.ASSET | xrfragment_XRF.T_URL) | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.BROWSER_OVERRIDE) | xrfragment_XRF.PROMPT)
|
||||
if ((len(value) == 0) and (not (key in Frag.h))):
|
||||
value1 = xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE)
|
||||
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)
|
||||
return True
|
||||
if (key in Frag.h):
|
||||
v = xrfragment_XRF(key,Frag.h.get(key,None))
|
||||
if (not v.validate(value)):
|
||||
|
@ -1537,10 +1541,11 @@ class xrfragment_URI:
|
|||
splitByEqual = _this.split("=")
|
||||
regexPlus = EReg("\\+","g")
|
||||
key = (splitByEqual[0] if 0 < len(splitByEqual) else None)
|
||||
value = ""
|
||||
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)
|
||||
ok = xrfragment_Parser.parse(key,value,resultMap)
|
||||
if browser_override:
|
||||
_g = 0
|
||||
_g1 = python_Boot.fields(resultMap)
|
||||
|
@ -1558,7 +1563,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", "ASSET_OBJ", "PV_OVERRIDE", "QUERY_OPERATOR", "PROMPT", "ROUNDROBIN", "BROWSER_OVERRIDE", "T_INT", "T_VECTOR2", "T_VECTOR3", "T_URL", "T_PREDEFINED_VIEW", "T_STRING", "T_STRING_OBJ", "isColor", "isInt", "isFloat"]
|
||||
_hx_statics = ["ASSET", "ASSET_OBJ", "QUERY_OPERATOR", "PROMPT", "ROUNDROBIN", "BROWSER_OVERRIDE", "PV_OVERRIDE", "PV_EXECUTE", "T_INT", "T_VECTOR2", "T_VECTOR3", "T_URL", "T_PREDEFINED_VIEW", "T_STRING", "T_STRING_OBJ", "isColor", "isInt", "isFloat"]
|
||||
|
||||
def __init__(self,_fragment,_flags):
|
||||
self.query = None
|
||||
|
@ -1636,18 +1641,19 @@ python_Boot.prefixLength = len("_hx_")
|
|||
xrfragment_Parser.error = ""
|
||||
xrfragment_XRF.ASSET = 1
|
||||
xrfragment_XRF.ASSET_OBJ = 2
|
||||
xrfragment_XRF.PV_OVERRIDE = 4
|
||||
xrfragment_XRF.QUERY_OPERATOR = 8
|
||||
xrfragment_XRF.PROMPT = 16
|
||||
xrfragment_XRF.ROUNDROBIN = 32
|
||||
xrfragment_XRF.BROWSER_OVERRIDE = 64
|
||||
xrfragment_XRF.T_INT = 256
|
||||
xrfragment_XRF.T_VECTOR2 = 1024
|
||||
xrfragment_XRF.T_VECTOR3 = 2048
|
||||
xrfragment_XRF.T_URL = 4096
|
||||
xrfragment_XRF.T_PREDEFINED_VIEW = 8192
|
||||
xrfragment_XRF.T_STRING = 16384
|
||||
xrfragment_XRF.T_STRING_OBJ = 32768
|
||||
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_INT = 512
|
||||
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.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]+$","")
|
|
@ -1,5 +1,6 @@
|
|||
import xrfragment.Query;
|
||||
import xrfragment.URI;
|
||||
import xrfragment.XRF;
|
||||
|
||||
class Spec {
|
||||
macro public static function load(path : String) {
|
||||
|
@ -34,6 +35,7 @@ class Test {
|
|||
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 == "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);
|
||||
|
|
|
@ -5,5 +5,6 @@
|
|||
{"fn":"url","data":"http://foo.com?foo=1#prio=foo", "expect":{ "fn":"testParsed", "input":"prio","out":false},"label":"should trigger incompatible type"},
|
||||
{"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#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#mypredefinedview", "expect":{ "fn":"testPredefinedView", "input":"mypredefinedview","out":true},"label":"test predefined view executed"}
|
||||
]
|
||||
|
|
|
@ -60,6 +60,10 @@ class Parser {
|
|||
* > icanhazcode? yes, see [Parser.hx](https://github.com/coderofsalvation/xrfragment/blob/main/src/xrfragment/Parser.hx)
|
||||
* the gist of it:
|
||||
*/
|
||||
if( value.length == 0 && !Frag.exists(key) ){
|
||||
resultMap.set(key, new XRF(key, XRF.PV_EXECUTE ) );
|
||||
return true;
|
||||
}
|
||||
if( Frag.exists(key) ){ // 1. check if param exist
|
||||
var v:XRF = new XRF(key, Frag.get(key));
|
||||
if( !v.validate(value) ){
|
||||
|
|
|
@ -51,16 +51,18 @@ class URI {
|
|||
var splitByEqual = splitArray[i].split('='); // 1. for each fragment split on `=` to separate key/values
|
||||
var regexPlus = ~/\+/g; // 1. fragment-values are urlencoded (space becomes `+` using `encodeUriComponent` e.g.)
|
||||
var key:String = splitByEqual[0];
|
||||
|
||||
var value:String = "";
|
||||
if (splitByEqual.length > 1) {
|
||||
var value:String = 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
|
||||
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
|
||||
}
|
||||
if( browser_override ){
|
||||
for (key in resultMap.keys()) {
|
||||
var xrf:XRF = resultMap.get(key);
|
||||
if( !xrf.is( XRF.BROWSER_OVERRIDE ) ) resultMap.remove(key);
|
||||
if( !xrf.is( XRF.BROWSER_OVERRIDE ) ){
|
||||
resultMap.remove(key);
|
||||
}
|
||||
}
|
||||
}
|
||||
return resultMap;
|
||||
|
|
|
@ -8,25 +8,26 @@ class XRF {
|
|||
|
||||
// public static inline readonly ASSET
|
||||
|
||||
// scope types (power of 2)
|
||||
public static var ASSET:Int = 1; // fragment is immutable (typed in asset) globally
|
||||
public static var ASSET_OBJ:Int = 2; // fragment is immutable (typed in object in asset)
|
||||
public static var PV_OVERRIDE:Int = 4; // fragment can be overriden when specified in predefined view value
|
||||
public static var QUERY_OPERATOR = 8; // fragment will be applied to result of queryselecto
|
||||
public static var PROMPT:Int = 16; // ask user whether this fragment value can be changed
|
||||
public static var ROUNDROBIN:Int = 32; // evaluation of this (multi) value can be roundrobined
|
||||
public static var BROWSER_OVERRIDE:Int = 64; // fragment can be overriden by (manual) browser URI change
|
||||
// scope types (powers of 2)
|
||||
public static var ASSET:Int = 1; // fragment is immutable (typed in asset) globally
|
||||
public static var ASSET_OBJ:Int = 2; // fragment is immutable (typed in object in asset)
|
||||
public static var QUERY_OPERATOR:Int = 4; // fragment will be applied to result of queryselecto
|
||||
public static var PROMPT:Int = 8; // ask user whether this fragment value can be changed
|
||||
public static var ROUNDROBIN:Int = 16; // evaluation of this (multi) value can be roundrobined
|
||||
public static var BROWSER_OVERRIDE:Int = 32; // fragment can be overriden by (manual) browser URI change
|
||||
public static var PV_OVERRIDE:Int = 64; // fragment can be overriden when specified in predefined view value
|
||||
public static var PV_EXECUTE:Int = 128; // fragment can be overriden by (manual) browser URI change
|
||||
|
||||
// highlevel types (power of 2)
|
||||
public static var T_COLOR:Int = 128;
|
||||
public static var T_INT:Int = 256;
|
||||
public static var T_FLOAT:Int = 512;
|
||||
public static var T_VECTOR2:Int = 1024;
|
||||
public static var T_VECTOR3:Int = 2048;
|
||||
public static var T_URL:Int = 4096;
|
||||
public static var T_PREDEFINED_VIEW:Int = 8192;
|
||||
public static var T_STRING:Int = 16384;
|
||||
public static var T_STRING_OBJ:Int = 32768;
|
||||
// high-level value-types (powers of 2)
|
||||
public static var T_COLOR:Int = 256;
|
||||
public static var T_INT:Int = 512;
|
||||
public static var T_FLOAT:Int = 1024;
|
||||
public static var T_VECTOR2:Int = 2048;
|
||||
public static var T_VECTOR3:Int = 4096;
|
||||
public static var T_URL:Int = 8192;
|
||||
public static var T_PREDEFINED_VIEW:Int = 16384;
|
||||
public static var T_STRING:Int = 32768;
|
||||
public static var T_STRING_OBJ:Int = 65536;
|
||||
|
||||
// regexes
|
||||
public static var isColor:EReg = ~/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/; // 1. hex colors are detected using regex `/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/`
|
||||
|
|
|
@ -136,11 +136,11 @@ 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"}]);
|
||||
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"}]);
|
||||
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) {
|
||||
console.log("src/Test.hx:21:","\n-----\n[ ❌] " + Test.errors + " errors :/");
|
||||
console.log("src/Test.hx:22:","\n-----\n[ ❌] " + Test.errors + " errors :/");
|
||||
}
|
||||
};
|
||||
Test.test = function(spec) {
|
||||
|
@ -171,6 +171,9 @@ Test.test = function(spec) {
|
|||
if(item.expect.fn == "testParsed") {
|
||||
valid = item.expect.out == Object.prototype.hasOwnProperty.call(res,item.expect.input);
|
||||
}
|
||||
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);
|
||||
|
@ -189,7 +192,7 @@ Test.test = function(spec) {
|
|||
valid = Test.equalMulti(res,item);
|
||||
}
|
||||
var ok = valid ? "[ ✔ ] " : "[ ❌] ";
|
||||
console.log("src/Test.hx:43:",ok + Std.string(item.fn) + ": '" + Std.string(item.data) + "'" + (item.label ? " (" + (item.label ? item.label : item.expect.fn) + ")" : ""));
|
||||
console.log("src/Test.hx:45:",ok + Std.string(item.fn) + ": '" + Std.string(item.data) + "'" + (item.label ? " (" + (item.label ? item.label : item.expect.fn) + ")" : ""));
|
||||
if(!valid) {
|
||||
Test.errors += 1;
|
||||
}
|
||||
|
@ -342,15 +345,19 @@ xrfragment_Parser.parse = function(key,value,resultMap) {
|
|||
Frag_h["unit"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING;
|
||||
Frag_h["description"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING;
|
||||
Frag_h["src_session"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.BROWSER_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);
|
||||
return true;
|
||||
}
|
||||
if(Object.prototype.hasOwnProperty.call(Frag_h,key)) {
|
||||
var v = new xrfragment_XRF(key,Frag_h[key]);
|
||||
if(!v.validate(value)) {
|
||||
console.log("src/xrfragment/Parser.hx:66:","[ i ] fragment '" + key + "' has incompatible value (" + value + ")");
|
||||
console.log("src/xrfragment/Parser.hx:70:","[ i ] fragment '" + key + "' has incompatible value (" + value + ")");
|
||||
return false;
|
||||
}
|
||||
resultMap[key] = v;
|
||||
} else {
|
||||
console.log("src/xrfragment/Parser.hx:70:","[ i ] fragment '" + key + "' does not exist or has no type typed (yet)");
|
||||
console.log("src/xrfragment/Parser.hx:74:","[ i ] fragment '" + key + "' does not exist or has no type typed (yet)");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
@ -550,11 +557,12 @@ xrfragment_URI.parse = function(qs,browser_override) {
|
|||
var splitByEqual = splitArray[i].split("=");
|
||||
var regexPlus = new EReg("\\+","g");
|
||||
var key = splitByEqual[0];
|
||||
var value = "";
|
||||
if(splitByEqual.length > 1) {
|
||||
var s = regexPlus.split(splitByEqual[1]).join(" ");
|
||||
var value = decodeURIComponent(s.split("+").join(" "));
|
||||
var ok = xrfragment_Parser.parse(key,value,resultMap);
|
||||
value = decodeURIComponent(s.split("+").join(" "));
|
||||
}
|
||||
var ok = xrfragment_Parser.parse(key,value,resultMap);
|
||||
}
|
||||
if(browser_override) {
|
||||
var _g = 0;
|
||||
|
@ -652,18 +660,19 @@ Test.errors = 0;
|
|||
xrfragment_Parser.error = "";
|
||||
xrfragment_XRF.ASSET = 1;
|
||||
xrfragment_XRF.ASSET_OBJ = 2;
|
||||
xrfragment_XRF.PV_OVERRIDE = 4;
|
||||
xrfragment_XRF.QUERY_OPERATOR = 8;
|
||||
xrfragment_XRF.PROMPT = 16;
|
||||
xrfragment_XRF.ROUNDROBIN = 32;
|
||||
xrfragment_XRF.BROWSER_OVERRIDE = 64;
|
||||
xrfragment_XRF.T_INT = 256;
|
||||
xrfragment_XRF.T_VECTOR2 = 1024;
|
||||
xrfragment_XRF.T_VECTOR3 = 2048;
|
||||
xrfragment_XRF.T_URL = 4096;
|
||||
xrfragment_XRF.T_PREDEFINED_VIEW = 8192;
|
||||
xrfragment_XRF.T_STRING = 16384;
|
||||
xrfragment_XRF.T_STRING_OBJ = 32768;
|
||||
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_INT = 512;
|
||||
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.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"})])
|
||||
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"})])
|
||||
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):
|
||||
|
@ -420,6 +420,8 @@ class Test:
|
|||
valid = (Reflect.field(Reflect.field(item,"expect"),"out") == q.testProperty(HxOverrides.arrayGet(Reflect.field(Reflect.field(item,"expect"),"input"), 0),HxOverrides.arrayGet(Reflect.field(Reflect.field(item,"expect"),"input"), 1),True))
|
||||
if (Reflect.field(Reflect.field(item,"expect"),"fn") == "testParsed"):
|
||||
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") == "equal.string"):
|
||||
|
@ -1428,6 +1430,10 @@ class xrfragment_Parser:
|
|||
Frag.h["unit"] = (xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING)
|
||||
Frag.h["description"] = (xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING)
|
||||
Frag.h["src_session"] = ((((xrfragment_XRF.ASSET | xrfragment_XRF.T_URL) | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.BROWSER_OVERRIDE) | xrfragment_XRF.PROMPT)
|
||||
if ((len(value) == 0) and (not (key in Frag.h))):
|
||||
value1 = xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE)
|
||||
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)
|
||||
return True
|
||||
if (key in Frag.h):
|
||||
v = xrfragment_XRF(key,Frag.h.get(key,None))
|
||||
if (not v.validate(value)):
|
||||
|
@ -1582,8 +1588,8 @@ class xrfragment_Query:
|
|||
fails = 0
|
||||
qualify = 0
|
||||
def _hx_local_2(expr):
|
||||
nonlocal conds
|
||||
nonlocal fails
|
||||
nonlocal conds
|
||||
conds = (conds + 1)
|
||||
fails = (fails + (0 if expr else 1))
|
||||
return expr
|
||||
|
@ -1645,10 +1651,11 @@ class xrfragment_URI:
|
|||
splitByEqual = _this.split("=")
|
||||
regexPlus = EReg("\\+","g")
|
||||
key = (splitByEqual[0] if 0 < len(splitByEqual) else None)
|
||||
value = ""
|
||||
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)
|
||||
ok = xrfragment_Parser.parse(key,value,resultMap)
|
||||
if browser_override:
|
||||
_g = 0
|
||||
_g1 = python_Boot.fields(resultMap)
|
||||
|
@ -1666,7 +1673,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", "ASSET_OBJ", "PV_OVERRIDE", "QUERY_OPERATOR", "PROMPT", "ROUNDROBIN", "BROWSER_OVERRIDE", "T_INT", "T_VECTOR2", "T_VECTOR3", "T_URL", "T_PREDEFINED_VIEW", "T_STRING", "T_STRING_OBJ", "isColor", "isInt", "isFloat"]
|
||||
_hx_statics = ["ASSET", "ASSET_OBJ", "QUERY_OPERATOR", "PROMPT", "ROUNDROBIN", "BROWSER_OVERRIDE", "PV_OVERRIDE", "PV_EXECUTE", "T_INT", "T_VECTOR2", "T_VECTOR3", "T_URL", "T_PREDEFINED_VIEW", "T_STRING", "T_STRING_OBJ", "isColor", "isInt", "isFloat"]
|
||||
|
||||
def __init__(self,_fragment,_flags):
|
||||
self.query = None
|
||||
|
@ -1745,18 +1752,19 @@ python_Boot.prefixLength = len("_hx_")
|
|||
xrfragment_Parser.error = ""
|
||||
xrfragment_XRF.ASSET = 1
|
||||
xrfragment_XRF.ASSET_OBJ = 2
|
||||
xrfragment_XRF.PV_OVERRIDE = 4
|
||||
xrfragment_XRF.QUERY_OPERATOR = 8
|
||||
xrfragment_XRF.PROMPT = 16
|
||||
xrfragment_XRF.ROUNDROBIN = 32
|
||||
xrfragment_XRF.BROWSER_OVERRIDE = 64
|
||||
xrfragment_XRF.T_INT = 256
|
||||
xrfragment_XRF.T_VECTOR2 = 1024
|
||||
xrfragment_XRF.T_VECTOR3 = 2048
|
||||
xrfragment_XRF.T_URL = 4096
|
||||
xrfragment_XRF.T_PREDEFINED_VIEW = 8192
|
||||
xrfragment_XRF.T_STRING = 16384
|
||||
xrfragment_XRF.T_STRING_OBJ = 32768
|
||||
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_INT = 512
|
||||
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.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