mpeterv / luacheck

A tool for linting and static analysis of Lua code.
MIT License
1.91k stars 318 forks source link

Lexer fails to ignore multi-line string within a commented out block #191

Open drauschenbach opened 5 years ago

drauschenbach commented 5 years ago

Given the following commented-out code:

--[[
  call_function([[
local x = 1
local y = 2
... dozens more lines
]])
--]]

LuaCheck reports:

spec.lua:237:3: (E011) expected statement near ')'

CelticMinstrel commented 7 months ago

I think this is correct, actually. You should add one or more = to your comment, like so:

--[=[
  call_function([[
local x = 1
local y = 2
... dozens more lines
]])
--]=]
alerque commented 7 months ago

As @CelticMinstrel notes, if you are trying to nest block comments in Lua you should be using different = counts in the comment syntax to differentiate which starts go with which stops.

alerque commented 7 months ago

Also per #198 this is no longer the canonical repository for this project (see https://github.com/lunarmodules/luacheck) and nobody has any ability to close issues here. Please lets try to keep things tidy so future users can better notice the relevant migration issue. I ask that you please close this issue. If something is still amiss and you have a bug or question, feel free to open a new issue on the current repository.