Recent

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

440bx

  • Hero Member
  • *****
  • Posts: 3944
"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
(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v3.2) on Windows 7 SP1 64bit.

Blaazen

  • Hero Member
  • *****
  • Posts: 3237
  • 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.3.0 (rev main-2_3-2863...) FPC 3.3.1 x86_64-linux-qt Chakra, Qt 4.8.7/5.13.2, Plasma 5.17.3
Lazarus 1.8.2 r57369 FPC 3.0.4 i386-win32-win32/win64 Wine 3.21

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

ASerge

  • Hero Member
  • *****
  • Posts: 2222
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

  • Hero Member
  • *****
  • Posts: 3944
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.
(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v3.2) on Windows 7 SP1 64bit.

Blaazen

  • Hero Member
  • *****
  • Posts: 3237
  • 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.3.0 (rev main-2_3-2863...) FPC 3.3.1 x86_64-linux-qt Chakra, Qt 4.8.7/5.13.2, Plasma 5.17.3
Lazarus 1.8.2 r57369 FPC 3.0.4 i386-win32-win32/win64 Wine 3.21

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

sstvmaster

  • Sr. Member
  • ****
  • Posts: 299
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.
greetings Maik

Windows 10,
- Lazarus 2.2.6 (stable) + fpc 3.2.2 (stable)
- Lazarus 2.2.7 (fixes) + fpc 3.3.1 (main/trunk)

Thaddy

  • Hero Member
  • *****
  • Posts: 14197
  • Probably until I exterminate Putin.
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 »
Specialize a type, not a var.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9791
  • Debugger - SynEdit - and more
    • 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: 3237
  • 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.3.0 (rev main-2_3-2863...) FPC 3.3.1 x86_64-linux-qt Chakra, Qt 4.8.7/5.13.2, Plasma 5.17.3
Lazarus 1.8.2 r57369 FPC 3.0.4 i386-win32-win32/win64 Wine 3.21

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

440bx

  • Hero Member
  • *****
  • Posts: 3944
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.
(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v3.2) on Windows 7 SP1 64bit.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9791
  • Debugger - SynEdit - and more
    • 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: 3237
  • POKE 54296,15
    • Eye-Candy Controls
Lazarus 2.3.0 (rev main-2_3-2863...) FPC 3.3.1 x86_64-linux-qt Chakra, Qt 4.8.7/5.13.2, Plasma 5.17.3
Lazarus 1.8.2 r57369 FPC 3.0.4 i386-win32-win32/win64 Wine 3.21

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

440bx

  • Hero Member
  • *****
  • Posts: 3944
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.

(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v3.2) on Windows 7 SP1 64bit.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9791
  • Debugger - SynEdit - and more
    • 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

  • Hero Member
  • *****
  • Posts: 3944
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.
(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v3.2) on Windows 7 SP1 64bit.

 

TinyPortal © 2005-2018