elua: line information in the generated output
This commit is contained in:
parent
a0b8f72ae9
commit
7cf6a8abb0
|
@ -1,5 +1,6 @@
|
|||
-- Elua xgettext: generator
|
||||
|
||||
local lexer = require("xgettext.lexer")
|
||||
local parser = require("xgettext.parser")
|
||||
|
||||
local gen_comment = function(cmt)
|
||||
|
@ -45,6 +46,8 @@ return { init = function(chunkname, input, keywords, flags, opts)
|
|||
if msg.context then
|
||||
ret[#ret + 1] = "msgctxt " .. gen_message(msg.context)
|
||||
end
|
||||
ret[#ret + 1] = "#: " .. lexer.source_to_msg(chunkname)
|
||||
.. ":" .. msg.line
|
||||
ret[#ret + 1] = "msgid " .. gen_message(msg[1])
|
||||
local spf, ssf = opts["m"], opts["M"]
|
||||
if msg[2] then
|
||||
|
|
|
@ -303,4 +303,4 @@ return { init = function(chunkname, input, opts)
|
|||
ls.coro = coro
|
||||
coro(ls)
|
||||
return coro
|
||||
end, syntax_error = syntax_error }
|
||||
end, syntax_error = syntax_error, source_to_msg = source_to_msg }
|
|
@ -102,7 +102,8 @@ local parse = function(ls, keywords)
|
|||
saved_comment = tok.value
|
||||
ls:get()
|
||||
elseif tok.name == "<name>" and keywords[tok.value] then
|
||||
local kw = keywords[tok.value]
|
||||
local line = ls.line_number
|
||||
local kw = keywords[tok.value]
|
||||
ls:get()
|
||||
local args = parse_call(ls)
|
||||
local n1, n2, cx, an = kw[1], kw[2], kw.context, kw.argnum
|
||||
|
@ -122,7 +123,7 @@ local parse = function(ls, keywords)
|
|||
saved_comment = nil
|
||||
yield {
|
||||
n1arg[1], n2 and n2arg[1], context = cx and cxarg[1],
|
||||
xcomment = kw.xcomment, comment = sc
|
||||
xcomment = kw.xcomment, comment = sc, line = line
|
||||
}
|
||||
else
|
||||
ls:get()
|
||||
|
|
Loading…
Reference in New Issue