lua-users home
lua-l archive

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


Dinu Gherman wrote:
If that's the one and only way of using gettext in Lua I'd like
to have a look, but I'd prefer something like a download link
that I could pass on to others, if you don't mind.
The lua-xgettext could be located at http://www.modeemi.fi/~tuomov/repos/

Our current differences from the upstream are attached. They add support for
the modulo operator, numeric character escapes and shebang.

I'll try to submit our changes to Tuomo (the author) once again. Maybe he
just overlooked my message.

As to the Lua interface to the intl library, unfortunately, I'm not in a
position to release the sources, but it is pretty easy to do your own.

Sincerely,
Nick
diff -ru a/Kuu/Parser.hs b/Kuu/Parser.hs
--- a/Kuu/Parser.hs	2010-03-26 11:18:49.000000000 +0300
+++ b/Kuu/Parser.hs	2009-10-07 20:24:53.000000000 +0400
@@ -320,7 +320,8 @@
     [("-",   True,   undefined),
      ("#",   True,   undefined),
      ("not", True,   undefined)],
-    [("/",   False,  AssocLeft),
+    [("%",   False,  AssocLeft),
+     ("/",   False,  AssocLeft),
      ("*",   False,  AssocLeft)],
     [("-",   False,  AssocLeft),
      ("+",   False,  AssocLeft)],
diff -ru a/Kuu/Token.hs b/Kuu/Token.hs
--- a/Kuu/Token.hs	2010-03-26 11:18:49.000000000 +0300
+++ b/Kuu/Token.hs	2009-10-07 20:20:53.000000000 +0400
@@ -46,6 +46,7 @@
 tokenize = parse pars
 
 pars = do
+    optional (try (string "#!" >> skipMany (noneOf "\n")))
     skipMany space
     choice[
         eof >> return [],
@@ -64,7 +65,7 @@
 -----------
 
 sp0 = ["...", ".", ":", ",", ";", "=", "(", ")", "[", "]", "{", "}"]
-op0 = ["+", "-", "*", "/", "^", "..", "<=", "<", ">=", ">", "==", "~=", "#"]
+op0 = ["+", "-", "*", "/", "%", "^", "..", "<=", "<", ">=", ">", "==", "~=", "#"]
 op1 = ["and", "or", "not"]
 
 reserved = ["end", "in", "repeat", "break", "false", "local", "return",
@@ -119,8 +120,7 @@
 	    <|> do { c <- escaped <|> noneOf "\n"; s <- dcs; return (c:s) }
 	escaped = do
 	    char '\\'
-	    c_ <- anyChar
-	    unescape c_
+            (integer >>= return . toEnum) <|> (anyChar >>= unescape)
 
 unescape 'a' = return '\a'
 unescape 'b' = return '\b'