From f2a207e379be997c184b54de628b33731bebff61 Mon Sep 17 00:00:00 2001 From: Leon van Kammen Date: Fri, 2 Jun 2023 16:20:22 +0200 Subject: [PATCH] update docs --- dist/license.js | 3 - dist/xrfragment.js | 595 --------- dist/xrfragment.lua | 2457 ------------------------------------- dist/xrfragment.module.js | 599 --------- dist/xrfragment.py | 1678 ------------------------- index.html | 28 +- 6 files changed, 17 insertions(+), 5343 deletions(-) delete mode 100644 dist/license.js delete mode 100644 dist/xrfragment.js delete mode 100644 dist/xrfragment.lua delete mode 100644 dist/xrfragment.module.js delete mode 100644 dist/xrfragment.py diff --git a/dist/license.js b/dist/license.js deleted file mode 100644 index fd8ce4a..0000000 --- a/dist/license.js +++ /dev/null @@ -1,3 +0,0 @@ -// SPDX-License-Identifier: MPL-2.0 -// Copyright (c) 2023 Leon van Kammen/NLNET - diff --git a/dist/xrfragment.js b/dist/xrfragment.js deleted file mode 100644 index f576b4e..0000000 --- a/dist/xrfragment.js +++ /dev/null @@ -1,595 +0,0 @@ -var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; -(function ($global) { "use strict"; -$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; -var EReg = function(r,opt) { - this.r = new RegExp(r,opt.split("u").join("")); -}; -EReg.__name__ = true; -EReg.prototype = { - match: function(s) { - if(this.r.global) { - this.r.lastIndex = 0; - } - this.r.m = this.r.exec(s); - this.r.s = s; - return this.r.m != null; - } - ,split: function(s) { - var d = "#__delim__#"; - return s.replace(this.r,d).split(d); - } -}; -var HxOverrides = function() { }; -HxOverrides.__name__ = true; -HxOverrides.cca = function(s,index) { - var x = s.charCodeAt(index); - if(x != x) { - return undefined; - } - return x; -}; -HxOverrides.substr = function(s,pos,len) { - if(len == null) { - len = s.length; - } else if(len < 0) { - if(pos == 0) { - len = s.length + len; - } else { - return ""; - } - } - return s.substr(pos,len); -}; -HxOverrides.now = function() { - return Date.now(); -}; -Math.__name__ = true; -var Reflect = function() { }; -Reflect.__name__ = true; -Reflect.field = function(o,field) { - try { - return o[field]; - } catch( _g ) { - return null; - } -}; -Reflect.fields = function(o) { - var a = []; - if(o != null) { - var hasOwnProperty = Object.prototype.hasOwnProperty; - for( var f in o ) { - if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { - a.push(f); - } - } - } - return a; -}; -Reflect.deleteField = function(o,field) { - if(!Object.prototype.hasOwnProperty.call(o,field)) { - return false; - } - delete(o[field]); - return true; -}; -var Std = function() { }; -Std.__name__ = true; -Std.string = function(s) { - return js_Boot.__string_rec(s,""); -}; -Std.parseInt = function(x) { - if(x != null) { - var _g = 0; - var _g1 = x.length; - while(_g < _g1) { - var i = _g++; - var c = x.charCodeAt(i); - if(c <= 8 || c >= 14 && c != 32 && c != 45) { - var nc = x.charCodeAt(i + 1); - var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); - if(isNaN(v)) { - return null; - } else { - return v; - } - } - } - } - return null; -}; -var StringTools = function() { }; -StringTools.__name__ = true; -StringTools.isSpace = function(s,pos) { - var c = HxOverrides.cca(s,pos); - if(!(c > 8 && c < 14)) { - return c == 32; - } else { - return true; - } -}; -StringTools.ltrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,r)) ++r; - if(r > 0) { - return HxOverrides.substr(s,r,l - r); - } else { - return s; - } -}; -StringTools.rtrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; - if(r > 0) { - return HxOverrides.substr(s,0,l - r); - } else { - return s; - } -}; -StringTools.trim = function(s) { - return StringTools.ltrim(StringTools.rtrim(s)); -}; -StringTools.replace = function(s,sub,by) { - return s.split(sub).join(by); -}; -var haxe_iterators_ArrayIterator = function(array) { - this.current = 0; - this.array = array; -}; -haxe_iterators_ArrayIterator.__name__ = true; -haxe_iterators_ArrayIterator.prototype = { - hasNext: function() { - return this.current < this.array.length; - } - ,next: function() { - return this.array[this.current++]; - } -}; -var js_Boot = function() { }; -js_Boot.__name__ = true; -js_Boot.__string_rec = function(o,s) { - if(o == null) { - return "null"; - } - if(s.length >= 5) { - return "<...>"; - } - var t = typeof(o); - if(t == "function" && (o.__name__ || o.__ename__)) { - t = "object"; - } - switch(t) { - case "function": - return ""; - case "object": - if(((o) instanceof Array)) { - var str = "["; - s += "\t"; - var _g = 0; - var _g1 = o.length; - while(_g < _g1) { - var i = _g++; - str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); - } - str += "]"; - return str; - } - var tostr; - try { - tostr = o.toString; - } catch( _g ) { - return "???"; - } - if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { - var s2 = o.toString(); - if(s2 != "[object Object]") { - return s2; - } - } - var str = "{\n"; - s += "\t"; - var hasp = o.hasOwnProperty != null; - var k = null; - for( k in o ) { - if(hasp && !o.hasOwnProperty(k)) { - continue; - } - if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { - continue; - } - if(str.length != 2) { - str += ", \n"; - } - str += s + k + " : " + js_Boot.__string_rec(o[k],s); - } - s = s.substring(1); - str += "\n" + s + "}"; - return str; - case "string": - return o; - default: - return String(o); - } -}; -var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; -xrfragment_Parser.__name__ = true; -xrfragment_Parser.parse = function(key,value,resultMap) { - var Frag_h = Object.create(null); - Frag_h["prio"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_INT; - Frag_h["#"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_PREDEFINED_VIEW; - Frag_h["class"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["src"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL; - Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING_OBJ | xrfragment_XRF.EMBEDDED | xrfragment_XRF.NAVIGATOR; - Frag_h["href"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; - Frag_h["q"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_STRING | xrfragment_XRF.EMBEDDED; - Frag_h["scale"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.EMBEDDED; - Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.EMBEDDED | xrfragment_XRF.NAVIGATOR; - Frag_h["translate"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.EMBEDDED; - Frag_h["visible"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_INT | xrfragment_XRF.EMBEDDED; - Frag_h["env"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_STRING | xrfragment_XRF.EMBEDDED; - Frag_h["t"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.EMBEDDED; - Frag_h["gravity"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.EMBEDDED; - Frag_h["physics"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.EMBEDDED; - Frag_h["fov"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_INT | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.EMBEDDED; - Frag_h["clip"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.EMBEDDED; - Frag_h["fog"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_STRING | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.EMBEDDED; - 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.EMBEDDED | xrfragment_XRF.PROMPT; - if(value.length == 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key)) { - resultMap[key] = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR); - return true; - } - if(key.split(".").length > 1 && value.split(".").length > 1) { - resultMap[key] = new xrfragment_XRF(key,xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_STRING | xrfragment_XRF.PROP_BIND); - return true; - } - if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { - var v = new xrfragment_XRF(key,Frag_h[key]); - if(!v.validate(value)) { - console.log("src/xrfragment/Parser.hx:75:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); - return false; - } - if(xrfragment_Parser.debug) { - console.log("src/xrfragment/Parser.hx:78:","✔ " + key + ": " + v.string); - } - resultMap[key] = v; - } - return true; -}; -var xrfragment_Query = $hx_exports["xrfragment"]["Query"] = function(str) { - this.isNumber = new EReg("^[0-9\\.]+$",""); - this.isClass = new EReg("^[-]?class$",""); - this.isExclude = new EReg("^-",""); - this.isProp = new EReg("^.*:[><=!]?",""); - this.q = { }; - this.str = ""; - if(str != null) { - this.parse(str); - } -}; -xrfragment_Query.__name__ = true; -xrfragment_Query.prototype = { - toObject: function() { - return this.q; - } - ,expandAliases: function(token) { - var classAlias = new EReg("^(-)?\\.",""); - if(classAlias.match(token)) { - return StringTools.replace(token,".","class:"); - } else { - return token; - } - } - ,get: function() { - return this.q; - } - ,parse: function(str,recurse) { - if(recurse == null) { - recurse = false; - } - var _gthis = this; - var token = str.split(" "); - var q = { }; - var process = function(str,prefix) { - if(prefix == null) { - prefix = ""; - } - str = StringTools.trim(str); - 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)) { - 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 = "!="; - k = HxOverrides.substr(k,1,null); - } else { - v = HxOverrides.substr(v,oper.length,null); - } - if(oper.length == 0) { - oper = "="; - } - if(_gthis.isClass.match(k)) { - filter[prefix + k] = oper != "!="; - q[v] = filter; - } else { - var rule = { }; - if(_gthis.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; - var key = _gthis.isExclude.match(str) ? HxOverrides.substr(str,1,null) : str; - q[key] = filter; - } - }; - var _g = 0; - var _g1 = token.length; - while(_g < _g1) { - var i = _g++; - process(this.expandAliases(token[i])); - } - return this.q = q; - } - ,test: function(obj) { - var qualify = false; - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v)) { - qualify = true; - } - } - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v,true)) { - qualify = false; - } - } - return qualify; - } - ,testProperty: function(property,value,exclude) { - var conds = 0; - var fails = 0; - var qualify = 0; - var testprop = function(expr) { - conds += 1; - fails += expr ? 0 : 1; - return expr; - }; - if(this.q[value] != null) { - var v = this.q[value]; - if(v[property] != null) { - 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; - } - } - } - } - return qualify > 0; - } -}; -var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { }; -xrfragment_URI.__name__ = true; -xrfragment_URI.parse = function(url,filter) { - var store = { }; - if(url.indexOf("#") == -1) { - return store; - } - var fragment = url.split("#"); - var splitArray = fragment[1].split("&"); - var _g = 0; - var _g1 = splitArray.length; - while(_g < _g1) { - var i = _g++; - var splitByEqual = splitArray[i].split("="); - var regexPlus = new EReg("\\+","g"); - var key = splitByEqual[0]; - var value = ""; - if(splitByEqual.length > 1) { - var s = regexPlus.split(splitByEqual[1]).join(" "); - value = decodeURIComponent(s.split("+").join(" ")); - } - var ok = xrfragment_Parser.parse(key,value,store); - } - if(filter != null && filter != 0) { - var _g = 0; - var _g1 = Reflect.fields(store); - while(_g < _g1.length) { - var key = _g1[_g]; - ++_g; - var xrf = store[key]; - if(!xrf.is(filter)) { - Reflect.deleteField(store,key); - } - } - } - return store; -}; -var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags) { - this.fragment = _fragment; - this.flags = _flags; -}; -xrfragment_XRF.__name__ = true; -xrfragment_XRF.set = function(flag,flags) { - return flags | flag; -}; -xrfragment_XRF.unset = function(flag,flags) { - return flags & ~flag; -}; -xrfragment_XRF.prototype = { - is: function(flag) { - return (this.flags & flag) != 0; - } - ,validate: function(value) { - this.guessType(this,value); - if(value.split("|").length > 1) { - this.args = []; - var args = value.split("|"); - var _g = 0; - var _g1 = args.length; - while(_g < _g1) { - var i = _g++; - var x = new xrfragment_XRF(this.fragment,this.flags); - this.guessType(x,args[i]); - this.args.push(x); - } - } - if(this.fragment == "q") { - this.query = new xrfragment_Query(value).get(); - } - var ok = true; - if(!((this.args) instanceof Array)) { - if(this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { - ok = false; - } - if(this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { - ok = false; - } - var tmp; - if(this.is(xrfragment_XRF.T_INT)) { - var v = this.int; - tmp = !(typeof(v) == "number" && ((v | 0) === v)); - } else { - tmp = false; - } - if(tmp) { - ok = false; - } - } - return ok; - } - ,guessType: function(v,str) { - v.string = str; - if(str.split(",").length > 1) { - var xyz = str.split(","); - if(xyz.length > 0) { - v.x = parseFloat(xyz[0]); - } - if(xyz.length > 1) { - v.y = parseFloat(xyz[1]); - } - if(xyz.length > 2) { - v.z = parseFloat(xyz[2]); - } - } - if(xrfragment_XRF.isColor.match(str)) { - v.color = str; - } - if(xrfragment_XRF.isFloat.match(str)) { - v.float = parseFloat(str); - } - if(xrfragment_XRF.isInt.match(str)) { - v.int = Std.parseInt(str); - } - } -}; -if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { - HxOverrides.now = performance.now.bind(performance); -} -String.__name__ = true; -Array.__name__ = true; -js_Boot.__toStr = ({ }).toString; -xrfragment_Parser.error = ""; -xrfragment_Parser.debug = false; -xrfragment_XRF.ASSET = 1; -xrfragment_XRF.PROP_BIND = 2; -xrfragment_XRF.QUERY_OPERATOR = 4; -xrfragment_XRF.PROMPT = 8; -xrfragment_XRF.ROUNDROBIN = 16; -xrfragment_XRF.NAVIGATOR = 32; -xrfragment_XRF.EMBEDDED = 64; -xrfragment_XRF.PV_OVERRIDE = 128; -xrfragment_XRF.PV_EXECUTE = 256; -xrfragment_XRF.T_COLOR = 8192; -xrfragment_XRF.T_INT = 16384; -xrfragment_XRF.T_FLOAT = 32768; -xrfragment_XRF.T_VECTOR2 = 65536; -xrfragment_XRF.T_VECTOR3 = 131072; -xrfragment_XRF.T_URL = 262144; -xrfragment_XRF.T_PREDEFINED_VIEW = 524288; -xrfragment_XRF.T_STRING = 1048576; -xrfragment_XRF.T_STRING_OBJ = 2097152; -xrfragment_XRF.T_STRING_OBJ_PROP = 4194304; -xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); -xrfragment_XRF.isInt = new EReg("^[0-9]+$",""); -xrfragment_XRF.isFloat = new EReg("^[0-9]+\\.[0-9]+$",""); -xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); -xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); -xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); -xrfragment_XRF.isString = new EReg(".*",""); -})({}); -var xrfragment = $hx_exports["xrfragment"]; diff --git a/dist/xrfragment.lua b/dist/xrfragment.lua deleted file mode 100644 index 661c20a..0000000 --- a/dist/xrfragment.lua +++ /dev/null @@ -1,2457 +0,0 @@ -local _hx_hidden = {__id__=true, hx__closures=true, super=true, prototype=true, __fields__=true, __ifields__=true, __class__=true, __properties__=true, __fields__=true, __name__=true} - -_hx_array_mt = { - __newindex = function(t,k,v) - local len = t.length - t.length = k >= len and (k + 1) or len - rawset(t,k,v) - end -} - -function _hx_is_array(o) - return type(o) == "table" - and o.__enum__ == nil - and getmetatable(o) == _hx_array_mt -end - - - -function _hx_tab_array(tab, length) - tab.length = length - return setmetatable(tab, _hx_array_mt) -end - - - -function _hx_print_class(obj, depth) - local first = true - local result = '' - for k,v in pairs(obj) do - if _hx_hidden[k] == nil then - if first then - first = false - else - result = result .. ', ' - end - if _hx_hidden[k] == nil then - result = result .. k .. ':' .. _hx_tostring(v, depth+1) - end - end - end - return '{ ' .. result .. ' }' -end - -function _hx_print_enum(o, depth) - if o.length == 2 then - return o[0] - else - local str = o[0] .. "(" - for i = 2, (o.length-1) do - if i ~= 2 then - str = str .. "," .. _hx_tostring(o[i], depth+1) - else - str = str .. _hx_tostring(o[i], depth+1) - end - end - return str .. ")" - end -end - -function _hx_tostring(obj, depth) - if depth == nil then - depth = 0 - elseif depth > 5 then - return "<...>" - end - - local tstr = _G.type(obj) - if tstr == "string" then return obj - elseif tstr == "nil" then return "null" - elseif tstr == "number" then - if obj == _G.math.POSITIVE_INFINITY then return "Infinity" - elseif obj == _G.math.NEGATIVE_INFINITY then return "-Infinity" - elseif obj == 0 then return "0" - elseif obj ~= obj then return "NaN" - else return _G.tostring(obj) - end - elseif tstr == "boolean" then return _G.tostring(obj) - elseif tstr == "userdata" then - local mt = _G.getmetatable(obj) - if mt ~= nil and mt.__tostring ~= nil then - return _G.tostring(obj) - else - return "" - end - elseif tstr == "function" then return "" - elseif tstr == "thread" then return "" - elseif tstr == "table" then - if obj.__enum__ ~= nil then - return _hx_print_enum(obj, depth) - elseif obj.toString ~= nil and not _hx_is_array(obj) then return obj:toString() - elseif _hx_is_array(obj) then - if obj.length > 5 then - return "[...]" - else - local str = "" - for i=0, (obj.length-1) do - if i == 0 then - str = str .. _hx_tostring(obj[i], depth+1) - else - str = str .. "," .. _hx_tostring(obj[i], depth+1) - end - end - return "[" .. str .. "]" - end - elseif obj.__class__ ~= nil then - return _hx_print_class(obj, depth) - else - local buffer = {} - local ref = obj - if obj.__fields__ ~= nil then - ref = obj.__fields__ - end - for k,v in pairs(ref) do - if _hx_hidden[k] == nil then - _G.table.insert(buffer, _hx_tostring(k, depth+1) .. ' : ' .. _hx_tostring(obj[k], depth+1)) - end - end - - return "{ " .. table.concat(buffer, ", ") .. " }" - end - else - _G.error("Unknown Lua type", 0) - return "" - end -end - -function _hx_error(obj) - if obj.value then - _G.print("runtime error:\n " .. _hx_tostring(obj.value)); - else - _G.print("runtime error:\n " .. tostring(obj)); - end - - if _G.debug and _G.debug.traceback then - _G.print(debug.traceback()); - end -end - - -local function _hx_obj_newindex(t,k,v) - t.__fields__[k] = true - rawset(t,k,v) -end - -local _hx_obj_mt = {__newindex=_hx_obj_newindex, __tostring=_hx_tostring} - -local function _hx_a(...) - local __fields__ = {}; - local ret = {__fields__ = __fields__}; - local max = select('#',...); - local tab = {...}; - local cur = 1; - while cur < max do - local v = tab[cur]; - __fields__[v] = true; - ret[v] = tab[cur+1]; - cur = cur + 2 - end - return setmetatable(ret, _hx_obj_mt) -end - -local function _hx_e() - return setmetatable({__fields__ = {}}, _hx_obj_mt) -end - -local function _hx_o(obj) - return setmetatable(obj, _hx_obj_mt) -end - -local function _hx_new(prototype) - return setmetatable({__fields__ = {}}, {__newindex=_hx_obj_newindex, __index=prototype, __tostring=_hx_tostring}) -end - -function _hx_field_arr(obj) - res = {} - idx = 0 - if obj.__fields__ ~= nil then - obj = obj.__fields__ - end - for k,v in pairs(obj) do - if _hx_hidden[k] == nil then - res[idx] = k - idx = idx + 1 - end - end - return _hx_tab_array(res, idx) -end - -local _hxClasses = {} -local Int = _hx_e(); -local Dynamic = _hx_e(); -local Float = _hx_e(); -local Bool = _hx_e(); -local Class = _hx_e(); -local Enum = _hx_e(); - -local _hx_exports = _hx_exports or {} -_hx_exports["xrfragment"] = _hx_exports["xrfragment"] or _hx_e() -local Array = _hx_e() -__lua_lib_lrexlib_Rex = _G.require("rex_pcre") -__lua_lib_luautf8_Utf8 = _G.require("lua-utf8") -local EReg = _hx_e() -local Math = _hx_e() -local Reflect = _hx_e() -local String = _hx_e() -local Std = _hx_e() -local StringTools = _hx_e() -__haxe_IMap = _hx_e() -__haxe_Exception = _hx_e() -__haxe_Log = _hx_e() -__haxe_NativeStackTrace = _hx_e() -__haxe_ValueException = _hx_e() -__haxe_ds_StringMap = _hx_e() -__haxe_iterators_ArrayIterator = _hx_e() -__haxe_iterators_ArrayKeyValueIterator = _hx_e() -__lua_Boot = _hx_e() -__lua_UserData = _hx_e() -__lua_Lib = _hx_e() -__lua_Thread = _hx_e() -__xrfragment_Parser = _hx_e() -__xrfragment_Query = _hx_e() -__xrfragment_URI = _hx_e() -__xrfragment_XRF = _hx_e() - -local _hx_bind, _hx_bit, _hx_staticToInstance, _hx_funcToField, _hx_maxn, _hx_print, _hx_apply_self, _hx_box_mr, _hx_bit_clamp, _hx_table, _hx_bit_raw -local _hx_pcall_default = {}; -local _hx_pcall_break = {}; - -Array.new = function() - local self = _hx_new(Array.prototype) - Array.super(self) - return self -end -Array.super = function(self) - _hx_tab_array(self, 0); -end -Array.__name__ = true -Array.prototype = _hx_e(); -Array.prototype.concat = function(self,a) - local _g = _hx_tab_array({}, 0); - local _g1 = 0; - local _g2 = self; - while (_g1 < _g2.length) do - local i = _g2[_g1]; - _g1 = _g1 + 1; - _g:push(i); - end; - local ret = _g; - local _g = 0; - while (_g < a.length) do - local i = a[_g]; - _g = _g + 1; - ret:push(i); - end; - do return ret end -end -Array.prototype.join = function(self,sep) - local tbl = ({}); - local _g_current = 0; - local _g_array = self; - while (_g_current < _g_array.length) do - _g_current = _g_current + 1; - local i = _g_array[_g_current - 1]; - _G.table.insert(tbl, Std.string(i)); - end; - do return _G.table.concat(tbl, sep) end -end -Array.prototype.pop = function(self) - if (self.length == 0) then - do return nil end; - end; - local ret = self[self.length - 1]; - self[self.length - 1] = nil; - self.length = self.length - 1; - do return ret end -end -Array.prototype.push = function(self,x) - self[self.length] = x; - do return self.length end -end -Array.prototype.reverse = function(self) - local tmp; - local i = 0; - while (i < Std.int(self.length / 2)) do - tmp = self[i]; - self[i] = self[(self.length - i) - 1]; - self[(self.length - i) - 1] = tmp; - i = i + 1; - end; -end -Array.prototype.shift = function(self) - if (self.length == 0) then - do return nil end; - end; - local ret = self[0]; - if (self.length == 1) then - self[0] = nil; - else - if (self.length > 1) then - self[0] = self[1]; - _G.table.remove(self, 1); - end; - end; - local tmp = self; - tmp.length = tmp.length - 1; - do return ret end -end -Array.prototype.slice = function(self,pos,_end) - if ((_end == nil) or (_end > self.length)) then - _end = self.length; - else - if (_end < 0) then - _end = _G.math.fmod((self.length - (_G.math.fmod(-_end, self.length))), self.length); - end; - end; - if (pos < 0) then - pos = _G.math.fmod((self.length - (_G.math.fmod(-pos, self.length))), self.length); - end; - if ((pos > _end) or (pos > self.length)) then - do return _hx_tab_array({}, 0) end; - end; - local ret = _hx_tab_array({}, 0); - local _g = pos; - local _g1 = _end; - while (_g < _g1) do - _g = _g + 1; - local i = _g - 1; - ret:push(self[i]); - end; - do return ret end -end -Array.prototype.sort = function(self,f) - local i = 0; - local l = self.length; - while (i < l) do - local swap = false; - local j = 0; - local max = (l - i) - 1; - while (j < max) do - if (f(self[j], self[j + 1]) > 0) then - local tmp = self[j + 1]; - self[j + 1] = self[j]; - self[j] = tmp; - swap = true; - end; - j = j + 1; - end; - if (not swap) then - break; - end; - i = i + 1; - end; -end -Array.prototype.splice = function(self,pos,len) - if ((len < 0) or (pos > self.length)) then - do return _hx_tab_array({}, 0) end; - else - if (pos < 0) then - pos = self.length - (_G.math.fmod(-pos, self.length)); - end; - end; - len = Math.min(len, self.length - pos); - local ret = _hx_tab_array({}, 0); - local _g = pos; - local _g1 = pos + len; - while (_g < _g1) do - _g = _g + 1; - local i = _g - 1; - ret:push(self[i]); - self[i] = self[i + len]; - end; - local _g = pos + len; - local _g1 = self.length; - while (_g < _g1) do - _g = _g + 1; - local i = _g - 1; - self[i] = self[i + len]; - end; - local tmp = self; - tmp.length = tmp.length - len; - do return ret end -end -Array.prototype.toString = function(self) - local tbl = ({}); - _G.table.insert(tbl, "["); - _G.table.insert(tbl, self:join(",")); - _G.table.insert(tbl, "]"); - do return _G.table.concat(tbl, "") end -end -Array.prototype.unshift = function(self,x) - local len = self.length; - local _g = 0; - local _g1 = len; - while (_g < _g1) do - _g = _g + 1; - local i = _g - 1; - self[len - i] = self[(len - i) - 1]; - end; - self[0] = x; -end -Array.prototype.insert = function(self,pos,x) - if (pos > self.length) then - pos = self.length; - end; - if (pos < 0) then - pos = self.length + pos; - if (pos < 0) then - pos = 0; - end; - end; - local cur_len = self.length; - while (cur_len > pos) do - self[cur_len] = self[cur_len - 1]; - cur_len = cur_len - 1; - end; - self[pos] = x; -end -Array.prototype.remove = function(self,x) - local _g = 0; - local _g1 = self.length; - while (_g < _g1) do - _g = _g + 1; - local i = _g - 1; - if (self[i] == x) then - local _g = i; - local _g1 = self.length - 1; - while (_g < _g1) do - _g = _g + 1; - local j = _g - 1; - self[j] = self[j + 1]; - end; - self[self.length - 1] = nil; - self.length = self.length - 1; - do return true end; - end; - end; - do return false end -end -Array.prototype.contains = function(self,x) - local _g = 0; - local _g1 = self.length; - while (_g < _g1) do - _g = _g + 1; - local i = _g - 1; - if (self[i] == x) then - do return true end; - end; - end; - do return false end -end -Array.prototype.indexOf = function(self,x,fromIndex) - local _end = self.length; - if (fromIndex == nil) then - fromIndex = 0; - else - if (fromIndex < 0) then - fromIndex = self.length + fromIndex; - if (fromIndex < 0) then - fromIndex = 0; - end; - end; - end; - local _g = fromIndex; - local _g1 = _end; - while (_g < _g1) do - _g = _g + 1; - local i = _g - 1; - if (x == self[i]) then - do return i end; - end; - end; - do return -1 end -end -Array.prototype.lastIndexOf = function(self,x,fromIndex) - if ((fromIndex == nil) or (fromIndex >= self.length)) then - fromIndex = self.length - 1; - else - if (fromIndex < 0) then - fromIndex = self.length + fromIndex; - if (fromIndex < 0) then - do return -1 end; - end; - end; - end; - local i = fromIndex; - while (i >= 0) do - if (self[i] == x) then - do return i end; - else - i = i - 1; - end; - end; - do return -1 end -end -Array.prototype.copy = function(self) - local _g = _hx_tab_array({}, 0); - local _g1 = 0; - local _g2 = self; - while (_g1 < _g2.length) do - local i = _g2[_g1]; - _g1 = _g1 + 1; - _g:push(i); - end; - do return _g end -end -Array.prototype.map = function(self,f) - local _g = _hx_tab_array({}, 0); - local _g1 = 0; - local _g2 = self; - while (_g1 < _g2.length) do - local i = _g2[_g1]; - _g1 = _g1 + 1; - _g:push(f(i)); - end; - do return _g end -end -Array.prototype.filter = function(self,f) - local _g = _hx_tab_array({}, 0); - local _g1 = 0; - local _g2 = self; - while (_g1 < _g2.length) do - local i = _g2[_g1]; - _g1 = _g1 + 1; - if (f(i)) then - _g:push(i); - end; - end; - do return _g end -end -Array.prototype.iterator = function(self) - do return __haxe_iterators_ArrayIterator.new(self) end -end -Array.prototype.keyValueIterator = function(self) - do return __haxe_iterators_ArrayKeyValueIterator.new(self) end -end -Array.prototype.resize = function(self,len) - if (self.length < len) then - self.length = len; - else - if (self.length > len) then - local _g = len; - local _g1 = self.length; - while (_g < _g1) do - _g = _g + 1; - local i = _g - 1; - self[i] = nil; - end; - self.length = len; - end; - end; -end - -Array.prototype.__class__ = Array - -EReg.new = function(r,opt) - local self = _hx_new(EReg.prototype) - EReg.super(self,r,opt) - return self -end -EReg.super = function(self,r,opt) - local ropt = 0; - local _g = 0; - local _g1 = __lua_lib_luautf8_Utf8.len(opt); - while (_g < _g1) do - _g = _g + 1; - local i = _g - 1; - local _g = __lua_lib_luautf8_Utf8.sub(opt, i + 1, i + 1); - if (_g) == "g" then - self.global = true; - elseif (_g) == "i" then - ropt = _hx_bit.bor(ropt,EReg.FLAGS.CASELESS); - elseif (_g) == "m" then - ropt = _hx_bit.bor(ropt,EReg.FLAGS.MULTILINE); - elseif (_g) == "s" then - ropt = _hx_bit.bor(ropt,EReg.FLAGS.DOTALL);else end; - end; - ropt = _hx_bit.bor(ropt,EReg.FLAGS.UTF8); - ropt = _hx_bit.bor(ropt,EReg.FLAGS.UCP); - if (self.global == nil) then - self.global = false; - end; - self.r = __lua_lib_lrexlib_Rex.new(r, ropt); -end -EReg.__name__ = true -EReg.prototype = _hx_e(); -EReg.prototype.match = function(self,s) - if (s == nil) then - do return false end; - else - self.m = _hx_table.pack(self.r:exec(s, 1)); - self.s = s; - do return self.m[1] ~= nil end; - end; -end -EReg.prototype.split = function(self,s) - if (self.global) then - do return __lua_Lib.fillArray(_hx_wrap_if_string_field(__lua_lib_lrexlib_Rex,'split')(s, self.r)) end; - else - local d = "#__delim__#"; - do return __lua_Lib.fillArray(_hx_wrap_if_string_field(__lua_lib_lrexlib_Rex,'split')(self:replace(s, d), d)) end; - end; -end -EReg.prototype.replace = function(self,s,by) - 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(by, "$$", idx, true); - else - if (idx >= __lua_lib_luautf8_Utf8.len(by)) then - newidx = nil; - else - newidx = idx + 1; - end; - end; - if (newidx ~= nil) then - local match = __lua_lib_luautf8_Utf8.sub(by, idx, newidx - 1); - ret:push(match); - idx = newidx + __lua_lib_luautf8_Utf8.len("$$"); - else - ret:push(__lua_lib_luautf8_Utf8.sub(by, idx, __lua_lib_luautf8_Utf8.len(by))); - idx = nil; - end; - end; - local chunks = ret; - local _g = _hx_tab_array({}, 0); - local _g1 = 0; - while (_g1 < chunks.length) do - local chunk = chunks[_g1]; - _g1 = _g1 + 1; - _g:push(__lua_lib_lrexlib_Rex.gsub(chunk, "\\$(\\d)", "%%%1", 1)); - end; - chunks = _g; - by = chunks:join("$"); - do return __lua_lib_lrexlib_Rex.gsub(s, self.r, by, (function() - local _hx_1 - if (self.global) then - _hx_1 = nil; else - _hx_1 = 1; end - return _hx_1 - end )()) end -end - -EReg.prototype.__class__ = EReg - -Math.new = {} -Math.__name__ = true -Math.isNaN = function(f) - do return f ~= f end; -end -Math.isFinite = function(f) - if (f > -_G.math.huge) then - do return f < _G.math.huge end; - else - do return false end; - end; -end -Math.min = function(a,b) - if (Math.isNaN(a) or Math.isNaN(b)) then - do return (0/0) end; - else - do return _G.math.min(a, b) end; - end; -end - -Reflect.new = {} -Reflect.__name__ = true -Reflect.field = function(o,field) - if (_G.type(o) == "string") then - if (field == "length") then - do return _hx_wrap_if_string_field(o,'length') end; - else - do return String.prototype[field] end; - end; - else - local _hx_status, _hx_result = pcall(function() - - do return o[field] end; - return _hx_pcall_default - end) - if not _hx_status and _hx_result == "_hx_pcall_break" then - elseif not _hx_status then - local _g = _hx_result; - do return nil end; - elseif _hx_result ~= _hx_pcall_default then - return _hx_result - end; - end; -end -Reflect.fields = function(o) - if (_G.type(o) == "string") then - do return Reflect.fields(String.prototype) end; - else - do return _hx_field_arr(o) end; - end; -end -Reflect.deleteField = function(o,field) - if (not ((function() - local _hx_1 - if ((_G.type(o) == "string") and ((String.prototype[field] ~= nil) or (field == "length"))) then - _hx_1 = true; elseif (o.__fields__ ~= nil) then - _hx_1 = o.__fields__[field] ~= nil; else - _hx_1 = o[field] ~= nil; end - return _hx_1 - end )())) then - do return false end; - end; - o[field] = nil; - o.__fields__[field] = nil; - do return true end; -end - -String.new = function(string) - local self = _hx_new(String.prototype) - String.super(self,string) - self = string - return self -end -String.super = function(self,string) -end -String.__name__ = true -String.__index = function(s,k) - if (k == "length") then - do return __lua_lib_luautf8_Utf8.len(s) end; - else - local o = String.prototype; - local field = k; - if ((function() - local _hx_1 - if ((_G.type(o) == "string") and ((String.prototype[field] ~= nil) or (field == "length"))) then - _hx_1 = true; elseif (o.__fields__ ~= nil) then - _hx_1 = o.__fields__[field] ~= nil; else - _hx_1 = o[field] ~= nil; end - return _hx_1 - end )()) then - do return String.prototype[k] end; - else - if (String.__oldindex ~= nil) then - if (_G.type(String.__oldindex) == "function") then - do return String.__oldindex(s, k) end; - else - if (_G.type(String.__oldindex) == "table") then - do return String.__oldindex[k] end; - end; - end; - do return nil end; - else - do return nil end; - end; - end; - end; -end -String.indexOfEmpty = function(s,startIndex) - local length = __lua_lib_luautf8_Utf8.len(s); - if (startIndex < 0) then - startIndex = length + startIndex; - if (startIndex < 0) then - startIndex = 0; - end; - end; - if (startIndex > length) then - do return length end; - else - do return startIndex end; - end; -end -String.fromCharCode = function(code) - do return __lua_lib_luautf8_Utf8.char(code) end; -end -String.prototype = _hx_e(); -String.prototype.toUpperCase = function(self) - do return __lua_lib_luautf8_Utf8.upper(self) end -end -String.prototype.toLowerCase = function(self) - do return __lua_lib_luautf8_Utf8.lower(self) end -end -String.prototype.indexOf = function(self,str,startIndex) - if (startIndex == nil) then - startIndex = 1; - else - startIndex = startIndex + 1; - end; - if (str == "") then - do return String.indexOfEmpty(self, startIndex - 1) end; - end; - local r = __lua_lib_luautf8_Utf8.find(self, str, startIndex, true); - if ((r ~= nil) and (r > 0)) then - do return r - 1 end; - else - do return -1 end; - end; -end -String.prototype.lastIndexOf = function(self,str,startIndex) - local ret = -1; - if (startIndex == nil) then - startIndex = __lua_lib_luautf8_Utf8.len(self); - end; - while (true) do - local startIndex1 = ret + 1; - if (startIndex1 == nil) then - startIndex1 = 1; - else - startIndex1 = startIndex1 + 1; - end; - local p; - if (str == "") then - p = String.indexOfEmpty(self, startIndex1 - 1); - else - local r = __lua_lib_luautf8_Utf8.find(self, str, startIndex1, true); - p = (function() - local _hx_1 - if ((r ~= nil) and (r > 0)) then - _hx_1 = r - 1; else - _hx_1 = -1; end - return _hx_1 - end )(); - end; - if (((p == -1) or (p > startIndex)) or (p == ret)) then - break; - end; - ret = p; - end; - do return ret end -end -String.prototype.split = function(self,delimiter) - local idx = 1; - local ret = _hx_tab_array({}, 0); - while (idx ~= nil) do - local newidx = 0; - if (__lua_lib_luautf8_Utf8.len(delimiter) > 0) then - newidx = __lua_lib_luautf8_Utf8.find(self, delimiter, idx, true); - else - if (idx >= __lua_lib_luautf8_Utf8.len(self)) then - newidx = nil; - else - newidx = idx + 1; - end; - end; - if (newidx ~= nil) then - local match = __lua_lib_luautf8_Utf8.sub(self, idx, newidx - 1); - ret:push(match); - idx = newidx + __lua_lib_luautf8_Utf8.len(delimiter); - else - ret:push(__lua_lib_luautf8_Utf8.sub(self, idx, __lua_lib_luautf8_Utf8.len(self))); - idx = nil; - end; - end; - do return ret end -end -String.prototype.toString = function(self) - do return self end -end -String.prototype.substring = function(self,startIndex,endIndex) - if (endIndex == nil) then - endIndex = __lua_lib_luautf8_Utf8.len(self); - end; - if (endIndex < 0) then - endIndex = 0; - end; - if (startIndex < 0) then - startIndex = 0; - end; - if (endIndex < startIndex) then - do return __lua_lib_luautf8_Utf8.sub(self, endIndex + 1, startIndex) end; - else - do return __lua_lib_luautf8_Utf8.sub(self, startIndex + 1, endIndex) end; - end; -end -String.prototype.charAt = function(self,index) - do return __lua_lib_luautf8_Utf8.sub(self, index + 1, index + 1) end -end -String.prototype.charCodeAt = function(self,index) - do return __lua_lib_luautf8_Utf8.byte(self, index + 1) end -end -String.prototype.substr = function(self,pos,len) - if ((len == nil) or (len > (pos + __lua_lib_luautf8_Utf8.len(self)))) then - len = __lua_lib_luautf8_Utf8.len(self); - else - if (len < 0) then - len = __lua_lib_luautf8_Utf8.len(self) + len; - end; - end; - if (pos < 0) then - pos = __lua_lib_luautf8_Utf8.len(self) + pos; - end; - if (pos < 0) then - pos = 0; - end; - do return __lua_lib_luautf8_Utf8.sub(self, pos + 1, pos + len) end -end - -String.prototype.__class__ = String - -Std.new = {} -Std.__name__ = true -Std.string = function(s) - do return _hx_tostring(s, 0) end; -end -Std.int = function(x) - if (not Math.isFinite(x) or Math.isNaN(x)) then - do return 0 end; - else - do return _hx_bit_clamp(x) end; - end; -end -Std.parseInt = function(x) - if (x == nil) then - do return nil end; - end; - local hexMatch = _G.string.match(x, "^[ \t\r\n]*([%-+]*0[xX][%da-fA-F]*)"); - if (hexMatch ~= nil) then - local sign; - local _g = __lua_lib_luautf8_Utf8.byte(hexMatch, 1); - if (_g) == 43 then - sign = 1; - elseif (_g) == 45 then - sign = -1;else - sign = 0; end; - local pos = (function() - local _hx_1 - if (sign == 0) then - _hx_1 = 2; else - _hx_1 = 3; end - return _hx_1 - end )(); - local len = nil; - if ((len == nil) or (len > (pos + __lua_lib_luautf8_Utf8.len(hexMatch)))) then - len = __lua_lib_luautf8_Utf8.len(hexMatch); - else - if (len < 0) then - len = __lua_lib_luautf8_Utf8.len(hexMatch) + len; - end; - end; - if (pos < 0) then - pos = __lua_lib_luautf8_Utf8.len(hexMatch) + pos; - end; - if (pos < 0) then - pos = 0; - end; - do return (function() - local _hx_2 - if (sign == -1) then - _hx_2 = -1; else - _hx_2 = 1; end - return _hx_2 - end )() * _G.tonumber(__lua_lib_luautf8_Utf8.sub(hexMatch, pos + 1, pos + len), 16) end; - else - local intMatch = _G.string.match(x, "^ *[%-+]?%d*"); - if (intMatch ~= nil) then - do return _G.tonumber(intMatch) end; - else - do return nil end; - end; - end; -end -Std.parseFloat = function(x) - if ((x == nil) or (x == "")) then - do return (0/0) end; - end; - local digitMatch = _G.string.match(x, "^ *[%.%-+]?[0-9]%d*"); - if (digitMatch == nil) then - do return (0/0) end; - end; - local pos = __lua_lib_luautf8_Utf8.len(digitMatch); - local len = nil; - if ((len == nil) or (len > (pos + __lua_lib_luautf8_Utf8.len(x)))) then - len = __lua_lib_luautf8_Utf8.len(x); - else - if (len < 0) then - len = __lua_lib_luautf8_Utf8.len(x) + len; - end; - end; - if (pos < 0) then - pos = __lua_lib_luautf8_Utf8.len(x) + pos; - end; - if (pos < 0) then - pos = 0; - end; - x = __lua_lib_luautf8_Utf8.sub(x, pos + 1, pos + len); - local decimalMatch = _G.string.match(x, "^%.%d*"); - if (decimalMatch == nil) then - decimalMatch = ""; - end; - local pos = __lua_lib_luautf8_Utf8.len(decimalMatch); - local len = nil; - if ((len == nil) or (len > (pos + __lua_lib_luautf8_Utf8.len(x)))) then - len = __lua_lib_luautf8_Utf8.len(x); - else - if (len < 0) then - len = __lua_lib_luautf8_Utf8.len(x) + len; - end; - end; - if (pos < 0) then - pos = __lua_lib_luautf8_Utf8.len(x) + pos; - end; - if (pos < 0) then - pos = 0; - end; - x = __lua_lib_luautf8_Utf8.sub(x, pos + 1, pos + len); - local eMatch = _G.string.match(x, "^[eE][+%-]?%d+"); - if (eMatch == nil) then - eMatch = ""; - end; - local result = _G.tonumber(Std.string(Std.string(digitMatch) .. Std.string(decimalMatch)) .. Std.string(eMatch)); - if (result ~= nil) then - do return result end; - else - do return (0/0) end; - end; -end - -StringTools.new = {} -StringTools.__name__ = true -StringTools.urlDecode = function(s) - s = _G.string.gsub(s, "+", " "); - s = _G.string.gsub(s, "%%(%x%x)", function(h) - do return _G.string.char(_G.tonumber(h, 16)) end; - end); - s = _G.string.gsub(s, "\r\n", "\n"); - do return s end; -end -StringTools.isSpace = function(s,pos) - if (((__lua_lib_luautf8_Utf8.len(s) == 0) or (pos < 0)) or (pos >= __lua_lib_luautf8_Utf8.len(s))) then - do return false end; - end; - local c = __lua_lib_luautf8_Utf8.byte(s, pos + 1); - if (not ((c > 8) and (c < 14))) then - do return c == 32 end; - else - do return true end; - end; -end -StringTools.ltrim = function(s) - local l = __lua_lib_luautf8_Utf8.len(s); - local r = 0; - while ((r < l) and StringTools.isSpace(s, r)) do - r = r + 1; - end; - if (r > 0) then - local pos = r; - local len = l - r; - if ((len == nil) or (len > (pos + __lua_lib_luautf8_Utf8.len(s)))) then - len = __lua_lib_luautf8_Utf8.len(s); - else - if (len < 0) then - len = __lua_lib_luautf8_Utf8.len(s) + len; - end; - end; - if (pos < 0) then - pos = __lua_lib_luautf8_Utf8.len(s) + pos; - end; - if (pos < 0) then - pos = 0; - end; - do return __lua_lib_luautf8_Utf8.sub(s, pos + 1, pos + len) end; - else - do return s end; - end; -end -StringTools.rtrim = function(s) - local l = __lua_lib_luautf8_Utf8.len(s); - local r = 0; - while ((r < l) and StringTools.isSpace(s, (l - r) - 1)) do - r = r + 1; - end; - if (r > 0) then - local pos = 0; - local len = l - r; - if ((len == nil) or (len > (pos + __lua_lib_luautf8_Utf8.len(s)))) then - len = __lua_lib_luautf8_Utf8.len(s); - else - if (len < 0) then - len = __lua_lib_luautf8_Utf8.len(s) + len; - end; - end; - if (pos < 0) then - pos = __lua_lib_luautf8_Utf8.len(s) + pos; - end; - if (pos < 0) then - pos = 0; - end; - do return __lua_lib_luautf8_Utf8.sub(s, pos + 1, pos + len) end; - else - do return s end; - end; -end -StringTools.trim = function(s) - do return StringTools.ltrim(StringTools.rtrim(s)) end; -end -StringTools.replace = function(s,sub,by) - local idx = 1; - local ret = _hx_tab_array({}, 0); - while (idx ~= nil) do - local newidx = 0; - if (__lua_lib_luautf8_Utf8.len(sub) > 0) then - newidx = __lua_lib_luautf8_Utf8.find(s, sub, idx, true); - else - if (idx >= __lua_lib_luautf8_Utf8.len(s)) then - newidx = nil; - else - newidx = idx + 1; - end; - end; - if (newidx ~= nil) then - local match = __lua_lib_luautf8_Utf8.sub(s, idx, newidx - 1); - ret:push(match); - idx = newidx + __lua_lib_luautf8_Utf8.len(sub); - else - ret:push(__lua_lib_luautf8_Utf8.sub(s, idx, __lua_lib_luautf8_Utf8.len(s))); - idx = nil; - end; - end; - do return ret:join(by) end; -end - -__haxe_IMap.new = {} -__haxe_IMap.__name__ = true - -__haxe_Exception.new = function(message,previous,native) - local self = _hx_new(__haxe_Exception.prototype) - __haxe_Exception.super(self,message,previous,native) - return self -end -__haxe_Exception.super = function(self,message,previous,native) - self.__skipStack = 0; - self.__exceptionMessage = message; - self.__previousException = previous; - if (native ~= nil) then - self.__nativeException = native; - self.__nativeStack = __haxe_NativeStackTrace.exceptionStack(); - else - self.__nativeException = self; - self.__nativeStack = __haxe_NativeStackTrace.callStack(); - self.__skipStack = 1; - end; -end -__haxe_Exception.__name__ = true -__haxe_Exception.thrown = function(value) - if (__lua_Boot.__instanceof(value, __haxe_Exception)) then - do return value:get_native() end; - else - local e = __haxe_ValueException.new(value); - e.__skipStack = e.__skipStack + 1; - do return e end; - end; -end -__haxe_Exception.prototype = _hx_e(); -__haxe_Exception.prototype.get_native = function(self) - do return self.__nativeException end -end - -__haxe_Exception.prototype.__class__ = __haxe_Exception - -__haxe_Log.new = {} -__haxe_Log.__name__ = true -__haxe_Log.formatOutput = function(v,infos) - local str = Std.string(v); - if (infos == nil) then - do return str end; - end; - local pstr = Std.string(Std.string(infos.fileName) .. Std.string(":")) .. Std.string(infos.lineNumber); - if (infos.customParams ~= nil) then - local _g = 0; - local _g1 = infos.customParams; - while (_g < _g1.length) do - local v = _g1[_g]; - _g = _g + 1; - str = Std.string(str) .. Std.string((Std.string(", ") .. Std.string(Std.string(v)))); - end; - end; - do return Std.string(Std.string(pstr) .. Std.string(": ")) .. Std.string(str) end; -end -__haxe_Log.trace = function(v,infos) - local str = __haxe_Log.formatOutput(v, infos); - _hx_print(str); -end - -__haxe_NativeStackTrace.new = {} -__haxe_NativeStackTrace.__name__ = true -__haxe_NativeStackTrace.saveStack = function(exception) -end -__haxe_NativeStackTrace.callStack = function() - local _g = debug.traceback(); - if (_g == nil) then - do return _hx_tab_array({}, 0) end; - else - local s = _g; - local idx = 1; - local ret = _hx_tab_array({}, 0); - while (idx ~= nil) do - local newidx = 0; - if (__lua_lib_luautf8_Utf8.len("\n") > 0) then - newidx = __lua_lib_luautf8_Utf8.find(s, "\n", idx, true); - else - if (idx >= __lua_lib_luautf8_Utf8.len(s)) then - newidx = nil; - else - newidx = idx + 1; - end; - end; - if (newidx ~= nil) then - local match = __lua_lib_luautf8_Utf8.sub(s, idx, newidx - 1); - ret:push(match); - idx = newidx + __lua_lib_luautf8_Utf8.len("\n"); - else - ret:push(__lua_lib_luautf8_Utf8.sub(s, idx, __lua_lib_luautf8_Utf8.len(s))); - idx = nil; - end; - end; - do return ret:slice(3) end; - end; -end -__haxe_NativeStackTrace.exceptionStack = function() - do return _hx_tab_array({}, 0) end; -end - -__haxe_ValueException.new = function(value,previous,native) - local self = _hx_new(__haxe_ValueException.prototype) - __haxe_ValueException.super(self,value,previous,native) - return self -end -__haxe_ValueException.super = function(self,value,previous,native) - __haxe_Exception.super(self,Std.string(value),previous,native); - self.value = value; -end -__haxe_ValueException.__name__ = true -__haxe_ValueException.prototype = _hx_e(); - -__haxe_ValueException.prototype.__class__ = __haxe_ValueException -__haxe_ValueException.__super__ = __haxe_Exception -setmetatable(__haxe_ValueException.prototype,{__index=__haxe_Exception.prototype}) - -__haxe_ds_StringMap.new = {} -__haxe_ds_StringMap.__name__ = true -__haxe_ds_StringMap.__interfaces__ = {__haxe_IMap} - -__haxe_iterators_ArrayIterator.new = function(array) - local self = _hx_new(__haxe_iterators_ArrayIterator.prototype) - __haxe_iterators_ArrayIterator.super(self,array) - return self -end -__haxe_iterators_ArrayIterator.super = function(self,array) - self.current = 0; - self.array = array; -end -__haxe_iterators_ArrayIterator.__name__ = true -__haxe_iterators_ArrayIterator.prototype = _hx_e(); -__haxe_iterators_ArrayIterator.prototype.hasNext = function(self) - do return self.current < self.array.length end -end -__haxe_iterators_ArrayIterator.prototype.next = function(self) - do return self.array[(function() - local _hx_obj = self; - local _hx_fld = 'current'; - local _ = _hx_obj[_hx_fld]; - _hx_obj[_hx_fld] = _hx_obj[_hx_fld] + 1; - return _; - end)()] end -end - -__haxe_iterators_ArrayIterator.prototype.__class__ = __haxe_iterators_ArrayIterator - -__haxe_iterators_ArrayKeyValueIterator.new = function(array) - local self = _hx_new(__haxe_iterators_ArrayKeyValueIterator.prototype) - __haxe_iterators_ArrayKeyValueIterator.super(self,array) - return self -end -__haxe_iterators_ArrayKeyValueIterator.super = function(self,array) - self.array = array; -end -__haxe_iterators_ArrayKeyValueIterator.__name__ = true -__haxe_iterators_ArrayKeyValueIterator.prototype = _hx_e(); - -__haxe_iterators_ArrayKeyValueIterator.prototype.__class__ = __haxe_iterators_ArrayKeyValueIterator - -__lua_Boot.new = {} -__lua_Boot.__name__ = true -__lua_Boot.__instanceof = function(o,cl) - if (cl == nil) then - do return false end; - end; - local cl1 = cl; - if (cl1) == Array then - do return __lua_Boot.isArray(o) end; - elseif (cl1) == Bool then - do return _G.type(o) == "boolean" end; - elseif (cl1) == Dynamic then - do return o ~= nil end; - elseif (cl1) == Float then - do return _G.type(o) == "number" end; - elseif (cl1) == Int then - if (_G.type(o) == "number") then - do return _hx_bit_clamp(o) == o end; - else - do return false end; - end; - elseif (cl1) == String then - do return _G.type(o) == "string" end; - elseif (cl1) == _G.table then - do return _G.type(o) == "table" end; - elseif (cl1) == __lua_Thread then - do return _G.type(o) == "thread" end; - elseif (cl1) == __lua_UserData then - do return _G.type(o) == "userdata" end;else - if (((o ~= nil) and (_G.type(o) == "table")) and (_G.type(cl) == "table")) then - local tmp; - if (__lua_Boot.__instanceof(o, Array)) then - tmp = Array; - else - if (__lua_Boot.__instanceof(o, String)) then - tmp = String; - else - local cl = o.__class__; - tmp = (function() - local _hx_1 - if (cl ~= nil) then - _hx_1 = cl; else - _hx_1 = nil; end - return _hx_1 - end )(); - end; - end; - if (__lua_Boot.extendsOrImplements(tmp, cl)) then - do return true end; - end; - if ((function() - local _hx_2 - if (cl == Class) then - _hx_2 = o.__name__ ~= nil; else - _hx_2 = false; end - return _hx_2 - end )()) then - do return true end; - end; - if ((function() - local _hx_3 - if (cl == Enum) then - _hx_3 = o.__ename__ ~= nil; else - _hx_3 = false; end - return _hx_3 - end )()) then - do return true end; - end; - do return o.__enum__ == cl end; - else - do return false end; - end; end; -end -__lua_Boot.isArray = function(o) - if (_G.type(o) == "table") then - if ((o.__enum__ == nil) and (_G.getmetatable(o) ~= nil)) then - do return _G.getmetatable(o).__index == Array.prototype end; - else - do return false end; - end; - else - do return false end; - end; -end -__lua_Boot.extendsOrImplements = function(cl1,cl2) - if ((cl1 == nil) or (cl2 == nil)) then - do return false end; - else - if (cl1 == cl2) then - do return true end; - else - if (cl1.__interfaces__ ~= nil) then - local intf = cl1.__interfaces__; - local _g = 1; - local _g1 = _hx_table.maxn(intf) + 1; - while (_g < _g1) do - _g = _g + 1; - local i = _g - 1; - if (__lua_Boot.extendsOrImplements(intf[i], cl2)) then - do return true end; - end; - end; - end; - end; - end; - do return __lua_Boot.extendsOrImplements(cl1.__super__, cl2) end; -end - -__lua_UserData.new = {} -__lua_UserData.__name__ = true - -__lua_Lib.new = {} -__lua_Lib.__name__ = true -__lua_Lib.fillArray = function(itr) - local i = nil; - local ret = _hx_tab_array({}, 0); - while (true) do - i = itr(); - if (not (i ~= nil)) then - break; - end; - ret:push(i); - end; - do return ret end; -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,resultMap) - local Frag_h = ({}); - 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_PREDEFINED_VIEW); - 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_STRING); - if (value1 == nil) then - Frag_h.class = __haxe_ds_StringMap.tnull; - else - Frag_h.class = 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(_hx_bit.bor(_hx_bit.bor(_hx_bit.bor(__xrfragment_XRF.PV_OVERRIDE,__xrfragment_XRF.ROUNDROBIN),__xrfragment_XRF.T_VECTOR3),__xrfragment_XRF.T_STRING_OBJ),__xrfragment_XRF.EMBEDDED),__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.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(_hx_bit.bor(__xrfragment_XRF.PV_OVERRIDE,__xrfragment_XRF.T_STRING),__xrfragment_XRF.EMBEDDED); - 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(_hx_bit.bor(__xrfragment_XRF.QUERY_OPERATOR,__xrfragment_XRF.PV_OVERRIDE),__xrfragment_XRF.ROUNDROBIN),__xrfragment_XRF.T_VECTOR3),__xrfragment_XRF.EMBEDDED); - 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(_hx_bit.bor(__xrfragment_XRF.QUERY_OPERATOR,__xrfragment_XRF.PV_OVERRIDE),__xrfragment_XRF.ROUNDROBIN),__xrfragment_XRF.T_VECTOR3),__xrfragment_XRF.EMBEDDED),__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(__xrfragment_XRF.QUERY_OPERATOR,__xrfragment_XRF.PV_OVERRIDE),__xrfragment_XRF.ROUNDROBIN),__xrfragment_XRF.T_VECTOR3),__xrfragment_XRF.EMBEDDED); - if (value1 == nil) then - Frag_h.translate = __haxe_ds_StringMap.tnull; - else - Frag_h.translate = value1; - end; - local value1 = _hx_bit.bor(_hx_bit.bor(_hx_bit.bor(_hx_bit.bor(__xrfragment_XRF.QUERY_OPERATOR,__xrfragment_XRF.PV_OVERRIDE),__xrfragment_XRF.ROUNDROBIN),__xrfragment_XRF.T_INT),__xrfragment_XRF.EMBEDDED); - if (value1 == nil) then - Frag_h.visible = __haxe_ds_StringMap.tnull; - else - Frag_h.visible = value1; - end; - local value1 = _hx_bit.bor(_hx_bit.bor(_hx_bit.bor(__xrfragment_XRF.ASSET,__xrfragment_XRF.PV_OVERRIDE),__xrfragment_XRF.T_STRING),__xrfragment_XRF.EMBEDDED); - 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(__xrfragment_XRF.ASSET,__xrfragment_XRF.PV_OVERRIDE),__xrfragment_XRF.ROUNDROBIN),__xrfragment_XRF.T_VECTOR2),__xrfragment_XRF.NAVIGATOR),__xrfragment_XRF.EMBEDDED); - 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(__xrfragment_XRF.ASSET,__xrfragment_XRF.PV_OVERRIDE),__xrfragment_XRF.T_VECTOR3),__xrfragment_XRF.EMBEDDED); - 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.EMBEDDED); - 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.EMBEDDED); - 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.EMBEDDED); - 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_STRING),__xrfragment_XRF.NAVIGATOR),__xrfragment_XRF.EMBEDDED); - if (value1 == nil) then - Frag_h.fog = __haxe_ds_StringMap.tnull; - else - Frag_h.fog = 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.EMBEDDED),__xrfragment_XRF.PROMPT); - if (value1 == nil) then - Frag_h.session = __haxe_ds_StringMap.tnull; - else - Frag_h.session = value1; - end; - if ((__lua_lib_luautf8_Utf8.len(value) == 0) and (Frag_h[key] == nil)) then - local value = __xrfragment_XRF.new(key, _hx_bit.bor(__xrfragment_XRF.PV_EXECUTE,__xrfragment_XRF.NAVIGATOR)); - resultMap[key] = value; - do return true end; - end; - local tmp; - 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(key, ".", idx, true); - else - if (idx >= __lua_lib_luautf8_Utf8.len(key)) then - newidx = nil; - else - newidx = idx + 1; - end; - end; - if (newidx ~= nil) then - local match = __lua_lib_luautf8_Utf8.sub(key, idx, newidx - 1); - ret:push(match); - idx = newidx + __lua_lib_luautf8_Utf8.len("."); - else - ret:push(__lua_lib_luautf8_Utf8.sub(key, idx, __lua_lib_luautf8_Utf8.len(key))); - idx = nil; - end; - end; - 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(value, ".", idx, true); - else - if (idx >= __lua_lib_luautf8_Utf8.len(value)) then - newidx = nil; - else - newidx = idx + 1; - end; - end; - if (newidx ~= nil) then - local match = __lua_lib_luautf8_Utf8.sub(value, idx, newidx - 1); - ret:push(match); - idx = newidx + __lua_lib_luautf8_Utf8.len("."); - else - ret:push(__lua_lib_luautf8_Utf8.sub(value, idx, __lua_lib_luautf8_Utf8.len(value))); - idx = nil; - end; - end; - tmp = ret.length > 1; - else - tmp = false; - end; - if (tmp) then - local value = __xrfragment_XRF.new(key, _hx_bit.bor(_hx_bit.bor(_hx_bit.bor(__xrfragment_XRF.ASSET,__xrfragment_XRF.PV_OVERRIDE),__xrfragment_XRF.T_STRING),__xrfragment_XRF.PROP_BIND)); - resultMap[key] = value; - do return true end; - end; - if (Frag_h[key] ~= nil) then - local ret = Frag_h[key]; - if (ret == __haxe_ds_StringMap.tnull) then - ret = nil; - end; - local v = __xrfragment_XRF.new(key, ret); - if (not v:validate(value)) then - __haxe_Log.trace(Std.string(Std.string(Std.string(Std.string("⚠ 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=75,className="xrfragment.Parser",methodName="parse"})); - do return false end; - end; - 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=78,className="xrfragment.Parser",methodName="parse"})); - end; - resultMap[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) - return self -end -__xrfragment_Query.super = function(self,str) - self.isNumber = EReg.new("^[0-9\\.]+$", ""); - self.isClass = EReg.new("^[-]?class$", ""); - self.isExclude = EReg.new("^-", ""); - self.isProp = EReg.new("^.*:[><=!]?", ""); - 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 -end -__xrfragment_Query.prototype.expandAliases = function(self,token) - local classAlias = EReg.new("^(-)?\\.", ""); - if (classAlias:match(token)) then - do return StringTools.replace(token, ".", "class:") end; - else - do return token end; - end; -end -__xrfragment_Query.prototype.get = function(self) - do return self.q end -end -__xrfragment_Query.prototype.parse = function(self,str,recurse) - if (recurse == nil) then - recurse = false; - end; - local _gthis = self; - 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 token = ret; - local q = _hx_e(); - local process = function(str,prefix) - if (prefix == nil) then - prefix = ""; - end; - str = StringTools.trim(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; - end; - local k = ret[0]; - 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 v = ret[1]; - local filter = _hx_e(); - 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 - local oper = ""; - 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_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 - if ((r ~= nil) and (r > 0)) then - _hx_3 = r - 1; else - _hx_3 = -1; end - return _hx_3 - 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_4 - if ((r ~= nil) and (r > 0)) then - _hx_4 = r - 1; else - _hx_4 = -1; end - return _hx_4 - 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 = "!="; - local pos = 1; - local len = nil; - if ((len == nil) or (len > (pos + __lua_lib_luautf8_Utf8.len(k)))) then - len = __lua_lib_luautf8_Utf8.len(k); - else - if (len < 0) then - len = __lua_lib_luautf8_Utf8.len(k) + len; - end; - end; - if (pos < 0) then - pos = __lua_lib_luautf8_Utf8.len(k) + pos; - end; - if (pos < 0) then - 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; - if (__lua_lib_luautf8_Utf8.len(oper) == 0) then - oper = "="; - end; - if (_gthis.isClass:match(k)) then - local value = oper ~= "!="; - filter[Std.string(prefix) .. Std.string(k)] = value; - q[v] = filter; - else - local rule = _hx_e(); - if (_gthis.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; - end; - 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 key; - 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; - key = __lua_lib_luautf8_Utf8.sub(str, pos + 1, pos + len); - else - key = str; - end; - q[key] = filter; - end; - end; - local _g = 0; - local _g1 = token.length; - while (_g < _g1) do - _g = _g + 1; - local i = _g - 1; - process(self:expandAliases(token[i])); - end; - self.q = q do return self.q end -end -__xrfragment_Query.prototype.test = function(self,obj) - local qualify = false; - local _g = 0; - local _g1 = Reflect.fields(obj); - while (_g < _g1.length) do - local k = _g1[_g]; - _g = _g + 1; - local v = Std.string(Reflect.field(obj, k)); - if (self:testProperty(k, v)) then - qualify = true; - end; - end; - local _g = 0; - local _g1 = Reflect.fields(obj); - while (_g < _g1.length) do - local k = _g1[_g]; - _g = _g + 1; - local v = Std.string(Reflect.field(obj, k)); - if (self:testProperty(k, v, true)) then - qualify = false; - end; - end; - do return qualify end -end -__xrfragment_Query.prototype.testProperty = function(self,property,value,exclude) - local conds = 0; - local fails = 0; - local qualify = 0; - local testprop = function(expr) - conds = conds + 1; - fails = fails + (function() - local _hx_1 - if (expr) then - _hx_1 = 0; else - _hx_1 = 1; end - return _hx_1 - end )(); - do return expr end; - end; - if (Reflect.field(self.q, value) ~= nil) then - local v = Reflect.field(self.q, value); - if (Reflect.field(v, property) ~= nil) then - 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; - 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_URI.new = {} -_hx_exports["xrfragment"]["URI"] = __xrfragment_URI -__xrfragment_URI.__name__ = true -__xrfragment_URI.parse = function(url,filter) - local store = _hx_e(); - local startIndex = nil; - if (startIndex == nil) then - startIndex = 1; - else - startIndex = startIndex + 1; - end; - local r = __lua_lib_luautf8_Utf8.find(url, "#", startIndex, true); - if ((function() - local _hx_1 - if ((r ~= nil) and (r > 0)) then - _hx_1 = r - 1; else - _hx_1 = -1; end - return _hx_1 - end )() == -1) then - do return store end; - end; - local idx = 1; - local ret = _hx_tab_array({}, 0); - while (idx ~= nil) do - local newidx = 0; - if (__lua_lib_luautf8_Utf8.len("#") > 0) then - newidx = __lua_lib_luautf8_Utf8.find(url, "#", idx, true); - else - if (idx >= __lua_lib_luautf8_Utf8.len(url)) then - newidx = nil; - else - newidx = idx + 1; - end; - end; - if (newidx ~= nil) then - local match = __lua_lib_luautf8_Utf8.sub(url, idx, newidx - 1); - ret:push(match); - idx = newidx + __lua_lib_luautf8_Utf8.len("#"); - else - ret:push(__lua_lib_luautf8_Utf8.sub(url, idx, __lua_lib_luautf8_Utf8.len(url))); - idx = nil; - end; - end; - local fragment = ret; - local _this = fragment[1]; - 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(_this, "&", idx, true); - else - if (idx >= __lua_lib_luautf8_Utf8.len(_this)) then - newidx = nil; - else - newidx = idx + 1; - end; - end; - if (newidx ~= nil) then - local match = __lua_lib_luautf8_Utf8.sub(_this, idx, newidx - 1); - ret:push(match); - idx = newidx + __lua_lib_luautf8_Utf8.len("&"); - else - ret:push(__lua_lib_luautf8_Utf8.sub(_this, idx, __lua_lib_luautf8_Utf8.len(_this))); - idx = nil; - end; - end; - local splitArray = ret; - local _g = 0; - local _g1 = splitArray.length; - while (_g < _g1) do - _g = _g + 1; - local i = _g - 1; - local _this = splitArray[i]; - 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(_this, "=", idx, true); - else - if (idx >= __lua_lib_luautf8_Utf8.len(_this)) then - newidx = nil; - else - newidx = idx + 1; - end; - end; - if (newidx ~= nil) then - local match = __lua_lib_luautf8_Utf8.sub(_this, idx, newidx - 1); - ret:push(match); - idx = newidx + __lua_lib_luautf8_Utf8.len("="); - else - ret:push(__lua_lib_luautf8_Utf8.sub(_this, idx, __lua_lib_luautf8_Utf8.len(_this))); - idx = nil; - end; - end; - local splitByEqual = ret; - local regexPlus = EReg.new("\\+", "g"); - local key = splitByEqual[0]; - local value = ""; - if (splitByEqual.length > 1) then - value = StringTools.urlDecode(regexPlus:split(splitByEqual[1]):join(" ")); - end; - local ok = __xrfragment_Parser.parse(key, value, store); - end; - if ((filter ~= nil) and (filter ~= 0)) then - local _g = 0; - local _g1 = Reflect.fields(store); - while (_g < _g1.length) do - local key = _g1[_g]; - _g = _g + 1; - local xrf = Reflect.field(store, key); - if (not xrf:is(filter)) then - Reflect.deleteField(store, key); - end; - end; - end; - do return store end; -end - -__xrfragment_XRF.new = function(_fragment,_flags) - local self = _hx_new(__xrfragment_XRF.prototype) - __xrfragment_XRF.super(self,_fragment,_flags) - return self -end -__xrfragment_XRF.super = function(self,_fragment,_flags) - self.fragment = _fragment; - self.flags = _flags; -end -_hx_exports["xrfragment"]["XRF"] = __xrfragment_XRF -__xrfragment_XRF.__name__ = true -__xrfragment_XRF.set = function(flag,flags) - do return _hx_bit.bor(flags,flag) end; -end -__xrfragment_XRF.unset = function(flag,flags) - do return _hx_bit.band(flags,_hx_bit.bnot(flag)) end; -end -__xrfragment_XRF.prototype = _hx_e(); -__xrfragment_XRF.prototype.is = function(self,flag) - do return (_hx_bit.band(self.flags,flag)) ~= 0 end -end -__xrfragment_XRF.prototype.validate = function(self,value) - self:guessType(self, value); - 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(value, "|", idx, true); - else - if (idx >= __lua_lib_luautf8_Utf8.len(value)) then - newidx = nil; - else - newidx = idx + 1; - end; - end; - if (newidx ~= nil) then - local match = __lua_lib_luautf8_Utf8.sub(value, idx, newidx - 1); - ret:push(match); - idx = newidx + __lua_lib_luautf8_Utf8.len("|"); - else - ret:push(__lua_lib_luautf8_Utf8.sub(value, idx, __lua_lib_luautf8_Utf8.len(value))); - idx = nil; - end; - end; - if (ret.length > 1) then - self.args = Array.new(); - 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(value, "|", idx, true); - else - if (idx >= __lua_lib_luautf8_Utf8.len(value)) then - newidx = nil; - else - newidx = idx + 1; - end; - end; - if (newidx ~= nil) then - local match = __lua_lib_luautf8_Utf8.sub(value, idx, newidx - 1); - ret:push(match); - idx = newidx + __lua_lib_luautf8_Utf8.len("|"); - else - ret:push(__lua_lib_luautf8_Utf8.sub(value, idx, __lua_lib_luautf8_Utf8.len(value))); - idx = nil; - end; - end; - local args = ret; - local _g = 0; - local _g1 = args.length; - while (_g < _g1) do - _g = _g + 1; - local i = _g - 1; - local x = __xrfragment_XRF.new(self.fragment, self.flags); - self:guessType(x, args[i]); - self.args:push(x); - end; - end; - if (self.fragment == "q") then - self.query = __xrfragment_Query.new(value):get(); - end; - local ok = true; - if (not __lua_Boot.__instanceof(self.args, Array)) then - if (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; - if (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 (self:is(__xrfragment_XRF.T_INT) and not __lua_Boot.__instanceof(self.int, Int)) then - ok = false; - end; - 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; - end; - 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 xyz = ret; - if (xyz.length > 0) then - v.x = Std.parseFloat(xyz[0]); - end; - if (xyz.length > 1) then - v.y = Std.parseFloat(xyz[1]); - end; - if (xyz.length > 2) then - v.z = Std.parseFloat(xyz[2]); - end; - end; - if (__xrfragment_XRF.isColor:match(str)) then - v.color = str; - end; - if (__xrfragment_XRF.isFloat:match(str)) then - v.float = Std.parseFloat(str); - end; - if (__xrfragment_XRF.isInt:match(str)) then - v.int = Std.parseInt(str); - end; -end - -__xrfragment_XRF.prototype.__class__ = __xrfragment_XRF --- require this for lua 5.1 -pcall(require, 'bit') -if bit then - _hx_bit_raw = bit - _hx_bit = setmetatable({}, { __index = _hx_bit_raw }); -else - _hx_bit_raw = _G.require('bit32') - _hx_bit = setmetatable({}, { __index = _hx_bit_raw }); - -- lua 5.2 weirdness - _hx_bit.bnot = function(...) return _hx_bit_clamp(_hx_bit_raw.bnot(...)) end; - _hx_bit.bxor = function(...) return _hx_bit_clamp(_hx_bit_raw.bxor(...)) end; -end --- see https://github.com/HaxeFoundation/haxe/issues/8849 -_hx_bit.bor = function(...) return _hx_bit_clamp(_hx_bit_raw.bor(...)) end; -_hx_bit.band = function(...) return _hx_bit_clamp(_hx_bit_raw.band(...)) end; -_hx_bit.arshift = function(...) return _hx_bit_clamp(_hx_bit_raw.arshift(...)) end; - -if _hx_bit_raw then - _hx_bit_clamp = function(v) - if v <= 2147483647 and v >= -2147483648 then - if v > 0 then return _G.math.floor(v) - else return _G.math.ceil(v) - end - end - if v > 2251798999999999 then v = v*2 end; - if (v ~= v or math.abs(v) == _G.math.huge) then return nil end - return _hx_bit_raw.band(v, 2147483647 ) - math.abs(_hx_bit_raw.band(v, 2147483648)) - end -else - _hx_bit_clamp = function(v) - if v < -2147483648 then - return -2147483648 - elseif v > 2147483647 then - return 2147483647 - elseif v > 0 then - return _G.math.floor(v) - else - return _G.math.ceil(v) - end - end -end; - - - -_hx_array_mt.__index = Array.prototype - -local _hx_static_init = function() - - if (__lua_lib_lrexlib_Rex == nil) then - _G.error(__haxe_Exception.thrown("Rex is missing. Please install lrexlib-pcre."),0); - end; - String.__name__ = true; - Array.__name__ = true;EReg.FLAGS = __lua_lib_lrexlib_Rex.flags(); - - __haxe_ds_StringMap.tnull = ({}); - - __xrfragment_Parser.error = ""; - - __xrfragment_Parser.debug = false; - - __xrfragment_XRF.ASSET = 1; - - __xrfragment_XRF.PROP_BIND = 2; - - __xrfragment_XRF.QUERY_OPERATOR = 4; - - __xrfragment_XRF.PROMPT = 8; - - __xrfragment_XRF.ROUNDROBIN = 16; - - __xrfragment_XRF.NAVIGATOR = 32; - - __xrfragment_XRF.EMBEDDED = 64; - - __xrfragment_XRF.PV_OVERRIDE = 128; - - __xrfragment_XRF.PV_EXECUTE = 256; - - __xrfragment_XRF.T_COLOR = 8192; - - __xrfragment_XRF.T_INT = 16384; - - __xrfragment_XRF.T_FLOAT = 32768; - - __xrfragment_XRF.T_VECTOR2 = 65536; - - __xrfragment_XRF.T_VECTOR3 = 131072; - - __xrfragment_XRF.T_URL = 262144; - - __xrfragment_XRF.T_PREDEFINED_VIEW = 524288; - - __xrfragment_XRF.T_STRING = 1048576; - - __xrfragment_XRF.T_STRING_OBJ = 2097152; - - __xrfragment_XRF.T_STRING_OBJ_PROP = 4194304; - - __xrfragment_XRF.isColor = EReg.new("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$", ""); - - __xrfragment_XRF.isInt = EReg.new("^[0-9]+$", ""); - - __xrfragment_XRF.isFloat = EReg.new("^[0-9]+\\.[0-9]+$", ""); - - __xrfragment_XRF.isVector = EReg.new("([,]+|\\w)", ""); - - __xrfragment_XRF.isUrl = EReg.new("(://)?\\..*", ""); - - __xrfragment_XRF.isUrlOrPretypedView = EReg.new("(^#|://)?\\..*", ""); - - __xrfragment_XRF.isString = EReg.new(".*", ""); - - -end - -_hx_print = print or (function() end) - -_hx_table = {} -_hx_table.pack = _G.table.pack or function(...) - return {...} -end -_hx_table.unpack = _G.table.unpack or _G.unpack -_hx_table.maxn = _G.table.maxn or function(t) - local maxn=0; - for i in pairs(t) do - maxn=type(i)=='number'and i>maxn and i or maxn - end - return maxn -end; - -_hx_wrap_if_string_field = function(o, fld) - if _G.type(o) == 'string' then - if fld == 'length' then - return _G.string.len(o) - else - return String.prototype[fld] - end - else - return o[fld] - end -end - -_hx_static_init(); -return _hx_exports diff --git a/dist/xrfragment.module.js b/dist/xrfragment.module.js deleted file mode 100644 index 1640063..0000000 --- a/dist/xrfragment.module.js +++ /dev/null @@ -1,599 +0,0 @@ -// SPDX-License-Identifier: MPL-2.0 -// Copyright (c) 2023 Leon van Kammen/NLNET - -var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; -(function ($global) { "use strict"; -$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; -var EReg = function(r,opt) { - this.r = new RegExp(r,opt.split("u").join("")); -}; -EReg.__name__ = true; -EReg.prototype = { - match: function(s) { - if(this.r.global) { - this.r.lastIndex = 0; - } - this.r.m = this.r.exec(s); - this.r.s = s; - return this.r.m != null; - } - ,split: function(s) { - var d = "#__delim__#"; - return s.replace(this.r,d).split(d); - } -}; -var HxOverrides = function() { }; -HxOverrides.__name__ = true; -HxOverrides.cca = function(s,index) { - var x = s.charCodeAt(index); - if(x != x) { - return undefined; - } - return x; -}; -HxOverrides.substr = function(s,pos,len) { - if(len == null) { - len = s.length; - } else if(len < 0) { - if(pos == 0) { - len = s.length + len; - } else { - return ""; - } - } - return s.substr(pos,len); -}; -HxOverrides.now = function() { - return Date.now(); -}; -Math.__name__ = true; -var Reflect = function() { }; -Reflect.__name__ = true; -Reflect.field = function(o,field) { - try { - return o[field]; - } catch( _g ) { - return null; - } -}; -Reflect.fields = function(o) { - var a = []; - if(o != null) { - var hasOwnProperty = Object.prototype.hasOwnProperty; - for( var f in o ) { - if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { - a.push(f); - } - } - } - return a; -}; -Reflect.deleteField = function(o,field) { - if(!Object.prototype.hasOwnProperty.call(o,field)) { - return false; - } - delete(o[field]); - return true; -}; -var Std = function() { }; -Std.__name__ = true; -Std.string = function(s) { - return js_Boot.__string_rec(s,""); -}; -Std.parseInt = function(x) { - if(x != null) { - var _g = 0; - var _g1 = x.length; - while(_g < _g1) { - var i = _g++; - var c = x.charCodeAt(i); - if(c <= 8 || c >= 14 && c != 32 && c != 45) { - var nc = x.charCodeAt(i + 1); - var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); - if(isNaN(v)) { - return null; - } else { - return v; - } - } - } - } - return null; -}; -var StringTools = function() { }; -StringTools.__name__ = true; -StringTools.isSpace = function(s,pos) { - var c = HxOverrides.cca(s,pos); - if(!(c > 8 && c < 14)) { - return c == 32; - } else { - return true; - } -}; -StringTools.ltrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,r)) ++r; - if(r > 0) { - return HxOverrides.substr(s,r,l - r); - } else { - return s; - } -}; -StringTools.rtrim = function(s) { - var l = s.length; - var r = 0; - while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; - if(r > 0) { - return HxOverrides.substr(s,0,l - r); - } else { - return s; - } -}; -StringTools.trim = function(s) { - return StringTools.ltrim(StringTools.rtrim(s)); -}; -StringTools.replace = function(s,sub,by) { - return s.split(sub).join(by); -}; -var haxe_iterators_ArrayIterator = function(array) { - this.current = 0; - this.array = array; -}; -haxe_iterators_ArrayIterator.__name__ = true; -haxe_iterators_ArrayIterator.prototype = { - hasNext: function() { - return this.current < this.array.length; - } - ,next: function() { - return this.array[this.current++]; - } -}; -var js_Boot = function() { }; -js_Boot.__name__ = true; -js_Boot.__string_rec = function(o,s) { - if(o == null) { - return "null"; - } - if(s.length >= 5) { - return "<...>"; - } - var t = typeof(o); - if(t == "function" && (o.__name__ || o.__ename__)) { - t = "object"; - } - switch(t) { - case "function": - return ""; - case "object": - if(((o) instanceof Array)) { - var str = "["; - s += "\t"; - var _g = 0; - var _g1 = o.length; - while(_g < _g1) { - var i = _g++; - str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); - } - str += "]"; - return str; - } - var tostr; - try { - tostr = o.toString; - } catch( _g ) { - return "???"; - } - if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { - var s2 = o.toString(); - if(s2 != "[object Object]") { - return s2; - } - } - var str = "{\n"; - s += "\t"; - var hasp = o.hasOwnProperty != null; - var k = null; - for( k in o ) { - if(hasp && !o.hasOwnProperty(k)) { - continue; - } - if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { - continue; - } - if(str.length != 2) { - str += ", \n"; - } - str += s + k + " : " + js_Boot.__string_rec(o[k],s); - } - s = s.substring(1); - str += "\n" + s + "}"; - return str; - case "string": - return o; - default: - return String(o); - } -}; -var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; -xrfragment_Parser.__name__ = true; -xrfragment_Parser.parse = function(key,value,resultMap) { - var Frag_h = Object.create(null); - Frag_h["prio"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_INT; - Frag_h["#"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_PREDEFINED_VIEW; - Frag_h["class"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING; - Frag_h["src"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL; - Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING_OBJ | xrfragment_XRF.EMBEDDED | xrfragment_XRF.NAVIGATOR; - Frag_h["href"] = xrfragment_XRF.ASSET | xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; - Frag_h["q"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_STRING | xrfragment_XRF.EMBEDDED; - Frag_h["scale"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.EMBEDDED; - Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.EMBEDDED | xrfragment_XRF.NAVIGATOR; - Frag_h["translate"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.EMBEDDED; - Frag_h["visible"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_INT | xrfragment_XRF.EMBEDDED; - Frag_h["env"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_STRING | xrfragment_XRF.EMBEDDED; - Frag_h["t"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.EMBEDDED; - Frag_h["gravity"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.EMBEDDED; - Frag_h["physics"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.EMBEDDED; - Frag_h["fov"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_INT | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.EMBEDDED; - Frag_h["clip"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.EMBEDDED; - Frag_h["fog"] = xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_STRING | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.EMBEDDED; - 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.EMBEDDED | xrfragment_XRF.PROMPT; - if(value.length == 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key)) { - resultMap[key] = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR); - return true; - } - if(key.split(".").length > 1 && value.split(".").length > 1) { - resultMap[key] = new xrfragment_XRF(key,xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_STRING | xrfragment_XRF.PROP_BIND); - return true; - } - if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { - var v = new xrfragment_XRF(key,Frag_h[key]); - if(!v.validate(value)) { - console.log("src/xrfragment/Parser.hx:75:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); - return false; - } - if(xrfragment_Parser.debug) { - console.log("src/xrfragment/Parser.hx:78:","✔ " + key + ": " + v.string); - } - resultMap[key] = v; - } - return true; -}; -var xrfragment_Query = $hx_exports["xrfragment"]["Query"] = function(str) { - this.isNumber = new EReg("^[0-9\\.]+$",""); - this.isClass = new EReg("^[-]?class$",""); - this.isExclude = new EReg("^-",""); - this.isProp = new EReg("^.*:[><=!]?",""); - this.q = { }; - this.str = ""; - if(str != null) { - this.parse(str); - } -}; -xrfragment_Query.__name__ = true; -xrfragment_Query.prototype = { - toObject: function() { - return this.q; - } - ,expandAliases: function(token) { - var classAlias = new EReg("^(-)?\\.",""); - if(classAlias.match(token)) { - return StringTools.replace(token,".","class:"); - } else { - return token; - } - } - ,get: function() { - return this.q; - } - ,parse: function(str,recurse) { - if(recurse == null) { - recurse = false; - } - var _gthis = this; - var token = str.split(" "); - var q = { }; - var process = function(str,prefix) { - if(prefix == null) { - prefix = ""; - } - str = StringTools.trim(str); - 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)) { - 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 = "!="; - k = HxOverrides.substr(k,1,null); - } else { - v = HxOverrides.substr(v,oper.length,null); - } - if(oper.length == 0) { - oper = "="; - } - if(_gthis.isClass.match(k)) { - filter[prefix + k] = oper != "!="; - q[v] = filter; - } else { - var rule = { }; - if(_gthis.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; - var key = _gthis.isExclude.match(str) ? HxOverrides.substr(str,1,null) : str; - q[key] = filter; - } - }; - var _g = 0; - var _g1 = token.length; - while(_g < _g1) { - var i = _g++; - process(this.expandAliases(token[i])); - } - return this.q = q; - } - ,test: function(obj) { - var qualify = false; - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v)) { - qualify = true; - } - } - var _g = 0; - var _g1 = Reflect.fields(obj); - while(_g < _g1.length) { - var k = _g1[_g]; - ++_g; - var v = Std.string(Reflect.field(obj,k)); - if(this.testProperty(k,v,true)) { - qualify = false; - } - } - return qualify; - } - ,testProperty: function(property,value,exclude) { - var conds = 0; - var fails = 0; - var qualify = 0; - var testprop = function(expr) { - conds += 1; - fails += expr ? 0 : 1; - return expr; - }; - if(this.q[value] != null) { - var v = this.q[value]; - if(v[property] != null) { - 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; - } - } - } - } - return qualify > 0; - } -}; -var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { }; -xrfragment_URI.__name__ = true; -xrfragment_URI.parse = function(url,filter) { - var store = { }; - if(url.indexOf("#") == -1) { - return store; - } - var fragment = url.split("#"); - var splitArray = fragment[1].split("&"); - var _g = 0; - var _g1 = splitArray.length; - while(_g < _g1) { - var i = _g++; - var splitByEqual = splitArray[i].split("="); - var regexPlus = new EReg("\\+","g"); - var key = splitByEqual[0]; - var value = ""; - if(splitByEqual.length > 1) { - var s = regexPlus.split(splitByEqual[1]).join(" "); - value = decodeURIComponent(s.split("+").join(" ")); - } - var ok = xrfragment_Parser.parse(key,value,store); - } - if(filter != null && filter != 0) { - var _g = 0; - var _g1 = Reflect.fields(store); - while(_g < _g1.length) { - var key = _g1[_g]; - ++_g; - var xrf = store[key]; - if(!xrf.is(filter)) { - Reflect.deleteField(store,key); - } - } - } - return store; -}; -var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags) { - this.fragment = _fragment; - this.flags = _flags; -}; -xrfragment_XRF.__name__ = true; -xrfragment_XRF.set = function(flag,flags) { - return flags | flag; -}; -xrfragment_XRF.unset = function(flag,flags) { - return flags & ~flag; -}; -xrfragment_XRF.prototype = { - is: function(flag) { - return (this.flags & flag) != 0; - } - ,validate: function(value) { - this.guessType(this,value); - if(value.split("|").length > 1) { - this.args = []; - var args = value.split("|"); - var _g = 0; - var _g1 = args.length; - while(_g < _g1) { - var i = _g++; - var x = new xrfragment_XRF(this.fragment,this.flags); - this.guessType(x,args[i]); - this.args.push(x); - } - } - if(this.fragment == "q") { - this.query = new xrfragment_Query(value).get(); - } - var ok = true; - if(!((this.args) instanceof Array)) { - if(this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { - ok = false; - } - if(this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { - ok = false; - } - var tmp; - if(this.is(xrfragment_XRF.T_INT)) { - var v = this.int; - tmp = !(typeof(v) == "number" && ((v | 0) === v)); - } else { - tmp = false; - } - if(tmp) { - ok = false; - } - } - return ok; - } - ,guessType: function(v,str) { - v.string = str; - if(str.split(",").length > 1) { - var xyz = str.split(","); - if(xyz.length > 0) { - v.x = parseFloat(xyz[0]); - } - if(xyz.length > 1) { - v.y = parseFloat(xyz[1]); - } - if(xyz.length > 2) { - v.z = parseFloat(xyz[2]); - } - } - if(xrfragment_XRF.isColor.match(str)) { - v.color = str; - } - if(xrfragment_XRF.isFloat.match(str)) { - v.float = parseFloat(str); - } - if(xrfragment_XRF.isInt.match(str)) { - v.int = Std.parseInt(str); - } - } -}; -if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { - HxOverrides.now = performance.now.bind(performance); -} -String.__name__ = true; -Array.__name__ = true; -js_Boot.__toStr = ({ }).toString; -xrfragment_Parser.error = ""; -xrfragment_Parser.debug = false; -xrfragment_XRF.ASSET = 1; -xrfragment_XRF.PROP_BIND = 2; -xrfragment_XRF.QUERY_OPERATOR = 4; -xrfragment_XRF.PROMPT = 8; -xrfragment_XRF.ROUNDROBIN = 16; -xrfragment_XRF.NAVIGATOR = 32; -xrfragment_XRF.EMBEDDED = 64; -xrfragment_XRF.PV_OVERRIDE = 128; -xrfragment_XRF.PV_EXECUTE = 256; -xrfragment_XRF.T_COLOR = 8192; -xrfragment_XRF.T_INT = 16384; -xrfragment_XRF.T_FLOAT = 32768; -xrfragment_XRF.T_VECTOR2 = 65536; -xrfragment_XRF.T_VECTOR3 = 131072; -xrfragment_XRF.T_URL = 262144; -xrfragment_XRF.T_PREDEFINED_VIEW = 524288; -xrfragment_XRF.T_STRING = 1048576; -xrfragment_XRF.T_STRING_OBJ = 2097152; -xrfragment_XRF.T_STRING_OBJ_PROP = 4194304; -xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); -xrfragment_XRF.isInt = new EReg("^[0-9]+$",""); -xrfragment_XRF.isFloat = new EReg("^[0-9]+\\.[0-9]+$",""); -xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); -xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); -xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); -xrfragment_XRF.isString = new EReg(".*",""); -})({}); -var xrfragment = $hx_exports["xrfragment"]; -export default xrfragment; diff --git a/dist/xrfragment.py b/dist/xrfragment.py deleted file mode 100644 index f038d9f..0000000 --- a/dist/xrfragment.py +++ /dev/null @@ -1,1678 +0,0 @@ -import sys - -import math as python_lib_Math -import math as Math -import inspect as python_lib_Inspect -import sys as python_lib_Sys -import functools as python_lib_Functools -import re as python_lib_Re -import traceback as python_lib_Traceback -import urllib.parse as python_lib_urllib_Parse - - -class _hx_AnonObject: - _hx_disable_getattr = False - def __init__(self, fields): - self.__dict__ = fields - def __repr__(self): - return repr(self.__dict__) - def __contains__(self, item): - return item in self.__dict__ - def __getitem__(self, item): - return self.__dict__[item] - def __getattr__(self, name): - if (self._hx_disable_getattr): - raise AttributeError('field does not exist') - else: - return None - def _hx_hasattr(self,field): - self._hx_disable_getattr = True - try: - getattr(self, field) - self._hx_disable_getattr = False - return True - except AttributeError: - self._hx_disable_getattr = False - return False - - - -class Enum: - _hx_class_name = "Enum" - __slots__ = ("tag", "index", "params") - _hx_fields = ["tag", "index", "params"] - _hx_methods = ["__str__"] - - def __init__(self,tag,index,params): - self.tag = tag - self.index = index - self.params = params - - def __str__(self): - if (self.params is None): - return self.tag - else: - return self.tag + '(' + (', '.join(str(v) for v in self.params)) + ')' - - - -class Class: pass - - -class EReg: - _hx_class_name = "EReg" - __slots__ = ("pattern", "matchObj", "_hx_global") - _hx_fields = ["pattern", "matchObj", "global"] - _hx_methods = ["split"] - - def __init__(self,r,opt): - self.matchObj = None - self._hx_global = False - options = 0 - _g = 0 - _g1 = len(opt) - while (_g < _g1): - i = _g - _g = (_g + 1) - c = (-1 if ((i >= len(opt))) else ord(opt[i])) - if (c == 109): - options = (options | python_lib_Re.M) - if (c == 105): - options = (options | python_lib_Re.I) - if (c == 115): - options = (options | python_lib_Re.S) - if (c == 117): - options = (options | python_lib_Re.U) - if (c == 103): - self._hx_global = True - self.pattern = python_lib_Re.compile(r,options) - - def split(self,s): - if self._hx_global: - ret = [] - lastEnd = 0 - x = python_HaxeIterator(python_lib_Re.finditer(self.pattern,s)) - while x.hasNext(): - x1 = x.next() - x2 = HxString.substring(s,lastEnd,x1.start()) - ret.append(x2) - lastEnd = x1.end() - x = HxString.substr(s,lastEnd,None) - ret.append(x) - return ret - else: - self.matchObj = python_lib_Re.search(self.pattern,s) - if (self.matchObj is None): - return [s] - else: - return [HxString.substring(s,0,self.matchObj.start()), HxString.substr(s,self.matchObj.end(),None)] - - - -class Reflect: - _hx_class_name = "Reflect" - __slots__ = () - _hx_statics = ["field", "deleteField"] - - @staticmethod - def field(o,field): - return python_Boot.field(o,field) - - @staticmethod - def deleteField(o,field): - if (field in python_Boot.keywords): - field = ("_hx_" + field) - elif ((((len(field) > 2) and ((ord(field[0]) == 95))) and ((ord(field[1]) == 95))) and ((ord(field[(len(field) - 1)]) != 95))): - field = ("_hx_" + field) - if (not python_Boot.hasField(o,field)): - return False - o.__delattr__(field) - return True - - -class Std: - _hx_class_name = "Std" - __slots__ = () - _hx_statics = ["isOfType", "string", "parseInt", "shortenPossibleNumber", "parseFloat"] - - @staticmethod - def isOfType(v,t): - if ((v is None) and ((t is None))): - return False - if (t is None): - return False - if ((type(t) == type) and (t == Dynamic)): - return (v is not None) - isBool = isinstance(v,bool) - if (((type(t) == type) and (t == Bool)) and isBool): - return True - if ((((not isBool) and (not ((type(t) == type) and (t == Bool)))) and ((type(t) == type) and (t == Int))) and isinstance(v,int)): - return True - vIsFloat = isinstance(v,float) - tmp = None - tmp1 = None - if (((not isBool) and vIsFloat) and ((type(t) == type) and (t == Int))): - f = v - tmp1 = (((f != Math.POSITIVE_INFINITY) and ((f != Math.NEGATIVE_INFINITY))) and (not python_lib_Math.isnan(f))) - else: - tmp1 = False - if tmp1: - tmp1 = None - try: - tmp1 = int(v) - except BaseException as _g: - None - tmp1 = None - tmp = (v == tmp1) - else: - tmp = False - if ((tmp and ((v <= 2147483647))) and ((v >= -2147483648))): - return True - if (((not isBool) and ((type(t) == type) and (t == Float))) and isinstance(v,(float, int))): - return True - if ((type(t) == type) and (t == str)): - return isinstance(v,str) - isEnumType = ((type(t) == type) and (t == Enum)) - if ((isEnumType and python_lib_Inspect.isclass(v)) and hasattr(v,"_hx_constructs")): - return True - if isEnumType: - return False - isClassType = ((type(t) == type) and (t == Class)) - if ((((isClassType and (not isinstance(v,Enum))) and python_lib_Inspect.isclass(v)) and hasattr(v,"_hx_class_name")) and (not hasattr(v,"_hx_constructs"))): - return True - if isClassType: - return False - tmp = None - try: - tmp = isinstance(v,t) - except BaseException as _g: - None - tmp = False - if tmp: - return True - if python_lib_Inspect.isclass(t): - cls = t - loop = None - def _hx_local_1(intf): - f = (intf._hx_interfaces if (hasattr(intf,"_hx_interfaces")) else []) - if (f is not None): - _g = 0 - while (_g < len(f)): - i = (f[_g] if _g >= 0 and _g < len(f) else None) - _g = (_g + 1) - if (i == cls): - return True - else: - l = loop(i) - if l: - return True - return False - else: - return False - loop = _hx_local_1 - currentClass = v.__class__ - result = False - while (currentClass is not None): - if loop(currentClass): - result = True - break - currentClass = python_Boot.getSuperClass(currentClass) - return result - else: - return False - - @staticmethod - def string(s): - return python_Boot.toString1(s,"") - - @staticmethod - def parseInt(x): - if (x is None): - return None - try: - return int(x) - except BaseException as _g: - None - base = 10 - _hx_len = len(x) - foundCount = 0 - sign = 0 - firstDigitIndex = 0 - lastDigitIndex = -1 - previous = 0 - _g = 0 - _g1 = _hx_len - while (_g < _g1): - i = _g - _g = (_g + 1) - c = (-1 if ((i >= len(x))) else ord(x[i])) - if (((c > 8) and ((c < 14))) or ((c == 32))): - if (foundCount > 0): - return None - continue - else: - c1 = c - if (c1 == 43): - if (foundCount == 0): - sign = 1 - elif (not (((48 <= c) and ((c <= 57))))): - if (not (((base == 16) and ((((97 <= c) and ((c <= 122))) or (((65 <= c) and ((c <= 90))))))))): - break - elif (c1 == 45): - if (foundCount == 0): - sign = -1 - elif (not (((48 <= c) and ((c <= 57))))): - if (not (((base == 16) and ((((97 <= c) and ((c <= 122))) or (((65 <= c) and ((c <= 90))))))))): - break - elif (c1 == 48): - if (not (((foundCount == 0) or (((foundCount == 1) and ((sign != 0))))))): - if (not (((48 <= c) and ((c <= 57))))): - if (not (((base == 16) and ((((97 <= c) and ((c <= 122))) or (((65 <= c) and ((c <= 90))))))))): - break - elif ((c1 == 120) or ((c1 == 88))): - if ((previous == 48) and ((((foundCount == 1) and ((sign == 0))) or (((foundCount == 2) and ((sign != 0))))))): - base = 16 - elif (not (((48 <= c) and ((c <= 57))))): - if (not (((base == 16) and ((((97 <= c) and ((c <= 122))) or (((65 <= c) and ((c <= 90))))))))): - break - elif (not (((48 <= c) and ((c <= 57))))): - if (not (((base == 16) and ((((97 <= c) and ((c <= 122))) or (((65 <= c) and ((c <= 90))))))))): - break - if (((foundCount == 0) and ((sign == 0))) or (((foundCount == 1) and ((sign != 0))))): - firstDigitIndex = i - foundCount = (foundCount + 1) - lastDigitIndex = i - previous = c - if (firstDigitIndex <= lastDigitIndex): - digits = HxString.substring(x,firstDigitIndex,(lastDigitIndex + 1)) - try: - return (((-1 if ((sign == -1)) else 1)) * int(digits,base)) - except BaseException as _g: - return None - return None - - @staticmethod - def shortenPossibleNumber(x): - r = "" - _g = 0 - _g1 = len(x) - while (_g < _g1): - i = _g - _g = (_g + 1) - c = ("" if (((i < 0) or ((i >= len(x))))) else x[i]) - _g2 = HxString.charCodeAt(c,0) - if (_g2 is None): - break - else: - _g3 = _g2 - if (((((((((((_g3 == 57) or ((_g3 == 56))) or ((_g3 == 55))) or ((_g3 == 54))) or ((_g3 == 53))) or ((_g3 == 52))) or ((_g3 == 51))) or ((_g3 == 50))) or ((_g3 == 49))) or ((_g3 == 48))) or ((_g3 == 46))): - r = (("null" if r is None else r) + ("null" if c is None else c)) - else: - break - return r - - @staticmethod - def parseFloat(x): - try: - return float(x) - except BaseException as _g: - None - if (x is not None): - r1 = Std.shortenPossibleNumber(x) - if (r1 != x): - return Std.parseFloat(r1) - return Math.NaN - - -class Float: pass - - -class Int: pass - - -class Bool: pass - - -class Dynamic: pass - - -class StringTools: - _hx_class_name = "StringTools" - __slots__ = () - _hx_statics = ["isSpace", "ltrim", "rtrim", "trim", "replace"] - - @staticmethod - def isSpace(s,pos): - if (((len(s) == 0) or ((pos < 0))) or ((pos >= len(s)))): - return False - c = HxString.charCodeAt(s,pos) - if (not (((c > 8) and ((c < 14))))): - return (c == 32) - else: - return True - - @staticmethod - def ltrim(s): - l = len(s) - r = 0 - while ((r < l) and StringTools.isSpace(s,r)): - r = (r + 1) - if (r > 0): - return HxString.substr(s,r,(l - r)) - else: - return s - - @staticmethod - def rtrim(s): - l = len(s) - r = 0 - while ((r < l) and StringTools.isSpace(s,((l - r) - 1))): - r = (r + 1) - if (r > 0): - return HxString.substr(s,0,(l - r)) - else: - return s - - @staticmethod - def trim(s): - return StringTools.ltrim(StringTools.rtrim(s)) - - @staticmethod - def replace(s,sub,by): - _this = (list(s) if ((sub == "")) else s.split(sub)) - return by.join([python_Boot.toString1(x1,'') for x1 in _this]) - - -class haxe_IMap: - _hx_class_name = "haxe.IMap" - __slots__ = () - - -class haxe_Exception(Exception): - _hx_class_name = "haxe.Exception" - __slots__ = ("_hx___nativeStack", "_hx___nativeException", "_hx___previousException") - _hx_fields = ["__nativeStack", "__nativeException", "__previousException"] - _hx_methods = ["unwrap"] - _hx_statics = ["caught"] - _hx_interfaces = [] - _hx_super = Exception - - - def __init__(self,message,previous = None,native = None): - self._hx___previousException = None - self._hx___nativeException = None - self._hx___nativeStack = None - super().__init__(message) - self._hx___previousException = previous - if ((native is not None) and Std.isOfType(native,BaseException)): - self._hx___nativeException = native - self._hx___nativeStack = haxe_NativeStackTrace.exceptionStack() - else: - self._hx___nativeException = self - infos = python_lib_Traceback.extract_stack() - if (len(infos) != 0): - infos.pop() - infos.reverse() - self._hx___nativeStack = infos - - def unwrap(self): - return self._hx___nativeException - - @staticmethod - def caught(value): - if Std.isOfType(value,haxe_Exception): - return value - elif Std.isOfType(value,BaseException): - return haxe_Exception(str(value),None,value) - else: - return haxe_ValueException(value,None,value) - - - -class haxe_NativeStackTrace: - _hx_class_name = "haxe.NativeStackTrace" - __slots__ = () - _hx_statics = ["saveStack", "exceptionStack"] - - @staticmethod - def saveStack(exception): - pass - - @staticmethod - def exceptionStack(): - exc = python_lib_Sys.exc_info() - if (exc[2] is not None): - infos = python_lib_Traceback.extract_tb(exc[2]) - infos.reverse() - return infos - else: - return [] - - -class haxe_ValueException(haxe_Exception): - _hx_class_name = "haxe.ValueException" - __slots__ = ("value",) - _hx_fields = ["value"] - _hx_methods = ["unwrap"] - _hx_statics = [] - _hx_interfaces = [] - _hx_super = haxe_Exception - - - def __init__(self,value,previous = None,native = None): - self.value = None - super().__init__(Std.string(value),previous,native) - self.value = value - - def unwrap(self): - return self.value - - - -class haxe_ds_StringMap: - _hx_class_name = "haxe.ds.StringMap" - __slots__ = ("h",) - _hx_fields = ["h"] - _hx_interfaces = [haxe_IMap] - - def __init__(self): - self.h = dict() - - - -class haxe_iterators_ArrayIterator: - _hx_class_name = "haxe.iterators.ArrayIterator" - __slots__ = ("array", "current") - _hx_fields = ["array", "current"] - _hx_methods = ["hasNext", "next"] - - def __init__(self,array): - self.current = 0 - self.array = array - - def hasNext(self): - return (self.current < len(self.array)) - - def next(self): - def _hx_local_3(): - def _hx_local_2(): - _hx_local_0 = self - _hx_local_1 = _hx_local_0.current - _hx_local_0.current = (_hx_local_1 + 1) - return _hx_local_1 - return python_internal_ArrayImpl._get(self.array, _hx_local_2()) - return _hx_local_3() - - - -class haxe_iterators_ArrayKeyValueIterator: - _hx_class_name = "haxe.iterators.ArrayKeyValueIterator" - __slots__ = ("current", "array") - _hx_fields = ["current", "array"] - _hx_methods = ["hasNext", "next"] - - def __init__(self,array): - self.current = 0 - self.array = array - - def hasNext(self): - return (self.current < len(self.array)) - - def next(self): - def _hx_local_3(): - def _hx_local_2(): - _hx_local_0 = self - _hx_local_1 = _hx_local_0.current - _hx_local_0.current = (_hx_local_1 + 1) - return _hx_local_1 - return _hx_AnonObject({'value': python_internal_ArrayImpl._get(self.array, self.current), 'key': _hx_local_2()}) - return _hx_local_3() - - - -class python_Boot: - _hx_class_name = "python.Boot" - __slots__ = () - _hx_statics = ["keywords", "toString1", "fields", "simpleField", "hasField", "field", "getInstanceFields", "getSuperClass", "getClassFields", "prefixLength", "unhandleKeywords"] - - @staticmethod - def toString1(o,s): - if (o is None): - return "null" - if isinstance(o,str): - return o - if (s is None): - s = "" - if (len(s) >= 5): - return "<...>" - if isinstance(o,bool): - if o: - return "true" - else: - return "false" - if (isinstance(o,int) and (not isinstance(o,bool))): - return str(o) - if isinstance(o,float): - try: - if (o == int(o)): - return str(Math.floor((o + 0.5))) - else: - return str(o) - except BaseException as _g: - None - return str(o) - if isinstance(o,list): - o1 = o - l = len(o1) - st = "[" - s = (("null" if s is None else s) + "\t") - _g = 0 - _g1 = l - while (_g < _g1): - i = _g - _g = (_g + 1) - prefix = "" - if (i > 0): - prefix = "," - st = (("null" if st is None else st) + HxOverrides.stringOrNull(((("null" if prefix is None else prefix) + HxOverrides.stringOrNull(python_Boot.toString1((o1[i] if i >= 0 and i < len(o1) else None),s)))))) - st = (("null" if st is None else st) + "]") - return st - try: - if hasattr(o,"toString"): - return o.toString() - except BaseException as _g: - None - if hasattr(o,"__class__"): - if isinstance(o,_hx_AnonObject): - toStr = None - try: - fields = python_Boot.fields(o) - _g = [] - _g1 = 0 - while (_g1 < len(fields)): - f = (fields[_g1] if _g1 >= 0 and _g1 < len(fields) else None) - _g1 = (_g1 + 1) - x = ((("" + ("null" if f is None else f)) + " : ") + HxOverrides.stringOrNull(python_Boot.toString1(python_Boot.simpleField(o,f),(("null" if s is None else s) + "\t")))) - _g.append(x) - fieldsStr = _g - toStr = (("{ " + HxOverrides.stringOrNull(", ".join([x1 for x1 in fieldsStr]))) + " }") - except BaseException as _g: - None - return "{ ... }" - if (toStr is None): - return "{ ... }" - else: - return toStr - if isinstance(o,Enum): - o1 = o - l = len(o1.params) - hasParams = (l > 0) - if hasParams: - paramsStr = "" - _g = 0 - _g1 = l - while (_g < _g1): - i = _g - _g = (_g + 1) - prefix = "" - if (i > 0): - prefix = "," - paramsStr = (("null" if paramsStr is None else paramsStr) + HxOverrides.stringOrNull(((("null" if prefix is None else prefix) + HxOverrides.stringOrNull(python_Boot.toString1(o1.params[i],s)))))) - return (((HxOverrides.stringOrNull(o1.tag) + "(") + ("null" if paramsStr is None else paramsStr)) + ")") - else: - return o1.tag - if hasattr(o,"_hx_class_name"): - if (o.__class__.__name__ != "type"): - fields = python_Boot.getInstanceFields(o) - _g = [] - _g1 = 0 - while (_g1 < len(fields)): - f = (fields[_g1] if _g1 >= 0 and _g1 < len(fields) else None) - _g1 = (_g1 + 1) - x = ((("" + ("null" if f is None else f)) + " : ") + HxOverrides.stringOrNull(python_Boot.toString1(python_Boot.simpleField(o,f),(("null" if s is None else s) + "\t")))) - _g.append(x) - fieldsStr = _g - toStr = (((HxOverrides.stringOrNull(o._hx_class_name) + "( ") + HxOverrides.stringOrNull(", ".join([x1 for x1 in fieldsStr]))) + " )") - return toStr - else: - fields = python_Boot.getClassFields(o) - _g = [] - _g1 = 0 - while (_g1 < len(fields)): - f = (fields[_g1] if _g1 >= 0 and _g1 < len(fields) else None) - _g1 = (_g1 + 1) - x = ((("" + ("null" if f is None else f)) + " : ") + HxOverrides.stringOrNull(python_Boot.toString1(python_Boot.simpleField(o,f),(("null" if s is None else s) + "\t")))) - _g.append(x) - fieldsStr = _g - toStr = (((("#" + HxOverrides.stringOrNull(o._hx_class_name)) + "( ") + HxOverrides.stringOrNull(", ".join([x1 for x1 in fieldsStr]))) + " )") - return toStr - if ((type(o) == type) and (o == str)): - return "#String" - if ((type(o) == type) and (o == list)): - return "#Array" - if callable(o): - return "function" - try: - if hasattr(o,"__repr__"): - return o.__repr__() - except BaseException as _g: - None - if hasattr(o,"__str__"): - return o.__str__([]) - if hasattr(o,"__name__"): - return o.__name__ - return "???" - else: - return str(o) - - @staticmethod - def fields(o): - a = [] - if (o is not None): - if hasattr(o,"_hx_fields"): - fields = o._hx_fields - if (fields is not None): - return list(fields) - if isinstance(o,_hx_AnonObject): - d = o.__dict__ - keys = d.keys() - handler = python_Boot.unhandleKeywords - for k in keys: - if (k != '_hx_disable_getattr'): - a.append(handler(k)) - elif hasattr(o,"__dict__"): - d = o.__dict__ - keys1 = d.keys() - for k in keys1: - a.append(k) - return a - - @staticmethod - def simpleField(o,field): - if (field is None): - return None - field1 = (("_hx_" + field) if ((field in python_Boot.keywords)) else (("_hx_" + field) if (((((len(field) > 2) and ((ord(field[0]) == 95))) and ((ord(field[1]) == 95))) and ((ord(field[(len(field) - 1)]) != 95)))) else field)) - if hasattr(o,field1): - return getattr(o,field1) - else: - return None - - @staticmethod - def hasField(o,field): - if isinstance(o,_hx_AnonObject): - return o._hx_hasattr(field) - return hasattr(o,(("_hx_" + field) if ((field in python_Boot.keywords)) else (("_hx_" + field) if (((((len(field) > 2) and ((ord(field[0]) == 95))) and ((ord(field[1]) == 95))) and ((ord(field[(len(field) - 1)]) != 95)))) else field))) - - @staticmethod - def field(o,field): - if (field is None): - return None - if isinstance(o,str): - field1 = field - _hx_local_0 = len(field1) - if (_hx_local_0 == 10): - if (field1 == "charCodeAt"): - return python_internal_MethodClosure(o,HxString.charCodeAt) - else: - field1 = (("_hx_" + field) if ((field in python_Boot.keywords)) else (("_hx_" + field) if (((((len(field) > 2) and ((ord(field[0]) == 95))) and ((ord(field[1]) == 95))) and ((ord(field[(len(field) - 1)]) != 95)))) else field)) - if hasattr(o,field1): - return getattr(o,field1) - else: - return None - elif (_hx_local_0 == 11): - if (field1 == "lastIndexOf"): - return python_internal_MethodClosure(o,HxString.lastIndexOf) - elif (field1 == "toLowerCase"): - return python_internal_MethodClosure(o,HxString.toLowerCase) - elif (field1 == "toUpperCase"): - return python_internal_MethodClosure(o,HxString.toUpperCase) - else: - field1 = (("_hx_" + field) if ((field in python_Boot.keywords)) else (("_hx_" + field) if (((((len(field) > 2) and ((ord(field[0]) == 95))) and ((ord(field[1]) == 95))) and ((ord(field[(len(field) - 1)]) != 95)))) else field)) - if hasattr(o,field1): - return getattr(o,field1) - else: - return None - elif (_hx_local_0 == 9): - if (field1 == "substring"): - return python_internal_MethodClosure(o,HxString.substring) - else: - field1 = (("_hx_" + field) if ((field in python_Boot.keywords)) else (("_hx_" + field) if (((((len(field) > 2) and ((ord(field[0]) == 95))) and ((ord(field[1]) == 95))) and ((ord(field[(len(field) - 1)]) != 95)))) else field)) - if hasattr(o,field1): - return getattr(o,field1) - else: - return None - elif (_hx_local_0 == 5): - if (field1 == "split"): - return python_internal_MethodClosure(o,HxString.split) - else: - field1 = (("_hx_" + field) if ((field in python_Boot.keywords)) else (("_hx_" + field) if (((((len(field) > 2) and ((ord(field[0]) == 95))) and ((ord(field[1]) == 95))) and ((ord(field[(len(field) - 1)]) != 95)))) else field)) - if hasattr(o,field1): - return getattr(o,field1) - else: - return None - elif (_hx_local_0 == 7): - if (field1 == "indexOf"): - return python_internal_MethodClosure(o,HxString.indexOf) - else: - field1 = (("_hx_" + field) if ((field in python_Boot.keywords)) else (("_hx_" + field) if (((((len(field) > 2) and ((ord(field[0]) == 95))) and ((ord(field[1]) == 95))) and ((ord(field[(len(field) - 1)]) != 95)))) else field)) - if hasattr(o,field1): - return getattr(o,field1) - else: - return None - elif (_hx_local_0 == 8): - if (field1 == "toString"): - return python_internal_MethodClosure(o,HxString.toString) - else: - field1 = (("_hx_" + field) if ((field in python_Boot.keywords)) else (("_hx_" + field) if (((((len(field) > 2) and ((ord(field[0]) == 95))) and ((ord(field[1]) == 95))) and ((ord(field[(len(field) - 1)]) != 95)))) else field)) - if hasattr(o,field1): - return getattr(o,field1) - else: - return None - elif (_hx_local_0 == 6): - if (field1 == "charAt"): - return python_internal_MethodClosure(o,HxString.charAt) - elif (field1 == "length"): - return len(o) - elif (field1 == "substr"): - return python_internal_MethodClosure(o,HxString.substr) - else: - field1 = (("_hx_" + field) if ((field in python_Boot.keywords)) else (("_hx_" + field) if (((((len(field) > 2) and ((ord(field[0]) == 95))) and ((ord(field[1]) == 95))) and ((ord(field[(len(field) - 1)]) != 95)))) else field)) - if hasattr(o,field1): - return getattr(o,field1) - else: - return None - else: - field1 = (("_hx_" + field) if ((field in python_Boot.keywords)) else (("_hx_" + field) if (((((len(field) > 2) and ((ord(field[0]) == 95))) and ((ord(field[1]) == 95))) and ((ord(field[(len(field) - 1)]) != 95)))) else field)) - if hasattr(o,field1): - return getattr(o,field1) - else: - return None - elif isinstance(o,list): - field1 = field - _hx_local_1 = len(field1) - if (_hx_local_1 == 11): - if (field1 == "lastIndexOf"): - return python_internal_MethodClosure(o,python_internal_ArrayImpl.lastIndexOf) - else: - field1 = (("_hx_" + field) if ((field in python_Boot.keywords)) else (("_hx_" + field) if (((((len(field) > 2) and ((ord(field[0]) == 95))) and ((ord(field[1]) == 95))) and ((ord(field[(len(field) - 1)]) != 95)))) else field)) - if hasattr(o,field1): - return getattr(o,field1) - else: - return None - elif (_hx_local_1 == 4): - if (field1 == "copy"): - return python_internal_MethodClosure(o,python_internal_ArrayImpl.copy) - elif (field1 == "join"): - return python_internal_MethodClosure(o,python_internal_ArrayImpl.join) - elif (field1 == "push"): - return python_internal_MethodClosure(o,python_internal_ArrayImpl.push) - elif (field1 == "sort"): - return python_internal_MethodClosure(o,python_internal_ArrayImpl.sort) - else: - field1 = (("_hx_" + field) if ((field in python_Boot.keywords)) else (("_hx_" + field) if (((((len(field) > 2) and ((ord(field[0]) == 95))) and ((ord(field[1]) == 95))) and ((ord(field[(len(field) - 1)]) != 95)))) else field)) - if hasattr(o,field1): - return getattr(o,field1) - else: - return None - elif (_hx_local_1 == 5): - if (field1 == "shift"): - return python_internal_MethodClosure(o,python_internal_ArrayImpl.shift) - elif (field1 == "slice"): - return python_internal_MethodClosure(o,python_internal_ArrayImpl.slice) - else: - field1 = (("_hx_" + field) if ((field in python_Boot.keywords)) else (("_hx_" + field) if (((((len(field) > 2) and ((ord(field[0]) == 95))) and ((ord(field[1]) == 95))) and ((ord(field[(len(field) - 1)]) != 95)))) else field)) - if hasattr(o,field1): - return getattr(o,field1) - else: - return None - elif (_hx_local_1 == 7): - if (field1 == "indexOf"): - return python_internal_MethodClosure(o,python_internal_ArrayImpl.indexOf) - elif (field1 == "reverse"): - return python_internal_MethodClosure(o,python_internal_ArrayImpl.reverse) - elif (field1 == "unshift"): - return python_internal_MethodClosure(o,python_internal_ArrayImpl.unshift) - else: - field1 = (("_hx_" + field) if ((field in python_Boot.keywords)) else (("_hx_" + field) if (((((len(field) > 2) and ((ord(field[0]) == 95))) and ((ord(field[1]) == 95))) and ((ord(field[(len(field) - 1)]) != 95)))) else field)) - if hasattr(o,field1): - return getattr(o,field1) - else: - return None - elif (_hx_local_1 == 3): - if (field1 == "map"): - return python_internal_MethodClosure(o,python_internal_ArrayImpl.map) - elif (field1 == "pop"): - return python_internal_MethodClosure(o,python_internal_ArrayImpl.pop) - else: - field1 = (("_hx_" + field) if ((field in python_Boot.keywords)) else (("_hx_" + field) if (((((len(field) > 2) and ((ord(field[0]) == 95))) and ((ord(field[1]) == 95))) and ((ord(field[(len(field) - 1)]) != 95)))) else field)) - if hasattr(o,field1): - return getattr(o,field1) - else: - return None - elif (_hx_local_1 == 8): - if (field1 == "contains"): - return python_internal_MethodClosure(o,python_internal_ArrayImpl.contains) - elif (field1 == "iterator"): - return python_internal_MethodClosure(o,python_internal_ArrayImpl.iterator) - elif (field1 == "toString"): - return python_internal_MethodClosure(o,python_internal_ArrayImpl.toString) - else: - field1 = (("_hx_" + field) if ((field in python_Boot.keywords)) else (("_hx_" + field) if (((((len(field) > 2) and ((ord(field[0]) == 95))) and ((ord(field[1]) == 95))) and ((ord(field[(len(field) - 1)]) != 95)))) else field)) - if hasattr(o,field1): - return getattr(o,field1) - else: - return None - elif (_hx_local_1 == 16): - if (field1 == "keyValueIterator"): - return python_internal_MethodClosure(o,python_internal_ArrayImpl.keyValueIterator) - else: - field1 = (("_hx_" + field) if ((field in python_Boot.keywords)) else (("_hx_" + field) if (((((len(field) > 2) and ((ord(field[0]) == 95))) and ((ord(field[1]) == 95))) and ((ord(field[(len(field) - 1)]) != 95)))) else field)) - if hasattr(o,field1): - return getattr(o,field1) - else: - return None - elif (_hx_local_1 == 6): - if (field1 == "concat"): - return python_internal_MethodClosure(o,python_internal_ArrayImpl.concat) - elif (field1 == "filter"): - return python_internal_MethodClosure(o,python_internal_ArrayImpl.filter) - elif (field1 == "insert"): - return python_internal_MethodClosure(o,python_internal_ArrayImpl.insert) - elif (field1 == "length"): - return len(o) - elif (field1 == "remove"): - return python_internal_MethodClosure(o,python_internal_ArrayImpl.remove) - elif (field1 == "splice"): - return python_internal_MethodClosure(o,python_internal_ArrayImpl.splice) - else: - field1 = (("_hx_" + field) if ((field in python_Boot.keywords)) else (("_hx_" + field) if (((((len(field) > 2) and ((ord(field[0]) == 95))) and ((ord(field[1]) == 95))) and ((ord(field[(len(field) - 1)]) != 95)))) else field)) - if hasattr(o,field1): - return getattr(o,field1) - else: - return None - else: - field1 = (("_hx_" + field) if ((field in python_Boot.keywords)) else (("_hx_" + field) if (((((len(field) > 2) and ((ord(field[0]) == 95))) and ((ord(field[1]) == 95))) and ((ord(field[(len(field) - 1)]) != 95)))) else field)) - if hasattr(o,field1): - return getattr(o,field1) - else: - return None - else: - field1 = (("_hx_" + field) if ((field in python_Boot.keywords)) else (("_hx_" + field) if (((((len(field) > 2) and ((ord(field[0]) == 95))) and ((ord(field[1]) == 95))) and ((ord(field[(len(field) - 1)]) != 95)))) else field)) - if hasattr(o,field1): - return getattr(o,field1) - else: - return None - - @staticmethod - def getInstanceFields(c): - f = (list(c._hx_fields) if (hasattr(c,"_hx_fields")) else []) - if hasattr(c,"_hx_methods"): - f = (f + c._hx_methods) - sc = python_Boot.getSuperClass(c) - if (sc is None): - return f - else: - scArr = python_Boot.getInstanceFields(sc) - scMap = set(scArr) - _g = 0 - while (_g < len(f)): - f1 = (f[_g] if _g >= 0 and _g < len(f) else None) - _g = (_g + 1) - if (not (f1 in scMap)): - scArr.append(f1) - return scArr - - @staticmethod - def getSuperClass(c): - if (c is None): - return None - try: - if hasattr(c,"_hx_super"): - return c._hx_super - return None - except BaseException as _g: - None - return None - - @staticmethod - def getClassFields(c): - if hasattr(c,"_hx_statics"): - x = c._hx_statics - return list(x) - else: - return [] - - @staticmethod - def unhandleKeywords(name): - if (HxString.substr(name,0,python_Boot.prefixLength) == "_hx_"): - real = HxString.substr(name,python_Boot.prefixLength,None) - if (real in python_Boot.keywords): - return real - return name - - -class python_HaxeIterator: - _hx_class_name = "python.HaxeIterator" - __slots__ = ("it", "x", "has", "checked") - _hx_fields = ["it", "x", "has", "checked"] - _hx_methods = ["next", "hasNext"] - - def __init__(self,it): - self.checked = False - self.has = False - self.x = None - self.it = it - - def next(self): - if (not self.checked): - self.hasNext() - self.checked = False - return self.x - - def hasNext(self): - if (not self.checked): - try: - self.x = self.it.__next__() - self.has = True - except BaseException as _g: - None - if Std.isOfType(haxe_Exception.caught(_g).unwrap(),StopIteration): - self.has = False - self.x = None - else: - raise _g - self.checked = True - return self.has - - - -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"] - - @staticmethod - def concat(a1,a2): - return (a1 + a2) - - @staticmethod - def copy(x): - return list(x) - - @staticmethod - def iterator(x): - return python_HaxeIterator(x.__iter__()) - - @staticmethod - def keyValueIterator(x): - return haxe_iterators_ArrayKeyValueIterator(x) - - @staticmethod - def indexOf(a,x,fromIndex = None): - _hx_len = len(a) - l = (0 if ((fromIndex is None)) else ((_hx_len + fromIndex) if ((fromIndex < 0)) else fromIndex)) - if (l < 0): - l = 0 - _g = l - _g1 = _hx_len - while (_g < _g1): - i = _g - _g = (_g + 1) - if HxOverrides.eq(a[i],x): - return i - return -1 - - @staticmethod - def lastIndexOf(a,x,fromIndex = None): - _hx_len = len(a) - l = (_hx_len if ((fromIndex is None)) else (((_hx_len + fromIndex) + 1) if ((fromIndex < 0)) else (fromIndex + 1))) - if (l > _hx_len): - l = _hx_len - while True: - l = (l - 1) - tmp = l - if (not ((tmp > -1))): - break - if HxOverrides.eq(a[l],x): - return l - return -1 - - @staticmethod - def join(x,sep): - return sep.join([python_Boot.toString1(x1,'') for x1 in x]) - - @staticmethod - def toString(x): - return (("[" + HxOverrides.stringOrNull(",".join([python_Boot.toString1(x1,'') for x1 in x]))) + "]") - - @staticmethod - def pop(x): - if (len(x) == 0): - return None - else: - return x.pop() - - @staticmethod - def push(x,e): - x.append(e) - return len(x) - - @staticmethod - def unshift(x,e): - x.insert(0, e) - - @staticmethod - def remove(x,e): - try: - x.remove(e) - return True - except BaseException as _g: - None - return False - - @staticmethod - def contains(x,e): - return (e in x) - - @staticmethod - def shift(x): - if (len(x) == 0): - return None - return x.pop(0) - - @staticmethod - def slice(x,pos,end = None): - return x[pos:end] - - @staticmethod - def sort(x,f): - x.sort(key= python_lib_Functools.cmp_to_key(f)) - - @staticmethod - def splice(x,pos,_hx_len): - if (pos < 0): - pos = (len(x) + pos) - if (pos < 0): - pos = 0 - res = x[pos:(pos + _hx_len)] - del x[pos:(pos + _hx_len)] - return res - - @staticmethod - def map(x,f): - return list(map(f,x)) - - @staticmethod - def filter(x,f): - return list(filter(f,x)) - - @staticmethod - def insert(a,pos,x): - a.insert(pos, x) - - @staticmethod - def reverse(a): - a.reverse() - - @staticmethod - def _get(x,idx): - if ((idx > -1) and ((idx < len(x)))): - return x[idx] - else: - return None - - -class HxOverrides: - _hx_class_name = "HxOverrides" - __slots__ = () - _hx_statics = ["eq", "stringOrNull", "push", "arrayGet"] - - @staticmethod - def eq(a,b): - if (isinstance(a,list) or isinstance(b,list)): - return a is b - return (a == b) - - @staticmethod - def stringOrNull(s): - if (s is None): - return "null" - else: - return s - - @staticmethod - def push(x,e): - if isinstance(x,list): - _this = x - _this.append(e) - return len(_this) - return x.push(e) - - @staticmethod - def arrayGet(a,i): - if isinstance(a,list): - x = a - if ((i > -1) and ((i < len(x)))): - return x[i] - else: - return None - else: - return a[i] - - -class python_internal_MethodClosure: - _hx_class_name = "python.internal.MethodClosure" - __slots__ = ("obj", "func") - _hx_fields = ["obj", "func"] - _hx_methods = ["__call__"] - - def __init__(self,obj,func): - self.obj = obj - self.func = func - - def __call__(self,*args): - return self.func(self.obj,*args) - - - -class HxString: - _hx_class_name = "HxString" - __slots__ = () - _hx_statics = ["split", "charCodeAt", "charAt", "lastIndexOf", "toUpperCase", "toLowerCase", "indexOf", "indexOfImpl", "toString", "substring", "substr"] - - @staticmethod - def split(s,d): - if (d == ""): - return list(s) - else: - return s.split(d) - - @staticmethod - def charCodeAt(s,index): - if ((((s is None) or ((len(s) == 0))) or ((index < 0))) or ((index >= len(s)))): - return None - else: - return ord(s[index]) - - @staticmethod - def charAt(s,index): - if ((index < 0) or ((index >= len(s)))): - return "" - else: - return s[index] - - @staticmethod - def lastIndexOf(s,_hx_str,startIndex = None): - if (startIndex is None): - return s.rfind(_hx_str, 0, len(s)) - elif (_hx_str == ""): - length = len(s) - if (startIndex < 0): - startIndex = (length + startIndex) - if (startIndex < 0): - startIndex = 0 - if (startIndex > length): - return length - else: - return startIndex - else: - i = s.rfind(_hx_str, 0, (startIndex + 1)) - startLeft = (max(0,((startIndex + 1) - len(_hx_str))) if ((i == -1)) else (i + 1)) - check = s.find(_hx_str, startLeft, len(s)) - if ((check > i) and ((check <= startIndex))): - return check - else: - return i - - @staticmethod - def toUpperCase(s): - return s.upper() - - @staticmethod - def toLowerCase(s): - return s.lower() - - @staticmethod - def indexOf(s,_hx_str,startIndex = None): - if (startIndex is None): - return s.find(_hx_str) - else: - return HxString.indexOfImpl(s,_hx_str,startIndex) - - @staticmethod - def indexOfImpl(s,_hx_str,startIndex): - if (_hx_str == ""): - length = len(s) - if (startIndex < 0): - startIndex = (length + startIndex) - if (startIndex < 0): - startIndex = 0 - if (startIndex > length): - return length - else: - return startIndex - return s.find(_hx_str, startIndex) - - @staticmethod - def toString(s): - return s - - @staticmethod - def substring(s,startIndex,endIndex = None): - if (startIndex < 0): - startIndex = 0 - if (endIndex is None): - return s[startIndex:] - else: - if (endIndex < 0): - endIndex = 0 - if (endIndex < startIndex): - return s[endIndex:startIndex] - else: - return s[startIndex:endIndex] - - @staticmethod - def substr(s,startIndex,_hx_len = None): - if (_hx_len is None): - return s[startIndex:] - else: - if (_hx_len == 0): - return "" - if (startIndex < 0): - startIndex = (len(s) + startIndex) - if (startIndex < 0): - startIndex = 0 - 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,resultMap): - Frag = haxe_ds_StringMap() - Frag.h["prio"] = (xrfragment_XRF.ASSET | xrfragment_XRF.T_INT) - Frag.h["#"] = (xrfragment_XRF.ASSET | xrfragment_XRF.T_PREDEFINED_VIEW) - Frag.h["class"] = (xrfragment_XRF.ASSET | xrfragment_XRF.T_STRING) - Frag.h["src"] = (xrfragment_XRF.ASSET | xrfragment_XRF.T_URL) - Frag.h["pos"] = (((((xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.ROUNDROBIN) | xrfragment_XRF.T_VECTOR3) | xrfragment_XRF.T_STRING_OBJ) | xrfragment_XRF.EMBEDDED) | xrfragment_XRF.NAVIGATOR) - Frag.h["href"] = ((xrfragment_XRF.ASSET | xrfragment_XRF.T_URL) | xrfragment_XRF.T_PREDEFINED_VIEW) - Frag.h["q"] = ((xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_STRING) | xrfragment_XRF.EMBEDDED) - Frag.h["scale"] = ((((xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.ROUNDROBIN) | xrfragment_XRF.T_VECTOR3) | xrfragment_XRF.EMBEDDED) - Frag.h["rot"] = (((((xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.ROUNDROBIN) | xrfragment_XRF.T_VECTOR3) | xrfragment_XRF.EMBEDDED) | xrfragment_XRF.NAVIGATOR) - Frag.h["translate"] = ((((xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.ROUNDROBIN) | xrfragment_XRF.T_VECTOR3) | xrfragment_XRF.EMBEDDED) - Frag.h["visible"] = ((((xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.ROUNDROBIN) | xrfragment_XRF.T_INT) | xrfragment_XRF.EMBEDDED) - Frag.h["env"] = (((xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.T_STRING) | xrfragment_XRF.EMBEDDED) - Frag.h["t"] = (((((xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.ROUNDROBIN) | xrfragment_XRF.T_VECTOR2) | xrfragment_XRF.NAVIGATOR) | xrfragment_XRF.EMBEDDED) - Frag.h["gravity"] = (((xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.T_VECTOR3) | xrfragment_XRF.EMBEDDED) - Frag.h["physics"] = (((xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.T_VECTOR3) | xrfragment_XRF.EMBEDDED) - Frag.h["fov"] = ((((xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.T_INT) | xrfragment_XRF.NAVIGATOR) | xrfragment_XRF.EMBEDDED) - Frag.h["clip"] = ((((xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.T_VECTOR2) | xrfragment_XRF.NAVIGATOR) | xrfragment_XRF.EMBEDDED) - Frag.h["fog"] = ((((xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.T_STRING) | xrfragment_XRF.NAVIGATOR) | xrfragment_XRF.EMBEDDED) - 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.EMBEDDED) | xrfragment_XRF.PROMPT) - if ((len(value) == 0) and (not (key in Frag.h))): - value1 = xrfragment_XRF(key,(xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR)) - setattr(resultMap,(("_hx_" + key) if ((key in python_Boot.keywords)) else (("_hx_" + key) if (((((len(key) > 2) and ((ord(key[0]) == 95))) and ((ord(key[1]) == 95))) and ((ord(key[(len(key) - 1)]) != 95)))) else key)),value1) - return True - if ((len(key.split(".")) > 1) and ((len(value.split(".")) > 1))): - value1 = xrfragment_XRF(key,(((xrfragment_XRF.ASSET | xrfragment_XRF.PV_OVERRIDE) | xrfragment_XRF.T_STRING) | xrfragment_XRF.PROP_BIND)) - setattr(resultMap,(("_hx_" + key) if ((key in python_Boot.keywords)) else (("_hx_" + key) if (((((len(key) > 2) and ((ord(key[0]) == 95))) and ((ord(key[1]) == 95))) and ((ord(key[(len(key) - 1)]) != 95)))) else key)),value1) - return True - if (key in Frag.h): - v = xrfragment_XRF(key,Frag.h.get(key,None)) - if (not v.validate(value)): - print(str((((("⚠ fragment '" + ("null" if key is None else key)) + "' has incompatible value (") + ("null" if value is None else value)) + ")"))) - return False - if xrfragment_Parser.debug: - print(str(((("✔ " + ("null" if key is None else key)) + ": ") + HxOverrides.stringOrNull(v.string)))) - setattr(resultMap,(("_hx_" + key) if ((key in python_Boot.keywords)) else (("_hx_" + key) if (((((len(key) > 2) and ((ord(key[0]) == 95))) and ((ord(key[1]) == 95))) and ((ord(key[(len(key) - 1)]) != 95)))) else key)),v) - return True - - -class xrfragment_Query: - _hx_class_name = "xrfragment.Query" - __slots__ = ("str", "q", "isProp", "isExclude", "isClass", "isNumber") - _hx_fields = ["str", "q", "isProp", "isExclude", "isClass", "isNumber"] - _hx_methods = ["toObject", "expandAliases", "get", "parse", "test", "testProperty"] - - def __init__(self,_hx_str): - self.isNumber = EReg("^[0-9\\.]+$","") - self.isClass = EReg("^[-]?class$","") - 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 - - def expandAliases(self,token): - classAlias = EReg("^(-)?\\.","") - classAlias.matchObj = python_lib_Re.search(classAlias.pattern,token) - if (classAlias.matchObj is not None): - return StringTools.replace(token,".","class:") - else: - return token - - def get(self): - return self.q - - def parse(self,_hx_str,recurse = None): - if (recurse is None): - recurse = False - _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) - _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.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.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) - if (len(oper) == 0): - oper = "=" - _this = _gthis.isClass - _this.matchObj = python_lib_Re.search(_this.pattern,k) - if (_this.matchObj is not None): - key = (("null" if prefix is None else prefix) + ("null" if k is None else k)) - value = (oper != "!=") - setattr(_hx_filter,(("_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_" + v) if ((v in python_Boot.keywords)) else (("_hx_" + v) if (((((len(v) > 2) and ((ord(v[0]) == 95))) and ((ord(v[1]) == 95))) and ((ord(v[(len(v) - 1)]) != 95)))) else v)),_hx_filter) - else: - rule = _hx_AnonObject({}) - _this = _gthis.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.isExclude - _this.matchObj = python_lib_Re.search(_this.pattern,_hx_str) - key = (HxString.substr(_hx_str,1,None) if ((_this.matchObj is not None)) else _hx_str) - 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)),_hx_filter) - process = _hx_local_0 - _g = 0 - _g1 = len(token) - while (_g < _g1): - i = _g - _g = (_g + 1) - process(self.expandAliases((token[i] if i >= 0 and i < len(token) else None))) - def _hx_local_2(): - def _hx_local_1(): - self.q = q - return self.q - return _hx_local_1() - return _hx_local_2() - - def test(self,obj = None): - qualify = False - _g = 0 - _g1 = python_Boot.fields(obj) - while (_g < len(_g1)): - k = (_g1[_g] if _g >= 0 and _g < len(_g1) else None) - _g = (_g + 1) - v = Std.string(Reflect.field(obj,k)) - if self.testProperty(k,v): - qualify = True - _g = 0 - _g1 = python_Boot.fields(obj) - while (_g < len(_g1)): - k = (_g1[_g] if _g >= 0 and _g < len(_g1) else None) - _g = (_g + 1) - v = Std.string(Reflect.field(obj,k)) - if self.testProperty(k,v,True): - qualify = False - return qualify - - def testProperty(self,property,value,exclude = None): - conds = 0 - fails = 0 - qualify = 0 - def _hx_local_2(expr): - - - conds = (conds + 1) - fails = (fails + (0 if expr else 1)) - return expr - testprop = _hx_local_2 - if (Reflect.field(self.q,value) is not None): - 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) - return (qualify > 0) - - - -class xrfragment_URI: - _hx_class_name = "xrfragment.URI" - __slots__ = () - _hx_statics = ["parse"] - - @staticmethod - def parse(url,_hx_filter): - store = _hx_AnonObject({}) - startIndex = None - if (((url.find("#") if ((startIndex is None)) else HxString.indexOfImpl(url,"#",startIndex))) == -1): - return store - fragment = url.split("#") - _this = (fragment[1] if 1 < len(fragment) else None) - splitArray = _this.split("&") - _g = 0 - _g1 = len(splitArray) - while (_g < _g1): - i = _g - _g = (_g + 1) - _this = (splitArray[i] if i >= 0 and i < len(splitArray) else None) - splitByEqual = _this.split("=") - regexPlus = EReg("\\+","g") - key = (splitByEqual[0] if 0 < len(splitByEqual) else None) - value = "" - if (len(splitByEqual) > 1): - _this1 = regexPlus.split((splitByEqual[1] if 1 < len(splitByEqual) else None)) - value = python_lib_urllib_Parse.unquote(" ".join([python_Boot.toString1(x1,'') for x1 in _this1])) - ok = xrfragment_Parser.parse(key,value,store) - if ((_hx_filter is not None) and ((_hx_filter != 0))): - _g = 0 - _g1 = python_Boot.fields(store) - while (_g < len(_g1)): - key = (_g1[_g] if _g >= 0 and _g < len(_g1) else None) - _g = (_g + 1) - xrf = Reflect.field(store,key) - if (not xrf._hx_is(_hx_filter)): - Reflect.deleteField(store,key) - return store - - -class xrfragment_XRF: - _hx_class_name = "xrfragment.XRF" - __slots__ = ("fragment", "flags", "x", "y", "z", "color", "string", "int", "float", "args", "query") - _hx_fields = ["fragment", "flags", "x", "y", "z", "color", "string", "int", "float", "args", "query"] - _hx_methods = ["is", "validate", "guessType"] - _hx_statics = ["ASSET", "PROP_BIND", "QUERY_OPERATOR", "PROMPT", "ROUNDROBIN", "NAVIGATOR", "EMBEDDED", "PV_OVERRIDE", "PV_EXECUTE", "T_COLOR", "T_INT", "T_FLOAT", "T_VECTOR2", "T_VECTOR3", "T_URL", "T_PREDEFINED_VIEW", "T_STRING", "T_STRING_OBJ", "T_STRING_OBJ_PROP", "isColor", "isInt", "isFloat", "isVector", "isUrl", "isUrlOrPretypedView", "isString", "set", "unset"] - - def __init__(self,_fragment,_flags): - self.query = None - self.args = None - self.float = None - self.int = None - self.string = None - self.color = None - self.z = None - self.y = None - self.x = None - self.fragment = _fragment - self.flags = _flags - - def _hx_is(self,flag): - return (((self.flags & flag)) != 0) - - def validate(self,value): - self.guessType(self,value) - if (len(value.split("|")) > 1): - self.args = list() - args = value.split("|") - _g = 0 - _g1 = len(args) - while (_g < _g1): - i = _g - _g = (_g + 1) - x = xrfragment_XRF(self.fragment,self.flags) - self.guessType(x,(args[i] if i >= 0 and i < len(args) else None)) - _this = self.args - _this.append(x) - if (self.fragment == "q"): - self.query = xrfragment_Query(value).get() - ok = True - if (not Std.isOfType(self.args,list)): - if (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 - if (self._hx_is(xrfragment_XRF.T_VECTOR2) and (not ((Std.isOfType(self.x,Float) and Std.isOfType(self.y,Float))))): - ok = False - if (self._hx_is(xrfragment_XRF.T_INT) and (not Std.isOfType(self.int,Int))): - ok = False - return ok - - def guessType(self,v,_hx_str): - v.string = _hx_str - if (len(_hx_str.split(",")) > 1): - xyz = _hx_str.split(",") - if (len(xyz) > 0): - v.x = Std.parseFloat((xyz[0] if 0 < len(xyz) else None)) - if (len(xyz) > 1): - v.y = Std.parseFloat((xyz[1] if 1 < len(xyz) else None)) - if (len(xyz) > 2): - v.z = Std.parseFloat((xyz[2] if 2 < len(xyz) 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.float = Std.parseFloat(_hx_str) - _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) - - @staticmethod - def set(flag,flags): - return (flags | flag) - - @staticmethod - def unset(flag,flags): - return (flags & ~flag) - - -Math.NEGATIVE_INFINITY = float("-inf") -Math.POSITIVE_INFINITY = float("inf") -Math.NaN = float("nan") -Math.PI = python_lib_Math.pi - -python_Boot.keywords = set(["and", "del", "from", "not", "with", "as", "elif", "global", "or", "yield", "assert", "else", "if", "pass", "None", "break", "except", "import", "raise", "True", "class", "exec", "in", "return", "False", "continue", "finally", "is", "try", "def", "for", "lambda", "while"]) -python_Boot.prefixLength = len("_hx_") -xrfragment_Parser.error = "" -xrfragment_Parser.debug = False -xrfragment_XRF.ASSET = 1 -xrfragment_XRF.PROP_BIND = 2 -xrfragment_XRF.QUERY_OPERATOR = 4 -xrfragment_XRF.PROMPT = 8 -xrfragment_XRF.ROUNDROBIN = 16 -xrfragment_XRF.NAVIGATOR = 32 -xrfragment_XRF.EMBEDDED = 64 -xrfragment_XRF.PV_OVERRIDE = 128 -xrfragment_XRF.PV_EXECUTE = 256 -xrfragment_XRF.T_COLOR = 8192 -xrfragment_XRF.T_INT = 16384 -xrfragment_XRF.T_FLOAT = 32768 -xrfragment_XRF.T_VECTOR2 = 65536 -xrfragment_XRF.T_VECTOR3 = 131072 -xrfragment_XRF.T_URL = 262144 -xrfragment_XRF.T_PREDEFINED_VIEW = 524288 -xrfragment_XRF.T_STRING = 1048576 -xrfragment_XRF.T_STRING_OBJ = 2097152 -xrfragment_XRF.T_STRING_OBJ_PROP = 4194304 -xrfragment_XRF.isColor = EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$","") -xrfragment_XRF.isInt = EReg("^[0-9]+$","") -xrfragment_XRF.isFloat = EReg("^[0-9]+\\.[0-9]+$","") -xrfragment_XRF.isVector = EReg("([,]+|\\w)","") -xrfragment_XRF.isUrl = EReg("(://)?\\..*","") -xrfragment_XRF.isUrlOrPretypedView = EReg("(^#|://)?\\..*","") -xrfragment_XRF.isString = EReg(".*","") \ No newline at end of file diff --git a/index.html b/index.html index 379dd28..6ca2e37 100644 --- a/index.html +++ b/index.html @@ -982,6 +982,8 @@ Error message and password prompt
  • ↪ URI.parse(url,filter)
  • +
  • 📜 XR fragments
  • +
  • $:/.tb/macros/script
  • $:/.tb/modules/startup/hide-sidebar.js
  • @@ -1138,6 +1140,8 @@ Error message and password prompt
  • $:/state/toc/Examples-THREE-698730194
  • +
  • $:/state/toc/Reference-js/THREE.js--403145756
  • +
  • $:/status/RequireReloadDueToPluginChange
  • $:/StoryList
  • @@ -1218,7 +1222,9 @@ Error message and password prompt
  • interlinked.png
  • -
  • List of fragments
  • +
  • js/AFRAME
  • + +
  • js/THREE.js
  • navigation.png
  • @@ -1292,8 +1298,6 @@ Error message and password prompt
  • THREE template #online
  • -
  • THREE.js
  • -
  • vector
  • WebXR
  • @@ -1315,8 +1319,9 @@ Error message and password prompt