Recent

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

jamie

  • Hero Member
  • *****
  • Posts: 6791
Key word "Continue" does not mark up ?
« on: October 18, 2024, 02:22:25 pm »
I noticed a common key word "Continue" does not mark up its color in the editor.

 Is there a reason for this other than preference by the DEVS?
The only true wisdom is knowing you know nothing

Thaddy

  • Hero Member
  • *****
  • Posts: 16387
  • Censorship about opinions does not belong here.
Re: Key word "Continue" does not mark up ?
« Reply #1 on: October 18, 2024, 02:29:37 pm »
??? what do you mean,Jamie?
There is nothing wrong with being blunt. At a minimum it is also honest.

PascalDragon

  • Hero Member
  • *****
  • Posts: 5815
  • Compiler Developer
Re: Key word "Continue" does not mark up ?
« Reply #2 on: October 18, 2024, 02:30:29 pm »
That's because Continue is not a keyword. Neither is Break nor Exit. All three are identifiers from the unit System and for example the following code is perfectly valid (though it shows that the highlighter of the forum has a bug, cause it shows Break in bold :( ):

Code: Pascal  [Select][+][-]
  1. program tkeyword;
  2.  
  3. var
  4.   exit, break, continue: LongInt;
  5. begin
  6.   exit := 1;
  7.   break := 2;
  8.   continue := 3;
  9. end.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 10670
  • Debugger - SynEdit - and more
    • wiki
Re: Key word "Continue" does not mark up ?
« Reply #3 on: October 18, 2024, 02:31:10 pm »
Technically it is not a keyword (as in "reserved words").

In the doc its listed under modifiers. Though its the odd one out in that list. https://www.freepascal.org/docs-html/ref/refsu3.html#x14-130001.3.3

That aside, I acknowledge that it might be useful. But it hasn't yet been done.


You can add it as word in "used defined markup". And then in normal colors increase the priority for comment and string, and set the priority for the user defined markup between 0 and the comment/string priority. => That will do 99%.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 10670
  • Debugger - SynEdit - and more
    • wiki
Re: Key word "Continue" does not mark up ?
« Reply #4 on: October 18, 2024, 02:33:31 pm »
"break" seems to be in ExtendedKeywordsMode => that can be toggled somewhere in the options.

Same for: Exit and Continue

jamie

  • Hero Member
  • *****
  • Posts: 6791
Re: Key word "Continue" does not mark up ?
« Reply #5 on: October 18, 2024, 02:59:18 pm »
It's strange that you say that about BREAK because BREAK isn't always marked from my obversions?

I just inserted a BREAK in some code I am looking at and it did not markup.

So maybe there is a problem elsewhere.

Its seems that I remember Continue, Break being marked in Delphi, which is why I asked about it?


The only true wisdom is knowing you know nothing

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 10670
  • Debugger - SynEdit - and more
    • wiki
Re: Key word "Continue" does not mark up ?
« Reply #6 on: October 18, 2024, 03:05:49 pm »
As I said, there is a setting.

I had to look up the name "Highlight control statements as keywords" (in "Markup and Matches")

jamie

  • Hero Member
  • *****
  • Posts: 6791
Re: Key word "Continue" does not mark up ?
« Reply #7 on: October 18, 2024, 03:14:44 pm »
I don't have that checked.

But in any case I just noticed something.

I went into the USER markup, selected AddList, there was before I did that an empty window to the right, but then I exited out of there before actually adding anything to the list. I saw what looked like some updates taking place, and now I don't see "Break" in bold any more.

Now when I go into that option, it shows as a list with nothing in it.

strange.


The only true wisdom is knowing you know nothing

carl_caulkett

  • Hero Member
  • *****
  • Posts: 649
Re: Key word "Continue" does not mark up ?
« Reply #8 on: October 18, 2024, 03:23:31 pm »
You can add it as word in "used defined markup". And then in normal colors increase the priority for comment and string, and set the priority for the user defined markup between 0 and the comment/string priority. => That will do 99%.

Ooh! I didn't know about "user defined markup". Now I can get "integer" show up in colors like "string" does 😉

Thanks Martin_fr 🙏🏽

UPDATE: However, there is a slight problem. Guess what happens if I set "char" to be a different color?
Code: Pascal  [Select][+][-]
  1.   else
  2.   begin
  3.     PrePtr := PresetTree.GetNodeData(Node);
  4.     case Column of
  5.       0: CellText := PrePtr^.PresetName;
  6.       1: CellText := PrePtr^.CC0.ToString;
  7.       2: CellText := PrePtr^.PGM.ToString;
  8.       3: CellText := PrePtr^.Characters;       // HINT <== here it is
  9.       4: CellText := '';
  10.     end;
  11.   end;
  12.  

I can get round the problem by setting the custom color to be "case sensitive", but it would be good if the "user defined markup" code did not try to work for substrings...
"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 #9 on: October 18, 2024, 03:46:08 pm »
I don't have that checked.

But in any case I just noticed something.

I went into the USER markup, selected AddList, there was before I did that an empty window to the right, but then I exited out of there before actually adding anything to the list. I saw what looked like some updates taking place, and now I don't see "Break" in bold any more.

Ok, up until this post, I read your other posts as: You don't see break in bold, but you would like to see it in bold?

You even did not get it bold, after PascalDragon observed it was bold...

I am not sure how your "Add list" in user define markup may have changed that. Did you have other lists in the drop down already? The list in the config shows the pre-added words. If you define key-combos you can add session-specific words (but they will not be kept on restart).
However you only get that if you have a list, and if some colors or style are defined on that list (and key combos, if words aren't pre defined).





You can add it as word in "used defined markup". And then in normal colors increase the priority for comment and string, and set the priority for the user defined markup between 0 and the comment/string priority. => That will do 99%.

Ooh! I didn't know about "user defined markup". Now I can get "integer" show up in colors like "string" does 😉

Thanks Martin_fr 🙏🏽

UPDATE: However, there is a slight problem. Guess what happens if I set "char" to be a different color?
Code: Pascal  [Select][+][-]
  1.       3: CellText := PrePtr^.Characters;       // HINT <== here it is

I can get round the problem by setting the custom color to be "case sensitive", but it would be good if the "user defined markup" code did not try to work for substrings...

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.

carl_caulkett

  • Hero Member
  • *****
  • Posts: 649
Re: Key word "Continue" does not mark up ?
« Reply #10 on: October 18, 2024, 04:34:14 pm »
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.

So THAT'S what "Set bound at term start/end" means... I DID wonder 😉
"It builds... ship it!"

jamie

  • Hero Member
  • *****
  • Posts: 6791
Re: Key word "Continue" does not mark up ?
« Reply #11 on: October 18, 2024, 04:59:25 pm »
@Martin_Fr

I meant to say, "I never had that checked" !

But after entering the ADDLIST for the USER markup and not actually adding anything, I notice now I have a note in the
right pane window "Add new Item", that was note there the first time in that menu.

 And I no longer see "Break" in bold like I did randomly.

 I suppose I could look at the source code of that section, but I think my old eyes will get glossed over before I notice anything relevant


The only true wisdom is knowing you know nothing

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 10670
  • Debugger - SynEdit - and more
    • wiki
Re: Key word "Continue" does not mark up ?
« Reply #12 on: October 18, 2024, 05:27:30 pm »
Ok, I did not understand that you had it randomly bold.

Not sure what may cause that. (You don't have "word at caret highlight" to set it bold, when you are at any break occurrence?).


What you describe in the user-defined-markup sounds normal, but unrelated.
https://wiki.lazarus.freepascal.org/IDE_Window:_Editor_User_Defined_Words

Except, I don't know why it made the break non-bold => but maybe it just caused a recalculation, because settings changed, and whatever else had been the cause got corrected.

That you did not see  the "Add new item" before, means you had no list before, and therefore there would have been no highlights, and break would not have been affected.
The markup can have any amount of "item lists" (item = word, part-word, phrase). All items in each list are highlighted with the color set in that list.
Additionally session temporary items can be added from the editor via key-combo, if you define key combos (but that again needs a list, on which to define the keycombo)


Thaddy

  • Hero Member
  • *****
  • Posts: 16387
  • Censorship about opinions does not belong here.
Re: Key word "Continue" does not mark up ?
« Reply #13 on: October 18, 2024, 05:28:38 pm »
You should not have to check.
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.
(although it is not in ISO 7185)
« Last Edit: October 18, 2024, 05:45:26 pm by Thaddy »
There is nothing wrong with being blunt. At a minimum it is also honest.

ASerge

  • Hero Member
  • *****
  • Posts: 2354
Re: Key word "Continue" does not mark up ?
« Reply #14 on: October 18, 2024, 05:44:50 pm »
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

 

TinyPortal © 2005-2018