diff options
author | daurnimator <quae@daurnimator.com> | 2017-05-08 12:32:08 +1000 |
---|---|---|
committer | daurnimator <quae@daurnimator.com> | 2017-05-08 15:31:29 +1000 |
commit | 2977fe002407b6f86efa4ba5216f567082f33e45 (patch) | |
tree | da7e0127cd26534d01655e7b6a5c8732fb4920a0 /src/llex.js | |
parent | 8c8585a0bba0e05b6382f2f4f063515b5988639c (diff) | |
download | fengari-2977fe002407b6f86efa4ba5216f567082f33e45.tar.gz fengari-2977fe002407b6f86efa4ba5216f567082f33e45.tar.bz2 fengari-2977fe002407b6f86efa4ba5216f567082f33e45.zip |
Move string functions to centralised lstring.js
Diffstat (limited to 'src/llex.js')
-rw-r--r-- | src/llex.js | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/llex.js b/src/llex.js index 5591054..e690ea2 100644 --- a/src/llex.js +++ b/src/llex.js @@ -7,6 +7,7 @@ const ldebug = require('./ldebug.js'); const ldo = require('./ldo.js'); const ljstype = require('./ljstype'); const lobject = require('./lobject'); +const lstring = require('./lstring.js'); const llimit = require('./llimit.js'); const TS = defs.thread_status; const char = defs.char; @@ -231,7 +232,7 @@ const luaX_setinput = function(L, ls, z, source, firstchar) { ls.linenumber = 1; ls.lastline = 1; ls.source = source; - ls.envn = defs.to_luastring("_ENV", true); + ls.envn = lstring.luaS_newliteral(L, "_ENV"); }; const check_next1 = function(ls, c) { @@ -368,7 +369,7 @@ const read_long_string = function(ls, seminfo, sep) { } if (seminfo) - seminfo.ts = ls.buff.buffer.slice(2 + sep, 2 + sep - 2 * (2 + sep)); + seminfo.ts = lstring.luaS_bless(ls.L, ls.buff.buffer.slice(2 + sep, 2 + sep - 2 * (2 + sep))); }; const esccheck = function(ls, c, msg) { @@ -493,7 +494,7 @@ const read_string = function(ls, del, seminfo) { } save_and_next(ls); /* skip delimiter */ - seminfo.ts = ls.buff.buffer.slice(1, ls.buff.n-1); + seminfo.ts = lstring.luaS_bless(ls.L, ls.buff.buffer.slice(1, ls.buff.n-1)); }; const isreserved = function(w) { @@ -605,7 +606,7 @@ const llex = function(ls, seminfo) { save_and_next(ls); } while (ljstype.lislalnum(ls.current)); - let ts = ls.buff.buffer; + let ts = lstring.luaS_new(ls.L, ls.buff.buffer); seminfo.ts = ts; let kidx = luaX_tokens.slice(0, 22).indexOf(defs.to_jsstring(ts)); if (kidx >= 0) /* reserved word? */ |