lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hi list :-)

I don't know it's the right place to report this bug, but I meet a
metalua lexer bug with string's escapes.

the metalua use two :gsub to turn string escapes to correct byte, but
a "\92" escape will confuse the lexer, the patch is below:


diff --git a/src/compiler/lexer.lua b/src/compiler/lexer.lua
index 8b19804..a5f7a9a 100644
--- a/src/compiler/lexer.lua
+++ b/src/compiler/lexer.lua
@@ -92,8 +92,8 @@ local function unescape_string (s)
    end

    return s
-      :gsub ("(\\+)([0-9][0-9]?[0-9]?)", unesc_digits)
       :gsub ("\\(%D)",unesc_letter)
+      :gsub ("(\\+)([0-9][0-9]?[0-9]?)", unesc_digits)
 end

 lexer.extractors = {

regards