Skip to content

Support for multiline comments #2

@josh42k

Description

@josh42k

I tried using this but found that multiline comments aren't supported.
I was able to get this working by making these changes to the isComment function:

local function isComment(char)
	if (char == "-" and look() == "-") then
		local isMultiline = look(1) == "[" and look(2) == "["
		posOffset = pos - 1;
		start = posOffset;
		pos = pos + 1;
		while not isEndOfComment(look(), isMultiline) do--isEndOfLine(look()) do
			pos = pos + 1;
		end;
		if (isMultiline) pos = pos + 2
		return true;
	end;
	return false;
end;

Where isEndOfComment is defined as:

local function isEndOfComment(char, isMultiline)
	if not isMultiline then
		return isEndOfLine(char)
	else
		return char == "]" and look(1) == "]"
	end
end

P.S. thanks for making this!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions