Recent

Author Topic: Key word "Continue" does not mark up ?  (Read 3340 times)

Thaddy

  • Hero Member
  • *****
  • Posts: 16387
  • Censorship about opinions does not belong here.
Re: Key word "Continue" does not mark up ?
« Reply #15 on: October 18, 2024, 05:46:45 pm »
It is more fundamental than that....
There is nothing wrong with being blunt. At a minimum it is also honest.

WooBean

  • Sr. Member
  • ****
  • Posts: 278
Re: Key word "Continue" does not mark up ?
« Reply #16 on: October 18, 2024, 07:50:12 pm »
...
As usual I might be wrong, but in this case highly unlikely.
(although it is not in ISO 7185)

@Thaddy, you are absolutely right (except unlikely).

Code: Pascal  [Select][+][-]
  1. program Break;
  2. var Continue: integer;
  3. begin
  4.   Continue:=1;
  5.   while True do begin
  6.     inc(Continue);
  7.     if Continue>3 then System.Break;
  8.   end;
  9.   writeln(Continue); // prints 4
  10.   while Continue>0 do begin
  11.     dec(Continue);
  12.     if Continue=2 then System.Continue;
  13.     writeln(Continue); //2 omitted
  14.   end;
  15.   readln;
  16. end.
  17.  
« Last Edit: October 18, 2024, 08:11:15 pm by WooBean »
Platforms: Win7/64, Linux Mint Ulyssa/64

Joanna from IRC

  • Hero Member
  • *****
  • Posts: 1283
Re: Key word "Continue" does not mark up ?
« Reply #17 on: October 19, 2024, 12:57:21 am »
I noticed a common key word "Continue" does not mark up its color in the editor.
IDE Options/Editor/Display/Markup and Matches/Highlight control statement as keywords
This is neat I got to add some more colors for begin ends  :)
For those who aren’t Lazarus ide experts I’d like to add that it’s  tools/Options/Editor/Display/Markup and Matches
✨ 🙋🏻‍♀️ More Pascal enthusiasts are needed on IRC .. https://libera.chat/guides/ IRC.LIBERA.CHAT  Ports [6667 plaintext ] or [6697 secure] channel #fpc  #pascal Please private Message me if you have any questions or need assistance. 💁🏻‍♀️

MarkMLl

  • Hero Member
  • *****
  • Posts: 8111
Re: Key word "Continue" does not mark up ?
« Reply #18 on: October 19, 2024, 09:33:33 pm »
For those who aren’t Lazarus ide experts I’d like to add that it’s  tools/Options/Editor/Display/Markup and Matches

Putting in a quick "how to get there" is always valuable, although (and please note that I'm not finding fault here, just trying to suggest a documentation style) that could be improved by noting what version of the IDE the sequence applies to.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Logitech, TopSpeed & FTL Modula-2 on bare metal (Z80, '286 protected mode).
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 10670
  • Debugger - SynEdit - and more
    • wiki
Re: Key word "Continue" does not mark up ?
« Reply #19 on: October 19, 2024, 10:36:31 pm »
For those who aren’t Lazarus ide experts I’d like to add that it’s  tools/Options/Editor/Display/Markup and Matches

Putting in a quick "how to get there" is always valuable, although (and please note that I'm not finding fault here, just trying to suggest a documentation style) that could be improved by noting what version of the IDE the sequence applies to.

tools/Options/Editor/Display/Markup and Matches => Highlight control statement as keywords

Since Lazarus 1.0.15 (or probably before)
Up to an including 4.99


Thaddy

  • Hero Member
  • *****
  • Posts: 16387
  • Censorship about opinions does not belong here.
Re: Key word "Continue" does not mark up ?
« Reply #20 on: October 19, 2024, 10:44:40 pm »
@WooBean
Code: Pascal  [Select][+][-]
  1. type
  2.  bool = (maybe, notsure);
  3. const
  4.   false:bool = maybe;
  5.   true:bool = notsure;
  6. begin
  7.   writeln(false:6, true);
  8. // but
  9.   writeln(100 < 99);
  10. end.
8)
« Last Edit: October 19, 2024, 10:46:30 pm by Thaddy »
There is nothing wrong with being blunt. At a minimum it is also honest.

MarkMLl

  • Hero Member
  • *****
  • Posts: 8111
Re: Key word "Continue" does not mark up ?
« Reply #21 on: October 19, 2024, 11:03:21 pm »
Since Lazarus 1.0.15 (or probably before)

If you insist... it's not in the longlived 0.9 series, which didn't have a Tools -> Options menu entry.

So somewhere around the laboured 0.9 -> 1.0 transition.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Logitech, TopSpeed & FTL Modula-2 on bare metal (Z80, '286 protected mode).
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

WooBean

  • Sr. Member
  • ****
  • Posts: 278
Re: Key word "Continue" does not mark up ?
« Reply #22 on: October 20, 2024, 07:33:06 am »
...

@Thaddy, remark noted.
 
Nice to share an opinion  that something obvious can be a little bit more complicated in fact.
Platforms: Win7/64, Linux Mint Ulyssa/64

Joanna from IRC

  • Hero Member
  • *****
  • Posts: 1283
Re: Key word "Continue" does not mark up ?
« Reply #23 on: October 20, 2024, 10:08:45 am »
Is it really ok to reuse true and false like that? It will interfere with boolean things. I’ve unintentionally hid things that shouldn’t be hidden when declaring keys for my resource strings . I really wish it wouldn’t let me do that.. :(
✨ 🙋🏻‍♀️ More Pascal enthusiasts are needed on IRC .. https://libera.chat/guides/ IRC.LIBERA.CHAT  Ports [6667 plaintext ] or [6697 secure] channel #fpc  #pascal Please private Message me if you have any questions or need assistance. 💁🏻‍♀️

MarkMLl

  • Hero Member
  • *****
  • Posts: 8111
Re: Key word "Continue" does not mark up ?
« Reply #24 on: October 20, 2024, 10:19:19 am »
Is it really ok to reuse true and false like that? It will interfere with boolean things. I’ve unintentionally hid things that shouldn’t be hidden when declaring keys for my resource strings . I really wish it wouldn’t let me do that.. :(

They're not reserved words. /Now/ do you see why some of us grumble that Pascal's type handling etc. is sloppy?

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Logitech, TopSpeed & FTL Modula-2 on bare metal (Z80, '286 protected mode).
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

cdbc

  • Hero Member
  • *****
  • Posts: 1778
    • http://www.cdbc.dk
Re: Key word "Continue" does not mark up ?
« Reply #25 on: October 20, 2024, 10:19:28 am »
Hi
@Joanna: Look at it this way - It's a compiler, /not/ a babysitter...
Regards Benny
If it ain't broke, don't fix it ;)
PCLinuxOS(rolling release) 64bit -> KDE5 -> FPC 3.2.2 -> Lazarus 2.2.6 up until Jan 2024 from then on it's: KDE5/QT5 -> FPC 3.3.1 -> Lazarus 3.0

MarkMLl

  • Hero Member
  • *****
  • Posts: 8111
Re: Key word "Continue" does not mark up ?
« Reply #26 on: October 20, 2024, 10:23:15 am »
@Joanna: Look at it this way - It's a compiler, /not/ a babysitter...

But you could apply the same argument to all type checking etc., hence "real men" use C or assembler, not Pascal.

Anyway, this is getting /way/ off topic for the topic cited by OP, and if we want to get into "coding horrors" we should start a new thread.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Logitech, TopSpeed & FTL Modula-2 on bare metal (Z80, '286 protected mode).
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

PascalDragon

  • Hero Member
  • *****
  • Posts: 5812
  • Compiler Developer
Re: Key word "Continue" does not mark up ?
« Reply #27 on: October 20, 2024, 11:02:10 am »
Its seems that I remember Continue, Break being marked in Delphi, which is why I asked about it?

At least in Delphi 10.2 they are not. Though they have another nice gimmick: Continue has an arrow that points up after it and Break one that points down (see attached screenshot). Though it's not very intelligent, cause that errors will also appear at a variable declaration named Break or Continue. 😂

Continue is part of the core Pascal syntax.(meaning it should never be modified or even modifiable)
You are very right to raise that question.
(That is not a display issue, but a real bug in the compiler, it seems, rather strange answer from PascalDragon)
As usual I might be wrong, but in this case highly unlikely.

As usual you are indeed wrong. Neither in FPC nor in Delphi (did not check TP however) Continue, Break and Exit count as keywords. They are instead symbols declared in the System unit, just like Writeln or TypeInfo and thus one is free to redeclare them. Delphi behaves the same here.

(although it is not in ISO 7185)

Of course not, cause ISO Pascal does not know about them and neither does ISO Extended Pascal.

Is it really ok to reuse true and false like that? It will interfere with boolean things. I’ve unintentionally hid things that shouldn’t be hidden when declaring keys for my resource strings . I really wish it wouldn’t let me do that.. :(

True and False are not keywords, they are symbols inside the System unit thus according to the rules of the language one is free to redeclare them in other units. Just like for any other symbols the usual lookup rules will be followed.

carl_caulkett

  • Hero Member
  • *****
  • Posts: 649
Re: Key word "Continue" does not mark up ?
« Reply #28 on: October 23, 2024, 09:20:46 pm »
Just as a follow up question to this. How do you set a user defined term to show the defined color in live code but not in comments? I thought it had something to do with the priority setting, but a given setting value seems to be shared by an entire list.

Here it is. @Martin_fr said...
"You can check that word-boundaries should be matched (needs to be done for each word).
You can also set priorities for colors, and put the markup at priority = 1
Then set strings and comment to priority = 2
And "char" wont color in strings and comments."

... but I'm having difficulties in making Martin's words correspond with what I see on screen!
« Last Edit: October 23, 2024, 09:39:55 pm by carl_caulkett »
"It builds... ship it!"

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 10670
  • Debugger - SynEdit - and more
    • wiki
Re: Key word "Continue" does not mark up ?
« Reply #29 on: October 23, 2024, 10:06:26 pm »
Just as a follow up question to this. How do you set a user defined term to show the defined color in live code but not in comments? I thought it had something to do with the priority setting, but a given setting value seems to be shared by an entire list.

You can have multiple list. All words that should be code only, but not comments => go into one list (or several for diff colors).
And that list then gets the priority.

However, you can not do
- some words only source
- other words only comments

Because for only source, the comment must have higher prior than source.
And for only comments it would be reverse.

First:
(Assuming you want to change foreground color / otherwise substitute foreground for what ever you need)

- Go to Display > Colors
- In the color tree find the entries for comment and string (as if you wanted to change their color)
- For each of them
  - At the bottom directly above the color-boxes, find the button "priority"
  - change the priority for foreground to:  2

- Then go to User Defined Markup
- Select your list
- For the foreground color select priority: 1





In Lazarus 5.0 you will be able to add words for sources to the HL directly (up to 10 lists). However only full words, no part words, nor multi word.
(Yes I mean 5.0 / not 4.0)

 

TinyPortal © 2005-2018