BracketHighlighting non-symetrical statements

SyntaxEditor for Windows Forms Forum

Posted 19 years ago by Russell Mason
Avatar
Hi

I want to use BracketHighlighting to match BEGIN and END statements (in SQL).
This is fine except:

BEGIN TRANSACTION X

IF (Somthing)
BEGIN
DoSomthing
END

...

In this situation when on the BEGIN of the BEGIN TRANSACTION it matches with the END of the IF statement.

I thought of doing this manually but then I have to do a load of work relating to nested matches (Ok, so this is not the most complex thing in the world, it just seems a shame to have to write it when you must be doing this already).

So,

1) Is there a way to 'intercept' Bracket Highlighting? I want to basically ignore bracket highlighting if the bracket highlighting start token is followed by a TRANSACTION token.

2) If not, given a token is it possible to find a matching token taking nested matches into account, without this being formally declared in the language definition? e.g. find the next END ignoring any BEGIN/ENDs in between.

Thanks
Russell Mason

Comments (2)

Posted 19 years ago by Russell Mason
Avatar
OK, that was a rubbish example, what I meant was:

IF (Somthing)
BEGIN
BEGIN TRANSACTION X
END
Posted 19 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Russell,

We'll write down to try and make bracket highlighting more customizable (via custom classes) in the future, maybe for v4.0.

You can probably get this working if your BEGIN token is different than your BEGIN TRANSACTION token. By that I mean define BEGIN TRANSACTION as its own token value and that way, END will skip over it since it's a different token than what is being searched for and it will pick up the first BEGIN instead.

I believe we did that sort of thing in our VB sample (not for bracket highlighting but for outlining... same concept though).

[Modified at 12/20/2005 04:29 PM]


Actipro Software Support

The latest build of this product (v24.1.1) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.