Posted 16 years ago by Anzor
Version: 4.0.0262
Avatar
I'm trying to create a lexical pattern group that ends with a new line, unless there is a u before it.

((DynamicLexicalState)language.DefaultLexicalState).LexicalPatternGroups.Add(new
LexicalPatternGroup(LexicalPatternType.Regex, "T1", inputStyle, 
inputPrefixPattern, @"[^u]{LineTerminatorMacro}"));
But I'm getting an exception at runtime:
Additional information: An invalid character 'L' was found in a range specification.
The error occurred in the lexical pattern group for token 'T1' in the look-ahead pattern '[^u]{LineTerminatorMacro}'.

Can someone tell me what I'm missing?

Thanks!

Comments (3)

Posted 16 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Put a space before the { character. It probably thinks that you are doing a range specification for [^u], meaning the number of occurrences, which also uses {number} syntax. The space will let it distinguish between the two.


Actipro Software Support

Posted 16 years ago by Anzor
Avatar
Hi and thanks for your response.

Putting the space there indeed avoided the exception, although it was still not what I needed. And after my many tweaks, I still can't get it to highlight the way I want.

The desired behavior I want is this:
http://img221.imageshack.us/img221/5933/regexvd2.jpg

Can you please help me out?

Thanks! :)
Posted 16 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
The pattern you have, '[^u] {LineTerminatorMacro}' means:
Any character other than 'u' (and probably also including line terminators) and the next line terminator. The fact you are implicitly including line terminators in your [^u] is probably bad.

You'll need to be more specific on what text you are trying to highlight in your screenshot with this pattern for us to help you.


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.