Token Memers and span questions.

SyntaxEditor for Windows Forms Forum

Posted 18 years ago by Justin Milly
Avatar
I am tring to create a tool tip to create the effect in this picture
http://www.ctshouston.com/cc_example.jpg
(seems no image support in the forum)

It seems that the easiest way to do this would be grab the token(CloseCurlyBrace) and look for the corisponding token(OpenCurlyBrace) to grab the code from that linr to display the tooltip.

It also seems that that is not possible, Without re-processing the entire document how would i find the opening token?


Thank you,

Justin

Comments (5)

Posted 18 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
You can use the methods of TextStream to navigate back through tokens to find your open curly brace. Once found you can keep iterating backwards through tokens to look at the method definition and build your tooltip text.


Actipro Software Support

Posted 18 years ago by Justin Milly
Avatar
Yes, thank you... I was just hoping for a single pointer instead of backing through the tokens. I have a fear of choosing the wrong opening brace, I figure if i count the close and open braces i should level out on the correct one, but i need to account for all the other sematic possiblities of the brace occuring.

Mabye it is much easier than I am thinking. I will put together a project and test it out before I ask questions that are easier solved by a quick 'trial & error'.

Thanks,

Justin Milly
Posted 18 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
For that sort of thing we usually keep track of a brace level count. So every time we see another close brace when moving backwards, we increment the count. We decrement the count on an open brace. Then we only match an open brace that has a brace level count at zero. In v4.0 we're adding some methods to do some of this automatically for you.


Actipro Software Support

Posted 18 years ago by Justin Milly
Avatar
When is 4.0 scheduled for release?
Posted 18 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
SyntaxEditor 4.0 is currently our top priority and we're making very good progress on it.
The feature set we're trying to implement for it is extremely ambitious so it's taking a little longer than expected.
We don't have a release date so basically it will be out as soon as it's done.
Once it's ready it should be worth the wait.


Actipro Software Support

The latest build of this product (v24.1.0) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.