]> git.lizzy.rs Git - metalua.git/commitdiff
literal parsing bug
authorFabien Fleutot <fabien@MacFabien.home>
Sat, 13 Sep 2008 08:53:11 +0000 (10:53 +0200)
committerFabien Fleutot <fabien@MacFabien.home>
Sat, 13 Sep 2008 08:53:11 +0000 (10:53 +0200)
src/compiler/lexer.lua
src/compiler/mlc.mlua

index 6815011ec79855d950c5ed2cd447d4a33ae67b5f..f066d093fa4122417fbe3bab08c01dae6975d6cb 100644 (file)
@@ -52,7 +52,7 @@ lexer.patterns = {
    long_string         = "^%[(=*)%[\n?(.-)%]%1%]()",
    number_mantissa     = {
       "^%d+%.?%d*()",
-      "^%d*%d%.%d+()" },
+      "^%d*%.%d+()" },
    number_exponant = "^[eE][%+%-]?%d+()",
    number_hex      = "^0[xX]%x+()",
    word            = "^([%a_][%w_]*)()"
@@ -84,7 +84,7 @@ local function unescape_string (s)
 
    return s
       :gsub ("\\(%D)",unesc_letter)
-      :gsub ("\\([0-9]+)", unesc_digits)
+      :gsub ("\\([0-9][0-9]?[0-9]?)", unesc_digits)
 end
 
 lexer.extractors = {
index 7dcfae69e9a0563bec9e104550f443a20a01a858..d317f0c40522e59be436f81ae9efa3910572fe81 100644 (file)
@@ -102,7 +102,7 @@ function mlc.convert (x, src_fmt, dst_fmt, name)
    if not status and x then 
       -- x = error msg; get rid of ???
       x = x:strmatch "[^:]+:[0-9]+: (.*)" or x
-      local li = lx:lineinfo()
+      local li = lx:lineinfo_left()
       error(string.format("Parsing error in %s line %s, column %i, char %s: \n%s",
                           name or "<nofilename>", li[1], li[2], li[3], x))
       return nil