From 4badfe4a096f4b6f88b1c3afd69587efce97a1c0 Mon Sep 17 00:00:00 2001 From: Kyle Simpson Date: Wed, 15 Nov 2023 11:15:09 -0600 Subject: [PATCH] fixing bugs with foi-toy (web and cli), including updating to include changes to the external ebnf validator --- foi-toy/src/external/ebnftest.js | 24 ++++++++++++------------ foi-toy/src/grammar-checker.js | 11 ++++++++++- 2 files changed, 22 insertions(+), 13 deletions(-) diff --git a/foi-toy/src/external/ebnftest.js b/foi-toy/src/external/ebnftest.js index 8564b5e..aa127e6 100644 --- a/foi-toy/src/external/ebnftest.js +++ b/foi-toy/src/external/ebnftest.js @@ -5,15 +5,15 @@ // Secondary License: MIT https://getify.mit-license.org/ if(typeof Math.imul == "undefined" || (Math.imul(0xffffffff,5) == 0)) { - Math.imul = function (a, b) { - var ah = (a >>> 16) & 0xffff; - var al = a & 0xffff; - var bh = (b >>> 16) & 0xffff; - var bl = b & 0xffff; - // the shift by 0 fixes the sign on the high part - // the final |0 converts the unsigned value into a signed value - return ((al * bl) + (((ah * bl + al * bh) << 16) >>> 0)|0); - } + Math.imul = function (a, b) { + var ah = (a >>> 16) & 0xffff; + var al = a & 0xffff; + var bh = (b >>> 16) & 0xffff; + var bl = b & 0xffff; + // the shift by 0 fixes the sign on the high part + // the final |0 converts the unsigned value into a signed value + return ((al * bl) + (((ah * bl + al * bh) << 16) >>> 0)|0); + } } @@ -438,9 +438,9 @@ function Gn(a){var b=function(){var b=En(a);if(q(b))return b;b=Fn(a);if(q(b))ret function Jn(a,b){var c;c=In(a);c=q(c)?c:Kn?Kn(ik,a,null,null):Ln.call(null,ik,a,null,null);return An(c,b)}function Mn(a,b,c){if(!q(function(){var b=Cn(a);return q(b)?Pe(a):b}()))throw Error([v("Assert failed: "),v("k must be namespaced keyword or resolveable symbol"),v("\n"),v("(c/and (named? k) (namespace k))")].join(""));b=q(function(){var a=En(c);if(q(a))return a;a=Fn(c);return q(a)?a:x.b(H.a?H.a(Bn):H.call(null,Bn),c)}())?c:Kn?Kn(b,c,null,null):Ln.call(null,b,c,null,null);Gf.H(Bn,P,a,b)} Cf||Bf.call(null,sf);function Ln(a){for(var b=[],c=arguments.length,d=0;;)if(d { if (elems.grammar.value != "" && elems.input.value != "") { - context.postMessage({ [evt.target.className]: evt.target.innerHTML, }); + context.postMessage({ [evt.target.className]: evt.target.innerText, }); } }); @@ -47,6 +47,7 @@ function onMessage(message) { function elem(_id) { var _value = ""; var _html = ""; + var _text = ""; var _className = "valid"; var cbs = {}; var publicAPI = { @@ -83,6 +84,14 @@ function elem(_id) { publicAPI.dispatchEvent({ type: "_innerHTML", target: publicAPI }); return v; }, + get innerText() { + return _text; + }, + set innerText(v) { + _text = v; + publicAPI.dispatchEvent({ type: "_innerText", target: publicAPI }); + return v; + }, get className() { return _className; },