From cfec02797fa9ce99140441cb0846f89663ea5c2a Mon Sep 17 00:00:00 2001 From: kungfooman Date: Wed, 24 Nov 2021 15:07:39 +0100 Subject: [PATCH] Handle RegEx's like `{a: /a/, b: /b/}` --- ganja.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ganja.js b/ganja.js index 16f6dc8..425d080 100644 --- a/ganja.js +++ b/ganja.js @@ -1610,7 +1610,7 @@ while (txt.length) for (t in tokens) { if (t == 4 && !possibleRegex) continue; if (resi = txt.match(tokens[t])) { - c = resi[0]; if (t!=0) {possibleRegex = c == '(' || c == '=' || c == '[' || c == ',' || c == ';';} tok.push([t | 0, c]); txt = txt.slice(c.length); break; + c = resi[0]; if (t!=0) {possibleRegex = c == '(' || c == '=' || c == '[' || c == ',' || c == ';' || c == ':';} tok.push([t | 0, c]); txt = txt.slice(c.length); break; }} // tokenise // Translate algebraic literals. (scientific e-notation to "this.Coeff" tok=tok.map(t=>(t[0]==2)?[2,'Element.Coeff('+basis.indexOf((!options.Cayley?simplify:(x)=>x)('e'+t[1].split(/e_|e|i/)[1]||1).replace('-',''))+','+(simplify(t[1].split(/e_|e|i/)[1]||1).match('-')?"-1*":"")+parseFloat(t[1][0]=='e'?1:t[1].split(/e_|e|i/)[0])+')']:t);