Sublime Forum

Lua syntax bug

#1

When using Lua, there is a bug in recognizing a block of comments for syntax highlighting.

If one uses any nested arrays or literal strings (with double closing brackets), this causes the syntax highlighting to break, and the remaining lines to look as though they will be interpreted.

Example:

myFunction(some_var)
--
myVariable = my_array[my_other_array[2]]
if myVariable then print("True") end
--]]
myOtherFunction(some_var)

The ‘–’ starts the comments, but because the next line has ‘]]’, the line after that appears like it will be interpreted, when in actuality, it will not (as the closing of the comment doesn’t happen until the ‘–]]’. This also occurs for literal strings:

    page = 
    <HTML>
    <HEAD>
    <TITLE>An HTML Page</TITLE>
    </HEAD>
    <BODY>
     <A HREF="http://www.lua.org">Lua</A>
     [a text between double brackets]]
    </BODY>
    </HTML>
    ]]

Even when inside comments, the brackets must be matched, since it is valid Lua syntax to have brackets like that inside a comment.

0 Likes

#2

i verified this… still broken. what is the way to fix this?

0 Likes