elua: comment is a valid token in xgettext
authorDaniel Kolesa <quaker66@gmail.com>
Thu, 15 May 2014 14:56:51 +0000 (15:56 +0100)
committerDaniel Kolesa <d.kolesa@samsung.com>
Tue, 10 Jun 2014 14:48:51 +0000 (15:48 +0100)
src/bin/elua/modules/xgettext/lexer.lua

index ed065c3b2cd9884407ee416c225bbc7597145a6c..5af0f3422183dbcce96d0218668f5dead691ccdd 100644 (file)
@@ -99,16 +99,16 @@ local read_long_string = function(ls, sep, cmt)
             if skip_sep(ls, tbuf) == sep then
                 c = next_char(ls)
                 break
-            elseif not cmt then
+            else
                 buf[#buf + 1] = tconc(tbuf)
             end
             c = ls.current
         else
-            if not cmt then buf[#buf + 1] = c end
+            buf[#buf + 1] = c
             c = next_char(ls)
         end
     end
-    if not cmt then return tconc(buf) end
+    return tconc(buf)
 end
 
 local read_string = function(ls)
@@ -145,13 +145,15 @@ local lex_tbl = {
         if c == "[" then
             local sep = skip_sep(ls, {})
             if sep >= 0 then
-                read_long_string(ls, sep, true)
-                return
+                return "<comment>", read_long_string(ls, sep, true)
             end
         end
+        local buf = {}
         while ls.current and ls.current ~= "\n" and ls.current ~= "\r" do
+            buf[#buf + 1] = ls.current
             next_char(ls)
         end
+        return "<comment>", tconc(buf)
     end,
     ["[" ] = function(ls)
         local buf = {}