summaryrefslogtreecommitdiff
path: root/src/llex.js
diff options
context:
space:
mode:
authordaurnimator <quae@daurnimator.com>2017-12-13 14:47:45 +1100
committerdaurnimator <quae@daurnimator.com>2017-12-13 15:04:09 +1100
commita1ddb1f89944fc997d6f4a61445c48e8511610ca (patch)
treee3d8d9f9e91e1a6810dde2e00aafe1fcf672942b /src/llex.js
parentd8e002a33c6b212891d09a2221edd0f516d13d9a (diff)
downloadfengari-a1ddb1f89944fc997d6f4a61445c48e8511610ca.tar.gz
fengari-a1ddb1f89944fc997d6f4a61445c48e8511610ca.tar.bz2
fengari-a1ddb1f89944fc997d6f4a61445c48e8511610ca.zip
src/llex.js: Use luaZ_buffer when not using .slice
Diffstat (limited to 'src/llex.js')
-rw-r--r--src/llex.js7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/llex.js b/src/llex.js
index 5bcd744..779557a 100644
--- a/src/llex.js
+++ b/src/llex.js
@@ -237,7 +237,7 @@ const read_numeral = function(ls, seminfo) {
// save(ls, 0);
let obj = new lobject.TValue();
- if (lobject.luaO_str2num(ls.buff.buffer, obj) === 0) /* format error? */
+ if (lobject.luaO_str2num(lzio.luaZ_buffer(ls.buff), obj) === 0) /* format error? */
lexerror(ls, defs.to_luastring("malformed number", true), R.TK_FLT);
if (obj.ttisinteger()) {
seminfo.i = obj.value;
@@ -254,7 +254,7 @@ const txtToken = function(ls, token) {
case R.TK_NAME: case R.TK_STRING:
case R.TK_FLT: case R.TK_INT:
// save(ls, 0);
- return lobject.luaO_pushfstring(ls.L, defs.to_luastring("'%s'", true), ls.buff.buffer);
+ return lobject.luaO_pushfstring(ls.L, defs.to_luastring("'%s'", true), lzio.luaZ_buffer(ls.buff));
default:
return luaX_token2str(ls, token);
}
@@ -561,8 +561,7 @@ const llex = function(ls, seminfo) {
do {
save_and_next(ls);
} while (ljstype.lislalnum(ls.current));
-
- let ts = luaX_newstring(ls, ls.buff.buffer);
+ let ts = luaX_newstring(ls, lzio.luaZ_buffer(ls.buff));
seminfo.ts = ts;
let kidx = token_to_index[lstring.luaS_hashlongstr(ts)];
if (kidx !== void 0 && kidx <= 22) /* reserved word? */