From 4c404c404c281f1872f0283acbaee97657f3e08b Mon Sep 17 00:00:00 2001 From: Benoit Giannangeli Date: Sun, 12 Mar 2017 16:01:08 +0100 Subject: [Strings] lapi.js, lcode.js, llex.js, lparser.js --- src/llex.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'src/llex.js') diff --git a/src/llex.js b/src/llex.js index 2e79066..fc3603f 100644 --- a/src/llex.js +++ b/src/llex.js @@ -218,7 +218,7 @@ const luaX_setinput = function(L, ls, z, source, firstchar) { ls.linenumber = 1; ls.lastline = 1; ls.source = source; - ls.envn = new TValue(CT.LUA_TLNGSTR, "_ENV"); + ls.envn = L.l_G.intern(lua.to_luastring("_ENV")); }; const check_next1 = function(ls, c) { @@ -356,7 +356,7 @@ const read_long_string = function(ls, seminfo, sep) { } if (seminfo) - seminfo.ts = new TValue(CT.LUA_TLNGSTR, ls.buff.buffer.slice(2 + sep).join('')); + seminfo.ts = new TValue(CT.LUA_TLNGSTR, lua.to_luastring(ls.buff.buffer.slice(2 + sep).join(''))); }; const esccheck = function(ls, c, msg) { @@ -478,7 +478,12 @@ const read_string = function(ls, del, seminfo) { } } save_and_next(ls); /* skip delimiter */ - seminfo.ts = new TValue(CT.LUA_TLNGSTR, ls.buff.buffer.slice(1, ls.buff.buffer.length-1).join('')); + seminfo.ts = new TValue( + CT.LUA_TLNGSTR, + lua.to_luastring( + ls.buff.buffer.slice(1, ls.buff.buffer.length-1).join('') + ) + ); }; const isreserved = function(w) { @@ -589,7 +594,7 @@ const llex = function(ls, seminfo) { save_and_next(ls); } while (ljstype.lislalnum(ls.current)); - let ts = new TValue(CT.LUA_TLNGSTR, ls.buff.buffer.join('')); + let ts = new TValue(CT.LUA_TLNGSTR, lua.to_luastring(ls.buff.buffer.join(''))); seminfo.ts = ts; let kidx = luaX_tokens.slice(0, 22).indexOf(ts.value); if (kidx >= 0) /* reserved word? */ -- cgit v1.2.3-54-g00ecf