From d6af357adf720347f2b3e03c41a36dc70b5a3d33 Mon Sep 17 00:00:00 2001 From: Benoit Giannangeli Date: Fri, 24 Mar 2017 08:57:07 +0100 Subject: \x escape sequence must store byte as is, in resulting string --- src/llex.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/llex.js b/src/llex.js index 4f5b97e..9983c1d 100644 --- a/src/llex.js +++ b/src/llex.js @@ -480,11 +480,13 @@ const read_string = function(ls, del, seminfo) { } } save_and_next(ls); /* skip delimiter */ + seminfo.ts = new TValue( CT.LUA_TLNGSTR, - lua.to_luastring( - ls.buff.buffer.slice(1, ls.buff.buffer.length-1).join('') - ) + ls.buff.buffer + .slice(1, ls.buff.n-1) + .map(e => typeof e === "string" ? lua.to_luastring(e) : [e]) + .reduce((acc, e) => acc = acc.concat(e), []) /* Hex value must not be converted */ ); }; @@ -641,4 +643,4 @@ module.exports.luaX_next = luaX_next; module.exports.luaX_setinput = luaX_setinput; module.exports.luaX_syntaxerror = luaX_syntaxerror; module.exports.luaX_token2str = luaX_token2str; -module.exports.luaX_tokens = luaX_tokens; \ No newline at end of file +module.exports.luaX_tokens = luaX_tokens; -- cgit v1.2.3-70-g09d2