[Gambas-user] Comment Blocks

Tobias Boege taboege at gmail.com
Thu Apr 25 12:08:43 CEST 2019

On Thu, 25 Apr 2019, Rolf-Werner Eilert wrote:
> Am 24.04.19 um 20:20 schrieb Tobias Boege:
> > 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.

Or, more importantly, if one line is changed, the syntax highlighter has
to rehighlight only that one line, not jump some amount of lines back to
hopefully get all relevant context (how long do you expect the average
block comment to be?) and parse all those lines until you have gathered
the information to correctly highlight the one that actually changed.

Yes, the rehighlighting algorithm can be improved, but that sophistication
isn't necessary right now -- as much as I like line continuation, BTW.

> > 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'm talking about the former. It is about "escaping" the newline that would
otherwise end a statement in Gambas, so that you can spread a statement over
multiple lines. That feature is requested in Bug#1540 [1] and Accepted.
The latter, a new statement separator, is also requested there!

> 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.

I think the Gambas scripter supports the colon already so that you can write
a "oneliner" Gambas program in the terminal. But I don't know how robust the
implementation is. It's certainly not available in the normal Gambas.
The scripter having it would be a case for ":" as the separator character


[1] https://lists.gambas-basic.org/pipermail/bugtracker/2019-March/001121.html

"There's an old saying: Don't change anything... ever!" -- Mr. Monk

More information about the User mailing list