From 17698c9c7e35379ff3cd35229ff7bc69293c7d5d Mon Sep 17 00:00:00 2001 From: Daniel Kolesa Date: Tue, 10 Jun 2014 14:37:57 +0100 Subject: [PATCH] elua: xgettext fixes --- src/bin/elua/modules/xgettext/lexer.lua | 2 +- src/bin/elua/modules/xgettext/parser.lua | 19 +++++++++---------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/src/bin/elua/modules/xgettext/lexer.lua b/src/bin/elua/modules/xgettext/lexer.lua index d88859ddb4..0c8ebd5d11 100644 --- a/src/bin/elua/modules/xgettext/lexer.lua +++ b/src/bin/elua/modules/xgettext/lexer.lua @@ -213,7 +213,7 @@ local lex_tbl = { ["="] = function(ls) local oc = ls.current local c = next_char(ls) - if c ~= "=" then return c end + if c ~= "=" then return c else next_char(ls); return c .. "=" end end, ['"' ] = function(ls) diff --git a/src/bin/elua/modules/xgettext/parser.lua b/src/bin/elua/modules/xgettext/parser.lua index 74502984dc..1d6c252701 100644 --- a/src/bin/elua/modules/xgettext/parser.lua +++ b/src/bin/elua/modules/xgettext/parser.lua @@ -180,14 +180,14 @@ local parse_kw = function(ls, keywords) local n1argt, n2argt, cxargt = n1arg and (n1arg[2] ~= ""), n2arg and (n2arg[2] ~= ""), cxarg and (cxarg[2] ~= "") - if not args then goto skip end - if an and #args ~= an then goto skip end - if #args < n1 then goto skip end - if n2 and #args < n2 then goto skip end - if cx and #args < cx then goto skip end - if not n1argt then goto skip end - if n2 and not n2argt then goto skip end - if cx and not cxargt then goto skip end + if not args then return false end + if an and #args ~= an then return false end + if #args < n1 then return false end + if n2 and #args < n2 then return false end + if cx and #args < cx then return false end + if not n1argt then return false end + if n2 and not n2argt then return false end + if cx and not cxargt then return false end local sc = saved_comments saved_comments = {} sc = tconc(sc, "\n") @@ -214,7 +214,7 @@ local parse = function(ls, keywords, flags) elseif tok.name == "" then if keywords[tok.value] then local status, str = pcall(parse_kw, keywords) - if status then + if status and str then str:generate() end elseif flags[tok.value] then @@ -228,7 +228,6 @@ local parse = function(ls, keywords, flags) else ls:get() end - ::skip:: end end