Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2008-07

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

2 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Martin Friebe

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

** 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.

Reply by email

Mattias Gaertner
to Martin Friebe
Show quoted text 13 lines
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.

Show quoted text 16 lines
** 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

Reply by email