bugfix + build

This commit is contained in:
Leon van Kammen 2023-11-28 17:39:33 +01:00
parent 970495d076
commit 09020d0da2
31 changed files with 15694 additions and 7834 deletions

2
dist/utils.js vendored
View File

@ -267,7 +267,7 @@ function notify(scope){
if( str.match(/error/g) ) opts.status = "danger"
if( str.match(/warning/g) ) opts.status = "warning"
}
opts = Object.assign({ message: str , status, timeout:2000 },opts)
opts = Object.assign({ message: str , status, timeout:4000 },opts)
SnackBar( opts )
}
}

File diff suppressed because one or more lines are too long

301
dist/xrfragment.js vendored
View File

@ -72,6 +72,20 @@ Reflect.deleteField = function(o,field) {
delete(o[field]);
return true;
};
Reflect.copy = function(o) {
if(o == null) {
return null;
}
var o2 = { };
var _g = 0;
var _g1 = Reflect.fields(o);
while(_g < _g1.length) {
var f = _g1[_g];
++_g;
o2[f] = Reflect.field(o,f);
}
return o2;
};
var Std = function() { };
Std.__name__ = true;
Std.string = function(s) {
@ -209,83 +223,22 @@ js_Boot.__string_rec = function(o,s) {
return String(o);
}
};
var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { };
xrfragment_Parser.__name__ = true;
xrfragment_Parser.parse = function(key,value,store) {
var Frag_h = Object.create(null);
Frag_h["#"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE;
Frag_h["prio"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_INT;
Frag_h["src"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL;
Frag_h["href"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW;
Frag_h["tag"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING;
Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING_OBJ | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR;
Frag_h["q"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA;
Frag_h["scale"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA;
Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR;
Frag_h["mov"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA;
Frag_h["show"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_INT | xrfragment_XRF.METADATA;
Frag_h["env"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA;
Frag_h["t"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_STRING | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA;
Frag_h["tv"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA;
Frag_h["gravity"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA;
Frag_h["physics"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA;
Frag_h["fov"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_INT | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA;
Frag_h["clip"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA;
Frag_h["fog"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA;
Frag_h["bg"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA;
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.NAVIGATOR | xrfragment_XRF.METADATA | xrfragment_XRF.PROMPT;
var isPVDynamic = value.length == 0 && key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key);
var isPVDefault = value.length == 0 && key.length > 0 && key == "#";
if(isPVDynamic) {
var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR);
v.validate(key);
store[key] = v;
return true;
}
var v = new xrfragment_XRF(key,Frag_h[key]);
if(Object.prototype.hasOwnProperty.call(Frag_h,key)) {
if(!v.validate(value)) {
console.log("src/xrfragment/Parser.hx:80:","⚠ fragment '" + key + "' has incompatible value (" + value + ")");
return false;
}
store[key] = v;
if(xrfragment_Parser.debug) {
console.log("src/xrfragment/Parser.hx:84:","✔ " + key + ": " + v.string);
}
} else {
if(typeof(value) == "string") {
v.guessType(v,value);
}
v.noXRF = true;
store[key] = v;
}
return true;
};
var xrfragment_Query = $hx_exports["xrfragment"]["Query"] = function(str) {
this.isNumber = new EReg("^[0-9\\.]+$","");
this.isRoot = new EReg("^[-]?/","");
this.isExclude = new EReg("^-","");
this.isProp = new EReg("^.*:[><=!]?","");
var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) {
this.q = { };
this.str = "";
if(str != null) {
this.parse(str);
}
};
xrfragment_Query.__name__ = true;
xrfragment_Query.prototype = {
xrfragment_Filter.__name__ = true;
xrfragment_Filter.prototype = {
toObject: function() {
return this.q;
return Reflect.copy(this.q);
}
,get: function() {
return this.q;
return Reflect.copy(this.q);
}
,parse: function(str) {
var _gthis = this;
var token = str.split(" ");
var q = { };
var process = function(str,prefix) {
@ -293,59 +246,42 @@ xrfragment_Query.prototype = {
prefix = "";
}
str = StringTools.trim(str);
var k = str.split(":")[0];
var v = str.split(":")[1];
var k = str.split("=")[0];
var v = str.split("=")[1];
var filter = { };
if(q[prefix + k]) {
filter = q[prefix + k];
}
filter["rules"] = filter["rules"] != null ? filter["rules"] : [];
if(_gthis.isProp.match(str)) {
if(xrfragment_XRF.isProp.match(str)) {
var oper = "";
if(str.indexOf("*") != -1) {
oper = "*";
}
if(str.indexOf(">") != -1) {
oper = ">";
}
if(str.indexOf("<") != -1) {
oper = "<";
}
if(str.indexOf(">=") != -1) {
oper = ">=";
}
if(str.indexOf("<=") != -1) {
oper = "<=";
}
if(_gthis.isExclude.match(k)) {
oper = "!=";
if(xrfragment_XRF.isExclude.match(k)) {
k = HxOverrides.substr(k,1,null);
} else {
v = HxOverrides.substr(v,oper.length,null);
}
v = HxOverrides.substr(v,oper.length,null);
if(oper.length == 0) {
oper = "=";
}
var rule = { };
if(_gthis.isNumber.match(v)) {
if(xrfragment_XRF.isNumber.match(v)) {
rule[oper] = parseFloat(v);
} else {
rule[oper] = v;
}
filter["rules"].push(rule);
q[k] = filter;
return;
} else {
filter["id"] = _gthis.isExclude.match(str) ? false : true;
filter["root"] = _gthis.isRoot.match(str);
if(_gthis.isExclude.match(str)) {
str = HxOverrides.substr(str,1,null);
}
if(_gthis.isRoot.match(str)) {
str = HxOverrides.substr(str,1,null);
}
q[str] = filter;
q["expr"] = rule;
}
var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0;
q["deep"] = value;
var value = xrfragment_XRF.isExclude.match(str) ? false : true;
q["show"] = value;
var value = k.replace(xrfragment_XRF.operators.r,"");
q["key"] = value;
q["value"] = v;
};
var _g = 0;
var _g1 = token.length;
@ -394,49 +330,75 @@ xrfragment_Query.prototype = {
return v[property];
}
}
var _g = 0;
var _g1 = Reflect.fields(this.q);
while(_g < _g1.length) {
var k = _g1[_g];
++_g;
var filter = Reflect.field(this.q,k);
if(filter.rules == null) {
continue;
}
var rules = filter.rules;
var _g2 = 0;
while(_g2 < rules.length) {
var rule = rules[_g2];
++_g2;
if(exclude) {
if(Reflect.field(rule,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(rule,"!="))) && exclude) {
++qualify;
}
} else {
if(Reflect.field(rule,"*") != null && testprop(parseFloat(value) != null)) {
++qualify;
}
if(Reflect.field(rule,">") != null && testprop(parseFloat(value) > parseFloat(Reflect.field(rule,">")))) {
++qualify;
}
if(Reflect.field(rule,"<") != null && testprop(parseFloat(value) < parseFloat(Reflect.field(rule,"<")))) {
++qualify;
}
if(Reflect.field(rule,">=") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(rule,">=")))) {
++qualify;
}
if(Reflect.field(rule,"<=") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(rule,"<=")))) {
++qualify;
}
if(Reflect.field(rule,"=") != null && (testprop(value == Reflect.field(rule,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(rule,"="))))) {
++qualify;
}
if(Reflect.field(this.q,"expr")) {
var f = Reflect.field(this.q,"expr");
if(!Reflect.field(this.q,"show")) {
if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) {
++qualify;
}
} else {
if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) {
++qualify;
}
if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) {
++qualify;
}
if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) {
++qualify;
}
if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) {
++qualify;
}
}
}
return qualify > 0;
}
};
var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { };
xrfragment_Parser.__name__ = true;
xrfragment_Parser.parse = function(key,value,store,index) {
var Frag_h = Object.create(null);
Frag_h["#"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE;
Frag_h["src"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL;
Frag_h["href"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW;
Frag_h["tag"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING;
Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.T_STRING_OBJ | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR;
Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR;
Frag_h["t"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_STRING | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA;
Frag_h["tv"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA;
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.NAVIGATOR | xrfragment_XRF.METADATA | xrfragment_XRF.PROMPT;
var keyStripped = key.replace(xrfragment_XRF.operators.r,"");
var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key);
var isPVDefault = value.length == 0 && key.length > 0 && key == "#";
if(isPVDynamic) {
var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index);
v.validate(value);
store[keyStripped] = v;
return true;
}
var v = new xrfragment_XRF(key,Frag_h[key],index);
if(Object.prototype.hasOwnProperty.call(Frag_h,key)) {
if(!v.validate(value)) {
console.log("src/xrfragment/Parser.hx:66:","⚠ fragment '" + key + "' has incompatible value (" + value + ")");
return false;
}
store[keyStripped] = v;
if(xrfragment_Parser.debug) {
console.log("src/xrfragment/Parser.hx:70:","✔ " + key + ": " + v.string);
}
} else {
if(typeof(value) == "string") {
v.guessType(v,value);
}
v.noXRF = true;
store[keyStripped] = v;
}
return true;
};
var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { };
xrfragment_URI.__name__ = true;
xrfragment_URI.parse = function(url,filter) {
@ -458,7 +420,7 @@ xrfragment_URI.parse = function(url,filter) {
var s = regexPlus.split(splitByEqual[1]).join(" ");
value = decodeURIComponent(s.split("+").join(" "));
}
var ok = xrfragment_Parser.parse(key,value,store);
var ok = xrfragment_Parser.parse(key,value,store,i);
}
if(filter != null && filter != 0) {
var _g = 0;
@ -474,9 +436,10 @@ xrfragment_URI.parse = function(url,filter) {
}
return store;
};
var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags) {
var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) {
this.fragment = _fragment;
this.flags = _flags;
this.index = _index;
};
xrfragment_XRF.__name__ = true;
xrfragment_XRF.set = function(flag,flags) {
@ -495,45 +458,50 @@ xrfragment_XRF.prototype = {
}
,validate: function(value) {
this.guessType(this,value);
if(this.fragment == "q") {
this.query = new xrfragment_Query(value).get();
}
var ok = true;
if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) {
ok = false;
}
if(!this.is(xrfragment_XRF.T_VECTOR2) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) {
if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) {
ok = false;
}
return ok;
}
,guessType: function(v,str) {
v.string = str;
if(str.split(",").length > 1) {
var xyzw = str.split(",");
if(xyzw.length > 0) {
v.x = parseFloat(xyzw[0]);
}
if(xyzw.length > 1) {
v.y = parseFloat(xyzw[1]);
}
if(xyzw.length > 2) {
v.z = parseFloat(xyzw[2]);
}
if(xyzw.length > 3) {
v.w = parseFloat(xyzw[3]);
}
if(typeof(str) != "string") {
return;
}
if(xrfragment_XRF.isColor.match(str)) {
v.color = str;
}
if(xrfragment_XRF.isFloat.match(str)) {
v.x = parseFloat(str);
v.float = v.x;
}
if(xrfragment_XRF.isInt.match(str)) {
v.int = Std.parseInt(str);
v.x = v.int;
if(str.length > 0) {
if(str.split(",").length > 1) {
var xyzw = str.split(",");
if(xyzw.length > 0) {
v.x = parseFloat(xyzw[0]);
}
if(xyzw.length > 1) {
v.y = parseFloat(xyzw[1]);
}
if(xyzw.length > 2) {
v.z = parseFloat(xyzw[2]);
}
if(xyzw.length > 3) {
v.w = parseFloat(xyzw[3]);
}
}
if(xrfragment_XRF.isColor.match(str)) {
v.color = str;
}
if(xrfragment_XRF.isFloat.match(str)) {
v.x = parseFloat(str);
v.float = v.x;
}
if(xrfragment_XRF.isInt.match(str)) {
v.int = Std.parseInt(str);
v.x = v.int;
}
v.filter = new xrfragment_Filter(v.fragment + "=" + v.string);
} else {
v.filter = new xrfragment_Filter(v.fragment);
}
}
};
@ -571,5 +539,10 @@ xrfragment_XRF.isVector = new EReg("([,]+|\\w)","");
xrfragment_XRF.isUrl = new EReg("(://)?\\..*","");
xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*","");
xrfragment_XRF.isString = new EReg(".*","");
xrfragment_XRF.operators = new EReg("(^-|[\\*]+)","");
xrfragment_XRF.isProp = new EReg("^.*=[><=]?","");
xrfragment_XRF.isExclude = new EReg("^-","");
xrfragment_XRF.isDeep = new EReg("\\*","");
xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$","");
})({});
var xrfragment = $hx_exports["xrfragment"];

747
dist/xrfragment.lua vendored
View File

@ -217,8 +217,8 @@ __lua_Boot = _hx_e()
__lua_UserData = _hx_e()
__lua_Lib = _hx_e()
__lua_Thread = _hx_e()
__xrfragment_Filter = _hx_e()
__xrfragment_Parser = _hx_e()
__xrfragment_Query = _hx_e()
__xrfragment_URI = _hx_e()
__xrfragment_XRF = _hx_e()
@ -710,6 +710,20 @@ Reflect.deleteField = function(o,field)
o.__fields__[field] = nil;
do return true end;
end
Reflect.copy = function(o)
if (o == nil) then
do return nil end;
end;
local o2 = _hx_e();
local _g = 0;
local _g1 = Reflect.fields(o);
while (_g < _g1.length) do
local f = _g1[_g];
_g = _g + 1;
o2[f] = Reflect.field(o, f);
end;
do return o2 end;
end
String.new = function(string)
local self = _hx_new(String.prototype)
@ -1378,220 +1392,28 @@ end
__lua_Thread.new = {}
__lua_Thread.__name__ = true
__xrfragment_Parser.new = {}
_hx_exports["xrfragment"]["Parser"] = __xrfragment_Parser
__xrfragment_Parser.__name__ = true
__xrfragment_Parser.parse = function(key,value,store)
local Frag_h = ({});
local value1 = _hx_bit.bor(_hx_bit.bor(__xrfragment_XRF.ASSET,__xrfragment_XRF.T_PREDEFINED_VIEW),__xrfragment_XRF.PV_EXECUTE);
if (value1 == nil) then
Frag_h["#"] = __haxe_ds_StringMap.tnull;
else
Frag_h["#"] = value1;
end;
local value1 = _hx_bit.bor(__xrfragment_XRF.ASSET,__xrfragment_XRF.T_INT);
if (value1 == nil) then
Frag_h.prio = __haxe_ds_StringMap.tnull;
else
Frag_h.prio = value1;
end;
local value1 = _hx_bit.bor(__xrfragment_XRF.ASSET,__xrfragment_XRF.T_URL);
if (value1 == nil) then
Frag_h.src = __haxe_ds_StringMap.tnull;
else
Frag_h.src = value1;
end;
local value1 = _hx_bit.bor(_hx_bit.bor(__xrfragment_XRF.ASSET,__xrfragment_XRF.T_URL),__xrfragment_XRF.T_PREDEFINED_VIEW);
if (value1 == nil) then
Frag_h.href = __haxe_ds_StringMap.tnull;
else
Frag_h.href = value1;
end;
local value1 = _hx_bit.bor(__xrfragment_XRF.ASSET,__xrfragment_XRF.T_STRING);
if (value1 == nil) then
Frag_h.tag = __haxe_ds_StringMap.tnull;
else
Frag_h.tag = value1;
end;
local value1 = _hx_bit.bor(_hx_bit.bor(_hx_bit.bor(_hx_bit.bor(__xrfragment_XRF.PV_OVERRIDE,__xrfragment_XRF.T_VECTOR3),__xrfragment_XRF.T_STRING_OBJ),__xrfragment_XRF.METADATA),__xrfragment_XRF.NAVIGATOR);
if (value1 == nil) then
Frag_h.pos = __haxe_ds_StringMap.tnull;
else
Frag_h.pos = value1;
end;
local value1 = _hx_bit.bor(_hx_bit.bor(__xrfragment_XRF.PV_OVERRIDE,__xrfragment_XRF.T_STRING),__xrfragment_XRF.METADATA);
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.T_VECTOR3),__xrfragment_XRF.METADATA);
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(_hx_bit.bor(__xrfragment_XRF.QUERY_OPERATOR,__xrfragment_XRF.PV_OVERRIDE),__xrfragment_XRF.T_VECTOR3),__xrfragment_XRF.METADATA),__xrfragment_XRF.NAVIGATOR);
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.T_VECTOR3),__xrfragment_XRF.METADATA);
if (value1 == nil) then
Frag_h.mov = __haxe_ds_StringMap.tnull;
else
Frag_h.mov = value1;
end;
local value1 = _hx_bit.bor(_hx_bit.bor(_hx_bit.bor(__xrfragment_XRF.QUERY_OPERATOR,__xrfragment_XRF.PV_OVERRIDE),__xrfragment_XRF.T_INT),__xrfragment_XRF.METADATA);
if (value1 == nil) then
Frag_h.show = __haxe_ds_StringMap.tnull;
else
Frag_h.show = 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.METADATA);
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(_hx_bit.bor(_hx_bit.bor(__xrfragment_XRF.ASSET,__xrfragment_XRF.PV_OVERRIDE),__xrfragment_XRF.T_FLOAT),__xrfragment_XRF.T_VECTOR2),__xrfragment_XRF.T_STRING),__xrfragment_XRF.NAVIGATOR),__xrfragment_XRF.METADATA);
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(_hx_bit.bor(_hx_bit.bor(_hx_bit.bor(_hx_bit.bor(__xrfragment_XRF.ASSET,__xrfragment_XRF.PV_OVERRIDE),__xrfragment_XRF.T_FLOAT),__xrfragment_XRF.T_VECTOR2),__xrfragment_XRF.T_VECTOR3),__xrfragment_XRF.NAVIGATOR),__xrfragment_XRF.METADATA);
if (value1 == nil) then
Frag_h.tv = __haxe_ds_StringMap.tnull;
else
Frag_h.tv = value1;
end;
local value1 = _hx_bit.bor(_hx_bit.bor(_hx_bit.bor(__xrfragment_XRF.ASSET,__xrfragment_XRF.PV_OVERRIDE),__xrfragment_XRF.T_VECTOR3),__xrfragment_XRF.METADATA);
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(_hx_bit.bor(__xrfragment_XRF.ASSET,__xrfragment_XRF.PV_OVERRIDE),__xrfragment_XRF.T_VECTOR3),__xrfragment_XRF.METADATA);
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(_hx_bit.bor(__xrfragment_XRF.ASSET,__xrfragment_XRF.PV_OVERRIDE),__xrfragment_XRF.T_INT),__xrfragment_XRF.NAVIGATOR),__xrfragment_XRF.METADATA);
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(_hx_bit.bor(__xrfragment_XRF.ASSET,__xrfragment_XRF.PV_OVERRIDE),__xrfragment_XRF.T_VECTOR2),__xrfragment_XRF.NAVIGATOR),__xrfragment_XRF.METADATA);
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(_hx_bit.bor(__xrfragment_XRF.ASSET,__xrfragment_XRF.PV_OVERRIDE),__xrfragment_XRF.T_VECTOR2),__xrfragment_XRF.NAVIGATOR),__xrfragment_XRF.METADATA);
if (value1 == nil) then
Frag_h.fog = __haxe_ds_StringMap.tnull;
else
Frag_h.fog = 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.T_VECTOR3),__xrfragment_XRF.NAVIGATOR),__xrfragment_XRF.METADATA);
if (value1 == nil) then
Frag_h.bg = __haxe_ds_StringMap.tnull;
else
Frag_h.bg = value1;
end;
local value1 = _hx_bit.bor(__xrfragment_XRF.ASSET,__xrfragment_XRF.T_STRING);
if (value1 == nil) then
Frag_h.namespace = __haxe_ds_StringMap.tnull;
else
Frag_h.namespace = value1;
end;
local value1 = _hx_bit.bor(__xrfragment_XRF.ASSET,__xrfragment_XRF.T_STRING);
if (value1 == nil) then
Frag_h.SPDX = __haxe_ds_StringMap.tnull;
else
Frag_h.SPDX = value1;
end;
local value1 = _hx_bit.bor(__xrfragment_XRF.ASSET,__xrfragment_XRF.T_STRING);
if (value1 == nil) then
Frag_h.unit = __haxe_ds_StringMap.tnull;
else
Frag_h.unit = value1;
end;
local value1 = _hx_bit.bor(__xrfragment_XRF.ASSET,__xrfragment_XRF.T_STRING);
if (value1 == nil) then
Frag_h.description = __haxe_ds_StringMap.tnull;
else
Frag_h.description = value1;
end;
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.NAVIGATOR),__xrfragment_XRF.METADATA),__xrfragment_XRF.PROMPT);
if (value1 == nil) then
Frag_h.session = __haxe_ds_StringMap.tnull;
else
Frag_h.session = value1;
end;
local isPVDynamic = ((__lua_lib_luautf8_Utf8.len(value) == 0) and (__lua_lib_luautf8_Utf8.len(key) > 0)) and (Frag_h[key] == nil);
local isPVDefault = ((__lua_lib_luautf8_Utf8.len(value) == 0) and (__lua_lib_luautf8_Utf8.len(key) > 0)) and (key == "#");
if (isPVDynamic) then
local v = __xrfragment_XRF.new(key, _hx_bit.bor(__xrfragment_XRF.PV_EXECUTE,__xrfragment_XRF.NAVIGATOR));
v:validate(key);
store[key] = v;
do return true end;
end;
local ret = Frag_h[key];
if (ret == __haxe_ds_StringMap.tnull) then
ret = nil;
end;
local v = __xrfragment_XRF.new(key, ret);
if (Frag_h[key] ~= nil) then
if (not v:validate(value)) then
__haxe_Log.trace(Std.string(Std.string(Std.string(Std.string("⚠ 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=80,className="xrfragment.Parser",methodName="parse"}));
do return false end;
end;
store[key] = v;
if (__xrfragment_Parser.debug) then
__haxe_Log.trace(Std.string(Std.string(Std.string("") .. Std.string(key)) .. Std.string(": ")) .. Std.string(v.string), _hx_o({__fields__={fileName=true,lineNumber=true,className=true,methodName=true},fileName="src/xrfragment/Parser.hx",lineNumber=84,className="xrfragment.Parser",methodName="parse"}));
end;
else
if (__lua_Boot.__instanceof(value, String)) then
v:guessType(v, value);
end;
v.noXRF = true;
store[key] = v;
end;
do return true end;
end
__xrfragment_Query.new = function(str)
local self = _hx_new(__xrfragment_Query.prototype)
__xrfragment_Query.super(self,str)
__xrfragment_Filter.new = function(str)
local self = _hx_new(__xrfragment_Filter.prototype)
__xrfragment_Filter.super(self,str)
return self
end
__xrfragment_Query.super = function(self,str)
self.isNumber = EReg.new("^[0-9\\.]+$", "");
self.isRoot = EReg.new("^[-]?/", "");
self.isExclude = EReg.new("^-", "");
self.isProp = EReg.new("^.*:[><=!]?", "");
__xrfragment_Filter.super = function(self,str)
self.q = _hx_e();
self.str = "";
if (str ~= nil) then
self:parse(str);
end;
end
_hx_exports["xrfragment"]["Query"] = __xrfragment_Query
__xrfragment_Query.__name__ = true
__xrfragment_Query.prototype = _hx_e();
__xrfragment_Query.prototype.toObject = function(self)
do return self.q end
_hx_exports["xrfragment"]["Filter"] = __xrfragment_Filter
__xrfragment_Filter.__name__ = true
__xrfragment_Filter.prototype = _hx_e();
__xrfragment_Filter.prototype.toObject = function(self)
do return Reflect.copy(self.q) end
end
__xrfragment_Query.prototype.get = function(self)
do return self.q end
__xrfragment_Filter.prototype.get = function(self)
do return Reflect.copy(self.q) end
end
__xrfragment_Query.prototype.parse = function(self,str)
local _gthis = self;
__xrfragment_Filter.prototype.parse = function(self,str)
local idx = 1;
local ret = _hx_tab_array({}, 0);
while (idx ~= nil) do
@ -1625,8 +1447,8 @@ __xrfragment_Query.prototype.parse = function(self,str)
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(str, ":", idx, true);
if (__lua_lib_luautf8_Utf8.len("=") > 0) then
newidx = __lua_lib_luautf8_Utf8.find(str, "=", idx, true);
else
if (idx >= __lua_lib_luautf8_Utf8.len(str)) then
newidx = nil;
@ -1637,7 +1459,7 @@ __xrfragment_Query.prototype.parse = function(self,str)
if (newidx ~= nil) then
local match = __lua_lib_luautf8_Utf8.sub(str, idx, newidx - 1);
ret:push(match);
idx = newidx + __lua_lib_luautf8_Utf8.len(":");
idx = newidx + __lua_lib_luautf8_Utf8.len("=");
else
ret:push(__lua_lib_luautf8_Utf8.sub(str, idx, __lua_lib_luautf8_Utf8.len(str)));
idx = nil;
@ -1648,8 +1470,8 @@ __xrfragment_Query.prototype.parse = function(self,str)
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(str, ":", idx, true);
if (__lua_lib_luautf8_Utf8.len("=") > 0) then
newidx = __lua_lib_luautf8_Utf8.find(str, "=", idx, true);
else
if (idx >= __lua_lib_luautf8_Utf8.len(str)) then
newidx = nil;
@ -1660,7 +1482,7 @@ __xrfragment_Query.prototype.parse = function(self,str)
if (newidx ~= nil) then
local match = __lua_lib_luautf8_Utf8.sub(str, idx, newidx - 1);
ret:push(match);
idx = newidx + __lua_lib_luautf8_Utf8.len(":");
idx = newidx + __lua_lib_luautf8_Utf8.len("=");
else
ret:push(__lua_lib_luautf8_Utf8.sub(str, idx, __lua_lib_luautf8_Utf8.len(str)));
idx = nil;
@ -1671,15 +1493,7 @@ __xrfragment_Query.prototype.parse = function(self,str)
if (Reflect.field(q, Std.string(prefix) .. Std.string(k))) then
filter = Reflect.field(q, Std.string(prefix) .. Std.string(k));
end;
local value = (function()
local _hx_1
if (Reflect.field(filter, "rules") ~= nil) then
_hx_1 = Reflect.field(filter, "rules"); else
_hx_1 = Array.new(); end
return _hx_1
end )();
filter.rules = value;
if (_gthis.isProp:match(str)) then
if (__xrfragment_XRF.isProp:match(str)) then
local oper = "";
local startIndex = nil;
if (startIndex == nil) then
@ -1687,29 +1501,13 @@ __xrfragment_Query.prototype.parse = function(self,str)
else
startIndex = startIndex + 1;
end;
local r = __lua_lib_luautf8_Utf8.find(str, "*", startIndex, true);
if ((function()
local _hx_2
if ((r ~= nil) and (r > 0)) then
_hx_2 = r - 1; else
_hx_2 = -1; end
return _hx_2
end )() ~= -1) then
oper = "*";
end;
local startIndex = nil;
if (startIndex == nil) then
startIndex = 1;
else
startIndex = startIndex + 1;
end;
local r = __lua_lib_luautf8_Utf8.find(str, ">", startIndex, true);
if ((function()
local _hx_3
local _hx_1
if ((r ~= nil) and (r > 0)) then
_hx_3 = r - 1; else
_hx_3 = -1; end
return _hx_3
_hx_1 = r - 1; else
_hx_1 = -1; end
return _hx_1
end )() ~= -1) then
oper = ">";
end;
@ -1721,48 +1519,15 @@ __xrfragment_Query.prototype.parse = function(self,str)
end;
local r = __lua_lib_luautf8_Utf8.find(str, "<", startIndex, true);
if ((function()
local _hx_4
local _hx_2
if ((r ~= nil) and (r > 0)) then
_hx_4 = r - 1; else
_hx_4 = -1; end
return _hx_4
_hx_2 = r - 1; else
_hx_2 = -1; end
return _hx_2
end )() ~= -1) then
oper = "<";
end;
local startIndex = nil;
if (startIndex == nil) then
startIndex = 1;
else
startIndex = startIndex + 1;
end;
local r = __lua_lib_luautf8_Utf8.find(str, ">=", startIndex, true);
if ((function()
local _hx_5
if ((r ~= nil) and (r > 0)) then
_hx_5 = r - 1; else
_hx_5 = -1; end
return _hx_5
end )() ~= -1) then
oper = ">=";
end;
local startIndex = nil;
if (startIndex == nil) then
startIndex = 1;
else
startIndex = startIndex + 1;
end;
local r = __lua_lib_luautf8_Utf8.find(str, "<=", startIndex, true);
if ((function()
local _hx_6
if ((r ~= nil) and (r > 0)) then
_hx_6 = r - 1; else
_hx_6 = -1; end
return _hx_6
end )() ~= -1) then
oper = "<=";
end;
if (_gthis.isExclude:match(k)) then
oper = "!=";
if (__xrfragment_XRF.isExclude:match(k)) then
local pos = 1;
local len = nil;
if ((len == nil) or (len > (pos + __lua_lib_luautf8_Utf8.len(k)))) then
@ -1779,86 +1544,75 @@ __xrfragment_Query.prototype.parse = function(self,str)
pos = 0;
end;
k = __lua_lib_luautf8_Utf8.sub(k, pos + 1, pos + len);
else
local pos = __lua_lib_luautf8_Utf8.len(oper);
local len = nil;
if ((len == nil) or (len > (pos + __lua_lib_luautf8_Utf8.len(v)))) then
len = __lua_lib_luautf8_Utf8.len(v);
else
if (len < 0) then
len = __lua_lib_luautf8_Utf8.len(v) + len;
end;
end;
if (pos < 0) then
pos = __lua_lib_luautf8_Utf8.len(v) + pos;
end;
if (pos < 0) then
pos = 0;
end;
v = __lua_lib_luautf8_Utf8.sub(v, pos + 1, pos + len);
end;
local pos = __lua_lib_luautf8_Utf8.len(oper);
local len = nil;
if ((len == nil) or (len > (pos + __lua_lib_luautf8_Utf8.len(v)))) then
len = __lua_lib_luautf8_Utf8.len(v);
else
if (len < 0) then
len = __lua_lib_luautf8_Utf8.len(v) + len;
end;
end;
if (pos < 0) then
pos = __lua_lib_luautf8_Utf8.len(v) + pos;
end;
if (pos < 0) then
pos = 0;
end;
v = __lua_lib_luautf8_Utf8.sub(v, pos + 1, pos + len);
if (__lua_lib_luautf8_Utf8.len(oper) == 0) then
oper = "=";
end;
local rule = _hx_e();
if (_gthis.isNumber:match(v)) then
if (__xrfragment_XRF.isNumber:match(v)) then
local value = Std.parseFloat(v);
rule[oper] = value;
else
rule[oper] = v;
end;
Reflect.field(filter, "rules"):push(rule);
q[k] = filter;
do return end;
else
local value = (function()
local _hx_7
if (_gthis.isExclude:match(str)) then
_hx_7 = false; else
_hx_7 = true; end
return _hx_7
end )();
filter.id = value;
local value = _gthis.isRoot:match(str);
filter.root = value;
if (_gthis.isExclude:match(str)) then
local pos = 1;
local len = nil;
if ((len == nil) or (len > (pos + __lua_lib_luautf8_Utf8.len(str)))) then
len = __lua_lib_luautf8_Utf8.len(str);
else
if (len < 0) then
len = __lua_lib_luautf8_Utf8.len(str) + len;
end;
end;
if (pos < 0) then
pos = __lua_lib_luautf8_Utf8.len(str) + pos;
end;
if (pos < 0) then
pos = 0;
end;
str = __lua_lib_luautf8_Utf8.sub(str, pos + 1, pos + len);
end;
if (_gthis.isRoot:match(str)) then
local pos = 1;
local len = nil;
if ((len == nil) or (len > (pos + __lua_lib_luautf8_Utf8.len(str)))) then
len = __lua_lib_luautf8_Utf8.len(str);
else
if (len < 0) then
len = __lua_lib_luautf8_Utf8.len(str) + len;
end;
end;
if (pos < 0) then
pos = __lua_lib_luautf8_Utf8.len(str) + pos;
end;
if (pos < 0) then
pos = 0;
end;
str = __lua_lib_luautf8_Utf8.sub(str, pos + 1, pos + len);
end;
q[str] = filter;
q.expr = rule;
end;
local value;
if (__xrfragment_XRF.isDeep:match(str)) then
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(k, "*", idx, true);
else
if (idx >= __lua_lib_luautf8_Utf8.len(k)) then
newidx = nil;
else
newidx = idx + 1;
end;
end;
if (newidx ~= nil) then
local match = __lua_lib_luautf8_Utf8.sub(k, idx, newidx - 1);
ret:push(match);
idx = newidx + __lua_lib_luautf8_Utf8.len("*");
else
ret:push(__lua_lib_luautf8_Utf8.sub(k, idx, __lua_lib_luautf8_Utf8.len(k)));
idx = nil;
end;
end;
value = ret.length - 1;
else
value = 0;
end;
q.deep = value;
local value = (function()
local _hx_3
if (__xrfragment_XRF.isExclude:match(str)) then
_hx_3 = false; else
_hx_3 = true; end
return _hx_3
end )();
q.show = value;
local value = __xrfragment_XRF.operators:replace(k, "");
q.key = value;
q.value = v;
end;
local _g = 0;
local _g1 = token.length;
@ -1869,7 +1623,7 @@ __xrfragment_Query.prototype.parse = function(self,str)
end;
self.q = q do return self.q end
end
__xrfragment_Query.prototype.test = function(self,obj)
__xrfragment_Filter.prototype.test = function(self,obj)
local qualify = false;
local _g = 0;
local _g1 = Reflect.fields(obj);
@ -1893,7 +1647,7 @@ __xrfragment_Query.prototype.test = function(self,obj)
end;
do return qualify end
end
__xrfragment_Query.prototype.testProperty = function(self,property,value,exclude)
__xrfragment_Filter.prototype.testProperty = function(self,property,value,exclude)
local conds = 0;
local fails = 0;
local qualify = 0;
@ -1914,56 +1668,147 @@ __xrfragment_Query.prototype.testProperty = function(self,property,value,exclude
do return Reflect.field(v, property) end;
end;
end;
local _g = 0;
local _g1 = Reflect.fields(self.q);
local _hx_continue_1 = false;
while (_g < _g1.length) do repeat
local k = _g1[_g];
_g = _g + 1;
local filter = Reflect.field(self.q, k);
if (filter.rules == nil) then
break;
end;
local rules = filter.rules;
local _g = 0;
while (_g < rules.length) do
local rule = rules[_g];
_g = _g + 1;
if (exclude) then
if (((Reflect.field(rule, "!=") ~= nil) and testprop(Std.string(value) == Std.string(Reflect.field(rule, "!=")))) and exclude) then
qualify = qualify + 1;
end;
else
if ((Reflect.field(rule, "*") ~= nil) and testprop(Std.parseFloat(value) ~= nil)) then
qualify = qualify + 1;
end;
if ((Reflect.field(rule, ">") ~= nil) and testprop(Std.parseFloat(value) > Std.parseFloat(Reflect.field(rule, ">")))) then
qualify = qualify + 1;
end;
if ((Reflect.field(rule, "<") ~= nil) and testprop(Std.parseFloat(value) < Std.parseFloat(Reflect.field(rule, "<")))) then
qualify = qualify + 1;
end;
if ((Reflect.field(rule, ">=") ~= nil) and testprop(Std.parseFloat(value) >= Std.parseFloat(Reflect.field(rule, ">=")))) then
qualify = qualify + 1;
end;
if ((Reflect.field(rule, "<=") ~= nil) and testprop(Std.parseFloat(value) <= Std.parseFloat(Reflect.field(rule, "<=")))) then
qualify = qualify + 1;
end;
if ((Reflect.field(rule, "=") ~= nil) and (testprop(value == Reflect.field(rule, "=")) or testprop(Std.parseFloat(value) == Std.parseFloat(Reflect.field(rule, "="))))) then
qualify = qualify + 1;
end;
if (Reflect.field(self.q, "expr")) then
local f = Reflect.field(self.q, "expr");
if (not Reflect.field(self.q, "show")) then
if (((Reflect.field(f, "!=") ~= nil) and testprop(Std.string(value) == Std.string(Reflect.field(f, "!=")))) and exclude) then
qualify = qualify + 1;
end;
else
if ((Reflect.field(f, "*") ~= nil) and testprop(Std.parseFloat(value) ~= nil)) then
qualify = qualify + 1;
end;
if ((Reflect.field(f, ">") ~= nil) and testprop(Std.parseFloat(value) >= Std.parseFloat(Reflect.field(f, ">")))) then
qualify = qualify + 1;
end;
if ((Reflect.field(f, "<") ~= nil) and testprop(Std.parseFloat(value) <= Std.parseFloat(Reflect.field(f, "<")))) then
qualify = qualify + 1;
end;
if ((Reflect.field(f, "=") ~= nil) and (testprop(value == Reflect.field(f, "=")) or testprop(Std.parseFloat(value) == Std.parseFloat(Reflect.field(f, "="))))) then
qualify = qualify + 1;
end;
end;until true
if _hx_continue_1 then
_hx_continue_1 = false;
break;
end;
end;
do return qualify > 0 end
end
__xrfragment_Query.prototype.__class__ = __xrfragment_Query
__xrfragment_Filter.prototype.__class__ = __xrfragment_Filter
__xrfragment_Parser.new = {}
_hx_exports["xrfragment"]["Parser"] = __xrfragment_Parser
__xrfragment_Parser.__name__ = true
__xrfragment_Parser.parse = function(key,value,store,index)
local Frag_h = ({});
local value1 = _hx_bit.bor(_hx_bit.bor(__xrfragment_XRF.ASSET,__xrfragment_XRF.T_PREDEFINED_VIEW),__xrfragment_XRF.PV_EXECUTE);
if (value1 == nil) then
Frag_h["#"] = __haxe_ds_StringMap.tnull;
else
Frag_h["#"] = value1;
end;
local value1 = _hx_bit.bor(__xrfragment_XRF.ASSET,__xrfragment_XRF.T_URL);
if (value1 == nil) then
Frag_h.src = __haxe_ds_StringMap.tnull;
else
Frag_h.src = value1;
end;
local value1 = _hx_bit.bor(_hx_bit.bor(__xrfragment_XRF.ASSET,__xrfragment_XRF.T_URL),__xrfragment_XRF.T_PREDEFINED_VIEW);
if (value1 == nil) then
Frag_h.href = __haxe_ds_StringMap.tnull;
else
Frag_h.href = value1;
end;
local value1 = _hx_bit.bor(__xrfragment_XRF.ASSET,__xrfragment_XRF.T_STRING);
if (value1 == nil) then
Frag_h.tag = __haxe_ds_StringMap.tnull;
else
Frag_h.tag = value1;
end;
local value1 = _hx_bit.bor(_hx_bit.bor(_hx_bit.bor(_hx_bit.bor(_hx_bit.bor(__xrfragment_XRF.PV_OVERRIDE,__xrfragment_XRF.T_VECTOR3),__xrfragment_XRF.T_STRING),__xrfragment_XRF.T_STRING_OBJ),__xrfragment_XRF.METADATA),__xrfragment_XRF.NAVIGATOR);
if (value1 == nil) then
Frag_h.pos = __haxe_ds_StringMap.tnull;
else
Frag_h.pos = value1;
end;
local value1 = _hx_bit.bor(_hx_bit.bor(_hx_bit.bor(_hx_bit.bor(__xrfragment_XRF.QUERY_OPERATOR,__xrfragment_XRF.PV_OVERRIDE),__xrfragment_XRF.T_VECTOR3),__xrfragment_XRF.METADATA),__xrfragment_XRF.NAVIGATOR);
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(_hx_bit.bor(_hx_bit.bor(_hx_bit.bor(__xrfragment_XRF.ASSET,__xrfragment_XRF.PV_OVERRIDE),__xrfragment_XRF.T_FLOAT),__xrfragment_XRF.T_VECTOR2),__xrfragment_XRF.T_STRING),__xrfragment_XRF.NAVIGATOR),__xrfragment_XRF.METADATA);
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(_hx_bit.bor(_hx_bit.bor(_hx_bit.bor(_hx_bit.bor(__xrfragment_XRF.ASSET,__xrfragment_XRF.PV_OVERRIDE),__xrfragment_XRF.T_FLOAT),__xrfragment_XRF.T_VECTOR2),__xrfragment_XRF.T_VECTOR3),__xrfragment_XRF.NAVIGATOR),__xrfragment_XRF.METADATA);
if (value1 == nil) then
Frag_h.tv = __haxe_ds_StringMap.tnull;
else
Frag_h.tv = value1;
end;
local value1 = _hx_bit.bor(__xrfragment_XRF.ASSET,__xrfragment_XRF.T_STRING);
if (value1 == nil) then
Frag_h.namespace = __haxe_ds_StringMap.tnull;
else
Frag_h.namespace = value1;
end;
local value1 = _hx_bit.bor(__xrfragment_XRF.ASSET,__xrfragment_XRF.T_STRING);
if (value1 == nil) then
Frag_h.SPDX = __haxe_ds_StringMap.tnull;
else
Frag_h.SPDX = value1;
end;
local value1 = _hx_bit.bor(__xrfragment_XRF.ASSET,__xrfragment_XRF.T_STRING);
if (value1 == nil) then
Frag_h.unit = __haxe_ds_StringMap.tnull;
else
Frag_h.unit = value1;
end;
local value1 = _hx_bit.bor(__xrfragment_XRF.ASSET,__xrfragment_XRF.T_STRING);
if (value1 == nil) then
Frag_h.description = __haxe_ds_StringMap.tnull;
else
Frag_h.description = value1;
end;
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.NAVIGATOR),__xrfragment_XRF.METADATA),__xrfragment_XRF.PROMPT);
if (value1 == nil) then
Frag_h.session = __haxe_ds_StringMap.tnull;
else
Frag_h.session = value1;
end;
local keyStripped = __xrfragment_XRF.operators:replace(key, "");
local isPVDynamic = (__lua_lib_luautf8_Utf8.len(key) > 0) and (Frag_h[key] == nil);
local isPVDefault = ((__lua_lib_luautf8_Utf8.len(value) == 0) and (__lua_lib_luautf8_Utf8.len(key) > 0)) and (key == "#");
if (isPVDynamic) then
local v = __xrfragment_XRF.new(key, _hx_bit.bor(__xrfragment_XRF.PV_EXECUTE,__xrfragment_XRF.NAVIGATOR), index);
v:validate(value);
store[keyStripped] = v;
do return true end;
end;
local ret = Frag_h[key];
if (ret == __haxe_ds_StringMap.tnull) then
ret = nil;
end;
local v = __xrfragment_XRF.new(key, ret, index);
if (Frag_h[key] ~= nil) then
if (not v:validate(value)) then
__haxe_Log.trace(Std.string(Std.string(Std.string(Std.string("⚠ 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"}));
do return false end;
end;
store[keyStripped] = v;
if (__xrfragment_Parser.debug) then
__haxe_Log.trace(Std.string(Std.string(Std.string("") .. Std.string(key)) .. Std.string(": ")) .. Std.string(v.string), _hx_o({__fields__={fileName=true,lineNumber=true,className=true,methodName=true},fileName="src/xrfragment/Parser.hx",lineNumber=70,className="xrfragment.Parser",methodName="parse"}));
end;
else
if (__lua_Boot.__instanceof(value, String)) then
v:guessType(v, value);
end;
v.noXRF = true;
store[keyStripped] = v;
end;
do return true end;
end
__xrfragment_URI.new = {}
_hx_exports["xrfragment"]["URI"] = __xrfragment_URI
@ -2074,7 +1919,7 @@ __xrfragment_URI.parse = function(url,filter)
if (splitByEqual.length > 1) then
value = StringTools.urlDecode(regexPlus:split(splitByEqual[1]):join(" "));
end;
local ok = __xrfragment_Parser.parse(key, value, store);
local ok = __xrfragment_Parser.parse(key, value, store, i);
end;
if ((filter ~= nil) and (filter ~= 0)) then
local _g = 0;
@ -2091,14 +1936,15 @@ __xrfragment_URI.parse = function(url,filter)
do return store end;
end
__xrfragment_XRF.new = function(_fragment,_flags)
__xrfragment_XRF.new = function(_fragment,_flags,_index)
local self = _hx_new(__xrfragment_XRF.prototype)
__xrfragment_XRF.super(self,_fragment,_flags)
__xrfragment_XRF.super(self,_fragment,_flags,_index)
return self
end
__xrfragment_XRF.super = function(self,_fragment,_flags)
__xrfragment_XRF.super = function(self,_fragment,_flags,_index)
self.fragment = _fragment;
self.flags = _flags;
self.index = _index;
end
_hx_exports["xrfragment"]["XRF"] = __xrfragment_XRF
__xrfragment_XRF.__name__ = true
@ -2117,43 +1963,21 @@ __xrfragment_XRF.prototype.is = function(self,flag)
end
__xrfragment_XRF.prototype.validate = function(self,value)
self:guessType(self, value);
if (self.fragment == "q") then
self.query = __xrfragment_Query.new(value):get();
end;
local ok = true;
if ((not self:is(__xrfragment_XRF.T_FLOAT) and self:is(__xrfragment_XRF.T_VECTOR2)) and not (__lua_Boot.__instanceof(self.x, Float) and __lua_Boot.__instanceof(self.y, Float))) then
ok = false;
end;
if ((not self:is(__xrfragment_XRF.T_VECTOR2) and self:is(__xrfragment_XRF.T_VECTOR3)) and not ((__lua_Boot.__instanceof(self.x, Float) and __lua_Boot.__instanceof(self.y, Float)) and __lua_Boot.__instanceof(self.z, Float))) then
if ((not (self:is(__xrfragment_XRF.T_VECTOR2) or self:is(__xrfragment_XRF.T_STRING)) and self:is(__xrfragment_XRF.T_VECTOR3)) and not ((__lua_Boot.__instanceof(self.x, Float) and __lua_Boot.__instanceof(self.y, Float)) and __lua_Boot.__instanceof(self.z, Float))) then
ok = false;
end;
do return ok end
end
__xrfragment_XRF.prototype.guessType = function(self,v,str)
v.string = str;
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(str, ",", idx, true);
else
if (idx >= __lua_lib_luautf8_Utf8.len(str)) then
newidx = nil;
else
newidx = idx + 1;
end;
end;
if (newidx ~= nil) then
local match = __lua_lib_luautf8_Utf8.sub(str, idx, newidx - 1);
ret:push(match);
idx = newidx + __lua_lib_luautf8_Utf8.len(",");
else
ret:push(__lua_lib_luautf8_Utf8.sub(str, idx, __lua_lib_luautf8_Utf8.len(str)));
idx = nil;
end;
if (not __lua_Boot.__instanceof(str, String)) then
do return end;
end;
if (ret.length > 1) then
if (__lua_lib_luautf8_Utf8.len(str) > 0) then
local idx = 1;
local ret = _hx_tab_array({}, 0);
while (idx ~= nil) do
@ -2176,30 +2000,57 @@ __xrfragment_XRF.prototype.guessType = function(self,v,str)
idx = nil;
end;
end;
local xyzw = ret;
if (xyzw.length > 0) then
v.x = Std.parseFloat(xyzw[0]);
if (ret.length > 1) then
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(str, ",", idx, true);
else
if (idx >= __lua_lib_luautf8_Utf8.len(str)) then
newidx = nil;
else
newidx = idx + 1;
end;
end;
if (newidx ~= nil) then
local match = __lua_lib_luautf8_Utf8.sub(str, idx, newidx - 1);
ret:push(match);
idx = newidx + __lua_lib_luautf8_Utf8.len(",");
else
ret:push(__lua_lib_luautf8_Utf8.sub(str, idx, __lua_lib_luautf8_Utf8.len(str)));
idx = nil;
end;
end;
local xyzw = ret;
if (xyzw.length > 0) then
v.x = Std.parseFloat(xyzw[0]);
end;
if (xyzw.length > 1) then
v.y = Std.parseFloat(xyzw[1]);
end;
if (xyzw.length > 2) then
v.z = Std.parseFloat(xyzw[2]);
end;
if (xyzw.length > 3) then
v.w = Std.parseFloat(xyzw[3]);
end;
end;
if (xyzw.length > 1) then
v.y = Std.parseFloat(xyzw[1]);
if (__xrfragment_XRF.isColor:match(str)) then
v.color = str;
end;
if (xyzw.length > 2) then
v.z = Std.parseFloat(xyzw[2]);
if (__xrfragment_XRF.isFloat:match(str)) then
v.x = Std.parseFloat(str);
v.float = v.x;
end;
if (xyzw.length > 3) then
v.w = Std.parseFloat(xyzw[3]);
if (__xrfragment_XRF.isInt:match(str)) then
v.int = Std.parseInt(str);
v.x = v.int;
end;
end;
if (__xrfragment_XRF.isColor:match(str)) then
v.color = str;
end;
if (__xrfragment_XRF.isFloat:match(str)) then
v.x = Std.parseFloat(str);
v.float = v.x;
end;
if (__xrfragment_XRF.isInt:match(str)) then
v.int = Std.parseInt(str);
v.x = v.int;
v.filter = __xrfragment_Filter.new(Std.string(Std.string(v.fragment) .. Std.string("=")) .. Std.string(v.string));
else
v.filter = __xrfragment_Filter.new(v.fragment);
end;
end
@ -2316,6 +2167,16 @@ local _hx_static_init = function()
__xrfragment_XRF.isString = EReg.new(".*", "");
__xrfragment_XRF.operators = EReg.new("(^-|[\\*]+)", "");
__xrfragment_XRF.isProp = EReg.new("^.*=[><=]?", "");
__xrfragment_XRF.isExclude = EReg.new("^-", "");
__xrfragment_XRF.isDeep = EReg.new("\\*", "");
__xrfragment_XRF.isNumber = EReg.new("^[0-9\\.]+$", "");
end

11940
dist/xrfragment.module.js vendored

File diff suppressed because it is too large Load Diff

View File

@ -1,706 +0,0 @@
<?php
/**
*/
use \haxe\iterators\ArrayIterator as IteratorsArrayIterator;
use \php\Boot;
use \php\_Boot\HxClosure;
use \haxe\iterators\ArrayKeyValueIterator;
final class Array_hx implements \JsonSerializable, \Countable, \IteratorAggregate, \ArrayAccess {
/**
* @var mixed[]
*/
public $arr;
/**
* @var int
* The length of `this` Array.
*/
public $length;
/**
* @param mixed[] $arr
*
* @return mixed[]|Array_hx
*/
public static function wrap ($arr) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:267: characters 3-23
$a = new Array_hx();
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:268: characters 3-14
$a->arr = $arr;
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:269: characters 3-31
$a->length = count($arr);
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:270: characters 3-11
return $a;
}
/**
* Creates a new Array.
*
* @return void
*/
public function __construct () {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:37: characters 9-36
$this1 = [];
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:37: characters 3-36
$this->arr = $this1;
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:38: characters 3-13
$this->length = 0;
}
/**
* Returns a new Array by appending the elements of `a` to the elements of
* `this` Array.
* This operation does not modify `this` Array.
* If `a` is the empty Array `[]`, a copy of `this` Array is returned.
* The length of the returned Array is equal to the sum of `this.length`
* and `a.length`.
* If `a` is `null`, the result is unspecified.
*
* @param mixed[]|Array_hx $a
*
* @return mixed[]|Array_hx
*/
public function concat ($a) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:42: characters 3-46
return Array_hx::wrap(array_merge($this->arr, $a->arr));
}
/**
* Returns whether `this` Array contains `x`.
* If `x` is found by checking standard equality, the function returns `true`, otherwise
* the function returns `false`.
*
* @param mixed $x
*
* @return bool
*/
public function contains ($x) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:60: characters 3-26
return $this->indexOf($x) !== -1;
}
/**
* Returns a shallow copy of `this` Array.
* The elements are not copied and retain their identity, so
* `a[i] == a.copy()[i]` is true for any valid `i`. However,
* `a == a.copy()` is always false.
*
* @return mixed[]|Array_hx
*/
public function copy () {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:46: characters 3-28
return (clone $this);
}
/**
* @return int
*/
#[\ReturnTypeWillChange]
public function count () {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:257: characters 3-16
return $this->length;
}
/**
* Returns an Array containing those elements of `this` for which `f`
* returned true.
* The individual elements are not duplicated and retain their identity.
* If `f` is null, the result is unspecified.
*
* @param \Closure $f
*
* @return mixed[]|Array_hx
*/
public function filter ($f) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:50: characters 3-35
$result = [];
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:51: characters 15-18
$data = $this->arr;
$_g_current = 0;
$_g_length = count($data);
$_g_data = $data;
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:51: lines 51-55
while ($_g_current < $_g_length) {
$item = $_g_data[$_g_current++];
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:52: lines 52-54
if ($f($item)) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:53: characters 5-22
$result[] = $item;
}
}
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:56: characters 3-22
return Array_hx::wrap($result);
}
/**
* @return \Traversable
*/
#[\ReturnTypeWillChange]
public function getIterator () {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:250: characters 3-38
return new \ArrayIterator($this->arr);
}
/**
* Returns position of the first occurrence of `x` in `this` Array, searching front to back.
* If `x` is found by checking standard equality, the function returns its index.
* If `x` is not found, the function returns -1.
* If `fromIndex` is specified, it will be used as the starting index to search from,
* otherwise search starts with zero index. If it is negative, it will be taken as the
* offset from the end of `this` Array to compute the starting index. If given or computed
* starting index is less than 0, the whole array will be searched, if it is greater than
* or equal to the length of `this` Array, the function returns -1.
*
* @param mixed $x
* @param int $fromIndex
*
* @return int
*/
public function indexOf ($x, $fromIndex = null) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:64: characters 7-69
$tmp = null;
if (($fromIndex === null) && !($x instanceof HxClosure)) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:64: characters 53-69
$value = $x;
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:64: characters 7-69
$tmp = !(is_int($value) || is_float($value));
} else {
$tmp = false;
}
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:64: lines 64-71
if ($tmp) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:65: characters 4-50
$index = array_search($x, $this->arr, true);
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:66: lines 66-70
if ($index === false) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:67: characters 5-14
return -1;
} else {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:69: characters 5-17
return $index;
}
}
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:72: lines 72-79
if ($fromIndex === null) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:73: characters 4-17
$fromIndex = 0;
} else {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:75: lines 75-76
if ($fromIndex < 0) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:76: characters 5-24
$fromIndex += $this->length;
}
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:77: lines 77-78
if ($fromIndex < 0) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:78: characters 5-18
$fromIndex = 0;
}
}
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:80: lines 80-84
while ($fromIndex < $this->length) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:81: lines 81-82
if (Boot::equal($this->arr[$fromIndex], $x)) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:82: characters 5-21
return $fromIndex;
}
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:83: characters 4-15
++$fromIndex;
}
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:85: characters 3-12
return -1;
}
/**
* Inserts the element `x` at the position `pos`.
* This operation modifies `this` Array in place.
* The offset is calculated like so:
* - If `pos` exceeds `this.length`, the offset is `this.length`.
* - If `pos` is negative, the offset is calculated from the end of `this`
* Array, i.e. `this.length + pos`. If this yields a negative value, the
* offset is 0.
* - Otherwise, the offset is `pos`.
* If the resulting offset does not exceed `this.length`, all elements from
* and including that offset to the end of `this` Array are moved one index
* ahead.
*
* @param int $pos
* @param mixed $x
*
* @return void
*/
public function insert ($pos, $x) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:89: characters 3-11
$this->length++;
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:90: characters 3-56
array_splice($this->arr, $pos, 0, [$x]);
}
/**
* Returns an iterator of the Array values.
*
* @return IteratorsArrayIterator
*/
public function iterator () {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:95: characters 3-48
return new IteratorsArrayIterator($this);
}
/**
* Returns a string representation of `this` Array, with `sep` separating
* each element.
* The result of this operation is equal to `Std.string(this[0]) + sep +
* Std.string(this[1]) + sep + ... + sep + Std.string(this[this.length-1])`
* If `this` is the empty Array `[]`, the result is the empty String `""`.
* If `this` has exactly one element, the result is equal to a call to
* `Std.string(this[0])`.
* If `sep` is null, the result is unspecified.
*
* @param string $sep
*
* @return string
*/
public function join ($sep) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:104: characters 3-98
return implode($sep, array_map((Boot::class??'null') . "::stringify", $this->arr));
}
/**
* @return mixed[]
*/
#[\ReturnTypeWillChange]
public function jsonSerialize () {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:263: characters 3-13
return $this->arr;
}
/**
* Returns an iterator of the Array indices and values.
*
* @return ArrayKeyValueIterator
*/
public function keyValueIterator () {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:100: characters 3-41
return new ArrayKeyValueIterator($this);
}
/**
* Returns position of the last occurrence of `x` in `this` Array, searching back to front.
* If `x` is found by checking standard equality, the function returns its index.
* If `x` is not found, the function returns -1.
* If `fromIndex` is specified, it will be used as the starting index to search from,
* otherwise search starts with the last element index. If it is negative, it will be
* taken as the offset from the end of `this` Array to compute the starting index. If
* given or computed starting index is greater than or equal to the length of `this` Array,
* the whole array will be searched, if it is less than 0, the function returns -1.
*
* @param mixed $x
* @param int $fromIndex
*
* @return int
*/
public function lastIndexOf ($x, $fromIndex = null) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:108: lines 108-109
if (($fromIndex === null) || ($fromIndex >= $this->length)) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:109: characters 4-26
$fromIndex = $this->length - 1;
}
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:110: lines 110-111
if ($fromIndex < 0) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:111: characters 4-23
$fromIndex += $this->length;
}
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:112: lines 112-116
while ($fromIndex >= 0) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:113: lines 113-114
if (Boot::equal($this->arr[$fromIndex], $x)) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:114: characters 5-21
return $fromIndex;
}
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:115: characters 4-15
--$fromIndex;
}
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:117: characters 3-12
return -1;
}
/**
* Creates a new Array by applying function `f` to all elements of `this`.
* The order of elements is preserved.
* If `f` is null, the result is unspecified.
*
* @param \Closure $f
*
* @return mixed[]|Array_hx
*/
public function map ($f) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:121: characters 3-35
$result = [];
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:122: characters 15-18
$data = $this->arr;
$_g_current = 0;
$_g_length = count($data);
$_g_data = $data;
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:122: lines 122-124
while ($_g_current < $_g_length) {
$item = $_g_data[$_g_current++];
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:123: characters 4-24
$result[] = $f($item);
}
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:125: characters 3-22
return Array_hx::wrap($result);
}
/**
* @param int $offset
*
* @return bool
*/
#[\ReturnTypeWillChange]
public function offsetExists ($offset) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:212: characters 3-25
return $offset < $this->length;
}
/**
* @param int $offset
*
* @return mixed
*/
#[\ReturnTypeWillChange]
public function &offsetGet ($offset) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:218: lines 218-222
try {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:219: characters 4-22
return $this->arr[$offset];
} catch(\Throwable $_g) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:221: characters 4-15
return null;
}
}
/**
* @param int $offset
* @param mixed $value
*
* @return void
*/
#[\ReturnTypeWillChange]
public function offsetSet ($offset, $value) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:228: lines 228-233
if ($this->length <= $offset) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:229: characters 13-19
$_g = $this->length;
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:229: characters 22-32
$_g1 = $offset + 1;
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:229: lines 229-231
while ($_g < $_g1) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:229: characters 13-32
$i = $_g++;
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:230: characters 5-18
$this->arr[$i] = null;
}
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:232: characters 4-23
$this->length = $offset + 1;
}
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:234: characters 3-22
$this->arr[$offset] = $value;
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:235: characters 3-35
return $value;
}
/**
* @param int $offset
*
* @return void
*/
#[\ReturnTypeWillChange]
public function offsetUnset ($offset) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:241: lines 241-244
if (($offset >= 0) && ($offset < $this->length)) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:242: characters 4-39
array_splice($this->arr, $offset, 1);
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:243: characters 4-12
--$this->length;
}
}
/**
* Removes the last element of `this` Array and returns it.
* This operation modifies `this` Array in place.
* If `this` has at least one element, `this.length` will decrease by 1.
* If `this` is the empty Array `[]`, null is returned and the length
* remains 0.
*
* @return mixed
*/
public function pop () {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:129: lines 129-130
if ($this->length > 0) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:130: characters 4-12
$this->length--;
}
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:131: characters 3-31
return array_pop($this->arr);
}
/**
* Adds the element `x` at the end of `this` Array and returns the new
* length of `this` Array.
* This operation modifies `this` Array in place.
* `this.length` increases by 1.
*
* @param mixed $x
*
* @return int
*/
public function push ($x) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:135: characters 3-20
$this->arr[$this->length++] = $x;
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:136: characters 3-16
return $this->length;
}
/**
* Removes the first occurrence of `x` in `this` Array.
* This operation modifies `this` Array in place.
* If `x` is found by checking standard equality, it is removed from `this`
* Array and all following elements are reindexed accordingly. The function
* then returns true.
* If `x` is not found, `this` Array is not changed and the function
* returns false.
*
* @param mixed $x
*
* @return bool
*/
public function remove ($x) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:140: characters 3-22
$result = false;
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:141: characters 16-20
$_g = 0;
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:141: characters 20-26
$_g1 = $this->length;
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:141: lines 141-148
while ($_g < $_g1) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:141: characters 16-26
$index = $_g++;
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:142: lines 142-147
if (Boot::equal($this->arr[$index], $x)) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:143: characters 5-39
array_splice($this->arr, $index, 1);
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:144: characters 5-13
$this->length--;
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:145: characters 5-18
$result = true;
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:146: characters 5-10
break;
}
}
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:149: characters 3-16
return $result;
}
/**
* Set the length of the Array.
* If `len` is shorter than the array's current size, the last
* `length - len` elements will be removed. If `len` is longer, the Array
* will be extended, with new elements set to a target-specific default
* value:
* - always null on dynamic targets
* - 0, 0.0 or false for Int, Float and Bool respectively on static targets
* - null for other types on static targets
*
* @param int $len
*
* @return void
*/
public function resize ($len) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:201: lines 201-205
if ($this->length < $len) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:202: characters 4-42
$this->arr = array_pad($this->arr, $len, null);
} else if ($this->length > $len) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:204: characters 4-47
array_splice($this->arr, $len, $this->length - $len);
}
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:206: characters 3-15
$this->length = $len;
}
/**
* Reverse the order of elements of `this` Array.
* This operation modifies `this` Array in place.
* If `this.length < 2`, `this` remains unchanged.
*
* @return void
*/
public function reverse () {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:153: characters 3-34
$this->arr = array_reverse($this->arr);
}
/**
* Removes the first element of `this` Array and returns it.
* This operation modifies `this` Array in place.
* If `this` has at least one element, `this`.length and the index of each
* remaining element is decreased by 1.
* If `this` is the empty Array `[]`, `null` is returned and the length
* remains 0.
*
* @return mixed
*/
public function shift () {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:157: lines 157-158
if ($this->length > 0) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:158: characters 4-12
$this->length--;
}
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:159: characters 3-33
return array_shift($this->arr);
}
/**
* Creates a shallow copy of the range of `this` Array, starting at and
* including `pos`, up to but not including `end`.
* This operation does not modify `this` Array.
* The elements are not copied and retain their identity.
* If `end` is omitted or exceeds `this.length`, it defaults to the end of
* `this` Array.
* If `pos` or `end` are negative, their offsets are calculated from the
* end of `this` Array by `this.length + pos` and `this.length + end`
* respectively. If this yields a negative value, 0 is used instead.
* If `pos` exceeds `this.length` or if `end` is less than or equals
* `pos`, the result is `[]`.
*
* @param int $pos
* @param int $end
*
* @return mixed[]|Array_hx
*/
public function slice ($pos, $end = null) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:163: lines 163-164
if ($pos < 0) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:164: characters 4-17
$pos += $this->length;
}
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:165: lines 165-166
if ($pos < 0) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:166: characters 4-11
$pos = 0;
}
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:167: lines 167-177
if ($end === null) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:168: characters 4-45
return Array_hx::wrap(array_slice($this->arr, $pos));
} else {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:170: lines 170-171
if ($end < 0) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:171: characters 5-18
$end += $this->length;
}
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:172: lines 172-176
if ($end <= $pos) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:173: characters 5-14
return new Array_hx();
} else {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:175: characters 5-57
return Array_hx::wrap(array_slice($this->arr, $pos, $end - $pos));
}
}
}
/**
* Sorts `this` Array according to the comparison function `f`, where
* `f(x,y)` returns 0 if x == y, a positive Int if x > y and a
* negative Int if x < y.
* This operation modifies `this` Array in place.
* The sort operation is not guaranteed to be stable, which means that the
* order of equal elements may not be retained. For a stable Array sorting
* algorithm, `haxe.ds.ArraySort.sort()` can be used instead.
* If `f` is null, the result is unspecified.
*
* @param \Closure $f
*
* @return void
*/
public function sort ($f) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:181: characters 3-15
usort($this->arr, $f);
}
/**
* Removes `len` elements from `this` Array, starting at and including
* `pos`, an returns them.
* This operation modifies `this` Array in place.
* If `len` is < 0 or `pos` exceeds `this`.length, an empty Array [] is
* returned and `this` Array is unchanged.
* If `pos` is negative, its value is calculated from the end of `this`
* Array by `this.length + pos`. If this yields a negative value, 0 is
* used instead.
* If the sum of the resulting values for `len` and `pos` exceed
* `this.length`, this operation will affect the elements from `pos` to the
* end of `this` Array.
* The length of the returned Array is equal to the new length of `this`
* Array subtracted from the original length of `this` Array. In other
* words, each element of the original `this` Array either remains in
* `this` Array or becomes an element of the returned Array.
*
* @param int $pos
* @param int $len
*
* @return mixed[]|Array_hx
*/
public function splice ($pos, $len) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:185: lines 185-186
if ($len < 0) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:186: characters 4-13
return new Array_hx();
}
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:187: characters 3-57
$result = Array_hx::wrap(array_splice($this->arr, $pos, $len));
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:188: characters 3-26
$this->length -= $result->length;
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:189: characters 3-16
return $result;
}
/**
* Returns a string representation of `this` Array.
* The result will include the individual elements' String representations
* separated by comma. The enclosing [ ] may be missing on some platforms,
* use `Std.string()` to get a String representation that is consistent
* across platforms.
*
* @return string
*/
public function toString () {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:197: characters 10-54
$arr = $this->arr;
$strings = [];
foreach ($arr as $key => $value) {
$strings[$key] = Boot::stringify($value, 9);
}
return "[" . (implode(",", $strings)??'null') . "]";
}
/**
* Adds the element `x` at the start of `this` Array.
* This operation modifies `this` Array in place.
* `this.length` and the index of each Array element increases by 1.
*
* @param mixed $x
*
* @return void
*/
public function unshift ($x) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Array.hx:193: characters 3-40
$this->length = array_unshift($this->arr, $x);
}
public function __toString() {
return $this->toString();
}
}
Boot::registerClass(Array_hx::class, 'Array');

View File

@ -1,147 +0,0 @@
<?php
/**
*/
use \php\Boot;
use \haxe\Exception as HaxeException;
/**
* The EReg class represents regular expressions.
* While basic usage and patterns consistently work across platforms, some more
* complex operations may yield different results. This is a necessary trade-
* off to retain a certain level of performance.
* EReg instances can be created by calling the constructor, or with the
* special syntax `~/pattern/modifier`
* EReg instances maintain an internal state, which is affected by several of
* its methods.
* A detailed explanation of the supported operations is available at
* <https://haxe.org/manual/std-regex.html>
*/
final class EReg {
/**
* @var bool
*/
public $global;
/**
* @var string
*/
public $last;
/**
* @var array[]
*/
public $matches;
/**
* @var string
*/
public $options;
/**
* @var string
*/
public $pattern;
/**
* @var string
*/
public $re;
/**
* Creates a new regular expression with pattern `r` and modifiers `opt`.
* This is equivalent to the shorthand syntax `~/r/opt`
* If `r` or `opt` are null, the result is unspecified.
*
* @param string $r
* @param string $opt
*
* @return void
*/
public function __construct ($r, $opt) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/EReg.hx:37: characters 3-19
$this->pattern = $r;
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/EReg.hx:38: characters 3-45
$this->options = str_replace("g", "", $opt);
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/EReg.hx:39: characters 3-26
$this->global = $this->options !== $opt;
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/EReg.hx:40: characters 3-49
$this->options = str_replace("u", "", $this->options);
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/EReg.hx:41: characters 3-68
$this->re = "\"" . (str_replace("\"", "\\\"", $r)??'null') . "\"" . ($this->options??'null');
}
/**
* @return void
*/
public function handlePregError () {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/EReg.hx:63: characters 3-36
$e = preg_last_error();
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/EReg.hx:64: lines 64-72
if ($e === PREG_INTERNAL_ERROR) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/EReg.hx:65: characters 4-9
throw HaxeException::thrown("EReg: internal PCRE error");
} else if ($e === PREG_BACKTRACK_LIMIT_ERROR) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/EReg.hx:67: characters 4-9
throw HaxeException::thrown("EReg: backtrack limit");
} else if ($e === PREG_RECURSION_LIMIT_ERROR) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/EReg.hx:69: characters 4-9
throw HaxeException::thrown("EReg: recursion limit");
} else if ($e === PREG_JIT_STACKLIMIT_ERROR) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/EReg.hx:71: characters 4-9
throw HaxeException::thrown("failed due to limited JIT stack space");
}
}
/**
* Tells if `this` regular expression matches String `s`.
* This method modifies the internal state.
* If `s` is `null`, the result is unspecified.
*
* @param string $s
*
* @return bool
*/
public function match ($s) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/EReg.hx:45: characters 10-29
$p = preg_match(($this->re . "u"), $s, $this->matches, PREG_OFFSET_CAPTURE, 0);
if ($p === false) {
$this->handlePregError();
$p = preg_match($this->re, $s, $this->matches, PREG_OFFSET_CAPTURE);
}
if ($p > 0) {
$this->last = $s;
} else {
$this->last = null;
}
return $p > 0;
}
/**
* Splits String `s` at all substrings `this` EReg matches.
* If a match is found at the start of `s`, the result contains a leading
* empty String "" entry.
* If a match is found at the end of `s`, the result contains a trailing
* empty String "" entry.
* If two matching substrings appear next to each other, the result
* contains the empty String `""` between them.
* By default, this method splits `s` into two parts at the first matched
* substring. If the global g modifier is in place, `s` is split at each
* matched substring.
* If `s` is null, the result is unspecified.
*
* @param string $s
*
* @return string[]|\Array_hx
*/
public function split ($s) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/EReg.hx:128: characters 3-96
$parts = preg_split(($this->re . "u"), $s, ($this->global ? -1 : 2));
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/EReg.hx:129: lines 129-132
if ($parts === false) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/EReg.hx:130: characters 4-21
$this->handlePregError();
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/EReg.hx:131: characters 4-55
$parts = preg_split($this->re, $s, ($this->global ? -1 : 2));
}
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/EReg.hx:133: characters 3-48
return \Array_hx::wrap($parts);
}
}
Boot::registerClass(EReg::class, 'EReg');

View File

@ -1,179 +0,0 @@
<?php
/**
*/
use \php\Boot;
use \php\_Boot\HxClass;
/**
* The Reflect API is a way to manipulate values dynamically through an
* abstract interface in an untyped manner. Use with care.
* @see https://haxe.org/manual/std-reflection.html
*/
class Reflect {
/**
* Removes the field named `field` from structure `o`.
* This method is only guaranteed to work on anonymous structures.
* If `o` or `field` are null, the result is unspecified.
*
* @param mixed $o
* @param string $field
*
* @return bool
*/
public static function deleteField ($o, $field) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Reflect.hx:158: lines 158-163
if (Reflect::hasField($o, $field)) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Reflect.hx:159: characters 4-40
unset($o->{$field});
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Reflect.hx:160: characters 4-15
return true;
} else {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Reflect.hx:162: characters 4-16
return false;
}
}
/**
* Returns the value of the field named `field` on object `o`.
* If `o` is not an object or has no field named `field`, the result is
* null.
* If the field is defined as a property, its accessors are ignored. Refer
* to `Reflect.getProperty` for a function supporting property accessors.
* If `field` is null, the result is unspecified.
*
* @param mixed $o
* @param string $field
*
* @return mixed
*/
public static function field ($o, $field) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Reflect.hx:50: lines 50-52
if (is_string($o)) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Reflect.hx:51: characters 24-45
$tmp = Boot::dynamicString($o);
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Reflect.hx:51: characters 4-53
return $tmp->{$field};
}
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Reflect.hx:53: lines 53-54
if (!is_object($o)) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Reflect.hx:54: characters 4-15
return null;
}
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Reflect.hx:56: lines 56-58
if (($field === "") && (PHP_VERSION_ID < 70100)) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Reflect.hx:57: characters 4-56
return (((array)($o))[$field] ?? null);
}
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Reflect.hx:60: lines 60-62
if (property_exists($o, $field)) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Reflect.hx:61: characters 4-33
return $o->{$field};
}
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Reflect.hx:63: lines 63-65
if (method_exists($o, $field)) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Reflect.hx:64: characters 4-44
return Boot::getInstanceClosure($o, $field);
}
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Reflect.hx:67: lines 67-78
if (($o instanceof HxClass)) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Reflect.hx:68: characters 4-54
$phpClassName = $o->phpClassName;
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Reflect.hx:69: lines 69-71
if (defined("" . ($phpClassName??'null') . "::" . ($field??'null'))) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Reflect.hx:70: characters 5-52
return constant("" . ($phpClassName??'null') . "::" . ($field??'null'));
}
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Reflect.hx:72: lines 72-74
if (property_exists($phpClassName, $field)) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Reflect.hx:73: characters 5-34
return $o->{$field};
}
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Reflect.hx:75: lines 75-77
if (method_exists($phpClassName, $field)) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Reflect.hx:76: characters 5-54
return Boot::getStaticClosure($phpClassName, $field);
}
}
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Reflect.hx:80: characters 3-14
return null;
}
/**
* Returns the fields of structure `o`.
* This method is only guaranteed to work on anonymous structures. Refer to
* `Type.getInstanceFields` for a function supporting class instances.
* If `o` is null, the result is unspecified.
*
* @param mixed $o
*
* @return string[]|\Array_hx
*/
public static function fields ($o) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Reflect.hx:117: lines 117-119
if (is_object($o)) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Reflect.hx:118: characters 4-77
return \Array_hx::wrap(array_keys(get_object_vars($o)));
}
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Reflect.hx:120: characters 3-12
return new \Array_hx();
}
/**
* Tells if structure `o` has a field named `field`.
* This is only guaranteed to work for anonymous structures. Refer to
* `Type.getInstanceFields` for a function supporting class instances.
* If `o` or `field` are null, the result is unspecified.
*
* @param mixed $o
* @param string $field
*
* @return bool
*/
public static function hasField ($o, $field) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Reflect.hx:34: lines 34-35
if (!is_object($o)) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Reflect.hx:35: characters 4-16
return false;
}
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Reflect.hx:36: lines 36-37
if (property_exists($o, $field)) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Reflect.hx:37: characters 4-15
return true;
}
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Reflect.hx:39: lines 39-44
if (($o instanceof HxClass)) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Reflect.hx:40: characters 4-54
$phpClassName = $o->phpClassName;
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Reflect.hx:41: lines 41-43
if (!(property_exists($phpClassName, $field) || method_exists($phpClassName, $field))) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Reflect.hx:43: characters 8-47
return defined("" . ($phpClassName??'null') . "::" . ($field??'null'));
} else {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Reflect.hx:41: lines 41-43
return true;
}
}
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Reflect.hx:46: characters 3-15
return false;
}
/**
* Sets the field named `field` of object `o` to value `value`.
* If `o` has no field named `field`, this function is only guaranteed to
* work for anonymous structures.
* If `o` or `field` are null, the result is unspecified.
*
* @param mixed $o
* @param string $field
* @param mixed $value
*
* @return void
*/
public static function setField ($o, $field, $value) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Reflect.hx:84: characters 3-35
$o->{$field} = $value;
}
}
Boot::registerClass(Reflect::class, 'Reflect');

View File

@ -1,125 +0,0 @@
<?php
/**
*/
use \php\Boot;
use \php\_Boot\HxString;
/**
* The Std class provides standard methods for manipulating basic types.
*/
class Std {
/**
* Converts a `String` to a `Float`.
* The parsing rules for `parseInt` apply here as well, with the exception of invalid input
* resulting in a `NaN` value instead of null.
* Additionally, decimal notation may contain a single `.` to denote the start of the fractions.
*
* @param string $x
*
* @return float
*/
public static function parseFloat ($x) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Std.hx:74: characters 3-35
$result = floatval($x);
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Std.hx:75: lines 75-76
if (!Boot::equal($result, 0)) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Std.hx:76: characters 4-17
return $result;
}
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Std.hx:78: characters 3-22
$x = ltrim($x);
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Std.hx:79: characters 3-53
$firstCharIndex = (mb_substr($x, 0, 1) === "-" ? 1 : 0);
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Std.hx:80: characters 3-47
$charCode = HxString::charCodeAt($x, $firstCharIndex);
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Std.hx:82: lines 82-84
if ($charCode === 46) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Std.hx:83: characters 4-47
$charCode = HxString::charCodeAt($x, $firstCharIndex + 1);
}
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Std.hx:86: lines 86-90
if (($charCode !== null) && ($charCode >= 48) && ($charCode <= 57)) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Std.hx:87: characters 4-14
return 0.0;
} else {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Std.hx:89: characters 4-20
return NAN;
}
}
/**
* Converts a `String` to an `Int`.
* Leading whitespaces are ignored.
* If `x` starts with 0x or 0X, hexadecimal notation is recognized where the following digits may
* contain 0-9 and A-F.
* Otherwise `x` is read as decimal number with 0-9 being allowed characters. `x` may also start with
* a - to denote a negative value.
* In decimal mode, parsing continues until an invalid character is detected, in which case the
* result up to that point is returned. For hexadecimal notation, the effect of invalid characters
* is unspecified.
* Leading 0s that are not part of the 0x/0X hexadecimal notation are ignored, which means octal
* notation is not supported.
* If `x` is null, the result is unspecified.
* If `x` cannot be parsed as integer, the result is `null`.
*
* @param string $x
*
* @return int
*/
public static function parseInt ($x) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Std.hx:55: lines 55-70
if (is_numeric($x)) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Std.hx:56: characters 4-31
return intval($x, 10);
} else {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Std.hx:58: characters 4-23
$x = ltrim($x);
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Std.hx:59: characters 4-54
$firstCharIndex = (mb_substr($x, 0, 1) === "-" ? 1 : 0);
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Std.hx:60: characters 4-53
$firstCharCode = HxString::charCodeAt($x, $firstCharIndex);
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Std.hx:61: lines 61-63
if (!(($firstCharCode !== null) && ($firstCharCode >= 48) && ($firstCharCode <= 57))) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Std.hx:62: characters 5-16
return null;
}
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Std.hx:64: characters 21-49
$index = $firstCharIndex + 1;
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Std.hx:64: characters 4-50
$secondChar = ($index < 0 ? "" : mb_substr($x, $index, 1));
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Std.hx:65: lines 65-69
if (($secondChar === "x") || ($secondChar === "X")) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Std.hx:66: characters 5-31
return intval($x, 0);
} else {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Std.hx:68: characters 5-32
return intval($x, 10);
}
}
}
/**
* Converts any value to a String.
* If `s` is of `String`, `Int`, `Float` or `Bool`, its value is returned.
* If `s` is an instance of a class and that class or one of its parent classes has
* a `toString` method, that method is called. If no such method is present, the result
* is unspecified.
* If `s` is an enum constructor without argument, the constructor's name is returned. If
* arguments exists, the constructor's name followed by the String representations of
* the arguments is returned.
* If `s` is a structure, the field names along with their values are returned. The field order
* and the operator separating field names and values are unspecified.
* If s is null, "null" is returned.
*
* @param mixed $s
*
* @return string
*/
public static function string ($s) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/Std.hx:47: characters 3-27
return Boot::stringify($s);
}
}
Boot::registerClass(Std::class, 'Std');

View File

@ -1,40 +0,0 @@
<?php
/**
*/
use \php\Boot;
/**
* This class provides advanced methods on Strings. It is ideally used with
* `using StringTools` and then acts as an [extension](https://haxe.org/manual/lf-static-extension.html)
* to the `String` class.
* If the first argument to any of the methods is null, the result is
* unspecified.
*/
class StringTools {
/**
* Replace all occurrences of the String `sub` in the String `s` by the
* String `by`.
* If `sub` is the empty String `""`, `by` is inserted after each character
* of `s` except the last one. If `by` is also the empty String `""`, `s`
* remains unchanged.
* If `sub` or `by` are null, the result is unspecified.
*
* @param string $s
* @param string $sub
* @param string $by
*
* @return string
*/
public static function replace ($s, $sub, $by) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/StringTools.hx:104: lines 104-106
if ($sub === "") {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/StringTools.hx:105: characters 4-89
return implode($by, preg_split("//u", $s, -1, PREG_SPLIT_NO_EMPTY));
}
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/StringTools.hx:107: characters 3-40
return str_replace($sub, $by, $s);
}
}
Boot::registerClass(StringTools::class, 'StringTools');

View File

@ -1,125 +0,0 @@
<?php
/**
*/
namespace haxe;
use \php\Boot;
/**
* Base class for exceptions.
* If this class (or derivatives) is used to catch an exception, then
* `haxe.CallStack.exceptionStack()` will not return a stack for the exception
* caught. Use `haxe.Exception.stack` property instead:
* ```haxe
* try {
* throwSomething();
* } catch(e:Exception) {
* trace(e.stack);
* }
* ```
* Custom exceptions should extend this class:
* ```haxe
* class MyException extends haxe.Exception {}
* //...
* throw new MyException('terrible exception');
* ```
* `haxe.Exception` is also a wildcard type to catch any exception:
* ```haxe
* try {
* throw 'Catch me!';
* } catch(e:haxe.Exception) {
* trace(e.message); // Output: Catch me!
* }
* ```
* To rethrow an exception just throw it again.
* Haxe will try to rethrow an original native exception whenever possible.
* ```haxe
* try {
* var a:Array<Int> = null;
* a.push(1); // generates target-specific null-pointer exception
* } catch(e:haxe.Exception) {
* throw e; // rethrows native exception instead of haxe.Exception
* }
* ```
*/
class Exception extends \Exception {
/**
* @var \Throwable
*/
public $__nativeException;
/**
* @var Exception
*/
public $__previousException;
/**
* @var int
*/
public $__skipStack;
/**
* @param mixed $value
*
* @return mixed
*/
public static function thrown ($value) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/haxe/Exception.hx:30: lines 30-38
if (($value instanceof Exception)) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/haxe/Exception.hx:31: characters 4-35
return $value->get_native();
} else if (($value instanceof \Throwable)) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/haxe/Exception.hx:33: characters 4-16
return $value;
} else {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/haxe/Exception.hx:35: characters 4-38
$e = new ValueException($value);
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/haxe/Exception.hx:36: characters 4-21
$e->__skipStack = 1;
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/haxe/Exception.hx:37: characters 4-12
return $e;
}
}
/**
* Create a new Exception instance.
* The `previous` argument could be used for exception chaining.
* The `native` argument is for internal usage only.
* There is no need to provide `native` argument manually and no need to keep it
* upon extending `haxe.Exception` unless you know what you're doing.
*
* @param string $message
* @param Exception $previous
* @param mixed $native
*
* @return void
*/
public function __construct ($message, $previous = null, $native = null) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/haxe/Exception.hx:16: characters 39-40
$this->__skipStack = 0;
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/haxe/Exception.hx:42: characters 3-30
parent::__construct($message, 0, $previous);
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/haxe/Exception.hx:43: characters 3-38
$this->__previousException = $previous;
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/haxe/Exception.hx:44: lines 44-48
if (($native !== null) && ($native instanceof \Throwable)) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/haxe/Exception.hx:45: characters 4-30
$this->__nativeException = $native;
} else {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/haxe/Exception.hx:47: characters 4-33
$this->__nativeException = $this;
}
}
/**
* @return mixed
*/
final public function get_native () {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/_std/haxe/Exception.hx:72: characters 3-27
return $this->__nativeException;
}
}
Boot::registerClass(Exception::class, 'haxe.Exception');
Boot::registerGetters('haxe\\Exception', [
'native' => true
]);

View File

@ -1,88 +0,0 @@
<?php
/**
*/
namespace haxe;
use \php\Boot;
/**
* Log primarily provides the `trace()` method, which is invoked upon a call to
* `trace()` in Haxe code.
*/
class Log {
/**
* @var \Closure
* Outputs `v` in a platform-dependent way.
* The second parameter `infos` is injected by the compiler and contains
* information about the position where the `trace()` call was made.
* This method can be rebound to a custom function:
* var oldTrace = haxe.Log.trace; // store old function
* haxe.Log.trace = function(v, ?infos) {
* // handle trace
* }
* ...
* haxe.Log.trace = oldTrace;
* If it is bound to null, subsequent calls to `trace()` will cause an
* exception.
*/
static public $trace;
/**
* Format the output of `trace` before printing it.
*
* @param mixed $v
* @param object $infos
*
* @return string
*/
public static function formatOutput ($v, $infos) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/haxe/Log.hx:34: characters 3-27
$str = \Std::string($v);
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/haxe/Log.hx:35: lines 35-36
if ($infos === null) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/haxe/Log.hx:36: characters 4-14
return $str;
}
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/haxe/Log.hx:37: characters 3-54
$pstr = ($infos->fileName??'null') . ":" . ($infos->lineNumber??'null');
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/haxe/Log.hx:38: lines 38-40
if ($infos->customParams !== null) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/haxe/Log.hx:39: lines 39-40
$_g = 0;
$_g1 = $infos->customParams;
while ($_g < $_g1->length) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/haxe/Log.hx:39: characters 9-10
$v = ($_g1->arr[$_g] ?? null);
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/haxe/Log.hx:39: lines 39-40
++$_g;
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/haxe/Log.hx:40: characters 5-32
$str = ($str??'null') . ", " . \Std::string($v);
}
}
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/haxe/Log.hx:41: characters 3-27
return ($pstr??'null') . ": " . ($str??'null');
}
/**
* @internal
* @access private
*/
static public function __hx__init ()
{
static $called = false;
if ($called) return;
$called = true;
self::$trace = function ($v, $infos = null) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/haxe/Log.hx:63: characters 3-36
$str = Log::formatOutput($v, $infos);
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/haxe/Log.hx:70: characters 3-19
echo(\Std::string($str) . \PHP_EOL);
};
}
}
Boot::registerClass(Log::class, 'haxe.Log');
Log::__hx__init();

View File

@ -1,44 +0,0 @@
<?php
/**
*/
namespace haxe;
use \php\Boot;
/**
* An exception containing arbitrary value.
* This class is automatically used for throwing values, which don't extend `haxe.Exception`
* or native exception type.
* For example:
* ```haxe
* throw "Terrible error";
* ```
* will be compiled to
* ```haxe
* throw new ValueException("Terrible error");
* ```
*/
class ValueException extends Exception {
/**
* @var mixed
* Thrown value.
*/
public $value;
/**
* @param mixed $value
* @param Exception $previous
* @param mixed $native
*
* @return void
*/
public function __construct ($value, $previous = null, $native = null) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/haxe/ValueException.hx:24: characters 3-100
parent::__construct(\Std::string($value), $previous, $native);
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/haxe/ValueException.hx:25: characters 3-21
$this->value = $value;
}
}
Boot::registerClass(ValueException::class, 'haxe.ValueException');

View File

@ -1,57 +0,0 @@
<?php
/**
*/
namespace haxe\iterators;
use \php\Boot;
/**
* This iterator is used only when `Array<T>` is passed to `Iterable<T>`
*/
class ArrayIterator {
/**
* @var mixed[]|\Array_hx
*/
public $array;
/**
* @var int
*/
public $current;
/**
* Create a new `ArrayIterator`.
*
* @param mixed[]|\Array_hx $array
*
* @return void
*/
public function __construct ($array) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/haxe/iterators/ArrayIterator.hx:30: characters 20-21
$this->current = 0;
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/haxe/iterators/ArrayIterator.hx:37: characters 3-21
$this->array = $array;
}
/**
* See `Iterator.hasNext`
*
* @return bool
*/
public function hasNext () {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/haxe/iterators/ArrayIterator.hx:45: characters 3-32
return $this->current < $this->array->length;
}
/**
* See `Iterator.next`
*
* @return mixed
*/
public function next () {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/haxe/iterators/ArrayIterator.hx:53: characters 3-26
return ($this->array->arr[$this->current++] ?? null);
}
}
Boot::registerClass(ArrayIterator::class, 'haxe.iterators.ArrayIterator');

View File

@ -1,26 +0,0 @@
<?php
/**
*/
namespace haxe\iterators;
use \php\Boot;
class ArrayKeyValueIterator {
/**
* @var mixed[]|\Array_hx
*/
public $array;
/**
* @param mixed[]|\Array_hx $array
*
* @return void
*/
public function __construct ($array) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/haxe/iterators/ArrayKeyValueIterator.hx:32: characters 3-21
$this->array = $array;
}
}
Boot::registerClass(ArrayKeyValueIterator::class, 'haxe.iterators.ArrayKeyValueIterator');

File diff suppressed because it is too large Load Diff

View File

@ -1,43 +0,0 @@
<?php
/**
*/
namespace php\_Boot;
use \php\Boot;
/**
* Anonymous objects implementation
*/
class HxAnon extends \StdClass {
/**
* @return void
*/
public function __construct () {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:950: lines 950-960
;
}
/**
* @param string $name
* @param array $args
*
* @return mixed
*/
public function __call ($name, $args) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:958: characters 3-57
return ($this->$name)(...$args);
}
/**
* @param string $name
*
* @return mixed
*/
public function __get ($name) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:953: characters 3-14
return null;
}
}
Boot::registerClass(HxAnon::class, 'php._Boot.HxAnon');

View File

@ -1,95 +0,0 @@
<?php
/**
*/
namespace php\_Boot;
use \php\Boot;
/**
* Class<T> implementation for Haxe->PHP internals.
*/
class HxClass {
/**
* @var string
*/
public $phpClassName;
/**
* @param string $phpClassName
*
* @return void
*/
public function __construct ($phpClassName) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:667: characters 3-35
$this->phpClassName = $phpClassName;
}
/**
* Magic method to call static methods of this class, when `HxClass` instance is in a `Dynamic` variable.
*
* @param string $method
* @param array $args
*
* @return mixed
*/
public function __call ($method, $args) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:675: characters 3-111
$callback = ((($this->phpClassName === "String" ? HxString::class : $this->phpClassName))??'null') . "::" . ($method??'null');
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:676: characters 3-53
return \call_user_func_array($callback, $args);
}
/**
* Magic method to get static vars of this class, when `HxClass` instance is in a `Dynamic` variable.
*
* @param string $property
*
* @return mixed
*/
public function __get ($property) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:684: lines 684-692
if (\defined("" . ($this->phpClassName??'null') . "::" . ($property??'null'))) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:685: characters 4-54
return \constant("" . ($this->phpClassName??'null') . "::" . ($property??'null'));
} else if (Boot::hasGetter($this->phpClassName, $property)) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:687: characters 29-41
$tmp = $this->phpClassName;
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:687: characters 4-59
return $tmp::{"get_" . ($property??'null')}();
} else if (\method_exists($this->phpClassName, $property)) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:689: characters 4-56
return Boot::getStaticClosure($this->phpClassName, $property);
} else {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:691: characters 33-45
$tmp = $this->phpClassName;
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:691: characters 4-56
return $tmp::${$property};
}
}
/**
* Magic method to set static vars of this class, when `HxClass` instance is in a `Dynamic` variable.
*
* @param string $property
* @param mixed $value
*
* @return void
*/
public function __set ($property, $value) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:700: lines 700-704
if (Boot::hasSetter($this->phpClassName, $property)) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:701: characters 22-34
$tmp = $this->phpClassName;
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:701: characters 4-59
$tmp::{"set_" . ($property??'null')}($value);
} else {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:703: characters 26-38
$tmp = $this->phpClassName;
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:703: characters 4-56
$tmp::${$property} = $value;
}
}
}
Boot::registerClass(HxClass::class, 'php._Boot.HxClass');

View File

@ -1,114 +0,0 @@
<?php
/**
*/
namespace php\_Boot;
use \php\Boot;
use \haxe\Exception;
/**
* Closures implementation
*/
class HxClosure {
/**
* @var mixed
* A callable value, which can be invoked by PHP
*/
public $callable;
/**
* @var string
* Method name for methods
*/
public $func;
/**
* @var mixed
* `this` for instance methods; php class name for static methods
*/
public $target;
/**
* @param mixed $target
* @param string $func
*
* @return void
*/
public function __construct ($target, $func) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:978: characters 3-23
$this->target = $target;
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:979: characters 3-19
$this->func = $func;
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:981: lines 981-983
if (\is_null($target)) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:982: characters 4-9
throw Exception::thrown("Unable to create closure on `null`");
}
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:984: characters 3-104
$this->callable = (($target instanceof HxAnon) ? $target->{$func} : [$target, $func]);
}
/**
* @see http://php.net/manual/en/language.oop5.magic.php#object.invoke
*
* @return mixed
*/
public function __invoke () {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:992: characters 3-71
return \call_user_func_array($this->callable, \func_get_args());
}
/**
* Invoke this closure with `newThis` instead of `this`
*
* @param mixed $newThis
* @param array $args
*
* @return mixed
*/
public function callWith ($newThis, $args) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:1019: characters 3-65
return \call_user_func_array($this->getCallback($newThis), $args);
}
/**
* Check if this is the same closure
*
* @param HxClosure $closure
*
* @return bool
*/
public function equals ($closure) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:1012: characters 10-60
if (Boot::equal($this->target, $closure->target)) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:1012: characters 39-59
return $this->func === $closure->func;
} else {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:1012: characters 10-60
return false;
}
}
/**
* Generates callable value for PHP
*
* @param mixed $eThis
*
* @return mixed[]
*/
public function getCallback ($eThis = null) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:999: lines 999-1001
if ($eThis === null) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:1000: characters 4-18
$eThis = $this->target;
}
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:1002: lines 1002-1004
if (($eThis instanceof HxAnon)) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:1003: characters 4-36
return $eThis->{$this->func};
}
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:1005: characters 3-39
return [$eThis, $this->func];
}
}
Boot::registerClass(HxClosure::class, 'php._Boot.HxClosure');

View File

@ -1,160 +0,0 @@
<?php
/**
*/
namespace php\_Boot;
use \php\Boot;
/**
* For Dynamic access which looks like String.
* Instances of this class should not be saved anywhere.
* Instead it should be used to immediately invoke a String field right after instance creation one time only.
*/
class HxDynamicStr extends HxClosure {
/**
* @var string
*/
static public $hxString;
/**
* @param string $str
* @param string $method
* @param array $args
*
* @return mixed
*/
public static function invoke ($str, $method, $args) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:892: characters 3-34
\array_unshift($args, $str);
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:893: characters 3-69
return \call_user_func_array((HxDynamicStr::$hxString??'null') . "::" . ($method??'null'), $args);
}
/**
* Returns HxDynamicStr instance if `value` is a string.
* Otherwise returns `value` as-is.
*
* @param mixed $value
*
* @return mixed
*/
public static function wrap ($value) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:884: lines 884-888
if (\is_string($value)) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:885: characters 4-34
return new HxDynamicStr($value);
} else {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:887: characters 4-16
return $value;
}
}
/**
* @param string $str
*
* @return void
*/
public function __construct ($str) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:897: characters 3-19
parent::__construct($str, null);
}
/**
* @param string $method
* @param array $args
*
* @return mixed
*/
public function __call ($method, $args) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:913: characters 10-38
\array_unshift($args, $this->target);
return \call_user_func_array((HxDynamicStr::$hxString??'null') . "::" . ($method??'null'), $args);
}
/**
* @param string $field
*
* @return mixed
*/
public function __get ($field) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:902: lines 902-908
if ($field === "length") {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:904: characters 5-36
return mb_strlen($this->target);
} else {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:906: characters 5-17
$this->func = $field;
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:907: characters 5-16
return $this;
}
}
/**
* @see http://php.net/manual/en/language.oop5.magic.php#object.invoke
*
* @return mixed
*/
public function __invoke () {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:921: characters 10-54
$str = $this->target;
$method = $this->func;
$args = \func_get_args();
\array_unshift($args, $str);
return \call_user_func_array((HxDynamicStr::$hxString??'null') . "::" . ($method??'null'), $args);
}
/**
* Invoke this closure with `newThis` instead of `this`
*
* @param mixed $newThis
* @param array $args
*
* @return mixed
*/
public function callWith ($newThis, $args) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:938: lines 938-940
if ($newThis === null) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:939: characters 4-20
$newThis = $this->target;
}
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:941: characters 10-37
$method = $this->func;
\array_unshift($args, $newThis);
return \call_user_func_array((HxDynamicStr::$hxString??'null') . "::" . ($method??'null'), $args);
}
/**
* Generates callable value for PHP
*
* @param mixed $eThis
*
* @return mixed[]
*/
public function getCallback ($eThis = null) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:928: lines 928-930
if ($eThis === null) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:929: characters 4-51
return [$this, $this->func];
}
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:931: characters 3-69
return [new HxDynamicStr($eThis), $this->func];
}
/**
* @internal
* @access private
*/
static public function __hx__init ()
{
static $called = false;
if ($called) return;
$called = true;
self::$hxString = Boot::getClass(HxString::class)->phpClassName;
}
}
Boot::registerClass(HxDynamicStr::class, 'php._Boot.HxDynamicStr');
HxDynamicStr::__hx__init();

View File

@ -1,73 +0,0 @@
<?php
/**
*/
namespace php\_Boot;
use \php\Boot;
/**
* Base class for enum types
*/
class HxEnum {
/**
* @var int
*/
public $index;
/**
* @var array
*/
public $params;
/**
* @var string
*/
public $tag;
/**
* @param string $tag
* @param int $index
* @param array $arguments
*
* @return void
*/
public function __construct ($tag, $index, $arguments = null) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:721: characters 3-17
$this->tag = $tag;
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:722: characters 3-21
$this->index = $index;
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:723: characters 12-63
$tmp = null;
if ($arguments === null) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:723: characters 33-50
$this1 = [];
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:723: characters 12-63
$tmp = $this1;
} else {
$tmp = $arguments;
}
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:723: characters 3-63
$this->params = $tmp;
}
/**
* PHP magic method to get string representation of this `Class`
*
* @return string
*/
public function __toString () {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:738: characters 3-30
return Boot::stringify($this);
}
/**
* Get string representation of this `Class`
*
* @return string
*/
public function toString () {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:730: characters 3-22
return $this->__toString();
}
}
Boot::registerClass(HxEnum::class, 'php._Boot.HxEnum');

View File

@ -1,294 +0,0 @@
<?php
/**
*/
namespace php\_Boot;
use \php\Boot;
/**
* `String` implementation
*/
class HxString {
/**
* @param string $str
* @param int $index
*
* @return string
*/
public static function charAt ($str, $index) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:759: characters 10-58
if ($index < 0) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:759: characters 22-24
return "";
} else {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:759: characters 27-58
return \mb_substr($str, $index, 1);
}
}
/**
* @param string $str
* @param int $index
*
* @return int
*/
public static function charCodeAt ($str, $index) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:763: lines 763-765
if (($index < 0) || ($str === "")) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:764: characters 4-15
return null;
}
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:766: lines 766-768
if ($index === 0) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:767: characters 11-30
$code = \ord($str[0]);
if ($code < 192) {
return $code;
} else if ($code < 224) {
return (($code - 192) << 6) + \ord($str[1]) - 128;
} else if ($code < 240) {
return (($code - 224) << 12) + ((\ord($str[1]) - 128) << 6) + \ord($str[2]) - 128;
} else {
return (($code - 240) << 18) + ((\ord($str[1]) - 128) << 12) + ((\ord($str[2]) - 128) << 6) + \ord($str[3]) - 128;
}
}
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:769: characters 3-46
$char = \mb_substr($str, $index, 1);
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:770: characters 10-50
if ($char === "") {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:770: characters 23-27
return null;
} else {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:770: characters 30-50
$code = \ord($char[0]);
if ($code < 192) {
return $code;
} else if ($code < 224) {
return (($code - 192) << 6) + \ord($char[1]) - 128;
} else if ($code < 240) {
return (($code - 224) << 12) + ((\ord($char[1]) - 128) << 6) + \ord($char[2]) - 128;
} else {
return (($code - 240) << 18) + ((\ord($char[1]) - 128) << 12) + ((\ord($char[2]) - 128) << 6) + \ord($char[3]) - 128;
}
}
}
/**
* @param int $code
*
* @return string
*/
public static function fromCharCode ($code) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:865: characters 3-29
return \mb_chr($code);
}
/**
* @param string $str
* @param string $search
* @param int $startIndex
*
* @return int
*/
public static function indexOf ($str, $search, $startIndex = null) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:774: lines 774-787
if ($startIndex === null) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:775: characters 4-18
$startIndex = 0;
} else {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:777: characters 4-28
$length = mb_strlen($str);
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:778: lines 778-783
if ($startIndex < 0) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:779: characters 5-25
$startIndex += $length;
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:780: lines 780-782
if ($startIndex < 0) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:781: characters 6-20
$startIndex = 0;
}
}
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:784: lines 784-786
if (($startIndex >= $length) && ($search !== "")) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:785: characters 5-14
return -1;
}
}
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:788: lines 788-793
$index = null;
if ($search === "") {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:789: characters 4-28
$length = mb_strlen($str);
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:788: lines 788-793
$index = ($startIndex > $length ? $length : $startIndex);
} else {
$index = \mb_strpos($str, $search, $startIndex);
}
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:794: characters 10-39
if ($index === false) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:794: characters 28-30
return -1;
} else {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:794: characters 33-38
return $index;
}
}
/**
* @param string $str
* @param string $search
* @param int $startIndex
*
* @return int
*/
public static function lastIndexOf ($str, $search, $startIndex = null) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:798: characters 3-26
$start = $startIndex;
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:799: lines 799-811
if ($start === null) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:800: characters 4-13
$start = 0;
} else {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:802: characters 4-28
$length = mb_strlen($str);
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:803: lines 803-810
if ($start >= 0) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:804: characters 5-27
$start -= $length;
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:805: lines 805-807
if ($start > 0) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:806: characters 6-15
$start = 0;
}
} else if ($start < -$length) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:809: characters 5-20
$start = -$length;
}
}
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:812: lines 812-817
$index = null;
if ($search === "") {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:813: characters 4-28
$length = mb_strlen($str);
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:812: lines 812-817
$index = (($startIndex === null) || ($startIndex > $length) ? $length : $startIndex);
} else {
$index = \mb_strrpos($str, $search, $start);
}
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:818: lines 818-822
if ($index === false) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:819: characters 4-13
return -1;
} else {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:821: characters 4-16
return $index;
}
}
/**
* @param string $str
* @param string $delimiter
*
* @return string[]|\Array_hx
*/
public static function split ($str, $delimiter) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:826: lines 826-831
$arr = null;
if ($delimiter === "") {
$arr = \preg_split("//u", $str, -1, \PREG_SPLIT_NO_EMPTY);
} else {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:829: characters 4-49
$delimiter = \preg_quote($delimiter, "/");
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:826: lines 826-831
$arr = \preg_split("/" . ($delimiter??'null') . "/", $str);
}
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:832: characters 3-41
return \Array_hx::wrap($arr);
}
/**
* @param string $str
* @param int $pos
* @param int $len
*
* @return string
*/
public static function substr ($str, $pos, $len = null) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:836: characters 3-41
return \mb_substr($str, $pos, $len);
}
/**
* @param string $str
* @param int $startIndex
* @param int $endIndex
*
* @return string
*/
public static function substring ($str, $startIndex, $endIndex = null) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:840: lines 840-845
if ($endIndex === null) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:841: lines 841-843
if ($startIndex < 0) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:842: characters 5-19
$startIndex = 0;
}
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:844: characters 4-44
return \mb_substr($str, $startIndex);
}
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:846: lines 846-848
if ($endIndex < 0) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:847: characters 4-16
$endIndex = 0;
}
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:849: lines 849-851
if ($startIndex < 0) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:850: characters 4-18
$startIndex = 0;
}
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:852: lines 852-856
if ($startIndex > $endIndex) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:853: characters 4-23
$tmp = $endIndex;
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:854: characters 4-25
$endIndex = $startIndex;
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:855: characters 4-20
$startIndex = $tmp;
}
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:857: characters 3-66
return \mb_substr($str, $startIndex, $endIndex - $startIndex);
}
/**
* @param string $str
*
* @return string
*/
public static function toLowerCase ($str) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:755: characters 3-35
return \mb_strtolower($str);
}
/**
* @param string $str
*
* @return string
*/
public static function toString ($str) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:861: characters 3-13
return $str;
}
/**
* @param string $str
*
* @return string
*/
public static function toUpperCase ($str) {
#/nix/store/ljakxdz94hcvn9b4k9y292dn5lhh20iy-haxe-4.2.5/lib/haxe/std/php/Boot.hx:751: characters 3-35
return \mb_strtoupper($str);
}
}
Boot::registerClass(HxString::class, 'php._Boot.HxString');

View File

@ -1,63 +0,0 @@
<?php
/**
* Polyfills for some functions, which are required by Haxe-generated code, but not available in PHP 7.0.
* No Haxe-generated code is available at this point.
* No code should be executed from this file.
* Symbols declarations are the only code allowed here.
*/
namespace { //Namespace declaration is required because this file is included under non-root namespace.
/**
* @see http://php.net/manual/en/function.mb-chr.php
*/
if(!function_exists('mb_chr')) {
function mb_chr($code, $encoding = null) {
if($encoding && $encoding !== 'UTF-8') {
throw new Exception("$encoding is not supported in mb_chr() polyfill.");
}
if (0x80 > $code %= 0x200000) {
$s = chr($code);
} elseif (0x800 > $code) {
$s = chr(0xC0 | $code >> 6) . chr(0x80 | $code & 0x3F);
} elseif (0x10000 > $code) {
$s = chr(0xE0 | $code >> 12) . chr(0x80 | $code >> 6 & 0x3F) . chr(0x80 | $code & 0x3F);
} else {
$s = chr(0xF0 | $code >> 18) . chr(0x80 | $code >> 12 & 0x3F) . chr(0x80 | $code >> 6 & 0x3F) . chr(0x80 | $code & 0x3F);
}
return $s;
}
}
/**
* @see http://php.net/manual/en/function.mb-ord.php
*/
if(!function_exists('mb_ord')) {
function mb_ord($s, $encoding = null) {
if($encoding && $encoding !== 'UTF-8') {
throw new Exception("$encoding is not supported in mb_ord() polyfill.");
}
$code = ($s = unpack('C*', substr($s, 0, 4))) ? $s[1] : 0;
if (0xF0 <= $code) {
return (($code - 0xF0) << 18) + (($s[2] - 0x80) << 12) + (($s[3] - 0x80) << 6) + $s[4] - 0x80;
}
if (0xE0 <= $code) {
return (($code - 0xE0) << 12) + (($s[2] - 0x80) << 6) + $s[3] - 0x80;
}
if (0xC0 <= $code) {
return (($code - 0xC0) << 6) + $s[2] - 0x80;
}
return $code;
}
}
/**
* @see http://php.net/manual/en/function.mb-scrub.php
*/
if(!function_exists('mb_scrub')) {
function mb_scrub($s, $encoding = null) {
$encoding = null === $encoding ? mb_internal_encoding() : $encoding;
return mb_convert_encoding($s, $encoding, $encoding);
}
}
}

View File

@ -1,139 +0,0 @@
<?php
/**
*/
namespace xrfragment;
use \php\_Boot\HxAnon;
use \php\Boot;
use \haxe\Log;
use \php\_Boot\HxString;
class Parser {
/**
* @var bool
*/
static public $debug = false;
/**
* @var string
*/
static public $error = "";
/**
* @param string $key
* @param string $value
* @param mixed $store
*
* @return bool
*/
public static function parse ($key, $value, $store) {
#src/xrfragment/Parser.hx:17: characters 35-57
$this1 = [];
$Frag_data = $this1;
#src/xrfragment/Parser.hx:20: characters 7-68
$Frag_data["prio"] = XRF::$ASSET | XRF::$T_INT;
#src/xrfragment/Parser.hx:21: characters 7-68
$Frag_data["#"] = XRF::$ASSET | XRF::$T_PREDEFINED_VIEW;
#src/xrfragment/Parser.hx:22: characters 7-68
$Frag_data["class"] = XRF::$ASSET | XRF::$T_STRING;
#src/xrfragment/Parser.hx:23: characters 7-68
$Frag_data["src"] = XRF::$ASSET | XRF::$T_URL;
#src/xrfragment/Parser.hx:26: characters 7-133
$Frag_data["pos"] = XRF::$PV_OVERRIDE | XRF::$ROUNDROBIN | XRF::$T_VECTOR3 | XRF::$T_STRING_OBJ | XRF::$EMBEDDED | XRF::$NAVIGATOR;
#src/xrfragment/Parser.hx:27: characters 7-97
$Frag_data["href"] = XRF::$ASSET | XRF::$T_URL | XRF::$T_PREDEFINED_VIEW;
#src/xrfragment/Parser.hx:30: characters 7-98
$Frag_data["q"] = XRF::$PV_OVERRIDE | XRF::$T_STRING | XRF::$EMBEDDED;
#src/xrfragment/Parser.hx:31: characters 7-119
$Frag_data["scale"] = XRF::$QUERY_OPERATOR | XRF::$PV_OVERRIDE | XRF::$ROUNDROBIN | XRF::$T_VECTOR3 | XRF::$EMBEDDED;
#src/xrfragment/Parser.hx:32: characters 7-135
$Frag_data["rot"] = XRF::$QUERY_OPERATOR | XRF::$PV_OVERRIDE | XRF::$ROUNDROBIN | XRF::$T_VECTOR3 | XRF::$EMBEDDED | XRF::$NAVIGATOR;
#src/xrfragment/Parser.hx:33: characters 7-119
$Frag_data["translate"] = XRF::$QUERY_OPERATOR | XRF::$PV_OVERRIDE | XRF::$ROUNDROBIN | XRF::$T_VECTOR3 | XRF::$EMBEDDED;
#src/xrfragment/Parser.hx:34: characters 7-119
$Frag_data["visible"] = XRF::$QUERY_OPERATOR | XRF::$PV_OVERRIDE | XRF::$ROUNDROBIN | XRF::$T_INT | XRF::$EMBEDDED;
#src/xrfragment/Parser.hx:35: characters 7-92
$Frag_data["env"] = XRF::$ASSET | XRF::$PV_OVERRIDE | XRF::$T_STRING | XRF::$EMBEDDED;
#src/xrfragment/Parser.hx:38: characters 7-125
$Frag_data["t"] = XRF::$ASSET | XRF::$PV_OVERRIDE | XRF::$ROUNDROBIN | XRF::$T_VECTOR2 | XRF::$NAVIGATOR | XRF::$EMBEDDED;
#src/xrfragment/Parser.hx:39: characters 7-93
$Frag_data["gravity"] = XRF::$ASSET | XRF::$PV_OVERRIDE | XRF::$T_VECTOR3 | XRF::$EMBEDDED;
#src/xrfragment/Parser.hx:40: characters 7-93
$Frag_data["physics"] = XRF::$ASSET | XRF::$PV_OVERRIDE | XRF::$T_VECTOR3 | XRF::$EMBEDDED;
#src/xrfragment/Parser.hx:43: characters 7-109
$Frag_data["fov"] = XRF::$ASSET | XRF::$PV_OVERRIDE | XRF::$T_INT | XRF::$NAVIGATOR | XRF::$EMBEDDED;
#src/xrfragment/Parser.hx:44: characters 7-109
$Frag_data["clip"] = XRF::$ASSET | XRF::$PV_OVERRIDE | XRF::$T_VECTOR2 | XRF::$NAVIGATOR | XRF::$EMBEDDED;
#src/xrfragment/Parser.hx:45: characters 7-109
$Frag_data["fog"] = XRF::$ASSET | XRF::$PV_OVERRIDE | XRF::$T_STRING | XRF::$NAVIGATOR | XRF::$EMBEDDED;
#src/xrfragment/Parser.hx:48: characters 7-92
$Frag_data["namespace"] = XRF::$ASSET | XRF::$T_STRING;
#src/xrfragment/Parser.hx:49: characters 7-92
$Frag_data["SPDX"] = XRF::$ASSET | XRF::$T_STRING;
#src/xrfragment/Parser.hx:50: characters 7-92
$Frag_data["unit"] = XRF::$ASSET | XRF::$T_STRING;
#src/xrfragment/Parser.hx:51: characters 7-92
$Frag_data["description"] = XRF::$ASSET | XRF::$T_STRING;
#src/xrfragment/Parser.hx:54: characters 7-114
$Frag_data["session"] = XRF::$ASSET | XRF::$T_URL | XRF::$PV_OVERRIDE | XRF::$NAVIGATOR | XRF::$EMBEDDED | XRF::$PROMPT;
#src/xrfragment/Parser.hx:67: lines 67-72
if ((mb_strlen($value) === 0) && (mb_strlen($key) > 0) && !\array_key_exists($key, $Frag_data)) {
#src/xrfragment/Parser.hx:68: characters 5-64
$v = new XRF($key, XRF::$PV_EXECUTE | XRF::$NAVIGATOR);
#src/xrfragment/Parser.hx:69: characters 9-24
$v->validate($key);
#src/xrfragment/Parser.hx:70: characters 5-23
\Reflect::setField($store, $key, $v);
#src/xrfragment/Parser.hx:71: characters 5-16
return true;
}
#src/xrfragment/Parser.hx:73: lines 73-76
if ((HxString::split($key, ".")->length > 1) && (HxString::split($value, ".")->length > 1)) {
#src/xrfragment/Parser.hx:74: characters 5-95
$value1 = new XRF($key, XRF::$ASSET | XRF::$PV_OVERRIDE | XRF::$T_STRING | XRF::$PROP_BIND);
\Reflect::setField($store, $key, $value1);
#src/xrfragment/Parser.hx:75: characters 5-16
return true;
}
#src/xrfragment/Parser.hx:79: characters 7-47
$v = new XRF($key, ($Frag_data[$key] ?? null));
#src/xrfragment/Parser.hx:80: lines 80-90
if (\array_key_exists($key, $Frag_data)) {
#src/xrfragment/Parser.hx:81: lines 81-84
if (!$v->validate($value)) {
#src/xrfragment/Parser.hx:82: characters 11-16
(Log::$trace)("⚠ fragment '" . ($key??'null') . "' has incompatible value (" . ($value??'null') . ")", new _HxAnon_Parser0("src/xrfragment/Parser.hx", 82, "xrfragment.Parser", "parse"));
#src/xrfragment/Parser.hx:83: characters 11-23
return false;
}
#src/xrfragment/Parser.hx:85: characters 9-27
\Reflect::setField($store, $key, $v);
#src/xrfragment/Parser.hx:86: characters 9-50
if (Parser::$debug) {
#src/xrfragment/Parser.hx:86: characters 21-26
(Log::$trace)("" . ($key??'null') . ": " . ($v->string??'null'), new _HxAnon_Parser0("src/xrfragment/Parser.hx", 86, "xrfragment.Parser", "parse"));
}
} else {
#src/xrfragment/Parser.hx:88: characters 9-63
if (is_string($value)) {
#src/xrfragment/Parser.hx:88: characters 43-63
$v->guessType($v, $value);
}
#src/xrfragment/Parser.hx:89: characters 9-29
\Reflect::setField($store, "_" . ($key??'null'), $v);
}
#src/xrfragment/Parser.hx:92: characters 7-18
return true;
}
}
class _HxAnon_Parser0 extends HxAnon {
function __construct($fileName, $lineNumber, $className, $methodName) {
$this->fileName = $fileName;
$this->lineNumber = $lineNumber;
$this->className = $className;
$this->methodName = $methodName;
}
}
Boot::registerClass(Parser::class, 'xrfragment.Parser');

View File

@ -1,393 +0,0 @@
<?php
/**
*/
namespace xrfragment;
use \php\_Boot\HxAnon;
use \php\Boot;
use \php\_Boot\HxString;
class Query {
/**
* @var \EReg
*/
public $isClass;
/**
* @var \EReg
*/
public $isExclude;
/**
* @var \EReg
*/
public $isNumber;
/**
* @var \EReg
*/
public $isProp;
/**
* @var \EReg
*/
public $isRoot;
/**
* @var mixed
*/
public $q;
/**
* @var string
* # Spec
*
* > version 1.0.0 [![Actions Status](https://github.com/coderofsalvation/xrfragment/workflows/test/badge.svg)](https://github.com/coderofsalvation/xrfragment/actions) generated by `make doc` @ $(date +"%Y-%m-%dT%H:%M:%S%z")
*
* In case your programming language has no parser ([check here](https://github.com/coderofsalvation/xrfragment/tree/main/dist)) you can [crosscompile it](https://github.com/coderofsalvation/xrfragment/blob/main/build.hxml), or roll your own `Query.parse(str)` using the spec:
*/
public $str;
/**
* @param string $str
*
* @return void
*/
public function __construct ($str) {
#src/xrfragment/Query.hx:59: characters 36-49
$this->isNumber = new \EReg("^[0-9\\.]+\$", "");
#src/xrfragment/Query.hx:58: characters 36-50
$this->isClass = new \EReg("^[-]?class\$", "");
#src/xrfragment/Query.hx:57: characters 36-46
$this->isRoot = new \EReg("^[-]?/", "");
#src/xrfragment/Query.hx:56: characters 36-41
$this->isExclude = new \EReg("^-", "");
#src/xrfragment/Query.hx:55: characters 36-50
$this->isProp = new \EReg("^.*:[><=!]?", "");
#src/xrfragment/Query.hx:54: characters 47-49
$this->q = new HxAnon();
#src/xrfragment/Query.hx:53: characters 28-30
$this->str = "";
#src/xrfragment/Query.hx:62: characters 5-39
if ($str !== null) {
#src/xrfragment/Query.hx:62: characters 24-39
$this->parse($str);
}
}
/**
* @param string $token
*
* @return string
*/
public function expandAliases ($token) {
#src/xrfragment/Query.hx:71: characters 5-33
$classAlias = new \EReg("^(-)?\\.", "");
#src/xrfragment/Query.hx:72: characters 12-85
if ($classAlias->match($token)) {
#src/xrfragment/Query.hx:72: characters 38-77
return \StringTools::replace($token, ".", "class:");
} else {
#src/xrfragment/Query.hx:72: characters 80-85
return $token;
}
}
/**
* @return mixed
*/
public function get () {
#src/xrfragment/Query.hx:76: characters 5-18
return $this->q;
}
/**
* @param string $str
*
* @return mixed
*/
public function parse ($str) {
#src/xrfragment/Query.hx:79: lines 79-126
$_gthis = $this;
#src/xrfragment/Query.hx:81: characters 5-32
$token = HxString::split($str, " ");
#src/xrfragment/Query.hx:82: characters 5-44
$q = new HxAnon();
#src/xrfragment/Query.hx:84: lines 84-123
$process = function ($str, $prefix = "") use (&$_gthis, &$q) {
if ($prefix === null) {
$prefix = "";
}
#src/xrfragment/Query.hx:85: characters 7-34
$str = \trim($str);
#src/xrfragment/Query.hx:86: characters 7-40
$k = (HxString::split($str, ":")->arr[0] ?? null);
#src/xrfragment/Query.hx:87: characters 7-40
$v = (HxString::split($str, ":")->arr[1] ?? null);
#src/xrfragment/Query.hx:89: characters 7-51
$filter = new HxAnon();
#src/xrfragment/Query.hx:90: characters 7-53
if (\Reflect::field($q, ($prefix??'null') . ($k??'null'))) {
#src/xrfragment/Query.hx:90: characters 29-53
$filter = \Reflect::field($q, ($prefix??'null') . ($k??'null'));
}
#src/xrfragment/Query.hx:91: characters 7-89
$value = (\Reflect::field($filter, "rules") !== null ? \Reflect::field($filter, "rules") : new \Array_hx());
\Reflect::setField($filter, "rules", $value);
#src/xrfragment/Query.hx:93: lines 93-122
if ($_gthis->isProp->match($str)) {
#src/xrfragment/Query.hx:94: characters 9-30
$oper = "";
#src/xrfragment/Query.hx:95: characters 9-49
if (HxString::indexOf($str, "*") !== -1) {
#src/xrfragment/Query.hx:95: characters 39-49
$oper = "*";
}
#src/xrfragment/Query.hx:96: characters 9-49
if (HxString::indexOf($str, ">") !== -1) {
#src/xrfragment/Query.hx:96: characters 39-49
$oper = ">";
}
#src/xrfragment/Query.hx:97: characters 9-49
if (HxString::indexOf($str, "<") !== -1) {
#src/xrfragment/Query.hx:97: characters 39-49
$oper = "<";
}
#src/xrfragment/Query.hx:98: characters 9-50
if (HxString::indexOf($str, ">=") !== -1) {
#src/xrfragment/Query.hx:98: characters 39-50
$oper = ">=";
}
#src/xrfragment/Query.hx:99: characters 9-50
if (HxString::indexOf($str, "<=") !== -1) {
#src/xrfragment/Query.hx:99: characters 39-50
$oper = "<=";
}
#src/xrfragment/Query.hx:100: lines 100-103
if ($_gthis->isExclude->match($k)) {
#src/xrfragment/Query.hx:101: characters 11-22
$oper = "!=";
#src/xrfragment/Query.hx:102: characters 15-26
$k = \mb_substr($k, 1, null);
} else {
#src/xrfragment/Query.hx:103: characters 19-40
$v = \mb_substr($v, mb_strlen($oper), null);
}
#src/xrfragment/Query.hx:104: characters 9-42
if (mb_strlen($oper) === 0) {
#src/xrfragment/Query.hx:104: characters 32-42
$oper = "=";
}
#src/xrfragment/Query.hx:105: lines 105-114
if ($_gthis->isClass->match($k)) {
#src/xrfragment/Query.hx:106: characters 11-45
$value = $oper !== "!=";
\Reflect::setField($filter, ($prefix??'null') . ($k??'null'), $value);
#src/xrfragment/Query.hx:107: characters 11-26
\Reflect::setField($q, $v, $filter);
} else {
#src/xrfragment/Query.hx:109: characters 11-53
$rule = new HxAnon();
#src/xrfragment/Query.hx:110: lines 110-111
if ($_gthis->isNumber->match($v)) {
#src/xrfragment/Query.hx:110: characters 35-67
$value = \Std::parseFloat($v);
\Reflect::setField($rule, $oper, $value);
} else {
#src/xrfragment/Query.hx:111: characters 16-30
\Reflect::setField($rule, $oper, $v);
}
#src/xrfragment/Query.hx:112: characters 11-39
\Reflect::field($filter, "rules")->push($rule);
#src/xrfragment/Query.hx:113: characters 11-29
\Reflect::setField($q, $k, $filter);
}
#src/xrfragment/Query.hx:115: characters 9-15
return;
} else {
#src/xrfragment/Query.hx:117: characters 9-62
$value = ($_gthis->isExclude->match($str) ? false : true);
\Reflect::setField($filter, "id", $value);
#src/xrfragment/Query.hx:118: characters 9-63
$value = $_gthis->isRoot->match($str);
\Reflect::setField($filter, "root", $value);
#src/xrfragment/Query.hx:119: characters 9-55
if ($_gthis->isExclude->match($str)) {
#src/xrfragment/Query.hx:119: characters 42-55
$str = \mb_substr($str, 1, null);
}
#src/xrfragment/Query.hx:120: characters 9-55
if ($_gthis->isRoot->match($str)) {
#src/xrfragment/Query.hx:120: characters 42-55
$str = \mb_substr($str, 1, null);
}
#src/xrfragment/Query.hx:121: characters 9-29
\Reflect::setField($q, $str, $filter);
}
};
#src/xrfragment/Query.hx:124: characters 15-19
$_g = 0;
#src/xrfragment/Query.hx:124: characters 19-31
$_g1 = $token->length;
#src/xrfragment/Query.hx:124: characters 5-68
while ($_g < $_g1) {
#src/xrfragment/Query.hx:124: characters 15-31
$i = $_g++;
#src/xrfragment/Query.hx:124: characters 34-68
$process($this->expandAliases(($token->arr[$i] ?? null)));
}
#src/xrfragment/Query.hx:125: characters 5-22
return $this->q = $q;
}
/**
* @param mixed $obj
*
* @return bool
*/
public function test ($obj = null) {
#src/xrfragment/Query.hx:130: characters 5-30
$qualify = false;
#src/xrfragment/Query.hx:132: lines 132-135
$_g = 0;
$_g1 = \Reflect::fields($obj);
while ($_g < $_g1->length) {
#src/xrfragment/Query.hx:132: characters 11-12
$k = ($_g1->arr[$_g] ?? null);
#src/xrfragment/Query.hx:132: lines 132-135
++$_g;
#src/xrfragment/Query.hx:133: characters 7-57
$v = \Std::string(\Reflect::field($obj, $k));
#src/xrfragment/Query.hx:134: characters 7-47
if ($this->testProperty($k, $v)) {
#src/xrfragment/Query.hx:134: characters 33-47
$qualify = true;
}
}
#src/xrfragment/Query.hx:136: lines 136-139
$_g = 0;
$_g1 = \Reflect::fields($obj);
while ($_g < $_g1->length) {
#src/xrfragment/Query.hx:136: characters 11-12
$k = ($_g1->arr[$_g] ?? null);
#src/xrfragment/Query.hx:136: lines 136-139
++$_g;
#src/xrfragment/Query.hx:137: characters 7-57
$v = \Std::string(\Reflect::field($obj, $k));
#src/xrfragment/Query.hx:138: characters 7-54
if ($this->testProperty($k, $v, true)) {
#src/xrfragment/Query.hx:138: characters 39-54
$qualify = false;
}
}
#src/xrfragment/Query.hx:140: characters 5-19
return $qualify;
}
/**
* @param string $property
* @param string $value
* @param bool $exclude
*
* @return bool
*/
public function testProperty ($property, $value, $exclude = null) {
#src/xrfragment/Query.hx:145: characters 5-23
$conds = 0;
#src/xrfragment/Query.hx:146: characters 5-23
$fails = 0;
#src/xrfragment/Query.hx:147: characters 5-26
$qualify = 0;
#src/xrfragment/Query.hx:149: lines 149-153
$testprop = function ($expr) use (&$conds, &$fails) {
#src/xrfragment/Query.hx:150: characters 7-15
$conds += 1;
#src/xrfragment/Query.hx:151: characters 7-27
$fails += ($expr ? 0 : 1);
#src/xrfragment/Query.hx:152: characters 7-18
return $expr;
};
#src/xrfragment/Query.hx:156: lines 156-159
if (\Reflect::field($this->q, $value) !== null) {
#src/xrfragment/Query.hx:157: characters 7-52
$v = \Reflect::field($this->q, $value);
#src/xrfragment/Query.hx:158: characters 7-59
if (\Reflect::field($v, $property) !== null) {
#src/xrfragment/Query.hx:158: characters 37-59
return \Reflect::field($v, $property);
}
}
#src/xrfragment/Query.hx:162: lines 162-183
$_g = 0;
$_g1 = \Reflect::fields($this->q);
while ($_g < $_g1->length) {
#src/xrfragment/Query.hx:162: characters 11-12
$k = ($_g1->arr[$_g] ?? null);
#src/xrfragment/Query.hx:162: lines 162-183
++$_g;
#src/xrfragment/Query.hx:163: characters 7-47
$filter = \Reflect::field($this->q, $k);
#src/xrfragment/Query.hx:164: characters 7-43
if (Boot::dynamicField($filter, 'rules') === null) {
#src/xrfragment/Query.hx:164: characters 35-43
continue;
}
#src/xrfragment/Query.hx:165: characters 7-47
$rules = Boot::dynamicField($filter, 'rules');
#src/xrfragment/Query.hx:167: lines 167-182
$_g2 = 0;
while ($_g2 < $rules->length) {
#src/xrfragment/Query.hx:167: characters 12-16
$rule = ($rules->arr[$_g2] ?? null);
#src/xrfragment/Query.hx:167: lines 167-182
++$_g2;
#src/xrfragment/Query.hx:169: lines 169-181
if ($exclude) {
#src/xrfragment/Query.hx:170: characters 11-145
if ((\Reflect::field($rule, "!=") !== null) && $testprop(\Std::string($value) === \Std::string(\Reflect::field($rule, "!="))) && $exclude) {
#src/xrfragment/Query.hx:170: characters 133-145
++$qualify;
}
} else {
#src/xrfragment/Query.hx:172: characters 11-141
if ((\Reflect::field($rule, "*") !== null) && $testprop(\Std::parseFloat($value) !== null)) {
#src/xrfragment/Query.hx:172: characters 129-141
++$qualify;
}
#src/xrfragment/Query.hx:173: characters 11-143
if ((\Reflect::field($rule, ">") !== null) && $testprop(\Std::parseFloat($value) > \Std::parseFloat(\Reflect::field($rule, ">")))) {
#src/xrfragment/Query.hx:173: characters 131-143
++$qualify;
}
#src/xrfragment/Query.hx:174: characters 11-143
if ((\Reflect::field($rule, "<") !== null) && $testprop(\Std::parseFloat($value) < \Std::parseFloat(\Reflect::field($rule, "<")))) {
#src/xrfragment/Query.hx:174: characters 131-143
++$qualify;
}
#src/xrfragment/Query.hx:175: characters 11-143
if ((\Reflect::field($rule, ">=") !== null) && $testprop(\Std::parseFloat($value) >= \Std::parseFloat(\Reflect::field($rule, ">=")))) {
#src/xrfragment/Query.hx:175: characters 131-143
++$qualify;
}
#src/xrfragment/Query.hx:176: characters 11-143
if ((\Reflect::field($rule, "<=") !== null) && $testprop(\Std::parseFloat($value) <= \Std::parseFloat(\Reflect::field($rule, "<=")))) {
#src/xrfragment/Query.hx:176: characters 131-143
++$qualify;
}
#src/xrfragment/Query.hx:177: lines 177-180
if ((\Reflect::field($rule, "=") !== null) && ($testprop($value === \Reflect::field($rule, "=")) || $testprop(Boot::equal(\Std::parseFloat($value), \Std::parseFloat(\Reflect::field($rule, "=")))))) {
#src/xrfragment/Query.hx:180: characters 14-26
++$qualify;
}
}
}
}
#src/xrfragment/Query.hx:184: characters 5-23
return $qualify > 0;
}
/**
* @return mixed
*/
public function toObject () {
#src/xrfragment/Query.hx:66: characters 5-18
return $this->q;
}
}
Boot::registerClass(Query::class, 'xrfragment.Query');

View File

@ -1,101 +0,0 @@
<?php
/**
*/
namespace xrfragment;
use \php\_Boot\HxAnon;
use \php\Boot;
use \php\_Boot\HxString;
/**
* # Spec
*
* > version 1.0.0 [![Actions Status](https://github.com/coderofsalvation/xrfragment/workflows/test/badge.svg)](https://github.com/coderofsalvation/xrfragment/actions) generated by `make doc` @ $(date +"%Y-%m-%dT%H:%M:%S%z")
*
* ### XR Fragment URI Grammar
*
* ```
* reserved = gen-delims / sub-delims
* gen-delims = "#" / "&"
* sub-delims = "," / "="
* ```
*
* > Example: `://foo.com/my3d.asset#pos=1,0,0&prio=-5&t=0,100|100,200`
*
* | Explanation | |
* |-|-|
* | `pos=1,2,3` | vector/coordinate argument e.g. |
* | `pos=1,2,3&rot=0,90,0&q=.foo` | combinators |
*
* In case your programming language has no parser ([check here](https://github.com/coderofsalvation/xrfragment/tree/main/dist)) you can [crosscompile it](https://github.com/coderofsalvation/xrfragment/blob/main/build.hxml), or roll your own `Parser.parse(k,v,store)` using the spec:
*
*/
class URI {
/**
* @param string $url
* @param int $filter
*
* @return mixed
*/
public static function parse ($url, $filter) {
#src/xrfragment/URI.hx:37: characters 7-50
$store = new HxAnon();
#src/xrfragment/URI.hx:38: characters 7-63
if (($url === null) || (HxString::indexOf($url, "#") === -1)) {
#src/xrfragment/URI.hx:38: characters 51-63
return $store;
}
#src/xrfragment/URI.hx:39: characters 7-54
$fragment = HxString::split($url, "#");
#src/xrfragment/URI.hx:40: characters 7-62
$splitArray = HxString::split(($fragment->arr[1] ?? null), "&");
#src/xrfragment/URI.hx:41: characters 19-23
$_g = 0;
#src/xrfragment/URI.hx:41: characters 23-40
$_g1 = $splitArray->length;
#src/xrfragment/URI.hx:41: lines 41-51
while ($_g < $_g1) {
#src/xrfragment/URI.hx:41: characters 19-40
$i = $_g++;
#src/xrfragment/URI.hx:43: characters 9-53
$splitByEqual = HxString::split(($splitArray->arr[$i] ?? null), "=");
#src/xrfragment/URI.hx:44: characters 9-33
$regexPlus = new \EReg("\\+", "g");
#src/xrfragment/URI.hx:45: characters 9-42
$key = ($splitByEqual->arr[0] ?? null);
#src/xrfragment/URI.hx:46: characters 5-27
$value = "";
#src/xrfragment/URI.hx:47: lines 47-49
if ($splitByEqual->length > 1) {
#src/xrfragment/URI.hx:48: characters 19-84
$value = \urldecode($regexPlus->split(($splitByEqual->arr[1] ?? null))->join(" "));
}
#src/xrfragment/URI.hx:50: characters 5-49
$ok = Parser::parse($key, $value, $store);
}
#src/xrfragment/URI.hx:52: lines 52-59
if (($filter !== null) && ($filter !== 0)) {
#src/xrfragment/URI.hx:53: lines 53-58
$_g = 0;
$_g1 = \Reflect::fields($store);
while ($_g < $_g1->length) {
#src/xrfragment/URI.hx:53: characters 14-17
$key = ($_g1->arr[$_g] ?? null);
#src/xrfragment/URI.hx:53: lines 53-58
++$_g;
#src/xrfragment/URI.hx:54: characters 13-42
$xrf = \Reflect::field($store, $key);
#src/xrfragment/URI.hx:55: lines 55-57
if (!$xrf->is($filter)) {
#src/xrfragment/URI.hx:56: characters 8-25
\Reflect::deleteField($store, $key);
}
}
}
#src/xrfragment/URI.hx:60: characters 7-19
return $store;
}
}
Boot::registerClass(URI::class, 'xrfragment.URI');

View File

@ -1,334 +0,0 @@
<?php
/**
*/
namespace xrfragment;
use \php\Boot;
use \php\_Boot\HxString;
class XRF {
/**
* @var int
*/
static public $ASSET = 1;
/**
* @var int
*/
static public $EMBEDDED = 64;
/**
* @var int
*/
static public $NAVIGATOR = 32;
/**
* @var int
*/
static public $PROMPT = 8;
/**
* @var int
*/
static public $PROP_BIND = 2;
/**
* @var int
*/
static public $PV_EXECUTE = 256;
/**
* @var int
*/
static public $PV_OVERRIDE = 128;
/**
* @var int
*/
static public $QUERY_OPERATOR = 4;
/**
* @var int
*/
static public $ROUNDROBIN = 16;
/**
* @var int
*/
static public $T_COLOR = 8192;
/**
* @var int
*/
static public $T_FLOAT = 32768;
/**
* @var int
*/
static public $T_INT = 16384;
/**
* @var int
*/
static public $T_PREDEFINED_VIEW = 524288;
/**
* @var int
*/
static public $T_STRING = 1048576;
/**
* @var int
*/
static public $T_STRING_OBJ = 2097152;
/**
* @var int
*/
static public $T_STRING_OBJ_PROP = 4194304;
/**
* @var int
*/
static public $T_URL = 262144;
/**
* @var int
*/
static public $T_VECTOR2 = 65536;
/**
* @var int
*/
static public $T_VECTOR3 = 131072;
/**
* @var \EReg
*/
static public $isColor;
/**
* @var \EReg
*/
static public $isFloat;
/**
* @var \EReg
*/
static public $isInt;
/**
* @var \EReg
*/
static public $isString;
/**
* @var \EReg
*/
static public $isUrl;
/**
* @var \EReg
*/
static public $isUrlOrPretypedView;
/**
* @var \EReg
*/
static public $isVector;
/**
* @var XRF[]|\Array_hx
*/
public $args;
/**
* @var string
*/
public $color;
/**
* @var int
*/
public $flags;
/**
* @var float
*/
public $float;
/**
* @var string
*/
public $fragment;
/**
* @var int
*/
public $int;
/**
* @var Query
*/
public $query;
/**
* @var string
*/
public $string;
/**
* @var float
*/
public $x;
/**
* @var float
*/
public $y;
/**
* @var float
*/
public $z;
/**
* @param int $flag
* @param int $flags
*
* @return int
*/
public static function set ($flag, $flags) {
#src/xrfragment/XRF.hx:70: characters 5-24
return $flags | $flag;
}
/**
* @param int $flag
* @param int $flags
*
* @return int
*/
public static function unset ($flag, $flags) {
#src/xrfragment/XRF.hx:74: characters 5-25
return $flags & ~$flag;
}
/**
* @param string $_fragment
* @param int $_flags
*
* @return void
*/
public function __construct ($_fragment, $_flags) {
#src/xrfragment/XRF.hx:61: characters 5-25
$this->fragment = $_fragment;
#src/xrfragment/XRF.hx:62: characters 5-22
$this->flags = $_flags;
}
/**
* @param XRF $v
* @param string $str
*
* @return void
*/
public function guessType ($v, $str) {
#src/xrfragment/XRF.hx:103: characters 5-19
$v->string = $str;
#src/xrfragment/XRF.hx:104: lines 104-109
if (HxString::split($str, ",")->length > 1) {
#src/xrfragment/XRF.hx:105: characters 7-46
$xyz = HxString::split($str, ",");
#src/xrfragment/XRF.hx:106: characters 7-56
if ($xyz->length > 0) {
#src/xrfragment/XRF.hx:106: characters 28-56
$v->x = \Std::parseFloat(($xyz->arr[0] ?? null));
}
#src/xrfragment/XRF.hx:107: characters 7-56
if ($xyz->length > 1) {
#src/xrfragment/XRF.hx:107: characters 28-56
$v->y = \Std::parseFloat(($xyz->arr[1] ?? null));
}
#src/xrfragment/XRF.hx:108: characters 7-56
if ($xyz->length > 2) {
#src/xrfragment/XRF.hx:108: characters 28-56
$v->z = \Std::parseFloat(($xyz->arr[2] ?? null));
}
}
#src/xrfragment/XRF.hx:111: characters 5-43
if (XRF::$isColor->match($str)) {
#src/xrfragment/XRF.hx:111: characters 30-43
$v->color = $str;
}
#src/xrfragment/XRF.hx:112: characters 5-59
if (XRF::$isFloat->match($str)) {
#src/xrfragment/XRF.hx:112: characters 30-59
$v->float = \Std::parseFloat($str);
}
#src/xrfragment/XRF.hx:113: characters 5-57
if (XRF::$isInt->match($str)) {
#src/xrfragment/XRF.hx:113: characters 30-57
$v->int = \Std::parseInt($str);
}
}
/**
* @param int $flag
*
* @return bool
*/
public function is ($flag) {
#src/xrfragment/XRF.hx:66: characters 5-31
return ($this->flags & $flag) !== 0;
}
/**
* @param string $value
*
* @return bool
*/
public function validate ($value) {
#src/xrfragment/XRF.hx:78: characters 5-27
$this->guessType($this, $value);
#src/xrfragment/XRF.hx:80: lines 80-88
if (HxString::split($value, "|")->length > 1) {
#src/xrfragment/XRF.hx:81: characters 7-35
$this->args = new \Array_hx();
#src/xrfragment/XRF.hx:82: characters 7-49
$args = HxString::split($value, "|");
#src/xrfragment/XRF.hx:83: characters 17-21
$_g = 0;
#src/xrfragment/XRF.hx:83: characters 21-32
$_g1 = $args->length;
#src/xrfragment/XRF.hx:83: lines 83-87
while ($_g < $_g1) {
#src/xrfragment/XRF.hx:83: characters 17-32
$i = $_g++;
#src/xrfragment/XRF.hx:84: characters 9-45
$x = new XRF($this->fragment, $this->flags);
#src/xrfragment/XRF.hx:85: characters 9-30
$this->guessType($x, ($args->arr[$i] ?? null));
#src/xrfragment/XRF.hx:86: characters 9-28
$_this = $this->args;
$_this->arr[$_this->length++] = $x;
}
}
#src/xrfragment/XRF.hx:90: characters 5-59
if ($this->fragment === "q") {
#src/xrfragment/XRF.hx:90: characters 27-59
$this->query = (new Query($value))->get();
}
#src/xrfragment/XRF.hx:92: characters 5-24
$ok = true;
#src/xrfragment/XRF.hx:93: lines 93-97
if (!($this->args instanceof \Array_hx)) {
#src/xrfragment/XRF.hx:94: characters 7-115
if ($this->is(XRF::$T_VECTOR3) && !((is_float($this->x) || is_int($this->x)) && (is_float($this->y) || is_int($this->y)) && (is_float($this->z) || is_int($this->z)))) {
#src/xrfragment/XRF.hx:94: characters 105-115
$ok = false;
}
#src/xrfragment/XRF.hx:95: characters 7-115
if ($this->is(XRF::$T_VECTOR2) && !((is_float($this->x) || is_int($this->x)) && (is_float($this->y) || is_int($this->y)))) {
#src/xrfragment/XRF.hx:95: characters 105-115
$ok = false;
}
#src/xrfragment/XRF.hx:96: characters 7-63
if ($this->is(XRF::$T_INT) && !Boot::isOfType($this->int, Boot::getClass('Int'))) {
#src/xrfragment/XRF.hx:96: characters 53-63
$ok = false;
}
}
#src/xrfragment/XRF.hx:98: characters 5-14
return $ok;
}
/**
* @internal
* @access private
*/
static public function __hx__init ()
{
static $called = false;
if ($called) return;
$called = true;
self::$isColor = new \EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})\$", "");
self::$isInt = new \EReg("^[0-9]+\$", "");
self::$isFloat = new \EReg("^[0-9]+\\.[0-9]+\$", "");
self::$isVector = new \EReg("([,]+|\\w)", "");
self::$isUrl = new \EReg("(://)?\\..*", "");
self::$isUrlOrPretypedView = new \EReg("(^#|://)?\\..*", "");
self::$isString = new \EReg(".*", "");
}
}
Boot::registerClass(XRF::class, 'xrfragment.XRF');
XRF::__hx__init();

364
dist/xrfragment.py vendored
View File

@ -63,7 +63,7 @@ class EReg:
_hx_class_name = "EReg"
__slots__ = ("pattern", "matchObj", "_hx_global")
_hx_fields = ["pattern", "matchObj", "global"]
_hx_methods = ["split"]
_hx_methods = ["split", "replace"]
def __init__(self,r,opt):
self.matchObj = None
@ -107,12 +107,35 @@ class EReg:
else:
return [HxString.substring(s,0,self.matchObj.start()), HxString.substr(s,self.matchObj.end(),None)]
def replace(self,s,by):
_this = by.split("$$")
by = "_hx_#repl#__".join([python_Boot.toString1(x1,'') for x1 in _this])
def _hx_local_0(x):
res = by
g = x.groups()
_g = 0
_g1 = len(g)
while (_g < _g1):
i = _g
_g = (_g + 1)
gs = g[i]
if (gs is None):
continue
delimiter = ("$" + HxOverrides.stringOrNull(str((i + 1))))
_this = (list(res) if ((delimiter == "")) else res.split(delimiter))
res = gs.join([python_Boot.toString1(x1,'') for x1 in _this])
_this = res.split("_hx_#repl#__")
res = "$".join([python_Boot.toString1(x1,'') for x1 in _this])
return res
replace = _hx_local_0
return python_lib_Re.sub(self.pattern,replace,s,(0 if (self._hx_global) else 1))
class Reflect:
_hx_class_name = "Reflect"
__slots__ = ()
_hx_statics = ["field", "deleteField"]
_hx_statics = ["field", "deleteField", "copy"]
@staticmethod
def field(o,field):
@ -129,6 +152,20 @@ class Reflect:
o.__delattr__(field)
return True
@staticmethod
def copy(o):
if (o is None):
return None
o2 = _hx_AnonObject({})
_g = 0
_g1 = python_Boot.fields(o)
while (_g < len(_g1)):
f = (_g1[_g] if _g >= 0 and _g < len(_g1) else None)
_g = (_g + 1)
value = Reflect.field(o,f)
setattr(o2,(("_hx_" + f) if ((f in python_Boot.keywords)) else (("_hx_" + f) if (((((len(f) > 2) and ((ord(f[0]) == 95))) and ((ord(f[1]) == 95))) and ((ord(f[(len(f) - 1)]) != 95)))) else f)),value)
return o2
class Std:
_hx_class_name = "Std"
@ -984,7 +1021,11 @@ class python_HaxeIterator:
class python_internal_ArrayImpl:
_hx_class_name = "python.internal.ArrayImpl"
__slots__ = ()
_hx_statics = ["concat", "copy", "iterator", "keyValueIterator", "indexOf", "lastIndexOf", "join", "toString", "pop", "push", "unshift", "remove", "contains", "shift", "slice", "sort", "splice", "map", "filter", "insert", "reverse", "_get"]
_hx_statics = ["get_length", "concat", "copy", "iterator", "keyValueIterator", "indexOf", "lastIndexOf", "join", "toString", "pop", "push", "unshift", "remove", "contains", "shift", "slice", "sort", "splice", "map", "filter", "insert", "reverse", "_get"]
@staticmethod
def get_length(x):
return len(x)
@staticmethod
def concat(a1,a2):
@ -1120,7 +1161,7 @@ class python_internal_ArrayImpl:
class HxOverrides:
_hx_class_name = "HxOverrides"
__slots__ = ()
_hx_statics = ["eq", "stringOrNull", "push", "arrayGet"]
_hx_statics = ["eq", "stringOrNull", "length", "arrayGet"]
@staticmethod
def eq(a,b):
@ -1136,12 +1177,12 @@ class HxOverrides:
return s
@staticmethod
def push(x,e):
if isinstance(x,list):
_this = x
_this.append(e)
return len(_this)
return x.push(e)
def length(x):
if isinstance(x,str):
return len(x)
elif isinstance(x,list):
return len(x)
return x.length
@staticmethod
def arrayGet(a,i):
@ -1173,7 +1214,7 @@ class python_internal_MethodClosure:
class HxString:
_hx_class_name = "HxString"
__slots__ = ()
_hx_statics = ["split", "charCodeAt", "charAt", "lastIndexOf", "toUpperCase", "toLowerCase", "indexOf", "indexOfImpl", "toString", "substring", "substr"]
_hx_statics = ["split", "charCodeAt", "charAt", "lastIndexOf", "toUpperCase", "toLowerCase", "indexOf", "indexOfImpl", "toString", "get_length", "substring", "substr"]
@staticmethod
def split(s,d):
@ -1252,6 +1293,10 @@ class HxString:
def toString(s):
return s
@staticmethod
def get_length(s):
return len(s)
@staticmethod
def substring(s,startIndex,endIndex = None):
if (startIndex < 0):
@ -1280,156 +1325,73 @@ class HxString:
return s[startIndex:(startIndex + _hx_len)]
class xrfragment_Parser:
_hx_class_name = "xrfragment.Parser"
__slots__ = ()
_hx_statics = ["error", "debug", "parse"]
@staticmethod
def parse(key,value,store):
Frag = haxe_ds_StringMap()
Frag.h["#"] = ((xrfragment_XRF.ASSET | xrfragment_XRF.T_PREDEFINED_VIEW) | xrfragment_XRF.PV_EXECUTE)
Frag.h["prio"] = (xrfragment_XRF.ASSET | xrfragment_XRF.T_INT)
Frag.h["src"] = (xrfragment_XRF.ASSET | xrfragment_XRF.T_URL)
Frag.h["href"] = ((xrfragment_XRF.ASSET | xrfragment_XRF.T_URL) | xrfragment_XRF.T_PREDEFINED_VIEW)
Frag.h["tag"] = (xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING)
Frag.h["pos"] = ((((xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3) | xrfragment_XRF.T_STRING_OBJ) | xrfragment_XRF.METADATA) | xrfragment_XRF.NAVIGATOR)
Frag.h["q"] = ((xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_STRING) | xrfragment_XRF.METADATA)
Frag.h["scale"] = (((xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.T_VECTOR3) | xrfragment_XRF.METADATA)
Frag.h["rot"] = ((((xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.T_VECTOR3) | xrfragment_XRF.METADATA) | xrfragment_XRF.NAVIGATOR)
Frag.h["mov"] = (((xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.T_VECTOR3) | xrfragment_XRF.METADATA)
Frag.h["show"] = (((xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.T_INT) | xrfragment_XRF.METADATA)
Frag.h["env"] = (((xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.T_STRING) | xrfragment_XRF.METADATA)
Frag.h["t"] = ((((((xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.T_FLOAT) | xrfragment_XRF.T_VECTOR2) | xrfragment_XRF.T_STRING) | xrfragment_XRF.NAVIGATOR) | xrfragment_XRF.METADATA)
Frag.h["tv"] = ((((((xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.T_FLOAT) | xrfragment_XRF.T_VECTOR2) | xrfragment_XRF.T_VECTOR3) | xrfragment_XRF.NAVIGATOR) | xrfragment_XRF.METADATA)
Frag.h["gravity"] = (((xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.T_VECTOR3) | xrfragment_XRF.METADATA)
Frag.h["physics"] = (((xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.T_VECTOR3) | xrfragment_XRF.METADATA)
Frag.h["fov"] = ((((xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.T_INT) | xrfragment_XRF.NAVIGATOR) | xrfragment_XRF.METADATA)
Frag.h["clip"] = ((((xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.T_VECTOR2) | xrfragment_XRF.NAVIGATOR) | xrfragment_XRF.METADATA)
Frag.h["fog"] = ((((xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.T_VECTOR2) | xrfragment_XRF.NAVIGATOR) | xrfragment_XRF.METADATA)
Frag.h["bg"] = ((((xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.T_VECTOR3) | xrfragment_XRF.NAVIGATOR) | xrfragment_XRF.METADATA)
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.NAVIGATOR) | xrfragment_XRF.METADATA) | xrfragment_XRF.PROMPT)
isPVDynamic = (((len(value) == 0) and ((len(key) > 0))) and (not (key in Frag.h)))
isPVDefault = (((len(value) == 0) and ((len(key) > 0))) and ((key == "#")))
if isPVDynamic:
v = xrfragment_XRF(key,(xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR))
v.validate(key)
setattr(store,(("_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)),v)
return True
v = xrfragment_XRF(key,Frag.h.get(key,None))
if (key in Frag.h):
if (not v.validate(value)):
print(str((((("⚠ fragment '" + ("null" if key is None else key)) + "' has incompatible value (") + ("null" if value is None else value)) + ")")))
return False
setattr(store,(("_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)),v)
if xrfragment_Parser.debug:
print(str(((("" + ("null" if key is None else key)) + ": ") + HxOverrides.stringOrNull(v.string))))
else:
if Std.isOfType(value,str):
v.guessType(v,value)
v.noXRF = True
setattr(store,(("_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)),v)
return True
class xrfragment_Query:
_hx_class_name = "xrfragment.Query"
__slots__ = ("str", "q", "isProp", "isExclude", "isRoot", "isNumber")
_hx_fields = ["str", "q", "isProp", "isExclude", "isRoot", "isNumber"]
class xrfragment_Filter:
_hx_class_name = "xrfragment.Filter"
__slots__ = ("str", "q")
_hx_fields = ["str", "q"]
_hx_methods = ["toObject", "get", "parse", "test", "testProperty"]
def __init__(self,_hx_str):
self.isNumber = EReg("^[0-9\\.]+$","")
self.isRoot = EReg("^[-]?/","")
self.isExclude = EReg("^-","")
self.isProp = EReg("^.*:[><=!]?","")
self.q = _hx_AnonObject({})
self.str = ""
if (_hx_str is not None):
self.parse(_hx_str)
def toObject(self):
return self.q
return Reflect.copy(self.q)
def get(self):
return self.q
return Reflect.copy(self.q)
def parse(self,_hx_str):
_gthis = self
token = _hx_str.split(" ")
q = _hx_AnonObject({})
def _hx_local_0(_hx_str,prefix = None):
if (prefix is None):
prefix = ""
_hx_str = StringTools.trim(_hx_str)
k = HxOverrides.arrayGet(_hx_str.split(":"), 0)
v = HxOverrides.arrayGet(_hx_str.split(":"), 1)
k = HxOverrides.arrayGet(_hx_str.split("="), 0)
v = HxOverrides.arrayGet(_hx_str.split("="), 1)
_hx_filter = _hx_AnonObject({})
if Reflect.field(q,(("null" if prefix is None else prefix) + ("null" if k is None else k))):
_hx_filter = Reflect.field(q,(("null" if prefix is None else prefix) + ("null" if k is None else k)))
value = (Reflect.field(_hx_filter,"rules") if ((Reflect.field(_hx_filter,"rules") is not None)) else list())
setattr(_hx_filter,(("_hx_" + "rules") if (("rules" in python_Boot.keywords)) else (("_hx_" + "rules") if (((((len("rules") > 2) and ((ord("rules"[0]) == 95))) and ((ord("rules"[1]) == 95))) and ((ord("rules"[(len("rules") - 1)]) != 95)))) else "rules")),value)
_this = _gthis.isProp
_this = xrfragment_XRF.isProp
_this.matchObj = python_lib_Re.search(_this.pattern,_hx_str)
if (_this.matchObj is not None):
oper = ""
startIndex = None
if (((_hx_str.find("*") if ((startIndex is None)) else HxString.indexOfImpl(_hx_str,"*",startIndex))) != -1):
oper = "*"
startIndex = None
if (((_hx_str.find(">") if ((startIndex is None)) else HxString.indexOfImpl(_hx_str,">",startIndex))) != -1):
oper = ">"
startIndex = None
if (((_hx_str.find("<") if ((startIndex is None)) else HxString.indexOfImpl(_hx_str,"<",startIndex))) != -1):
oper = "<"
startIndex = None
if (((_hx_str.find(">=") if ((startIndex is None)) else HxString.indexOfImpl(_hx_str,">=",startIndex))) != -1):
oper = ">="
startIndex = None
if (((_hx_str.find("<=") if ((startIndex is None)) else HxString.indexOfImpl(_hx_str,"<=",startIndex))) != -1):
oper = "<="
_this = _gthis.isExclude
_this = xrfragment_XRF.isExclude
_this.matchObj = python_lib_Re.search(_this.pattern,k)
if (_this.matchObj is not None):
oper = "!="
k = HxString.substr(k,1,None)
else:
v = HxString.substr(v,len(oper),None)
v = HxString.substr(v,len(oper),None)
if (len(oper) == 0):
oper = "="
rule = _hx_AnonObject({})
_this = _gthis.isNumber
_this = xrfragment_XRF.isNumber
_this.matchObj = python_lib_Re.search(_this.pattern,v)
if (_this.matchObj is not None):
value = Std.parseFloat(v)
setattr(rule,(("_hx_" + oper) if ((oper in python_Boot.keywords)) else (("_hx_" + oper) if (((((len(oper) > 2) and ((ord(oper[0]) == 95))) and ((ord(oper[1]) == 95))) and ((ord(oper[(len(oper) - 1)]) != 95)))) else oper)),value)
else:
setattr(rule,(("_hx_" + oper) if ((oper in python_Boot.keywords)) else (("_hx_" + oper) if (((((len(oper) > 2) and ((ord(oper[0]) == 95))) and ((ord(oper[1]) == 95))) and ((ord(oper[(len(oper) - 1)]) != 95)))) else oper)),v)
Reflect.field(Reflect.field(_hx_filter,"rules"),"push")(rule)
setattr(q,(("_hx_" + k) if ((k in python_Boot.keywords)) else (("_hx_" + k) if (((((len(k) > 2) and ((ord(k[0]) == 95))) and ((ord(k[1]) == 95))) and ((ord(k[(len(k) - 1)]) != 95)))) else k)),_hx_filter)
return
else:
_this = _gthis.isExclude
_this.matchObj = python_lib_Re.search(_this.pattern,_hx_str)
value = (False if ((_this.matchObj is not None)) else True)
setattr(_hx_filter,(("_hx_" + "id") if (("id" in python_Boot.keywords)) else (("_hx_" + "id") if (((((len("id") > 2) and ((ord("id"[0]) == 95))) and ((ord("id"[1]) == 95))) and ((ord("id"[(len("id") - 1)]) != 95)))) else "id")),value)
_this = _gthis.isRoot
_this.matchObj = python_lib_Re.search(_this.pattern,_hx_str)
value = (_this.matchObj is not None)
setattr(_hx_filter,(("_hx_" + "root") if (("root" in python_Boot.keywords)) else (("_hx_" + "root") if (((((len("root") > 2) and ((ord("root"[0]) == 95))) and ((ord("root"[1]) == 95))) and ((ord("root"[(len("root") - 1)]) != 95)))) else "root")),value)
_this = _gthis.isExclude
_this.matchObj = python_lib_Re.search(_this.pattern,_hx_str)
if (_this.matchObj is not None):
_hx_str = HxString.substr(_hx_str,1,None)
_this = _gthis.isRoot
_this.matchObj = python_lib_Re.search(_this.pattern,_hx_str)
if (_this.matchObj is not None):
_hx_str = HxString.substr(_hx_str,1,None)
setattr(q,(("_hx_" + _hx_str) if ((_hx_str in python_Boot.keywords)) else (("_hx_" + _hx_str) if (((((len(_hx_str) > 2) and ((ord(_hx_str[0]) == 95))) and ((ord(_hx_str[1]) == 95))) and ((ord(_hx_str[(len(_hx_str) - 1)]) != 95)))) else _hx_str)),_hx_filter)
setattr(q,(("_hx_" + "expr") if (("expr" in python_Boot.keywords)) else (("_hx_" + "expr") if (((((len("expr") > 2) and ((ord("expr"[0]) == 95))) and ((ord("expr"[1]) == 95))) and ((ord("expr"[(len("expr") - 1)]) != 95)))) else "expr")),rule)
_this = xrfragment_XRF.isDeep
_this.matchObj = python_lib_Re.search(_this.pattern,_hx_str)
value = ((Reflect.field(k.split("*"),"length") - 1) if ((_this.matchObj is not None)) else 0)
setattr(q,(("_hx_" + "deep") if (("deep" in python_Boot.keywords)) else (("_hx_" + "deep") if (((((len("deep") > 2) and ((ord("deep"[0]) == 95))) and ((ord("deep"[1]) == 95))) and ((ord("deep"[(len("deep") - 1)]) != 95)))) else "deep")),value)
_this = xrfragment_XRF.isExclude
_this.matchObj = python_lib_Re.search(_this.pattern,_hx_str)
value = (False if ((_this.matchObj is not None)) else True)
setattr(q,(("_hx_" + "show") if (("show" in python_Boot.keywords)) else (("_hx_" + "show") if (((((len("show") > 2) and ((ord("show"[0]) == 95))) and ((ord("show"[1]) == 95))) and ((ord("show"[(len("show") - 1)]) != 95)))) else "show")),value)
value = xrfragment_XRF.operators.replace(k,"")
setattr(q,(("_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")),value)
setattr(q,(("_hx_" + "value") if (("value" in python_Boot.keywords)) else (("_hx_" + "value") if (((((len("value") > 2) and ((ord("value"[0]) == 95))) and ((ord("value"[1]) == 95))) and ((ord("value"[(len("value") - 1)]) != 95)))) else "value")),v)
process = _hx_local_0
_g = 0
_g1 = len(token)
@ -1479,39 +1441,69 @@ class xrfragment_Query:
v = Reflect.field(self.q,value)
if (Reflect.field(v,property) is not None):
return Reflect.field(v,property)
_g = 0
_g1 = python_Boot.fields(self.q)
while (_g < len(_g1)):
k = (_g1[_g] if _g >= 0 and _g < len(_g1) else None)
_g = (_g + 1)
_hx_filter = Reflect.field(self.q,k)
if (Reflect.field(_hx_filter,"rules") is None):
continue
rules = Reflect.field(_hx_filter,"rules")
_g2 = 0
while (_g2 < len(rules)):
rule = (rules[_g2] if _g2 >= 0 and _g2 < len(rules) else None)
_g2 = (_g2 + 1)
if exclude:
if (((Reflect.field(rule,"!=") is not None) and testprop((Std.string(value) == Std.string(Reflect.field(rule,"!="))))) and exclude):
qualify = (qualify + 1)
else:
if ((Reflect.field(rule,"*") is not None) and testprop((Std.parseFloat(value) is not None))):
qualify = (qualify + 1)
if ((Reflect.field(rule,">") is not None) and testprop((Std.parseFloat(value) > Std.parseFloat(Reflect.field(rule,">"))))):
qualify = (qualify + 1)
if ((Reflect.field(rule,"<") is not None) and testprop((Std.parseFloat(value) < Std.parseFloat(Reflect.field(rule,"<"))))):
qualify = (qualify + 1)
if ((Reflect.field(rule,">=") is not None) and testprop((Std.parseFloat(value) >= Std.parseFloat(Reflect.field(rule,">="))))):
qualify = (qualify + 1)
if ((Reflect.field(rule,"<=") is not None) and testprop((Std.parseFloat(value) <= Std.parseFloat(Reflect.field(rule,"<="))))):
qualify = (qualify + 1)
if ((Reflect.field(rule,"=") is not None) and ((testprop((value == Reflect.field(rule,"="))) or testprop((Std.parseFloat(value) == Std.parseFloat(Reflect.field(rule,"="))))))):
qualify = (qualify + 1)
if Reflect.field(self.q,"expr"):
f = Reflect.field(self.q,"expr")
if (not Reflect.field(self.q,"show")):
if (((Reflect.field(f,"!=") is not None) and testprop((Std.string(value) == Std.string(Reflect.field(f,"!="))))) and exclude):
qualify = (qualify + 1)
else:
if ((Reflect.field(f,"*") is not None) and testprop((Std.parseFloat(value) is not None))):
qualify = (qualify + 1)
if ((Reflect.field(f,">") is not None) and testprop((Std.parseFloat(value) >= Std.parseFloat(Reflect.field(f,">"))))):
qualify = (qualify + 1)
if ((Reflect.field(f,"<") is not None) and testprop((Std.parseFloat(value) <= Std.parseFloat(Reflect.field(f,"<"))))):
qualify = (qualify + 1)
if ((Reflect.field(f,"=") is not None) and ((testprop((value == Reflect.field(f,"="))) or testprop((Std.parseFloat(value) == Std.parseFloat(Reflect.field(f,"="))))))):
qualify = (qualify + 1)
return (qualify > 0)
class xrfragment_Parser:
_hx_class_name = "xrfragment.Parser"
__slots__ = ()
_hx_statics = ["error", "debug", "parse"]
@staticmethod
def parse(key,value,store,index = None):
Frag = haxe_ds_StringMap()
Frag.h["#"] = ((xrfragment_XRF.ASSET | xrfragment_XRF.T_PREDEFINED_VIEW) | xrfragment_XRF.PV_EXECUTE)
Frag.h["src"] = (xrfragment_XRF.ASSET | xrfragment_XRF.T_URL)
Frag.h["href"] = ((xrfragment_XRF.ASSET | xrfragment_XRF.T_URL) | xrfragment_XRF.T_PREDEFINED_VIEW)
Frag.h["tag"] = (xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING)
Frag.h["pos"] = (((((xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3) | xrfragment_XRF.T_STRING) | xrfragment_XRF.T_STRING_OBJ) | xrfragment_XRF.METADATA) | xrfragment_XRF.NAVIGATOR)
Frag.h["rot"] = ((((xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.T_VECTOR3) | xrfragment_XRF.METADATA) | xrfragment_XRF.NAVIGATOR)
Frag.h["t"] = ((((((xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.T_FLOAT) | xrfragment_XRF.T_VECTOR2) | xrfragment_XRF.T_STRING) | xrfragment_XRF.NAVIGATOR) | xrfragment_XRF.METADATA)
Frag.h["tv"] = ((((((xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.T_FLOAT) | xrfragment_XRF.T_VECTOR2) | xrfragment_XRF.T_VECTOR3) | xrfragment_XRF.NAVIGATOR) | xrfragment_XRF.METADATA)
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.NAVIGATOR) | xrfragment_XRF.METADATA) | xrfragment_XRF.PROMPT)
keyStripped = xrfragment_XRF.operators.replace(key,"")
isPVDynamic = ((len(key) > 0) and (not (key in Frag.h)))
isPVDefault = (((len(value) == 0) and ((len(key) > 0))) and ((key == "#")))
if isPVDynamic:
v = xrfragment_XRF(key,(xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR),index)
v.validate(value)
setattr(store,(("_hx_" + keyStripped) if ((keyStripped in python_Boot.keywords)) else (("_hx_" + keyStripped) if (((((len(keyStripped) > 2) and ((ord(keyStripped[0]) == 95))) and ((ord(keyStripped[1]) == 95))) and ((ord(keyStripped[(len(keyStripped) - 1)]) != 95)))) else keyStripped)),v)
return True
v = xrfragment_XRF(key,Frag.h.get(key,None),index)
if (key in Frag.h):
if (not v.validate(value)):
print(str((((("⚠ fragment '" + ("null" if key is None else key)) + "' has incompatible value (") + ("null" if value is None else value)) + ")")))
return False
setattr(store,(("_hx_" + keyStripped) if ((keyStripped in python_Boot.keywords)) else (("_hx_" + keyStripped) if (((((len(keyStripped) > 2) and ((ord(keyStripped[0]) == 95))) and ((ord(keyStripped[1]) == 95))) and ((ord(keyStripped[(len(keyStripped) - 1)]) != 95)))) else keyStripped)),v)
if xrfragment_Parser.debug:
print(str(((("" + ("null" if key is None else key)) + ": ") + HxOverrides.stringOrNull(v.string))))
else:
if Std.isOfType(value,str):
v.guessType(v,value)
v.noXRF = True
setattr(store,(("_hx_" + keyStripped) if ((keyStripped in python_Boot.keywords)) else (("_hx_" + keyStripped) if (((((len(keyStripped) > 2) and ((ord(keyStripped[0]) == 95))) and ((ord(keyStripped[1]) == 95))) and ((ord(keyStripped[(len(keyStripped) - 1)]) != 95)))) else keyStripped)),v)
return True
class xrfragment_URI:
_hx_class_name = "xrfragment.URI"
__slots__ = ()
@ -1544,7 +1536,7 @@ 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,store)
ok = xrfragment_Parser.parse(key,value,store,i)
if ((_hx_filter is not None) and ((_hx_filter != 0))):
_g = 0
_g1 = python_Boot.fields(store)
@ -1559,14 +1551,14 @@ class xrfragment_URI:
class xrfragment_XRF:
_hx_class_name = "xrfragment.XRF"
__slots__ = ("fragment", "flags", "x", "y", "z", "w", "color", "string", "int", "float", "query", "noXRF")
_hx_fields = ["fragment", "flags", "x", "y", "z", "w", "color", "string", "int", "float", "query", "noXRF"]
__slots__ = ("fragment", "flags", "index", "x", "y", "z", "w", "color", "string", "int", "float", "filter", "noXRF")
_hx_fields = ["fragment", "flags", "index", "x", "y", "z", "w", "color", "string", "int", "float", "filter", "noXRF"]
_hx_methods = ["is", "validate", "guessType"]
_hx_statics = ["ASSET", "PROP_BIND", "QUERY_OPERATOR", "PROMPT", "ROUNDROBIN", "NAVIGATOR", "METADATA", "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", "NAVIGATOR", "METADATA", "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", "operators", "isProp", "isExclude", "isDeep", "isNumber", "set", "unset"]
def __init__(self,_fragment,_flags):
def __init__(self,_fragment,_flags,_index = None):
self.noXRF = None
self.query = None
self.filter = None
self.float = None
self.int = None
self.string = None
@ -1577,6 +1569,7 @@ class xrfragment_XRF:
self.x = None
self.fragment = _fragment
self.flags = _flags
self.index = _index
def _hx_is(self,flag):
if (not Std.isOfType(self.flags,Int)):
@ -1585,41 +1578,45 @@ class xrfragment_XRF:
def validate(self,value):
self.guessType(self,value)
if (self.fragment == "q"):
self.query = xrfragment_Query(value).get()
ok = True
if (((not self._hx_is(xrfragment_XRF.T_FLOAT)) and self._hx_is(xrfragment_XRF.T_VECTOR2)) and (not ((Std.isOfType(self.x,Float) and Std.isOfType(self.y,Float))))):
ok = False
if (((not self._hx_is(xrfragment_XRF.T_VECTOR2)) and self._hx_is(xrfragment_XRF.T_VECTOR3)) and (not (((Std.isOfType(self.x,Float) and Std.isOfType(self.y,Float)) and Std.isOfType(self.z,Float))))):
if (((not ((self._hx_is(xrfragment_XRF.T_VECTOR2) or self._hx_is(xrfragment_XRF.T_STRING)))) and self._hx_is(xrfragment_XRF.T_VECTOR3)) and (not (((Std.isOfType(self.x,Float) and Std.isOfType(self.y,Float)) and Std.isOfType(self.z,Float))))):
ok = False
return ok
def guessType(self,v,_hx_str):
v.string = _hx_str
if (len(_hx_str.split(",")) > 1):
xyzw = _hx_str.split(",")
if (len(xyzw) > 0):
v.x = Std.parseFloat((xyzw[0] if 0 < len(xyzw) else None))
if (len(xyzw) > 1):
v.y = Std.parseFloat((xyzw[1] if 1 < len(xyzw) else None))
if (len(xyzw) > 2):
v.z = Std.parseFloat((xyzw[2] if 2 < len(xyzw) else None))
if (len(xyzw) > 3):
v.w = Std.parseFloat((xyzw[3] if 3 < len(xyzw) else None))
_this = xrfragment_XRF.isColor
_this.matchObj = python_lib_Re.search(_this.pattern,_hx_str)
if (_this.matchObj is not None):
v.color = _hx_str
_this = xrfragment_XRF.isFloat
_this.matchObj = python_lib_Re.search(_this.pattern,_hx_str)
if (_this.matchObj is not None):
v.x = Std.parseFloat(_hx_str)
v.float = v.x
_this = xrfragment_XRF.isInt
_this.matchObj = python_lib_Re.search(_this.pattern,_hx_str)
if (_this.matchObj is not None):
v.int = Std.parseInt(_hx_str)
v.x = v.int
if (not Std.isOfType(_hx_str,str)):
return
if (len(_hx_str) > 0):
if (len(_hx_str.split(",")) > 1):
xyzw = _hx_str.split(",")
if (len(xyzw) > 0):
v.x = Std.parseFloat((xyzw[0] if 0 < len(xyzw) else None))
if (len(xyzw) > 1):
v.y = Std.parseFloat((xyzw[1] if 1 < len(xyzw) else None))
if (len(xyzw) > 2):
v.z = Std.parseFloat((xyzw[2] if 2 < len(xyzw) else None))
if (len(xyzw) > 3):
v.w = Std.parseFloat((xyzw[3] if 3 < len(xyzw) else None))
_this = xrfragment_XRF.isColor
_this.matchObj = python_lib_Re.search(_this.pattern,_hx_str)
if (_this.matchObj is not None):
v.color = _hx_str
_this = xrfragment_XRF.isFloat
_this.matchObj = python_lib_Re.search(_this.pattern,_hx_str)
if (_this.matchObj is not None):
v.x = Std.parseFloat(_hx_str)
v.float = v.x
_this = xrfragment_XRF.isInt
_this.matchObj = python_lib_Re.search(_this.pattern,_hx_str)
if (_this.matchObj is not None):
v.int = Std.parseInt(_hx_str)
v.x = v.int
v.filter = xrfragment_Filter(((HxOverrides.stringOrNull(v.fragment) + "=") + HxOverrides.stringOrNull(v.string)))
else:
v.filter = xrfragment_Filter(v.fragment)
@staticmethod
def set(flag,flags):
@ -1664,4 +1661,9 @@ xrfragment_XRF.isFloat = EReg("^[-0-9]+\\.[0-9]+$","")
xrfragment_XRF.isVector = EReg("([,]+|\\w)","")
xrfragment_XRF.isUrl = EReg("(://)?\\..*","")
xrfragment_XRF.isUrlOrPretypedView = EReg("(^#|://)?\\..*","")
xrfragment_XRF.isString = EReg(".*","")
xrfragment_XRF.isString = EReg(".*","")
xrfragment_XRF.operators = EReg("(^-|[\\*]+)","")
xrfragment_XRF.isProp = EReg("^.*=[><=]?","")
xrfragment_XRF.isExclude = EReg("^-","")
xrfragment_XRF.isDeep = EReg("\\*","")
xrfragment_XRF.isNumber = EReg("^[0-9\\.]+$","")

1840
dist/xrfragment.three.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -41,6 +41,7 @@ xrf.portalNonEuclidian = function(opts){
// spec: if src-object is child of portal (then portal is lens, and should include all children )
mesh.traverse( (n) => n.name == opts.srcFrag.target.key && (stencilObject = n) && (mesh.portal.isLens = true) )
}
if( !stencilObject ) return console.warn(`no objects were found (src:${mesh.userData.src}) for (portal)object name '${mesh.name}'`)
mesh.portal.stencilObject = stencilObject
@ -86,6 +87,12 @@ xrf.portalNonEuclidian = function(opts){
this.setupListeners = () => {
mesh.onAfterRender = function(renderer, scene, camera, geometry, material, group ){
mesh.portal.needUpdate = true
}
xrf.addEventListener('renderPost', (opts) => {
let {scene,camera,time,render,renderer} = opts
if( mesh.portal && mesh.portal.stencilObjects ){
let stencilRef = mesh.portal.stencilRef
let newPos = mesh.portal.posWorld
@ -103,9 +110,16 @@ xrf.portalNonEuclidian = function(opts){
if( !mesh.portal.isLocal || mesh.portal.isLens ) stencilObject.visible = true
mesh.portal.stencilObjects.traverse( (n) => showPortal(n,false) && n.stencil && n.stencil(stencilRef,newPos,newScale) )
renderer.autoClear = false
renderer.autoClearDepth = false
renderer.autoClearColor = false
renderer.autoClearStencil = false
// render
renderer.render( mesh.portal.stencilObjects, camera )
render( mesh.portal.stencilObjects, camera )
// de-init
renderer.autoClear = true
renderer.autoClearDepth = true
renderer.autoClearColor = true
renderer.autoClearStencil = true
mesh.portal.stencilObjects.traverse( (n) => showPortal(n,true) && n.stencil && (n.stencil(0)) )
if( !mesh.portal.isLocal || mesh.portal.isLens ) stencilObject.visible = false
@ -122,7 +136,8 @@ xrf.portalNonEuclidian = function(opts){
}
}
}
}
mesh.portal.needUpdate = false
})
return this
}
@ -153,7 +168,7 @@ xrf.portalNonEuclidian.setMaterial = function(mesh){
mesh.material.colorWrite = false;
mesh.material.stencilWrite = true;
mesh.material.stencilRef = xrf.portalNonEuclidian.stencilRef;
mesh.renderOrder = 10;//xrf.portalNonEuclidian.stencilRef;
// mesh.renderOrder = 0;//xrf.portalNonEuclidian.stencilRef;
mesh.material.stencilFunc = xrf.THREE.AlwaysStencilFunc;
mesh.material.stencilZPass = xrf.THREE.ReplaceStencilOp;
mesh.material.stencilZFail = xrf.THREE.ReplaceStencilOp;
@ -164,7 +179,7 @@ xrf.portalNonEuclidian.setMaterial = function(mesh){
xrf.addEventListener('parseModel',(opts) => {
const scene = opts.model.scene
scene.traverse( (n) => n.renderOrder = 0 ) // rendering everything *after* the stencil buffers
// scene.traverse( (n) => n.renderOrder = 10 ) // rendering everything *after* the stencil buffers
})