Lazarus

Using the Lazarus IDE => General => Topic started by: 440bx on September 30, 2018, 04:09:40 pm

Title: "else" keyword not highlighted when used in "case" statement
Post by: 440bx on September 30, 2018, 04:09:40 pm
Hello,

This is really very minor and don't really know where it should be reported.  In version 1.8.2 of Lazarus, the editor doesn't highlight the "else" keyword when used in a case statement. 
Code: Pascal  [Select][+][-]
  1. case something of
  2.   avalue : <do something>
  3.   bvalue : <do something>
  4. else         <- this else not highlighted
  5.   <do something else>
  6. end;
  7.  

the "else" is highlighted when it is part of an if statement. 

It's the end of the world :D
Title: Re: "else" keyword not highlighted when used in "case" statement
Post by: Blaazen on September 30, 2018, 04:48:47 pm
What version? It seems OK in trunk.

But I use beautiful pascalish otherwise.  :)
Title: Re: "else" keyword not highlighted when used in "case" statement
Post by: ASerge on September 30, 2018, 04:59:04 pm
What version? It seems OK in trunk.
I have in release and in trunk else only bold, but not color.
Title: Re: "else" keyword not highlighted when used in "case" statement
Post by: 440bx on September 30, 2018, 05:02:21 pm
I doubt I have the latest version but, in the versions I have, 1.8.2 and 1.9.0, the "else" keyword isn't highlighted.

I should have probably noted that this is under Win 7 64bit.  Maybe it is highlighted on a different platform but, I cannot know that.
Title: Re: "else" keyword not highlighted when used in "case" statement
Post by: Blaazen on September 30, 2018, 05:02:51 pm
The same for otherwise in trunk: bold only.
Title: Re: "else" keyword not highlighted when used in "case" statement
Post by: sstvmaster on September 30, 2018, 06:38:57 pm
Here 1.8.4 and 2.1.0 works in both Versions, OS Win7 x64, Laz x32.
Title: Re: "else" keyword not highlighted when used in "case" statement
Post by: Thaddy on September 30, 2018, 06:57:50 pm
What version? It seems OK in trunk.

But I use beautiful pascalish otherwise.  :)
We miss the if you don't shut up...otherwise... :P Ten year olds can be a... Joy... >:D I consider this Pascalish too  8-)

Maybe or else...
Title: Re: "else" keyword not highlighted when used in "case" statement
Post by: Martin_fr on October 11, 2018, 07:17:06 pm
"not highlighted" = not bold?

post an actual example file. It should work, even in older versions, but certainly 1.8.x

check if semicolons (adding/removing) makes a diff.

--------------
Note the case else is highlighted as:
keyword
mixed with "case label"

so if the latter is set to undo the bold......
Title: Re: "else" keyword not highlighted when used in "case" statement
Post by: Blaazen on October 11, 2018, 09:22:30 pm
I found problems (see images). Settings:
1)
procedure: Markup
begin/end (procedure): Markup & Outline
begin/end (nested): Markup & Outline
case: Off
2)
procedure: Markup & Outline
begin/end (procedure): Markup
begin/end (nested): Markup & Outline
case: Markup & Outline
Title: Re: "else" keyword not highlighted when used in "case" statement
Post by: 440bx on October 11, 2018, 11:04:06 pm
"not highlighted" = not bold?
No, not highlighted = not colored.

As far as an example, simply type a case statement that includes an else clause.   Anything syntactically correct will do.
Title: Re: "else" keyword not highlighted when used in "case" statement
Post by: Martin_fr on October 12, 2018, 02:19:59 pm
The else/otherwise is not supposed to be colored.

It is treated as a case label. The same as
   avalue:

---
@Blaazen: Please report as bug

There may be another issue in the highlighter.
It seems to assume that else/otherwise can be followed by one statement/block only, but it can be followed by a statementlist.
Title: Re: "else" keyword not highlighted when used in "case" statement
Post by: Blaazen on October 12, 2018, 03:13:54 pm
Done: https://bugs.freepascal.org/view.php?id=34410 (https://bugs.freepascal.org/view.php?id=34410)
Title: Re: "else" keyword not highlighted when used in "case" statement
Post by: 440bx on October 12, 2018, 06:06:39 pm
The else/otherwise is not supposed to be colored.

It is treated as a case label. The same as
   avalue:

That seems a bit strange.  It's obviously not a case label and it's inconsistent with the way it is treated in an if statement.   I think it would be nice if it were colored, it would create a visual break between what's directly controlled by the case labels and what happens when there is no match.

OTH, it's purely cosmetic.

Title: Re: "else" keyword not highlighted when used in "case" statement
Post by: Martin_fr on October 12, 2018, 06:37:11 pm
I am not opposing the change. Just stating what currently is.

Also it may need the change, because of the statementlist issue.
Title: Re: "else" keyword not highlighted when used in "case" statement
Post by: 440bx on October 12, 2018, 06:58:26 pm
I am not opposing the change. Just stating what currently is.

Also it may need the change, because of the statementlist issue.
I understand.  I just thought it was a bit strange that it would consider it a case label.  I appreciate your pointing that out.
TinyPortal © 2005-2018