You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix lexing of templated strings in pretokeniser, and detect templated strings with no templates and treat them as normal strings (allows pretokenisation) - fixespruino/Espruino#2577
// acorn splits these up into tokens, so we have to work through to the end, then just include the full text
148
+
lettk2,hasTemplate=false;
149
+
do{
150
+
tk2=t.getToken();
151
+
if(tk2.type.label=="${")
152
+
hasTemplate=true;
153
+
}while(tk2.type.label!="`");
154
+
tkStr=code.substring(tk.start,tk2.end);
155
+
tp=hasTemplate ? "TEMPLATEDSTRING" : "STRING";// if we don't have any templates, treat as a normal string (https://github.com/espruino/Espruino/issues/2577)
156
+
tkValue=hasTemplate ? tkStr : eval(tkStr);// don't evaluate if it has templates as it must be done at runtime!
0 commit comments