Skip to content

Commit

Permalink
Fix the multiline comment within the macro definition
Browse files Browse the repository at this point in the history
  • Loading branch information
ayourtch committed Aug 22, 2016
1 parent 8f64140 commit 67cb8dd
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lcpp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -411,13 +411,14 @@ local LCPP_TOKENIZE_COMMENT = {
STRING_LITERAL = '^"[^"]*"',
},
}

-- hint: LuaJIT ffi does not rely on us to remove the comments, but maybe other usecases
local function removeComments(input)
local out = {}
for k, v, start, end_ in tokenizer(input, LCPP_TOKENIZE_COMMENT) do
if k == "MLCOMMENT" then
local newlineCount = findn(input:sub(start, end_), "\n")
local newlines = string.rep("\n", newlineCount)
local newlines = string.rep("\\\n", newlineCount)
table.insert(out, newlines)
elseif k == "SLCOMMENT" then
table.insert(out, "\n")
Expand Down

0 comments on commit 67cb8dd

Please sign in to comment.