From fe7bd07450bf7073b0642e2f1b18869cd5676a2b Mon Sep 17 00:00:00 2001 From: Enyby Date: Mon, 21 Oct 2019 10:20:06 +0300 Subject: [PATCH] Fix lexer bugs. Wrong work with spaces. --- src/core/org/luaj/vm2/compiler/LexState.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/core/org/luaj/vm2/compiler/LexState.java b/src/core/org/luaj/vm2/compiler/LexState.java index ca4e0970..6e6a6708 100644 --- a/src/core/org/luaj/vm2/compiler/LexState.java +++ b/src/core/org/luaj/vm2/compiler/LexState.java @@ -589,6 +589,13 @@ public class LexState extends Constants { inclinenumber(); continue; } + case ' ': + case '\f': + case '\t': + case 0x0B: /* \v */ { + nextChar(); + continue; + } case '-': { nextChar(); if (current != '-') @@ -692,11 +699,7 @@ public class LexState extends Constants { return TK_EOS; } default: { - if (isspace(current)) { - _assert (!currIsNewline()); - nextChar(); - continue; - } else if (isalpha(current) || current == '_') { + if (isalpha(current) || current == '_') { /* identifier or reserved word */ LuaString ts; do {