[Gambas-user] Comment Blocks

Rolf-Werner Eilert rwe-sse at osnanet.de
Thu Apr 25 10:08:06 CEST 2019


Am 24.04.19 um 20:20 schrieb Tobias Boege:
> On Sat, 20 Apr 2019, Cedron Dawg wrote:
>> Kind of slow around here, so here is something to ponder.
>>
>> I'm wondering what others think about the ability to have comment blocks.  In C, I use them as intended, but they are also darn handy to block out sections of code while debugging.  The same would be true in Gambas.
>>
>> I would suggest using the much underutilized reverse apostrophe (aka grave accent or backquote), living lonely under the tilde on most keyboards, in combination with the traditional apostrophe to make the demarcation quite clear.
>>
>> '`  Anything here is comment...(including multiple lines)..... `'
>>
>> Kind of makes them look like stylish double quotes.
>>
>> I haven't tried these yet:  http://gambaswiki.org/wiki/doc/helpcomments
>>
>> But they could be done as '`'''  ....     `' and '`''  ....     `' respectively.
>>
>> Thoughts?
>>
> 
> My initial thought about this was: it adds complexity that wasn't there
> before. If you write a syntax highlighter for Gambas right now, you do not
> have to keep track of state between lines. You can analyze all lines
> independently of each other, in parallel, in a random order if you wish.

Ah ok, didn't see that. I have a project with an editor for printing 
forms, and I managed to change the editor in a way it can recognize 
blocks (like very long definitions of some kind spread to several lines) 
to highlight them in the same color. It was easy because in that "page 
language" I use, all commands are within {}, so the editor only has to 
keep the "command" color until the closing bracket appears.

But I know what you mean...

> A fully-fledged parser of course doesn't benefit this greatly from it,
> and the Gambas internals seem relatively agnostic about if, but a syntax
> highlighter is what I'm currently working on (in vimscript, if you have
> to ask, so keeping state *is* an issue).
> 
> But, this property is lost anyway once we get line continuation characters,
> by Bug#1540.
> 
> Regards,
> Tobi
> 

What do you mean line continuation? Some character to set the rest of a 
lengthy declaration from one line to the next one? Or would it be 
concatination of several commands on one line instead of spreading them 
to several lines?

I would definitely like to have the latter. Sometimes there are a number 
of very short lines, and it would be nice to have them on one line. 
There were many BASIC dialects which knew this, usually with a ":" as 
the special character.

Rolf


More information about the User mailing list