leafi / love-eclipse-ldt

LOVE2D Eclipse LDT Execution Environment. That means you get autocomplete and all that.
20 stars 2 forks source link

goto continue | '=' expected near continue #9

Closed 09jlardinois closed 6 years ago

09jlardinois commented 6 years ago

'=' expected near 'continue' DLTK Problem, says Eclipse LDT + Love2D 11.1

Here's the code:

for x = 1, numCols do
    -- if skipping is turned on and we're on a skip iteration...
    if skipPattern and skipFlag then
        -- turn skipping off for the next iteration
        skipFlag = not skipFlag

        -- Lua doesn't have a continue statement, so this is the workaround
        goto continue
    else
        -- flip the flag to true on an iteration we don't use it
        skipFlag = not skipFlag
    end

    b = Brick(
        -- x-coordinate
        (x-1)                   -- decrement x by 1 because tables are 1-indexed, coords are 0
        * 32                    -- multiply by 32, the brick width
        + 8                     -- the screen should have 8 pixels of padding; we can fit 13 cols + 16 pixels total
        + (13 - numCols) * 16,  -- left-side padding for when there are fewer than 13 columns

        -- y-coordinate
        y * 16                  -- just use y * 16, since we need top padding anyway
    )

    -- if we're alternating, figure out which color/tier we're on
    if alternatePattern and alternateFlag then
        b.color = alternateColor1
        b.tier = alternateTier1
        alternateFlag = not alternateFlag
    else
        b.color = alternateColor2
        b.tier = alternateTier2
        alternateFlag = not alternateFlag
    end

    -- if not alternating and we made it here, use the solid color/tier
    if not alternatePattern then
        b.color = solidColor
        b.tier = solidTier
    end

    table.insert(bricks, b)

    -- Lua's version of the 'continue' statement
    ::continue::
end

I thought maybe this was an error here because erasing the goto and ::continue:: stuff makes the error go away, but I can't see how adding them back (proper syntax) causes this.

It seems like Eclipse thinks that goto is a variable, and doesn't recognize it as a keyword. It thinks it should be goto = continue. Because when I write it like that, the error changes.

When I do

goto = continue then it tells me that ::continue:: has a nil name (from detaching it from goto, I don't know the term).

So I think it's not properly recognizing goto for what it is. It's missing from the interpreter.

sirskunkalot commented 6 years ago

Hi,

I have not been into LÖVE lately (never tried version 11 in fact), so I can't say much to that. But what I can say for certain is that the EE we provide here has nothing to do with errors thrown by DLTK. The EE is only documenting and structuring the API for eclipse so it can assist you with hints and stuff. From the looks of it I would say that that you should bring this to the attention of the DLTK guys. Or is this a runtime error? Then you would probably be better off with someone at the love2d project, as they wrote the interpreter. Sorry, I can't be of any help.

Greetings, Jules