xrfragment/test/generated/test.js

2433 lines
61 KiB
JavaScript

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"] || {};
$hx_exports["xrfragment"]["Query"] = $hx_exports["xrfragment"]["Query"] || {};
var $hxClasses = {},$hxEnums = $hxEnums || {},$_;
function $extend(from, fields) {
var proto = Object.create(from);
for (var name in fields) proto[name] = fields[name];
if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString;
return proto;
}
var EReg = function(r,opt) {
this.r = new RegExp(r,opt.split("u").join(""));
};
$hxClasses["EReg"] = EReg;
EReg.__name__ = "EReg";
EReg.escape = function(s) {
return s.replace(EReg.escapeRe,"\\$&");
};
EReg.prototype = {
r: null
,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;
}
,matched: function(n) {
if(this.r.m != null && n >= 0 && n < this.r.m.length) {
return this.r.m[n];
} else {
throw haxe_Exception.thrown("EReg::matched");
}
}
,matchedLeft: function() {
if(this.r.m == null) {
throw haxe_Exception.thrown("No string matched");
}
return HxOverrides.substr(this.r.s,0,this.r.m.index);
}
,matchedRight: function() {
if(this.r.m == null) {
throw haxe_Exception.thrown("No string matched");
}
var sz = this.r.m.index + this.r.m[0].length;
return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz);
}
,matchedPos: function() {
if(this.r.m == null) {
throw haxe_Exception.thrown("No string matched");
}
return { pos : this.r.m.index, len : this.r.m[0].length};
}
,matchSub: function(s,pos,len) {
if(len == null) {
len = -1;
}
if(this.r.global) {
this.r.lastIndex = pos;
this.r.m = this.r.exec(len < 0 ? s : HxOverrides.substr(s,0,pos + len));
var b = this.r.m != null;
if(b) {
this.r.s = s;
}
return b;
} else {
var b = this.match(len < 0 ? HxOverrides.substr(s,pos,null) : HxOverrides.substr(s,pos,len));
if(b) {
this.r.s = s;
this.r.m.index += pos;
}
return b;
}
}
,split: function(s) {
var d = "#__delim__#";
return s.replace(this.r,d).split(d);
}
,replace: function(s,by) {
return s.replace(this.r,by);
}
,map: function(s,f) {
var offset = 0;
var buf_b = "";
while(true) {
if(offset >= s.length) {
break;
} else if(!this.matchSub(s,offset)) {
buf_b += Std.string(HxOverrides.substr(s,offset,null));
break;
}
var p = this.matchedPos();
buf_b += Std.string(HxOverrides.substr(s,offset,p.pos - offset));
buf_b += Std.string(f(this));
if(p.len == 0) {
buf_b += Std.string(HxOverrides.substr(s,p.pos,1));
offset = p.pos + 1;
} else {
offset = p.pos + p.len;
}
if(!this.r.global) {
break;
}
}
if(!this.r.global && offset > 0 && offset < s.length) {
buf_b += Std.string(HxOverrides.substr(s,offset,null));
}
return buf_b;
}
,__class__: EReg
};
var EnumValue = {};
EnumValue.match = function(this1,pattern) {
return false;
};
var HxOverrides = function() { };
$hxClasses["HxOverrides"] = HxOverrides;
HxOverrides.__name__ = "HxOverrides";
HxOverrides.dateStr = function(date) {
var m = date.getMonth() + 1;
var d = date.getDate();
var h = date.getHours();
var mi = date.getMinutes();
var s = date.getSeconds();
return date.getFullYear() + "-" + (m < 10 ? "0" + m : "" + m) + "-" + (d < 10 ? "0" + d : "" + d) + " " + (h < 10 ? "0" + h : "" + h) + ":" + (mi < 10 ? "0" + mi : "" + mi) + ":" + (s < 10 ? "0" + s : "" + s);
};
HxOverrides.strDate = function(s) {
switch(s.length) {
case 8:
var k = s.split(":");
var d = new Date();
d["setTime"](0);
d["setUTCHours"](k[0]);
d["setUTCMinutes"](k[1]);
d["setUTCSeconds"](k[2]);
return d;
case 10:
var k = s.split("-");
return new Date(k[0],k[1] - 1,k[2],0,0,0);
case 19:
var k = s.split(" ");
var y = k[0].split("-");
var t = k[1].split(":");
return new Date(y[0],y[1] - 1,y[2],t[0],t[1],t[2]);
default:
throw haxe_Exception.thrown("Invalid date format : " + s);
}
};
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.indexOf = function(a,obj,i) {
var len = a.length;
if(i < 0) {
i += len;
if(i < 0) {
i = 0;
}
}
while(i < len) {
if(((a[i]) === obj)) {
return i;
}
++i;
}
return -1;
};
HxOverrides.lastIndexOf = function(a,obj,i) {
var len = a.length;
if(i >= len) {
i = len - 1;
} else if(i < 0) {
i += len;
}
while(i >= 0) {
if(((a[i]) === obj)) {
return i;
}
--i;
}
return -1;
};
HxOverrides.remove = function(a,obj) {
var i = a.indexOf(obj);
if(i == -1) {
return false;
}
a.splice(i,1);
return true;
};
HxOverrides.iter = function(a) {
return { cur : 0, arr : a, hasNext : function() {
return this.cur < this.arr.length;
}, next : function() {
return this.arr[this.cur++];
}};
};
HxOverrides.keyValueIter = function(a) {
return new haxe_iterators_ArrayKeyValueIterator(a);
};
HxOverrides.now = function() {
return Date.now();
};
var IntIterator = function(min,max) {
this.min = min;
this.max = max;
};
$hxClasses["IntIterator"] = IntIterator;
IntIterator.__name__ = "IntIterator";
IntIterator.prototype = {
min: null
,max: null
,hasNext: function() {
return this.min < this.max;
}
,next: function() {
return this.min++;
}
,__class__: IntIterator
};
Math.__name__ = "Math";
var Reflect = function() { };
$hxClasses["Reflect"] = Reflect;
Reflect.__name__ = "Reflect";
Reflect.hasField = function(o,field) {
return Object.prototype.hasOwnProperty.call(o,field);
};
Reflect.field = function(o,field) {
try {
return o[field];
} catch( _g ) {
haxe_NativeStackTrace.lastError = _g;
return null;
}
};
Reflect.setField = function(o,field,value) {
o[field] = value;
};
Reflect.getProperty = function(o,field) {
var tmp;
if(o == null) {
return null;
} else {
var tmp1;
if(o.__properties__) {
tmp = o.__properties__["get_" + field];
tmp1 = tmp;
} else {
tmp1 = false;
}
if(tmp1) {
return o[tmp]();
} else {
return o[field];
}
}
};
Reflect.setProperty = function(o,field,value) {
var tmp;
var tmp1;
if(o.__properties__) {
tmp = o.__properties__["set_" + field];
tmp1 = tmp;
} else {
tmp1 = false;
}
if(tmp1) {
o[tmp](value);
} else {
o[field] = value;
}
};
Reflect.callMethod = function(o,func,args) {
return func.apply(o,args);
};
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.isFunction = function(f) {
if(typeof(f) == "function") {
return !(f.__name__ || f.__ename__);
} else {
return false;
}
};
Reflect.compare = function(a,b) {
if(a == b) {
return 0;
} else if(a > b) {
return 1;
} else {
return -1;
}
};
Reflect.compareMethods = function(f1,f2) {
if(f1 == f2) {
return true;
}
if(!Reflect.isFunction(f1) || !Reflect.isFunction(f2)) {
return false;
}
if(f1.scope == f2.scope && f1.method == f2.method) {
return f1.method != null;
} else {
return false;
}
};
Reflect.isObject = function(v) {
if(v == null) {
return false;
}
var t = typeof(v);
if(!(t == "string" || t == "object" && v.__enum__ == null)) {
if(t == "function") {
return (v.__name__ || v.__ename__) != null;
} else {
return false;
}
} else {
return true;
}
};
Reflect.isEnumValue = function(v) {
if(v != null) {
return v.__enum__ != null;
} else {
return false;
}
};
Reflect.deleteField = function(o,field) {
if(!Object.prototype.hasOwnProperty.call(o,field)) {
return false;
}
delete(o[field]);
return true;
};
Reflect.copy = function(o) {
if(o == null) {
return null;
}
var o2 = { };
var _g = 0;
var _g1 = Reflect.fields(o);
while(_g < _g1.length) {
var f = _g1[_g];
++_g;
o2[f] = Reflect.field(o,f);
}
return o2;
};
Reflect.makeVarArgs = function(f) {
return function() {
var a = Array.prototype.slice;
var a1 = arguments;
var a2 = a.call(a1);
return f(a2);
};
};
var Std = function() { };
$hxClasses["Std"] = Std;
Std.__name__ = "Std";
Std.is = function(v,t) {
return js_Boot.__instanceof(v,t);
};
Std.isOfType = function(v,t) {
return js_Boot.__instanceof(v,t);
};
Std.downcast = function(value,c) {
if(js_Boot.__downcastCheck(value,c)) {
return value;
} else {
return null;
}
};
Std.instance = function(value,c) {
if(js_Boot.__downcastCheck(value,c)) {
return value;
} else {
return null;
}
};
Std.string = function(s) {
return js_Boot.__string_rec(s,"");
};
Std.int = function(x) {
return x | 0;
};
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;
};
Std.parseFloat = function(x) {
return parseFloat(x);
};
Std.random = function(x) {
if(x <= 0) {
return 0;
} else {
return Math.floor(Math.random() * x);
}
};
var StringBuf = function() {
this.b = "";
};
$hxClasses["StringBuf"] = StringBuf;
StringBuf.__name__ = "StringBuf";
StringBuf.prototype = {
b: null
,get_length: function() {
return this.b.length;
}
,add: function(x) {
this.b += Std.string(x);
}
,addChar: function(c) {
this.b += String.fromCodePoint(c);
}
,addSub: function(s,pos,len) {
this.b += len == null ? HxOverrides.substr(s,pos,null) : HxOverrides.substr(s,pos,len);
}
,toString: function() {
return this.b;
}
,__class__: StringBuf
,__properties__: {get_length:"get_length"}
};
var haxe_SysTools = function() { };
$hxClasses["haxe.SysTools"] = haxe_SysTools;
haxe_SysTools.__name__ = "haxe.SysTools";
haxe_SysTools.quoteUnixArg = function(argument) {
if(argument == "") {
return "''";
}
if(!new EReg("[^a-zA-Z0-9_@%+=:,./-]","").match(argument)) {
return argument;
}
return "'" + StringTools.replace(argument,"'","'\"'\"'") + "'";
};
haxe_SysTools.quoteWinArg = function(argument,escapeMetaCharacters) {
if(!new EReg("^[^ \t\\\\\"]+$","").match(argument)) {
var result_b = "";
var needquote = argument.indexOf(" ") != -1 || argument.indexOf("\t") != -1 || argument == "";
if(needquote) {
result_b += "\"";
}
var bs_buf = new StringBuf();
var _g = 0;
var _g1 = argument.length;
while(_g < _g1) {
var i = _g++;
var _g2 = HxOverrides.cca(argument,i);
if(_g2 == null) {
var c = _g2;
if(bs_buf.b.length > 0) {
result_b += Std.string(bs_buf.b);
bs_buf = new StringBuf();
}
result_b += String.fromCodePoint(c);
} else {
switch(_g2) {
case 34:
var bs = bs_buf.b;
result_b += bs == null ? "null" : "" + bs;
result_b += bs == null ? "null" : "" + bs;
bs_buf = new StringBuf();
result_b += "\\\"";
break;
case 92:
bs_buf.b += "\\";
break;
default:
var c1 = _g2;
if(bs_buf.b.length > 0) {
result_b += Std.string(bs_buf.b);
bs_buf = new StringBuf();
}
result_b += String.fromCodePoint(c1);
}
}
}
result_b += Std.string(bs_buf.b);
if(needquote) {
result_b += Std.string(bs_buf.b);
result_b += "\"";
}
argument = result_b;
}
if(escapeMetaCharacters) {
var result_b = "";
var _g = 0;
var _g1 = argument.length;
while(_g < _g1) {
var i = _g++;
var c = HxOverrides.cca(argument,i);
if(haxe_SysTools.winMetaCharacters.indexOf(c) >= 0) {
result_b += String.fromCodePoint(94);
}
result_b += String.fromCodePoint(c);
}
return result_b;
} else {
return argument;
}
};
var StringTools = function() { };
$hxClasses["StringTools"] = StringTools;
StringTools.__name__ = "StringTools";
StringTools.urlEncode = function(s) {
return encodeURIComponent(s);
};
StringTools.urlDecode = function(s) {
return decodeURIComponent(s.split("+").join(" "));
};
StringTools.htmlEscape = function(s,quotes) {
var buf_b = "";
var _g_offset = 0;
var _g_s = s;
while(_g_offset < _g_s.length) {
var s = _g_s;
var index = _g_offset++;
var c = s.charCodeAt(index);
if(c >= 55296 && c <= 56319) {
c = c - 55232 << 10 | s.charCodeAt(index + 1) & 1023;
}
var c1 = c;
if(c1 >= 65536) {
++_g_offset;
}
var code = c1;
switch(code) {
case 34:
if(quotes) {
buf_b += "&quot;";
} else {
buf_b += String.fromCodePoint(code);
}
break;
case 38:
buf_b += "&amp;";
break;
case 39:
if(quotes) {
buf_b += "&#039;";
} else {
buf_b += String.fromCodePoint(code);
}
break;
case 60:
buf_b += "&lt;";
break;
case 62:
buf_b += "&gt;";
break;
default:
buf_b += String.fromCodePoint(code);
}
}
return buf_b;
};
StringTools.htmlUnescape = function(s) {
return s.split("&gt;").join(">").split("&lt;").join("<").split("&quot;").join("\"").split("&#039;").join("'").split("&amp;").join("&");
};
StringTools.contains = function(s,value) {
return s.indexOf(value) != -1;
};
StringTools.startsWith = function(s,start) {
if(s.length >= start.length) {
return s.lastIndexOf(start,0) == 0;
} else {
return false;
}
};
StringTools.endsWith = function(s,end) {
var elen = end.length;
var slen = s.length;
if(slen >= elen) {
return s.indexOf(end,slen - elen) == slen - elen;
} else {
return false;
}
};
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.lpad = function(s,c,l) {
if(c.length <= 0) {
return s;
}
var buf_b = "";
l -= s.length;
while(buf_b.length < l) buf_b += c == null ? "null" : "" + c;
buf_b += s == null ? "null" : "" + s;
return buf_b;
};
StringTools.rpad = function(s,c,l) {
if(c.length <= 0) {
return s;
}
var buf_b = "";
buf_b += s == null ? "null" : "" + s;
while(buf_b.length < l) buf_b += c == null ? "null" : "" + c;
return buf_b;
};
StringTools.replace = function(s,sub,by) {
return s.split(sub).join(by);
};
StringTools.hex = function(n,digits) {
var s = "";
var hexChars = "0123456789ABCDEF";
while(true) {
s = hexChars.charAt(n & 15) + s;
n >>>= 4;
if(!(n > 0)) {
break;
}
}
if(digits != null) {
while(s.length < digits) s = "0" + s;
}
return s;
};
StringTools.fastCodeAt = function(s,index) {
return s.charCodeAt(index);
};
StringTools.unsafeCodeAt = function(s,index) {
return s.charCodeAt(index);
};
StringTools.iterator = function(s) {
return new haxe_iterators_StringIterator(s);
};
StringTools.keyValueIterator = function(s) {
return new haxe_iterators_StringKeyValueIterator(s);
};
StringTools.isEof = function(c) {
return c != c;
};
StringTools.quoteUnixArg = function(argument) {
if(argument == "") {
return "''";
} else if(!new EReg("[^a-zA-Z0-9_@%+=:,./-]","").match(argument)) {
return argument;
} else {
return "'" + StringTools.replace(argument,"'","'\"'\"'") + "'";
}
};
StringTools.quoteWinArg = function(argument,escapeMetaCharacters) {
var argument1 = argument;
if(!new EReg("^[^ \t\\\\\"]+$","").match(argument1)) {
var result_b = "";
var needquote = argument1.indexOf(" ") != -1 || argument1.indexOf("\t") != -1 || argument1 == "";
if(needquote) {
result_b += "\"";
}
var bs_buf = new StringBuf();
var _g = 0;
var _g1 = argument1.length;
while(_g < _g1) {
var i = _g++;
var _g2 = HxOverrides.cca(argument1,i);
if(_g2 == null) {
var c = _g2;
if(bs_buf.b.length > 0) {
result_b += Std.string(bs_buf.b);
bs_buf = new StringBuf();
}
result_b += String.fromCodePoint(c);
} else {
switch(_g2) {
case 34:
var bs = bs_buf.b;
result_b += Std.string(bs);
result_b += Std.string(bs);
bs_buf = new StringBuf();
result_b += "\\\"";
break;
case 92:
bs_buf.b += "\\";
break;
default:
var c1 = _g2;
if(bs_buf.b.length > 0) {
result_b += Std.string(bs_buf.b);
bs_buf = new StringBuf();
}
result_b += String.fromCodePoint(c1);
}
}
}
result_b += Std.string(bs_buf.b);
if(needquote) {
result_b += Std.string(bs_buf.b);
result_b += "\"";
}
argument1 = result_b;
}
if(escapeMetaCharacters) {
var result_b = "";
var _g = 0;
var _g1 = argument1.length;
while(_g < _g1) {
var i = _g++;
var c = HxOverrides.cca(argument1,i);
if(haxe_SysTools.winMetaCharacters.indexOf(c) >= 0) {
result_b += String.fromCodePoint(94);
}
result_b += String.fromCodePoint(c);
}
return result_b;
} else {
return argument1;
}
};
StringTools.utf16CodePointAt = function(s,index) {
var c = s.charCodeAt(index);
if(c >= 55296 && c <= 56319) {
c = c - 55232 << 10 | s.charCodeAt(index + 1) & 1023;
}
return c;
};
var Test = function() { };
$hxClasses["Test"] = Test;
Test.__name__ = "Test";
Test.main = function() {
haxe_Log.trace("starting tests",{ fileName : "src/Test.hx", lineNumber : 6, className : "Test", methodName : "main"});
var Query = xrfragment_Query;
haxe_Log.trace(new xrfragment_Query("foo or bar").toObject(),{ fileName : "src/Test.hx", lineNumber : 10, className : "Test", methodName : "main"});
haxe_Log.trace(new xrfragment_Query("class:fopoer or bar foo:bar").toObject().or[0],{ fileName : "src/Test.hx", lineNumber : 11, className : "Test", methodName : "main"});
haxe_Log.trace(new xrfragment_Query("-skybox class:foo").toObject().or[0],{ fileName : "src/Test.hx", lineNumber : 12, className : "Test", methodName : "main"});
haxe_Log.trace(new xrfragment_Query("foo/flop moo or bar").toObject().or[0],{ fileName : "src/Test.hx", lineNumber : 13, className : "Test", methodName : "main"});
haxe_Log.trace(new xrfragment_Query("-foo/flop moo or bar").toObject().or[0],{ fileName : "src/Test.hx", lineNumber : 14, className : "Test", methodName : "main"});
haxe_Log.trace(new xrfragment_Query("price:>4 moo or bar").toObject().or[0],{ fileName : "src/Test.hx", lineNumber : 15, className : "Test", methodName : "main"});
haxe_Log.trace(new xrfragment_Query("price:>=4 moo or bar").toObject().or[0],{ fileName : "src/Test.hx", lineNumber : 16, className : "Test", methodName : "main"});
haxe_Log.trace(new xrfragment_Query("price:<=4 moo or bar").toObject().or[0],{ fileName : "src/Test.hx", lineNumber : 17, className : "Test", methodName : "main"});
haxe_Log.trace(new xrfragment_Query("price:!=4 moo or bar").toObject().or[0],{ fileName : "src/Test.hx", lineNumber : 18, className : "Test", methodName : "main"});
var q = new xrfragment_Query("price:!=4 moo or bar");
var obj = q.toObject();
q.test("price",4);
var ok = !q.qualify("slkklskdf");
if(!ok) {
throw haxe_Exception.thrown("node should not be allowed");
}
q = new xrfragment_Query("price:!=3 moo or bar");
var obj = q.toObject();
q.test("price",4);
var ok = q.qualify("slkklskdf");
if(!ok) {
throw haxe_Exception.thrown("non-mentioned node should be allowed");
}
q = new xrfragment_Query("moo or bar");
var obj = q.toObject();
var ok = !q.qualify("slkklskdf");
if(!ok) {
throw haxe_Exception.thrown("node should not be allowed");
}
obj = q.toObject();
var ok = q.qualify("moo");
if(!ok) {
throw haxe_Exception.thrown("moo should be allowed");
}
var ok = q.qualify("bar");
if(!ok) {
throw haxe_Exception.thrown("bar should be allowed");
}
q = new xrfragment_Query("price:>3 moo or bar");
var obj = q.toObject();
q.test("price",4);
var ok = q.qualify("foo");
if(!ok) {
throw haxe_Exception.thrown("node should be allowed");
}
var ok = q.qualify("bar");
if(!ok) {
throw haxe_Exception.thrown("node should be allowed");
}
var ok = q.qualify("moo");
if(!ok) {
throw haxe_Exception.thrown("node should be allowed");
}
q = new xrfragment_Query("price:>3 price:<10 -bar");
var obj = q.toObject();
q.test("price",4);
var ok = q.qualify("foo");
if(!ok) {
throw haxe_Exception.thrown("node should be allowed");
}
var ok = !q.qualify("bar");
if(!ok) {
throw haxe_Exception.thrown("bar should not be allowed");
}
q.test("price",20);
var ok = !q.qualify("foo");
if(!ok) {
throw haxe_Exception.thrown("price 20 should not be allowed");
}
q = new xrfragment_Query("-bar");
var obj = q.toObject();
var ok = q.qualify("foo");
if(!ok) {
throw haxe_Exception.thrown("node should be allowed");
}
var ok = !q.qualify("bar");
if(!ok) {
throw haxe_Exception.thrown("bar should not be allowed");
}
q = new xrfragment_Query("title:*");
var obj = q.toObject();
var ok = !q.qualify("foo");
if(!ok) {
throw haxe_Exception.thrown("node should not be allowed");
}
q.test("foo","bar");
var ok = !q.qualify("foo");
if(!ok) {
throw haxe_Exception.thrown("node should not be allowed");
}
q.test("title","bar");
var ok = q.qualify("foo");
if(!ok) {
throw haxe_Exception.thrown("node should be allowed");
}
q = new xrfragment_Query("-bar +bar");
var obj = q.toObject();
var ok = q.qualify("foo");
if(!ok) {
throw haxe_Exception.thrown("node should be allowed");
}
var ok = q.qualify("bar");
if(!ok) {
throw haxe_Exception.thrown("bar should be allowed");
}
q = new xrfragment_Query("?discount");
var obj = q.toObject();
q.test("?discount","-foo");
var ok = !q.qualify("foo");
if(!ok) {
throw haxe_Exception.thrown("foo should not be allowed");
}
q = new xrfragment_Query("?");
q.test("?","-foo");
var ok = !q.qualify("foo");
if(!ok) {
throw haxe_Exception.thrown("foo should not be allowed");
}
q = new xrfragment_Query("?");
var ok = q.qualify("foo");
if(!ok) {
throw haxe_Exception.thrown("foo should not be allowed");
}
q = new xrfragment_Query("?discount");
q.test("?discount","-foo");
var ok = !q.qualify("foo");
if(!ok) {
throw haxe_Exception.thrown("foo should not be allowed");
}
q = new xrfragment_Query("?discount +foo");
var obj = q.toObject();
q.test("?discount","-foo");
var ok = !q.qualify("foo");
if(!ok) {
throw haxe_Exception.thrown("foo should not be allowed");
}
var ok = !q.qualify("foo");
if(!ok) {
throw haxe_Exception.thrown("foo should not be allowed");
}
haxe_Log.trace("all tests passed",{ fileName : "src/Test.hx", lineNumber : 116, className : "Test", methodName : "main"});
};
var ValueType = $hxEnums["ValueType"] = { __ename__:"ValueType",__constructs__:null
,TNull: {_hx_name:"TNull",_hx_index:0,__enum__:"ValueType"}
,TInt: {_hx_name:"TInt",_hx_index:1,__enum__:"ValueType"}
,TFloat: {_hx_name:"TFloat",_hx_index:2,__enum__:"ValueType"}
,TBool: {_hx_name:"TBool",_hx_index:3,__enum__:"ValueType"}
,TObject: {_hx_name:"TObject",_hx_index:4,__enum__:"ValueType"}
,TFunction: {_hx_name:"TFunction",_hx_index:5,__enum__:"ValueType"}
,TClass: ($_=function(c) { return {_hx_index:6,c:c,__enum__:"ValueType"}; },$_._hx_name="TClass",$_.__params__ = ["c"],$_)
,TEnum: ($_=function(e) { return {_hx_index:7,e:e,__enum__:"ValueType"}; },$_._hx_name="TEnum",$_.__params__ = ["e"],$_)
,TUnknown: {_hx_name:"TUnknown",_hx_index:8,__enum__:"ValueType"}
};
ValueType.__constructs__ = [ValueType.TNull,ValueType.TInt,ValueType.TFloat,ValueType.TBool,ValueType.TObject,ValueType.TFunction,ValueType.TClass,ValueType.TEnum,ValueType.TUnknown];
ValueType.__empty_constructs__ = [ValueType.TNull,ValueType.TInt,ValueType.TFloat,ValueType.TBool,ValueType.TObject,ValueType.TFunction,ValueType.TUnknown];
var Type = function() { };
$hxClasses["Type"] = Type;
Type.__name__ = "Type";
Type.getClass = function(o) {
return js_Boot.getClass(o);
};
Type.getEnum = function(o) {
if(o == null) {
return null;
}
return $hxEnums[o.__enum__];
};
Type.getSuperClass = function(c) {
return c.__super__;
};
Type.getClassName = function(c) {
return c.__name__;
};
Type.getEnumName = function(e) {
return e.__ename__;
};
Type.resolveClass = function(name) {
return $hxClasses[name];
};
Type.resolveEnum = function(name) {
return $hxEnums[name];
};
Type.createInstance = function(cl,args) {
var ctor = Function.prototype.bind.apply(cl,[null].concat(args));
return new (ctor);
};
Type.createEmptyInstance = function(cl) {
return Object.create(cl.prototype);
};
Type.createEnum = function(e,constr,params) {
var f = Reflect.field(e,constr);
if(f == null) {
throw haxe_Exception.thrown("No such constructor " + constr);
}
if(Reflect.isFunction(f)) {
if(params == null) {
throw haxe_Exception.thrown("Constructor " + constr + " need parameters");
}
return f.apply(e,params);
}
if(params != null && params.length != 0) {
throw haxe_Exception.thrown("Constructor " + constr + " does not need parameters");
}
return f;
};
Type.createEnumIndex = function(e,index,params) {
var c;
var _g = e.__constructs__[index];
if(_g == null) {
c = null;
} else {
var ctor = _g;
c = ctor._hx_name;
}
if(c == null) {
throw haxe_Exception.thrown(index + " is not a valid enum constructor index");
}
return Type.createEnum(e,c,params);
};
Type.getInstanceFields = function(c) {
var a = [];
for(var i in c.prototype) a.push(i);
HxOverrides.remove(a,"__class__");
HxOverrides.remove(a,"__properties__");
return a;
};
Type.getClassFields = function(c) {
var a = Reflect.fields(c);
HxOverrides.remove(a,"__name__");
HxOverrides.remove(a,"__interfaces__");
HxOverrides.remove(a,"__properties__");
HxOverrides.remove(a,"__super__");
HxOverrides.remove(a,"__meta__");
HxOverrides.remove(a,"prototype");
return a;
};
Type.getEnumConstructs = function(e) {
var _this = e.__constructs__;
var result = new Array(_this.length);
var _g = 0;
var _g1 = _this.length;
while(_g < _g1) {
var i = _g++;
result[i] = _this[i]._hx_name;
}
return result;
};
Type.typeof = function(v) {
switch(typeof(v)) {
case "boolean":
return ValueType.TBool;
case "function":
if(v.__name__ || v.__ename__) {
return ValueType.TObject;
}
return ValueType.TFunction;
case "number":
if(Math.ceil(v) == v % 2147483648.0) {
return ValueType.TInt;
}
return ValueType.TFloat;
case "object":
if(v == null) {
return ValueType.TNull;
}
var e = v.__enum__;
if(e != null) {
return ValueType.TEnum($hxEnums[e]);
}
var c = js_Boot.getClass(v);
if(c != null) {
return ValueType.TClass(c);
}
return ValueType.TObject;
case "string":
return ValueType.TClass(String);
case "undefined":
return ValueType.TNull;
default:
return ValueType.TUnknown;
}
};
Type.enumEq = function(a,b) {
if(a == b) {
return true;
}
try {
var e = a.__enum__;
if(e == null || e != b.__enum__) {
return false;
}
if(a._hx_index != b._hx_index) {
return false;
}
var enm = $hxEnums[e];
var params = enm.__constructs__[a._hx_index].__params__;
var _g = 0;
while(_g < params.length) {
var f = params[_g];
++_g;
if(!Type.enumEq(a[f],b[f])) {
return false;
}
}
} catch( _g ) {
haxe_NativeStackTrace.lastError = _g;
return false;
}
return true;
};
Type.enumConstructor = function(e) {
return $hxEnums[e.__enum__].__constructs__[e._hx_index]._hx_name;
};
Type.enumParameters = function(e) {
var enm = $hxEnums[e.__enum__];
var params = enm.__constructs__[e._hx_index].__params__;
if(params != null) {
var _g = [];
var _g1 = 0;
while(_g1 < params.length) {
var p = params[_g1];
++_g1;
_g.push(e[p]);
}
return _g;
} else {
return [];
}
};
Type.enumIndex = function(e) {
return e._hx_index;
};
Type.allEnums = function(e) {
return e.__empty_constructs__.slice();
};
var haxe_StackItem = $hxEnums["haxe.StackItem"] = { __ename__:"haxe.StackItem",__constructs__:null
,CFunction: {_hx_name:"CFunction",_hx_index:0,__enum__:"haxe.StackItem"}
,Module: ($_=function(m) { return {_hx_index:1,m:m,__enum__:"haxe.StackItem"}; },$_._hx_name="Module",$_.__params__ = ["m"],$_)
,FilePos: ($_=function(s,file,line,column) { return {_hx_index:2,s:s,file:file,line:line,column:column,__enum__:"haxe.StackItem"}; },$_._hx_name="FilePos",$_.__params__ = ["s","file","line","column"],$_)
,Method: ($_=function(classname,method) { return {_hx_index:3,classname:classname,method:method,__enum__:"haxe.StackItem"}; },$_._hx_name="Method",$_.__params__ = ["classname","method"],$_)
,LocalFunction: ($_=function(v) { return {_hx_index:4,v:v,__enum__:"haxe.StackItem"}; },$_._hx_name="LocalFunction",$_.__params__ = ["v"],$_)
};
haxe_StackItem.__constructs__ = [haxe_StackItem.CFunction,haxe_StackItem.Module,haxe_StackItem.FilePos,haxe_StackItem.Method,haxe_StackItem.LocalFunction];
haxe_StackItem.__empty_constructs__ = [haxe_StackItem.CFunction];
var haxe_CallStack = {};
haxe_CallStack.__properties__ = {get_length:"get_length"};
haxe_CallStack.get_length = function(this1) {
return this1.length;
};
haxe_CallStack.callStack = function() {
return haxe_NativeStackTrace.toHaxe(haxe_NativeStackTrace.callStack());
};
haxe_CallStack.exceptionStack = function(fullStack) {
if(fullStack == null) {
fullStack = false;
}
var eStack = haxe_NativeStackTrace.toHaxe(haxe_NativeStackTrace.exceptionStack());
return fullStack ? eStack : haxe_CallStack.subtract(eStack,haxe_CallStack.callStack());
};
haxe_CallStack.toString = function(stack) {
var b = new StringBuf();
var _g = 0;
var _g1 = stack;
while(_g < _g1.length) {
var s = _g1[_g];
++_g;
b.b += "\nCalled from ";
haxe_CallStack.itemToString(b,s);
}
return b.b;
};
haxe_CallStack.subtract = function(this1,stack) {
var startIndex = -1;
var i = -1;
while(++i < this1.length) {
var _g = 0;
var _g1 = stack.length;
while(_g < _g1) {
var j = _g++;
if(haxe_CallStack.equalItems(this1[i],stack[j])) {
if(startIndex < 0) {
startIndex = i;
}
++i;
if(i >= this1.length) {
break;
}
} else {
startIndex = -1;
}
}
if(startIndex >= 0) {
break;
}
}
if(startIndex >= 0) {
return this1.slice(0,startIndex);
} else {
return this1;
}
};
haxe_CallStack.copy = function(this1) {
return this1.slice();
};
haxe_CallStack.get = function(this1,index) {
return this1[index];
};
haxe_CallStack.asArray = function(this1) {
return this1;
};
haxe_CallStack.equalItems = function(item1,item2) {
if(item1 == null) {
if(item2 == null) {
return true;
} else {
return false;
}
} else {
switch(item1._hx_index) {
case 0:
if(item2 == null) {
return false;
} else if(item2._hx_index == 0) {
return true;
} else {
return false;
}
break;
case 1:
if(item2 == null) {
return false;
} else if(item2._hx_index == 1) {
var m2 = item2.m;
var m1 = item1.m;
return m1 == m2;
} else {
return false;
}
break;
case 2:
if(item2 == null) {
return false;
} else if(item2._hx_index == 2) {
var item21 = item2.s;
var file2 = item2.file;
var line2 = item2.line;
var col2 = item2.column;
var col1 = item1.column;
var line1 = item1.line;
var file1 = item1.file;
var item11 = item1.s;
if(file1 == file2 && line1 == line2 && col1 == col2) {
return haxe_CallStack.equalItems(item11,item21);
} else {
return false;
}
} else {
return false;
}
break;
case 3:
if(item2 == null) {
return false;
} else if(item2._hx_index == 3) {
var class2 = item2.classname;
var method2 = item2.method;
var method1 = item1.method;
var class1 = item1.classname;
if(class1 == class2) {
return method1 == method2;
} else {
return false;
}
} else {
return false;
}
break;
case 4:
if(item2 == null) {
return false;
} else if(item2._hx_index == 4) {
var v2 = item2.v;
var v1 = item1.v;
return v1 == v2;
} else {
return false;
}
break;
}
}
};
haxe_CallStack.exceptionToString = function(e) {
if(e.get_previous() == null) {
var tmp = "Exception: " + e.toString();
var tmp1 = e.get_stack();
return tmp + (tmp1 == null ? "null" : haxe_CallStack.toString(tmp1));
}
var result = "";
var e1 = e;
var prev = null;
while(e1 != null) {
if(prev == null) {
var result1 = "Exception: " + e1.get_message();
var tmp = e1.get_stack();
result = result1 + (tmp == null ? "null" : haxe_CallStack.toString(tmp)) + result;
} else {
var prevStack = haxe_CallStack.subtract(e1.get_stack(),prev.get_stack());
result = "Exception: " + e1.get_message() + (prevStack == null ? "null" : haxe_CallStack.toString(prevStack)) + "\n\nNext " + result;
}
prev = e1;
e1 = e1.get_previous();
}
return result;
};
haxe_CallStack.itemToString = function(b,s) {
switch(s._hx_index) {
case 0:
b.b += "a C function";
break;
case 1:
var m = s.m;
b.b += "module ";
b.b += m == null ? "null" : "" + m;
break;
case 2:
var s1 = s.s;
var file = s.file;
var line = s.line;
var col = s.column;
if(s1 != null) {
haxe_CallStack.itemToString(b,s1);
b.b += " (";
}
b.b += file == null ? "null" : "" + file;
b.b += " line ";
b.b += line == null ? "null" : "" + line;
if(col != null) {
b.b += " column ";
b.b += col == null ? "null" : "" + col;
}
if(s1 != null) {
b.b += ")";
}
break;
case 3:
var cname = s.classname;
var meth = s.method;
b.b += Std.string(cname == null ? "<unknown>" : cname);
b.b += ".";
b.b += meth == null ? "null" : "" + meth;
break;
case 4:
var n = s.v;
b.b += "local function #";
b.b += n == null ? "null" : "" + n;
break;
}
};
var haxe_IMap = function() { };
$hxClasses["haxe.IMap"] = haxe_IMap;
haxe_IMap.__name__ = "haxe.IMap";
haxe_IMap.__isInterface__ = true;
haxe_IMap.prototype = {
get: null
,set: null
,exists: null
,remove: null
,keys: null
,iterator: null
,keyValueIterator: null
,copy: null
,toString: null
,clear: null
,__class__: haxe_IMap
};
var haxe_DynamicAccess = {};
haxe_DynamicAccess._new = function() {
var this1 = { };
return this1;
};
haxe_DynamicAccess.get = function(this1,key) {
return this1[key];
};
haxe_DynamicAccess.set = function(this1,key,value) {
return this1[key] = value;
};
haxe_DynamicAccess.exists = function(this1,key) {
return Object.prototype.hasOwnProperty.call(this1,key);
};
haxe_DynamicAccess.remove = function(this1,key) {
return Reflect.deleteField(this1,key);
};
haxe_DynamicAccess.keys = function(this1) {
return Reflect.fields(this1);
};
haxe_DynamicAccess.copy = function(this1) {
return Reflect.copy(this1);
};
haxe_DynamicAccess.iterator = function(this1) {
return new haxe_iterators_DynamicAccessIterator(this1);
};
haxe_DynamicAccess.keyValueIterator = function(this1) {
return new haxe_iterators_DynamicAccessKeyValueIterator(this1);
};
var haxe_Exception = function(message,previous,native) {
Error.call(this,message);
this.message = message;
this.__previousException = previous;
this.__nativeException = native != null ? native : this;
this.__skipStack = 0;
var old = Error.prepareStackTrace;
Error.prepareStackTrace = function(e) { return e.stack; }
if(((native) instanceof Error)) {
this.stack = native.stack;
} else {
var e = null;
if(Error.captureStackTrace) {
Error.captureStackTrace(this,haxe_Exception);
e = this;
} else {
e = new Error();
if(typeof(e.stack) == "undefined") {
try { throw e; } catch(_) {}
this.__skipStack++;
}
}
this.stack = e.stack;
}
Error.prepareStackTrace = old;
};
$hxClasses["haxe.Exception"] = haxe_Exception;
haxe_Exception.__name__ = "haxe.Exception";
haxe_Exception.caught = function(value) {
if(((value) instanceof haxe_Exception)) {
return value;
} else if(((value) instanceof Error)) {
return new haxe_Exception(value.message,null,value);
} else {
return new haxe_ValueException(value,null,value);
}
};
haxe_Exception.thrown = function(value) {
if(((value) instanceof haxe_Exception)) {
return value.get_native();
} else if(((value) instanceof Error)) {
return value;
} else {
var e = new haxe_ValueException(value);
e.__skipStack++;
return e;
}
};
haxe_Exception.__super__ = Error;
haxe_Exception.prototype = $extend(Error.prototype,{
__skipStack: null
,__nativeException: null
,__previousException: null
,unwrap: function() {
return this.__nativeException;
}
,toString: function() {
return this.get_message();
}
,details: function() {
if(this.get_previous() == null) {
var tmp = "Exception: " + this.toString();
var tmp1 = this.get_stack();
return tmp + (tmp1 == null ? "null" : haxe_CallStack.toString(tmp1));
} else {
var result = "";
var e = this;
var prev = null;
while(e != null) {
if(prev == null) {
var result1 = "Exception: " + e.get_message();
var tmp = e.get_stack();
result = result1 + (tmp == null ? "null" : haxe_CallStack.toString(tmp)) + result;
} else {
var prevStack = haxe_CallStack.subtract(e.get_stack(),prev.get_stack());
result = "Exception: " + e.get_message() + (prevStack == null ? "null" : haxe_CallStack.toString(prevStack)) + "\n\nNext " + result;
}
prev = e;
e = e.get_previous();
}
return result;
}
}
,__shiftStack: function() {
this.__skipStack++;
}
,get_message: function() {
return this.message;
}
,get_previous: function() {
return this.__previousException;
}
,get_native: function() {
return this.__nativeException;
}
,get_stack: function() {
var _g = this.__exceptionStack;
if(_g == null) {
var value = haxe_NativeStackTrace.toHaxe(haxe_NativeStackTrace.normalize(this.stack),this.__skipStack);
this.setProperty("__exceptionStack",value);
return value;
} else {
var s = _g;
return s;
}
}
,setProperty: function(name,value) {
try {
Object.defineProperty(this,name,{ value : value});
} catch( _g ) {
this[name] = value;
}
}
,get___exceptionStack: function() {
return this.__exceptionStack;
}
,set___exceptionStack: function(value) {
this.setProperty("__exceptionStack",value);
return value;
}
,get___skipStack: function() {
return this.__skipStack;
}
,set___skipStack: function(value) {
this.setProperty("__skipStack",value);
return value;
}
,get___nativeException: function() {
return this.__nativeException;
}
,set___nativeException: function(value) {
this.setProperty("__nativeException",value);
return value;
}
,get___previousException: function() {
return this.__previousException;
}
,set___previousException: function(value) {
this.setProperty("__previousException",value);
return value;
}
,__class__: haxe_Exception
,__properties__: {set___exceptionStack:"set___exceptionStack",get___exceptionStack:"get___exceptionStack",get_native:"get_native",get_previous:"get_previous",get_stack:"get_stack",get_message:"get_message"}
});
var haxe_Log = function() { };
$hxClasses["haxe.Log"] = haxe_Log;
haxe_Log.__name__ = "haxe.Log";
haxe_Log.formatOutput = function(v,infos) {
var str = Std.string(v);
if(infos == null) {
return str;
}
var pstr = infos.fileName + ":" + infos.lineNumber;
if(infos.customParams != null) {
var _g = 0;
var _g1 = infos.customParams;
while(_g < _g1.length) {
var v = _g1[_g];
++_g;
str += ", " + Std.string(v);
}
}
return pstr + ": " + str;
};
haxe_Log.trace = function(v,infos) {
var str = haxe_Log.formatOutput(v,infos);
if(typeof(console) != "undefined" && console.log != null) {
console.log(str);
}
};
var haxe_NativeStackTrace = function() { };
$hxClasses["haxe.NativeStackTrace"] = haxe_NativeStackTrace;
haxe_NativeStackTrace.__name__ = "haxe.NativeStackTrace";
haxe_NativeStackTrace.lastError = null;
haxe_NativeStackTrace.wrapCallSite = null;
haxe_NativeStackTrace.saveStack = function(e) {
haxe_NativeStackTrace.lastError = e;
};
haxe_NativeStackTrace.callStack = function() {
var e = new Error("");
var stack = haxe_NativeStackTrace.tryHaxeStack(e);
if(typeof(stack) == "undefined") {
try {
throw e;
} catch( _g ) {
}
stack = e.stack;
}
return haxe_NativeStackTrace.normalize(stack,2);
};
haxe_NativeStackTrace.exceptionStack = function() {
return haxe_NativeStackTrace.normalize(haxe_NativeStackTrace.tryHaxeStack(haxe_NativeStackTrace.lastError));
};
haxe_NativeStackTrace.toHaxe = function(s,skip) {
if(skip == null) {
skip = 0;
}
if(s == null) {
return [];
} else if(typeof(s) == "string") {
var stack = s.split("\n");
if(stack[0] == "Error") {
stack.shift();
}
var m = [];
var _g = 0;
var _g1 = stack.length;
while(_g < _g1) {
var i = _g++;
if(skip > i) {
continue;
}
var line = stack[i];
var matched = line.match(/^ at ([A-Za-z0-9_. ]+) \(([^)]+):([0-9]+):([0-9]+)\)$/);
if(matched != null) {
var path = matched[1].split(".");
if(path[0] == "$hxClasses") {
path.shift();
}
var meth = path.pop();
var file = matched[2];
var line1 = Std.parseInt(matched[3]);
var column = Std.parseInt(matched[4]);
m.push(haxe_StackItem.FilePos(meth == "Anonymous function" ? haxe_StackItem.LocalFunction() : meth == "Global code" ? null : haxe_StackItem.Method(path.join("."),meth),file,line1,column));
} else {
m.push(haxe_StackItem.Module(StringTools.trim(line)));
}
}
return m;
} else if(skip > 0 && Array.isArray(s)) {
return s.slice(skip);
} else {
return s;
}
};
haxe_NativeStackTrace.tryHaxeStack = function(e) {
if(e == null) {
return [];
}
var oldValue = Error.prepareStackTrace;
Error.prepareStackTrace = haxe_NativeStackTrace.prepareHxStackTrace;
var stack = e.stack;
Error.prepareStackTrace = oldValue;
return stack;
};
haxe_NativeStackTrace.prepareHxStackTrace = function(e,callsites) {
var stack = [];
var _g = 0;
while(_g < callsites.length) {
var site = callsites[_g];
++_g;
if(haxe_NativeStackTrace.wrapCallSite != null) {
site = haxe_NativeStackTrace.wrapCallSite(site);
}
var method = null;
var fullName = site.getFunctionName();
if(fullName != null) {
var idx = fullName.lastIndexOf(".");
if(idx >= 0) {
var className = fullName.substring(0,idx);
var methodName = fullName.substring(idx + 1);
method = haxe_StackItem.Method(className,methodName);
} else {
method = haxe_StackItem.Method(null,fullName);
}
}
var fileName = site.getFileName();
var fileAddr = fileName == null ? -1 : fileName.indexOf("file:");
if(haxe_NativeStackTrace.wrapCallSite != null && fileAddr > 0) {
fileName = fileName.substring(fileAddr + 6);
}
stack.push(haxe_StackItem.FilePos(method,fileName,site.getLineNumber(),site.getColumnNumber()));
}
return stack;
};
haxe_NativeStackTrace.normalize = function(stack,skipItems) {
if(skipItems == null) {
skipItems = 0;
}
if(Array.isArray(stack) && skipItems > 0) {
return stack.slice(skipItems);
} else if(typeof(stack) == "string") {
switch(stack.substring(0,6)) {
case "Error\n":case "Error:":
++skipItems;
break;
default:
}
return haxe_NativeStackTrace.skipLines(stack,skipItems);
} else {
return stack;
}
};
haxe_NativeStackTrace.skipLines = function(stack,skip,pos) {
if(pos == null) {
pos = 0;
}
if(skip > 0) {
pos = stack.indexOf("\n",pos);
if(pos < 0) {
return "";
} else {
return haxe_NativeStackTrace.skipLines(stack,--skip,pos + 1);
}
} else {
return stack.substring(pos);
}
};
var haxe_Rest = {};
haxe_Rest.__properties__ = {get_length:"get_length"};
haxe_Rest.get_length = function(this1) {
return this1.length;
};
haxe_Rest.of = function(array) {
var this1 = array;
return this1;
};
haxe_Rest._new = function(array) {
var this1 = array;
return this1;
};
haxe_Rest.get = function(this1,index) {
return this1[index];
};
haxe_Rest.toArray = function(this1) {
return this1.slice();
};
haxe_Rest.iterator = function(this1) {
return new haxe_iterators_RestIterator(this1);
};
haxe_Rest.keyValueIterator = function(this1) {
return new haxe_iterators_RestKeyValueIterator(this1);
};
haxe_Rest.append = function(this1,item) {
var result = this1.slice();
result.push(item);
var this1 = result;
return this1;
};
haxe_Rest.prepend = function(this1,item) {
var result = this1.slice();
result.unshift(item);
var this1 = result;
return this1;
};
haxe_Rest.toString = function(this1) {
return "[" + this1.toString() + "]";
};
var haxe_ValueException = function(value,previous,native) {
haxe_Exception.call(this,String(value),previous,native);
this.value = value;
this.__skipStack++;
};
$hxClasses["haxe.ValueException"] = haxe_ValueException;
haxe_ValueException.__name__ = "haxe.ValueException";
haxe_ValueException.__super__ = haxe_Exception;
haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{
value: null
,unwrap: function() {
return this.value;
}
,__class__: haxe_ValueException
});
var haxe_ds_ReadOnlyArray = {};
haxe_ds_ReadOnlyArray.__properties__ = {get_length:"get_length"};
haxe_ds_ReadOnlyArray.get_length = function(this1) {
return this1.length;
};
haxe_ds_ReadOnlyArray.get = function(this1,i) {
return this1[i];
};
haxe_ds_ReadOnlyArray.concat = function(this1,a) {
return this1.concat(a);
};
var haxe_iterators_ArrayIterator = function(array) {
this.current = 0;
this.array = array;
};
$hxClasses["haxe.iterators.ArrayIterator"] = haxe_iterators_ArrayIterator;
haxe_iterators_ArrayIterator.__name__ = "haxe.iterators.ArrayIterator";
haxe_iterators_ArrayIterator.prototype = {
array: null
,current: null
,hasNext: function() {
return this.current < this.array.length;
}
,next: function() {
return this.array[this.current++];
}
,__class__: haxe_iterators_ArrayIterator
};
var haxe_iterators_ArrayKeyValueIterator = function(array) {
this.current = 0;
this.array = array;
};
$hxClasses["haxe.iterators.ArrayKeyValueIterator"] = haxe_iterators_ArrayKeyValueIterator;
haxe_iterators_ArrayKeyValueIterator.__name__ = "haxe.iterators.ArrayKeyValueIterator";
haxe_iterators_ArrayKeyValueIterator.prototype = {
current: null
,array: null
,hasNext: function() {
return this.current < this.array.length;
}
,next: function() {
return { value : this.array[this.current], key : this.current++};
}
,__class__: haxe_iterators_ArrayKeyValueIterator
};
var haxe_iterators_DynamicAccessIterator = function(access) {
this.access = access;
this.keys = Reflect.fields(access);
this.index = 0;
};
$hxClasses["haxe.iterators.DynamicAccessIterator"] = haxe_iterators_DynamicAccessIterator;
haxe_iterators_DynamicAccessIterator.__name__ = "haxe.iterators.DynamicAccessIterator";
haxe_iterators_DynamicAccessIterator.prototype = {
access: null
,keys: null
,index: null
,hasNext: function() {
return this.index < this.keys.length;
}
,next: function() {
return this.access[this.keys[this.index++]];
}
,__class__: haxe_iterators_DynamicAccessIterator
};
var haxe_iterators_DynamicAccessKeyValueIterator = function(access) {
this.access = access;
this.keys = Reflect.fields(access);
this.index = 0;
};
$hxClasses["haxe.iterators.DynamicAccessKeyValueIterator"] = haxe_iterators_DynamicAccessKeyValueIterator;
haxe_iterators_DynamicAccessKeyValueIterator.__name__ = "haxe.iterators.DynamicAccessKeyValueIterator";
haxe_iterators_DynamicAccessKeyValueIterator.prototype = {
access: null
,keys: null
,index: null
,hasNext: function() {
return this.index < this.keys.length;
}
,next: function() {
var key = this.keys[this.index++];
return { value : this.access[key], key : key};
}
,__class__: haxe_iterators_DynamicAccessKeyValueIterator
};
var haxe_iterators_RestIterator = function(args) {
this.current = 0;
this.args = args;
};
$hxClasses["haxe.iterators.RestIterator"] = haxe_iterators_RestIterator;
haxe_iterators_RestIterator.__name__ = "haxe.iterators.RestIterator";
haxe_iterators_RestIterator.prototype = {
args: null
,current: null
,hasNext: function() {
return this.current < this.args.length;
}
,next: function() {
return this.args[this.current++];
}
,__class__: haxe_iterators_RestIterator
};
var haxe_iterators_RestKeyValueIterator = function(args) {
this.current = 0;
this.args = args;
};
$hxClasses["haxe.iterators.RestKeyValueIterator"] = haxe_iterators_RestKeyValueIterator;
haxe_iterators_RestKeyValueIterator.__name__ = "haxe.iterators.RestKeyValueIterator";
haxe_iterators_RestKeyValueIterator.prototype = {
args: null
,current: null
,hasNext: function() {
return this.current < this.args.length;
}
,next: function() {
return { key : this.current, value : this.args[this.current++]};
}
,__class__: haxe_iterators_RestKeyValueIterator
};
var haxe_iterators_StringIterator = function(s) {
this.offset = 0;
this.s = s;
};
$hxClasses["haxe.iterators.StringIterator"] = haxe_iterators_StringIterator;
haxe_iterators_StringIterator.__name__ = "haxe.iterators.StringIterator";
haxe_iterators_StringIterator.prototype = {
offset: null
,s: null
,hasNext: function() {
return this.offset < this.s.length;
}
,next: function() {
return this.s.charCodeAt(this.offset++);
}
,__class__: haxe_iterators_StringIterator
};
var haxe_iterators_StringIteratorUnicode = function(s) {
this.offset = 0;
this.s = s;
};
$hxClasses["haxe.iterators.StringIteratorUnicode"] = haxe_iterators_StringIteratorUnicode;
haxe_iterators_StringIteratorUnicode.__name__ = "haxe.iterators.StringIteratorUnicode";
haxe_iterators_StringIteratorUnicode.unicodeIterator = function(s) {
return new haxe_iterators_StringIteratorUnicode(s);
};
haxe_iterators_StringIteratorUnicode.prototype = {
offset: null
,s: null
,hasNext: function() {
return this.offset < this.s.length;
}
,next: function() {
var s = this.s;
var index = this.offset++;
var c = s.charCodeAt(index);
if(c >= 55296 && c <= 56319) {
c = c - 55232 << 10 | s.charCodeAt(index + 1) & 1023;
}
var c1 = c;
if(c1 >= 65536) {
this.offset++;
}
return c1;
}
,__class__: haxe_iterators_StringIteratorUnicode
};
var haxe_iterators_StringKeyValueIterator = function(s) {
this.offset = 0;
this.s = s;
};
$hxClasses["haxe.iterators.StringKeyValueIterator"] = haxe_iterators_StringKeyValueIterator;
haxe_iterators_StringKeyValueIterator.__name__ = "haxe.iterators.StringKeyValueIterator";
haxe_iterators_StringKeyValueIterator.prototype = {
offset: null
,s: null
,hasNext: function() {
return this.offset < this.s.length;
}
,next: function() {
return { key : this.offset, value : this.s.charCodeAt(this.offset++)};
}
,__class__: haxe_iterators_StringKeyValueIterator
};
var js_Boot = function() { };
$hxClasses["js.Boot"] = js_Boot;
js_Boot.__name__ = "js.Boot";
js_Boot.isClass = function(o) {
return o.__name__;
};
js_Boot.isInterface = function(o) {
return o.__isInterface__;
};
js_Boot.isEnum = function(e) {
return e.__ename__;
};
js_Boot.getClass = function(o) {
if(o == null) {
return null;
} else if(((o) instanceof Array)) {
return Array;
} else {
var cl = o.__class__;
if(cl != null) {
return cl;
}
var name = js_Boot.__nativeClassName(o);
if(name != null) {
return js_Boot.__resolveNativeClass(name);
}
return null;
}
};
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 "<function>";
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 ) {
haxe_NativeStackTrace.lastError = _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);
}
};
js_Boot.__interfLoop = function(cc,cl) {
if(cc == null) {
return false;
}
if(cc == cl) {
return true;
}
var intf = cc.__interfaces__;
if(intf != null) {
var _g = 0;
var _g1 = intf.length;
while(_g < _g1) {
var i = _g++;
var i1 = intf[i];
if(i1 == cl || js_Boot.__interfLoop(i1,cl)) {
return true;
}
}
}
return js_Boot.__interfLoop(cc.__super__,cl);
};
js_Boot.__instanceof = function(o,cl) {
if(cl == null) {
return false;
}
switch(cl) {
case Array:
return ((o) instanceof Array);
case Bool:
return typeof(o) == "boolean";
case Dynamic:
return o != null;
case Float:
return typeof(o) == "number";
case Int:
if(typeof(o) == "number") {
return ((o | 0) === o);
} else {
return false;
}
break;
case String:
return typeof(o) == "string";
default:
if(o != null) {
if(typeof(cl) == "function") {
if(js_Boot.__downcastCheck(o,cl)) {
return true;
}
} else if(typeof(cl) == "object" && js_Boot.__isNativeObj(cl)) {
if(((o) instanceof cl)) {
return true;
}
}
} else {
return false;
}
if(cl == Class ? o.__name__ != null : false) {
return true;
}
if(cl == Enum ? o.__ename__ != null : false) {
return true;
}
return false;
}
};
js_Boot.__downcastCheck = function(o,cl) {
if(!((o) instanceof cl)) {
if(cl.__isInterface__) {
return js_Boot.__interfLoop(js_Boot.getClass(o),cl);
} else {
return false;
}
} else {
return true;
}
};
js_Boot.__implements = function(o,iface) {
return js_Boot.__interfLoop(js_Boot.getClass(o),iface);
};
js_Boot.__cast = function(o,t) {
if(o == null || js_Boot.__instanceof(o,t)) {
return o;
} else {
throw haxe_Exception.thrown("Cannot cast " + Std.string(o) + " to " + Std.string(t));
}
};
js_Boot.__toStr = null;
js_Boot.__nativeClassName = function(o) {
var name = js_Boot.__toStr.call(o).slice(8,-1);
if(name == "Object" || name == "Function" || name == "Math" || name == "JSON") {
return null;
}
return name;
};
js_Boot.__isNativeObj = function(o) {
return js_Boot.__nativeClassName(o) != null;
};
js_Boot.__resolveNativeClass = function(name) {
return $global[name];
};
var js_Lib = function() { };
$hxClasses["js.Lib"] = js_Lib;
js_Lib.__name__ = "js.Lib";
js_Lib.__properties__ = {get_undefined:"get_undefined"};
js_Lib.debug = function() {
debugger;
};
js_Lib.alert = function(v) {
alert(js_Boot.__string_rec(v,""));
};
js_Lib.eval = function(code) {
return eval(code);
};
js_Lib.get_undefined = function() {
return undefined;
};
js_Lib.rethrow = function() {
};
js_Lib.getOriginalException = function() {
return null;
};
js_Lib.getNextHaxeUID = function() {
return $global.$haxeUID++;
};
var js_lib_ObjectEntry = {};
js_lib_ObjectEntry.__properties__ = {get_value:"get_value",get_key:"get_key"};
js_lib_ObjectEntry.get_key = function(this1) {
return this1[0];
};
js_lib_ObjectEntry.get_value = function(this1) {
return this1[1];
};
var xrfragment_Query = function(str) {
this.preset = "";
this.accept = false;
this.exclude = [];
this.include = [];
this.q = { };
this.str = "";
if(str != null) {
this.parse(str);
}
};
$hxClasses["xrfragment.Query"] = xrfragment_Query;
xrfragment_Query.__name__ = "xrfragment.Query";
xrfragment_Query.prototype = {
str: null
,q: null
,include: null
,exclude: null
,accept: null
,preset: null
,toObject: function() {
return this.q;
}
,qualify: function(nodename) {
if(this.q.copy_all) {
this.accept = true;
}
if(this.include.indexOf(nodename) != -1) {
this.accept = true;
}
if(this.exclude.indexOf(nodename) != -1) {
this.accept = false;
}
return this.accept;
}
,parse: function(str,recurse) {
if(recurse == null) {
recurse = false;
}
var _gthis = this;
var copyAll = recurse ? this.q.copy_all : HxOverrides.substr(str,0,1) == "-" || HxOverrides.substr(str,0,1) == "?" || str == "";
var isOr = new EReg("^or$","");
var isProp = new EReg(".*:[><=!]?","");
var isName = new EReg("[^:/]","");
var isExclude = new EReg("^-","");
var isInclude = new EReg("^\\+","");
var isPreset = new EReg("^\\?","");
var token = str.split(" ");
var ors = [];
var q = { };
var composeQuery = function() {
q = { };
var value = [];
q["object"] = value;
var value = [];
q["-object"] = value;
ors.push(q);
return q;
};
composeQuery();
var match = null;
match = function(str,prefix) {
if(prefix == null) {
prefix = "";
}
if(isPreset.match(str) && !recurse) {
_gthis.preset = str;
return;
}
if(isExclude.match(str) || isInclude.match(str)) {
var t = HxOverrides.substr(str,1,null);
match(t,HxOverrides.substr(str,0,1));
return;
}
if(isProp.match(str)) {
var skip = 0;
var type = "=";
if(str.indexOf("*") != -1) {
type = "*";
}
if(str.indexOf(">") != -1) {
type = ">";
}
if(str.indexOf("<") != -1) {
type = "<";
}
if(str.indexOf("!=") != -1) {
type = "!=";
}
if(str.indexOf(">=") != -1) {
type = ">=";
}
if(str.indexOf("<=") != -1) {
type = "<=";
}
if(type != "=") {
skip += type.length;
}
var property = str.split(":")[0];
var value;
if(q[prefix + property]) {
value = q[prefix + property];
} else {
value = { };
}
value[type] = HxOverrides.substr(str.split(":")[1],skip,null);
q[prefix + property] = value;
return;
}
if(isName.match(str)) {
if(prefix == "-") {
q["-object"].push(str);
while(q["object"].contains(str) == true) q["object"].remove(str);
} else {
q["object"].push(str);
while(q["-object"].contains(str) == true) q["-object"].remove(str);
}
return;
}
};
var _g = 0;
var _g1 = token.length;
while(_g < _g1) {
var i = _g++;
if(isOr.match(token[i])) {
composeQuery();
} else {
match(token[i]);
}
}
var _g = 0;
var _g1 = ors.length;
while(_g < _g1) {
var i = _g++;
var or = ors[i];
if(Reflect.field(or,"object") != null) {
this.include = this.include.concat(Reflect.field(or,"object"));
}
if(Reflect.field(or,"-object") != null) {
this.exclude = this.exclude.concat(Reflect.field(or,"-object"));
}
}
this.q = { or : ors, copy_all : copyAll};
return this.q;
}
,test: function(property,value) {
if(this.preset == property) {
this.parse(value,true);
}
var _g = 0;
var _g1 = this.q.or.length;
while(_g < _g1) {
var i = _g++;
var or = this.q.or[i];
var conds = [0];
var fails = [0];
var pass = 0;
var when = (function(fails,conds) {
return function(expr) {
conds[0] += 1;
fails[0] += expr ? 0 : 1;
return expr;
};
})(fails,conds);
var _g2 = 0;
var _g3 = Reflect.fields(or);
while(_g2 < _g3.length) {
var k = _g3[_g2];
++_g2;
var orval = Reflect.field(or,k);
if(k != property) {
continue;
}
if(Reflect.field(orval,"=") != null && when(value == Reflect.field(orval,"="))) {
++pass;
}
if(Reflect.field(orval,"*") != null && when(value != null)) {
++pass;
}
if(Reflect.field(orval,">") != null && when(value > Std.parseInt(Reflect.field(orval,">")))) {
++pass;
}
if(Reflect.field(orval,"<") != null && when(value < Std.parseInt(Reflect.field(orval,"<")))) {
++pass;
}
if(Reflect.field(orval,">=") != null && when(value >= Std.parseInt(Reflect.field(orval,">=")))) {
++pass;
}
if(Reflect.field(orval,"<=") != null && when(value >= Std.parseInt(Reflect.field(orval,"<=")))) {
++pass;
}
if(Reflect.field(orval,"!=") != null && when(value != Std.parseInt(Reflect.field(orval,"!=")))) {
++pass;
}
}
if(this.accept && conds[0] > 0 && fails[0] > 0) {
this.accept = false;
}
if(conds[0] > 0 && pass > 0 && fails[0] == 0) {
this.accept = true;
}
}
}
,__class__: xrfragment_Query
};
if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) {
HxOverrides.now = performance.now.bind(performance);
}
$hxClasses["Math"] = Math;
if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); }
String.prototype.__class__ = $hxClasses["String"] = String;
String.__name__ = "String";
$hxClasses["Array"] = Array;
Array.__name__ = "Array";
Date.prototype.__class__ = $hxClasses["Date"] = Date;
Date.__name__ = "Date";
var Int = { };
var Dynamic = { };
var Float = Number;
var Bool = Boolean;
var Class = { };
var Enum = { };
js_Boot.__toStr = ({ }).toString;
EReg.escapeRe = new RegExp("[.*+?^${}()|[\\]\\\\]","g");
haxe_SysTools.winMetaCharacters = [32,40,41,37,33,94,34,60,62,38,124,10,13,44,59];
StringTools.winMetaCharacters = haxe_SysTools.winMetaCharacters;
StringTools.MIN_SURROGATE_CODE_POINT = 65536;
var xrfragment_Query_ok = $hx_exports["xrfragment"]["Query"]["ok"] =
// haxe workarounds
Array.prototype.contains = Array.prototype.includes
if (typeof Array.prototype.remove !== "function") {
Array.prototype.remove = function (item) {
const oldLength = this.length
let newLength = 0
for (let i = 0; i < oldLength; i++) {
const entry = this[i]
if (entry === item) {
let newLength = i++
while (i !== this.length) {
const entry = this[i]
if (entry !== item) this[newLength++] = entry
i++
}
this.length = newLength
for (let i = newLength; i < oldLength; i++) delete this[i]
return true
}
}
return false
}
}
;
Test.main();
})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this);
var xrfragment = $hx_exports["xrfragment"];