Lua Block Comments don't work

If reporting a bug with the Zeus IDE please post the details here. Please do not post questions here.
Post Reply
jmonier
Posts: 2
Joined: Tue Jun 17, 2014 2:10 pm

Lua Block Comments don't work

Post by jmonier » Tue Jun 17, 2014 5:03 pm

I'll first say that, with the as-supplied settings in Tools-Options-Keywords it has never worked right for me either in 3.97c or 3.97s. I won't go into details on that, but the options that work for me in 3.97c are:

Start: --[ End: ]] Line: --

Comment Details #2: blank

This has worked for me for over 4 years and many thousand lines of code.

If Comment Details #2 are [[, ]] (as supplied) it's not right.

The way it should work is spelled out in "Programming in Lua" pg 6 and here are 2 test cases:

#1:

--[[
A=B
--]]
B=C

#2:

---[[
A=B
--]]
B=C

In #1 the A=B line should be a comment (italics in magenta) and the B=C line is not a comment (black)

In #2 both the A=B and B=C should be executable (and in black)

It works this way (i.e. correctly) for me in 3.97c (with the modified options as shown above).

In 3.97s, however (with the same modified options), in #1 both the A=B and B=C lines show as comments (italics in green). In #2 A=B shows as a comment (italics in green) where it should be black; B=C does (correctly) show black. So, neither is correct.

I've tried other combinations of the options in 3.97s (including those as supplied) and have been unable to make it work correctly. (Note that I installed 3.97s on a separate machine that has NOT had Zeus on it before and does not have Lua on it at all and these results were identical to my production machine.)

Just to be absolutely clear, here is the way it is in 3.97c (correct):
#1:
--[[
A=B
--]]

B=C

#2:
---[[
A=B
--]]
B=C

and in 3.97s (incorrect):
#1:
--[[
A=B
--]]
B=C


#2:
---[[
A=B
--]]

B=C

jussij
Site Admin
Posts: 2516
Joined: Fri Aug 13, 2004 5:10 pm

Post by jussij » Tue Jun 17, 2014 11:14 pm

Thanks for submitting the bug report.

I can confirm that you have found a bug :(

I suspect what is going wrong is the line comment is being evaluated before the block comment and because they both share the some of the same characters that line comment is hiding the block comment.

That code would have been added to fix issues for languages like C/C++ where this code is not a block comment because of the starting line comment:

Code: Select all

///* some block comment */
I will look to see if this can be fixed ;)

Cheers Jussi

jmonier
Posts: 2
Joined: Tue Jun 17, 2014 2:10 pm

Post by jmonier » Tue Jun 17, 2014 11:43 pm

jussij wrote:I suspect what is going wrong is the line comment is being evaluated before the block comment and because they both share the some of the same characters that line comment is hiding the block comment.
I don't think that this is what is going on (at least not exactly).

If the line comment was ALWAYS evaluated first, then the open block comment would be hidden and the A=B line would NEVER show as a comment. However, it does need to be evaluated first (or at least along with the open block comment) so that case # 2 will work right, so it may be one of those cases that doesn't lend itself to an easy general solution.

BTW, are the options limited to 3 characters for a specific reason? If not, would allowing 4 characters be of some value?

jussij
Site Admin
Posts: 2516
Joined: Fri Aug 13, 2004 5:10 pm

Post by jussij » Wed Jun 18, 2014 12:01 am

The comments are limited to three characters only for historic reasons.

This comment handling code was add to Zeus in one of the very first ever Zeus releases and that same code runs pretty much unchanged in the current version of Zeus.

Back then computers were a lot less powerful than they are today and the comment detecting code had to run as fast as possible, so it was highly optimised.

To help with that optimisation the size of the comment strings was limited to three, since most of the languages of that time had block and line comments that were two characters long. Who would ever need more ;)

Cheers Jussi

jussij
Site Admin
Posts: 2516
Joined: Fri Aug 13, 2004 5:10 pm

Post by jussij » Wed Jun 18, 2014 11:40 pm

There is a new version of Zeus that should fix this issue.

The new Zeus is found here: http://www.zeusedit.com/z300/ze397t.zip

To use this version just backup you current Zeus install folder and then replace files in the install folder with those found in the zip file.

Cheers Jussi

Post Reply
kuchnie warszawa opinie

Who is online

Users browsing this forum: No registered users and 5 guests