Let's see:
All highlighting is about easiness of code comprehension and code-error checking.
No doubt about that. But then "easiness" is very subjective. For example "being used to something" can make something easier, and at the same time that "something" could make it harder for someone else.
Of course having the option doesn't hurt... But having the option, needs to be done.
And more, it needs to be maintained afterwards.
And there are other - also useful - similar requests already (typenames /goto labels).
=> But I also have a very long list of useful (and/or also "of personal interest to me") things to do.
If the syntax highlighter is separate from compiler - would be helpfull to know which files in IDE (?and how) to change to implement separate highlighting for optional tokens.
It is different. And not only different from the compiler.
The broad overview
1) Compiler: Only for compiling
(Not for highlighting)
2) Codetools (part of the IDE): Parses the code for code completion, etc. Codetools actually understands the code (like the compiler). That is codetools knows if an identifier is a variable, function, method, ....
(Not for highlighting, but could be used in markup)
3a) Highlighter: Only syntactical parsing. That is it does not check if an identifier exist, or if it may be a variable or function.
3b) Markup: All kind of other Highlight
This may sound a bit over complicated but there are good reasons for it. Highlighting can continue, even if the code is broken (e.g. when you are in the middle of editing it).
Highlighting also is much faster than all the other codetools. Highlighting needs to update with every key stroke (well it could wait, but ...). I know most computers today are so fast it does not matter. But people do run the IDE on their Raspberry. And also on laptops, where it is not about the speed but battery usage.
Again: to be clear, none of that means there shouldn't be those features. It just says those features should not make the above uses impossible.
The highlighting of Procedure/begin vs for/repeat => that could be done in
components\synedit\synhighlighterpas.ppAll the info is already there.
Only you did not make it clear if
- the "outline" solves your issue (the vertical lines can be switched off)
- the "user defined markup" (with correct priorities)? Because that has solved very similar issues in the past.
- the "begin" keyword of a procedure/function should be the same as "begin" of a "for ...to... do begin" block.
Also I fully acknowledge that it comes down to personal preferences, I still seek to understand. So I did ask for more details on how that helps.
Others may have similar needs, and if anything gets added, and without understanding the issue, I have a harder time judging what makes the most sense.
The "foo.method" => well I did ask, if it is just: any identifier after a dot?
Because, if yes, it is do-able in the Highlighter.
But if it is: only if it is a function/procedure/method call => then it needs the understanding of codetools.
That can not go into the Highlighter. But it can be done in a "Markup" which delivers the same end result.
This would be a new unit, a new Markup class.
You can look at the existing SynEditMarkup... units/classes. Like syneditmarkupfoldcoloring
None of them currently uses codetools. That is something new that needs to be done (it also means the code goes into the IDE, not into SynEdit).
But if it is done, you can have a color for lots of different things
- methods / functions
- type name
- goto labels
- local vars / params (if you want that)
....
As for codetools, I haven't got much info on how to get the required info from it. So I can't currently give any insight on that.