ExplicitPatternGroup LookBehind Equivalent?

SyntaxEditor for Windows Forms Forum

Posted 19 years ago by Marianne
Avatar
I have several language defs with a bunch of keywords...nothing unusual there. My problem is that if I have a keyword 'left', I only want it to be considered a keyword if it's not preceded by a period character. There is no lookbehind option in the explicit pattern group so how do I differentiate:
Left("my string", 3) (should be a keyword)
SomeObject.Left (should not be a keyword)

------------------------------- Marianne

Comments (5)

Posted 19 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
This was requested by another customer as well for the VB language. Right now there's no really good way to handle that since there is no look-behind. We do want to implement look-behind soon. However even if we have it, we need a way to assign a common look-behind to a lexical pattern group, like a group of keywords. Do you think we should also add a LookBehind attribute similar to our LookAhead attribute in the lexical pattern group itself that would apply to all inner keywords?


Actipro Software Support

Posted 19 years ago by Marianne
Avatar
Quote:
<font size="1" face="Verdana, Arial">quote:</font><HR>Do you think we should also add a LookBehind attribute similar to our LookAhead attribute in the lexical pattern group itself that would apply to all inner keywords?<HR>
That is exactly how I was thinking it could be handled. Obviously, this is something that should work for both explicit and regex pattern groups. But in my example, adding LookBehind=[^\.] should prevent the keyword from being recogized if it was preceded by a period.

------------------------------- Marianne

Posted 19 years ago by Boyd - Sr. Software Developer, Patterson Consulting, LLC
Avatar
I've been feeling the pain of this as well, and I think you have the right idea. Adding a complement to the "LookAhead" attribute for Explicit and RegEx groups should do the trick.
Posted 19 years ago by NSXDavid
Avatar
I have the same issue, and I sorta solved it by defining a token that consists of whitespace followed by the text to distinguish it. That solution is not very robust and messes up the visuals on collapse and so forth.

-- David
Posted 19 years ago by Marianne
Avatar
That won't work, though, for a large group of explicit patterns, but I agree it would work for regex patterns.

------------------------------- Marianne

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.