summaryrefslogtreecommitdiff
path: root/src/llex.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/llex.js')
-rw-r--r--src/llex.js14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/llex.js b/src/llex.js
index 59c9015..5591054 100644
--- a/src/llex.js
+++ b/src/llex.js
@@ -67,8 +67,6 @@ const luaX_tokens = [
"<number>", "<integer>", "<name>", "<string>"
];
-const NUM_RESERVED = Object.keys(RESERVED).length;
-
class MBuffer {
constructor(L, data, reader) {
this.L = L;
@@ -102,6 +100,18 @@ class MBuffer {
return r;
}
+ read(size) {
+ let r = [];
+
+ while (size > 0) {
+ let byte = this.getc();
+ if (byte !== -1) r.push(byte);
+ size--;
+ }
+
+ return r;
+ }
+
fill() {
if (this.reader) {
this.buffer = this.reader(this.L, this.data);