[Lazarus] bracket highlighting and context (eg mixing of quoted and unquoted brackets) / see bug 0009652

Mattias Gaertner nc-gaertnma at netcologne.de
Fri Jul 11 08:58:31 CEST 2008


On Thu, 10 Jul 2008 19:46:08 +0100
Martin Friebe <lazarus at mfriebe.de> wrote:

> This is a follow up to bug http://bugs.freepascal.org/view.php?id=9652
>  > In this line delete(str,1,pos('(',str)) the bracket in the string
>  > is 
> highlighted instead of the opening bracket after pos
> 
> An unquoted bracket (which is meaningful source text in pascal) can
> be matched by a bracket in quotes (or other context such as comment).
> This prevents highlighting of the matching *functional* bracket.
> 
> Other related issues would be:
>  ** comments:
> ( { ) } ) // will match the 1st and middle bracket, but for looking
> at it as pascal, the first and last are relevant

Or more complicated:
( { { ( } )

This depends on Delphi and FPC mode.

 
> ** concatenated strings:
> b := '(' + foo + ')';
> // OR
> i:= 1; // 2 or 3
> a := copy( '([{', i, 1 ) + 'some text in some bracket' + copy( '}])', 
> 4-i, 1 );
> would be nice to also match the correct brackets in the strings.
> 
> That means finding matching brackets will need to be implemented
> inside the highlighter (or access the highlighter a lot). I would say
> in the highlighter as it allows bracket-pairs like begin/end
> 
> Opinions are welcome, but I can't say how much would go into a
> possible fix. Haven't look at the highlighter yet.
> 
> This also affect jumping and marking to the matching bracket.

Yes, the highlighter should be able to override the bracket
search.

About pairs: Most highlighters do not gather pair information.
The pascal highlighter only gathers begin,asm,try,finally - end, {}, (*
*) pairs. Round brackets () and edged [] are ignored, especially in
comments.


Mattias



More information about the Lazarus mailing list