* * *

Author Topic: "else" keyword not highlighted when used in "case" statement  (Read 973 times)

440bx

  • Sr. Member
  • ****
  • Posts: 293
"else" keyword not highlighted when used in "case" statement
« 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

Blaazen

  • Hero Member
  • *****
  • Posts: 2641
  • POKE 54296,15
    • Eye-Candy Controls
Re: "else" keyword not highlighted when used in "case" statement
« Reply #1 on: September 30, 2018, 04:48:47 pm »
What version? It seems OK in trunk.

But I use beautiful pascalish otherwise:)
Lazarus 2.1.0 r59317M FPC 3.3.1 r39660 x86_64-linux-qt Chakra, Qt 4.8.7/5.11.1, Plasma 5.13.5
Lazarus 1.8.2 r57369 FPC 3.0.4 i386-win32-win32/win64 Wine 3.14

Try Eye-Candy Controls: https://sourceforge.net/projects/eccontrols/files/

ASerge

  • Hero Member
  • *****
  • Posts: 945
Re: "else" keyword not highlighted when used in "case" statement
« Reply #2 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.

440bx

  • Sr. Member
  • ****
  • Posts: 293
Re: "else" keyword not highlighted when used in "case" statement
« Reply #3 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.

Blaazen

  • Hero Member
  • *****
  • Posts: 2641
  • POKE 54296,15
    • Eye-Candy Controls
Re: "else" keyword not highlighted when used in "case" statement
« Reply #4 on: September 30, 2018, 05:02:51 pm »
The same for otherwise in trunk: bold only.
Lazarus 2.1.0 r59317M FPC 3.3.1 r39660 x86_64-linux-qt Chakra, Qt 4.8.7/5.11.1, Plasma 5.13.5
Lazarus 1.8.2 r57369 FPC 3.0.4 i386-win32-win32/win64 Wine 3.14

Try Eye-Candy Controls: https://sourceforge.net/projects/eccontrols/files/

sstvmaster

  • New member
  • *
  • Posts: 12
Re: "else" keyword not highlighted when used in "case" statement
« Reply #5 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.
Lazarus 2.1.0 Trunk x32
Lazarus 1.8.4 x32
OS Win 7 x64

Thaddy

  • Hero Member
  • *****
  • Posts: 6923
Re: "else" keyword not highlighted when used in "case" statement
« Reply #6 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...
« Last Edit: September 30, 2018, 07:00:52 pm by Thaddy »
Ada's daddy wrote this:"Fools are my theme, let satire be my song."

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 4818
    • wiki
Re: "else" keyword not highlighted when used in "case" statement
« Reply #7 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......

Blaazen

  • Hero Member
  • *****
  • Posts: 2641
  • POKE 54296,15
    • Eye-Candy Controls
Re: "else" keyword not highlighted when used in "case" statement
« Reply #8 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
Lazarus 2.1.0 r59317M FPC 3.3.1 r39660 x86_64-linux-qt Chakra, Qt 4.8.7/5.11.1, Plasma 5.13.5
Lazarus 1.8.2 r57369 FPC 3.0.4 i386-win32-win32/win64 Wine 3.14

Try Eye-Candy Controls: https://sourceforge.net/projects/eccontrols/files/

440bx

  • Sr. Member
  • ****
  • Posts: 293
Re: "else" keyword not highlighted when used in "case" statement
« Reply #9 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.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 4818
    • wiki
Re: "else" keyword not highlighted when used in "case" statement
« Reply #10 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.

Blaazen

  • Hero Member
  • *****
  • Posts: 2641
  • POKE 54296,15
    • Eye-Candy Controls
Lazarus 2.1.0 r59317M FPC 3.3.1 r39660 x86_64-linux-qt Chakra, Qt 4.8.7/5.11.1, Plasma 5.13.5
Lazarus 1.8.2 r57369 FPC 3.0.4 i386-win32-win32/win64 Wine 3.14

Try Eye-Candy Controls: https://sourceforge.net/projects/eccontrols/files/

440bx

  • Sr. Member
  • ****
  • Posts: 293
Re: "else" keyword not highlighted when used in "case" statement
« Reply #12 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.


Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 4818
    • wiki
Re: "else" keyword not highlighted when used in "case" statement
« Reply #13 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.

440bx

  • Sr. Member
  • ****
  • Posts: 293
Re: "else" keyword not highlighted when used in "case" statement
« Reply #14 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.

 

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus