elua: xgettext lexer enhancements

This commit is contained in:
Daniel Kolesa 2014-05-07 10:17:29 +01:00 committed by Daniel Kolesa
parent 23c27f06c5
commit 55b7973e56
1 changed files with 9 additions and 1 deletions

View File

@ -259,6 +259,12 @@ local skip_shebang = function(rdr)
return c
end
local ls_get = function(self)
local tok = self.token
tok.name, tok.value = self.coro()
return tok
end
return { init = function(chunkname, input)
local reader = type(input) == "string" and strstream(input) or input
local current = skip_shebang(reader)
@ -267,9 +273,11 @@ return { init = function(chunkname, input)
token = {},
source = chunkname,
current = current,
line_number = 1
line_number = 1,
get = ls_get
}
local coro = coroutine.wrap(lex_main, ls)
ls.coro = coro
coro(ls)
return coro
end }