diff options
| author | ruki <[email protected]> | 2020-11-27 00:12:14 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2020-11-27 00:12:14 +0800 |
| commit | cdb5fd2f2d96abc68fd46b4778db14157f11a460 (patch) | |
| tree | 683617d74034cdc58bdeed4186b23367d9d4bd55 /xmake/modules/private/tools/cl/parse_include.lua | |
| parent | 096ff0808e531c8e0f15e8240b73158beca4a89b (diff) | |
improve parse cl includes
Diffstat (limited to 'xmake/modules/private/tools/cl/parse_include.lua')
| -rw-r--r-- | xmake/modules/private/tools/cl/parse_include.lua | 51 |
1 files changed, 29 insertions, 22 deletions
diff --git a/xmake/modules/private/tools/cl/parse_include.lua b/xmake/modules/private/tools/cl/parse_include.lua index cd311ec49..708d87667 100644 --- a/xmake/modules/private/tools/cl/parse_include.lua +++ b/xmake/modules/private/tools/cl/parse_include.lua @@ -22,37 +22,44 @@ import("core.project.project") import("core.base.hashset") --- contain: "Note: including file: "? +-- probe include note prefix from cl +function _probe_include_note_from_cl() + -- TODO +end + +-- get include notes prefix, e.g. "Note: including file: " -- -- @note we cannot get better solution to distinguish between `includes` and `error infos` -- -function main(line) +function _get_include_notes() + local notes = _g.notes + if not notes then + notes = {} + local note = _probe_include_note_from_cl() + if note then + table.insert(notes, note) + end + table.join2(notes, { + "Note: including file: ", -- en + "注意: 包含文件: ", -- zh + "Remarque : inclusion du fichier : ", -- fr + "メモ: インクルード ファイル: " -- jp + }) + _g.notes = notes + end + return notes +end - -- init notes - -- - -- TODO zh-tw, zh-hk, jp, ... - -- - _g.notes = _g.notes or - { - "Note: including file: " -- en - , "注意: 包含文件: " -- zh - , "Remarque : inclusion du fichier : " -- fr - , "メモ: インクルード ファイル: " -- jp - } +-- main entry +function main(line) -- contain notes? - for idx, note in ipairs(_g.notes) do - - -- dump line bytes - --[[ - print(line) - line:gsub(".", function (ch) print(string.byte(ch)) end) - --]] - + local notes = _get_include_notes() + for idx, note in ipairs(notes) do if line:startswith(note) then -- optimization: move this note to head if idx ~= 1 then - table.insert(_g.notes, 1, note) + table.insert(notes, 1, note) end return line:sub(#note):trim() end |
