From 0ec526d9a2474ebe577d8c28744edf7634aca88e Mon Sep 17 00:00:00 2001 From: Leon van Kammen Date: Thu, 4 May 2023 16:26:14 +0200 Subject: [PATCH] minor updates --- dist/xrfragment.js | 9 +++++---- dist/xrfragment.lua | 10 ++++++---- dist/xrfragment.module.js | 9 +++++---- dist/xrfragment.py | 10 +++++----- example/threejs/sandbox/index.html | 2 +- src/xrfragment/Parser.hx | 6 ++++-- test/generated/test.js | 9 +++++---- test/generated/test.py | 10 +++++----- 8 files changed, 36 insertions(+), 29 deletions(-) diff --git a/dist/xrfragment.js b/dist/xrfragment.js index 081fbed..d1ee0a5 100644 --- a/dist/xrfragment.js +++ b/dist/xrfragment.js @@ -250,13 +250,13 @@ xrfragment_Parser.parse = function(key,value,resultMap) { 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:74:","[ i ] fragment '" + key + "' has incompatible value (" + 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:","✔ XR Fragment '" + key + "': '" + v.string + "'"); + } resultMap[key] = v; - } else { - console.log("src/xrfragment/Parser.hx:78:","[ i ] fragment '" + key + "' does not exist or has no type typed (yet)"); - return false; } return true; }; @@ -564,6 +564,7 @@ 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; diff --git a/dist/xrfragment.lua b/dist/xrfragment.lua index 5bec080..5ecd36a 100644 --- a/dist/xrfragment.lua +++ b/dist/xrfragment.lua @@ -1613,13 +1613,13 @@ __xrfragment_Parser.parse = function(key,value,resultMap) end; local v = __xrfragment_XRF.new(key, ret); if (not v:validate(value)) then - __haxe_Log.trace(Std.string(Std.string(Std.string(Std.string("[ i ] fragment '") .. Std.string(key)) .. Std.string("' has incompatible value (")) .. Std.string(value)) .. Std.string(")"), _hx_o({__fields__={fileName=true,lineNumber=true,className=true,methodName=true},fileName="src/xrfragment/Parser.hx",lineNumber=74,className="xrfragment.Parser",methodName="parse"})); + __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("✔ XR Fragment '") .. Std.string(key)) .. Std.string("': '")) .. Std.string(v.string)) .. Std.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; - else - __haxe_Log.trace(Std.string(Std.string("[ i ] fragment '") .. Std.string(key)) .. Std.string("' does not exist or has no type typed (yet)"), _hx_o({__fields__={fileName=true,lineNumber=true,className=true,methodName=true},fileName="src/xrfragment/Parser.hx",lineNumber=78,className="xrfragment.Parser",methodName="parse"})); - do return false end; end; do return true end; end @@ -2369,6 +2369,8 @@ local _hx_static_init = function() __xrfragment_Parser.error = ""; + __xrfragment_Parser.debug = false; + __xrfragment_XRF.ASSET = 1; __xrfragment_XRF.PROP_BIND = 2; diff --git a/dist/xrfragment.module.js b/dist/xrfragment.module.js index 6e0bec8..ec61eff 100644 --- a/dist/xrfragment.module.js +++ b/dist/xrfragment.module.js @@ -250,13 +250,13 @@ xrfragment_Parser.parse = function(key,value,resultMap) { 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:74:","[ i ] fragment '" + key + "' has incompatible value (" + 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:","✔ XR Fragment '" + key + "': '" + v.string + "'"); + } resultMap[key] = v; - } else { - console.log("src/xrfragment/Parser.hx:78:","[ i ] fragment '" + key + "' does not exist or has no type typed (yet)"); - return false; } return true; }; @@ -564,6 +564,7 @@ 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; diff --git a/dist/xrfragment.py b/dist/xrfragment.py index a7f3edc..5ebc81b 100644 --- a/dist/xrfragment.py +++ b/dist/xrfragment.py @@ -1288,7 +1288,7 @@ class HxString: class xrfragment_Parser: _hx_class_name = "xrfragment.Parser" __slots__ = () - _hx_statics = ["error", "parse"] + _hx_statics = ["error", "debug", "parse"] @staticmethod def parse(key,value,resultMap): @@ -1327,12 +1327,11 @@ class xrfragment_Parser: if (key in Frag.h): v = xrfragment_XRF(key,Frag.h.get(key,None)) if (not v.validate(value)): - print(str((((("[ i ] fragment '" + ("null" if key is None else key)) + "' has incompatible value (") + ("null" if value is None else 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((((("✔ XR Fragment '" + ("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) - else: - print(str((("[ i ] fragment '" + ("null" if key is None else key)) + "' does not exist or has no type typed (yet)"))) - return False return True @@ -1650,6 +1649,7 @@ 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 diff --git a/example/threejs/sandbox/index.html b/example/threejs/sandbox/index.html index c0715a2..4e0bd6a 100644 --- a/example/threejs/sandbox/index.html +++ b/example/threejs/sandbox/index.html @@ -19,7 +19,7 @@ - source + source diff --git a/src/xrfragment/Parser.hx b/src/xrfragment/Parser.hx index ac53da1..05244ed 100644 --- a/src/xrfragment/Parser.hx +++ b/src/xrfragment/Parser.hx @@ -6,6 +6,7 @@ import xrfragment.XRF; @:keep // <- avoids accidental removal by dead code elimination class Parser { public static var error:String = ""; + public static var debug:Bool = false; @:keep public static function parse(key:String,value:String,resultMap:haxe.DynamicAccess):Bool { @@ -71,11 +72,12 @@ class Parser { if( Frag.exists(key) ){ // 1. check if param exist var v:XRF = new XRF(key, Frag.get(key)); if( !v.validate(value) ){ - trace("[ i ] fragment '"+key+"' has incompatible value ("+value+")"); + trace("⚠ fragment '"+key+"' has incompatible value ("+value+")"); return false; } + if( debug ) trace("✔ XR Fragment '"+key+"': '"+v.string+"'"); resultMap.set(key, v ); - }else{ trace("[ i ] fragment '"+key+"' does not exist or has no type typed (yet)"); return false; } + } return true; } diff --git a/test/generated/test.js b/test/generated/test.js index cda622f..456ba84 100644 --- a/test/generated/test.js +++ b/test/generated/test.js @@ -360,13 +360,13 @@ xrfragment_Parser.parse = function(key,value,resultMap) { 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:74:","[ i ] fragment '" + key + "' has incompatible value (" + 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:","✔ XR Fragment '" + key + "': '" + v.string + "'"); + } resultMap[key] = v; - } else { - console.log("src/xrfragment/Parser.hx:78:","[ i ] fragment '" + key + "' does not exist or has no type typed (yet)"); - return false; } return true; }; @@ -675,6 +675,7 @@ Array.__name__ = true; js_Boot.__toStr = ({ }).toString; Test.errors = 0; xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; xrfragment_XRF.ASSET = 1; xrfragment_XRF.PROP_BIND = 2; xrfragment_XRF.QUERY_OPERATOR = 4; diff --git a/test/generated/test.py b/test/generated/test.py index 296561b..6cdb440 100644 --- a/test/generated/test.py +++ b/test/generated/test.py @@ -1402,7 +1402,7 @@ class HxString: class xrfragment_Parser: _hx_class_name = "xrfragment.Parser" __slots__ = () - _hx_statics = ["error", "parse"] + _hx_statics = ["error", "debug", "parse"] @staticmethod def parse(key,value,resultMap): @@ -1441,12 +1441,11 @@ class xrfragment_Parser: if (key in Frag.h): v = xrfragment_XRF(key,Frag.h.get(key,None)) if (not v.validate(value)): - print(str((((("[ i ] fragment '" + ("null" if key is None else key)) + "' has incompatible value (") + ("null" if value is None else 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((((("✔ XR Fragment '" + ("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) - else: - print(str((("[ i ] fragment '" + ("null" if key is None else key)) + "' does not exist or has no type typed (yet)"))) - return False return True @@ -1765,6 +1764,7 @@ Test.errors = 0 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