We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

ConfigLexems - Support for Zero-Width Lookahead Assertion?

I can see that there does not appear to be any support for zero-width lookahead/behind assertion in BeginBlock or EndBlock, but I am wondering whether this is on the roadmap for the EditControl. The EditControl works well initially, until you really try to push the regex blocks.

I have multiple lexems in place, many of which support sublexems, and I am having a few issues, due to the apparent lack of lookahead assertion support.
For example, say I have two lexems: one for quoted text and one for bracketed text.

Quoted text will start with " and end with ". Quoted text may contain all sublexems.
Bracketed text will start with [ and end with ]. Bracketed text only supports local sublexems and it cannot contain quotes.

Because quoted text can contain bracketed text, the following example creates a problem:

"bracketed text starts with [."

As a resolution, the following would be ideal:

ConfigLexem lexem = new ConfigLexem();
lexem.IsBeginRegex = true;
lexem.Type = FormatType.Custom;
lexem.FormatName = "Default";
lexem.IsComplex = true;
lexem.OnlyLocalSublexems = true;
lexem.IndentationGuideline = true;
// end the lexem on ] OR any character followed by " - DOES NOT WORK
lexem.EndBlock = @"\]|.(?=[""])";
lexem.IsEndRegex = true;

I can specify [\]"] as my EndBlock, which does serve to end the bracketed text lexem, but then the quoted text lexem is left open. Can you suggest any way to accomplish something similar, where a lexem ends on a character literal OR any character followed by a double quote?

This is just an example, but the EndBlock above using a zero-width lookahead assertion is perfectly valid regex in .NET, so I am a bit troubled that I cannot use it in a ConfigLexem EndBlock.

Thanks!

4 Replies

TN Timothy N Tow August 10, 2017 02:40 PM UTC

I forgot to include a BeginBlock in the example above.  Editing the post loses my font settings and will not allow me to set the font on any text, so consider this as the BeginBlock in the post above.

lexem.BeginBlock = @"\[";


VR Vijayalakshmi Roopkumar Syncfusion Team August 16, 2017 11:10 AM UTC

Hi Timothy,

Thank you for contacting Syncfusion Support.

Query 1: I can see that there does not appear to be any support for zero-width lookahead/behind assertion in BeginBlock or EndBlock

Yes , at present there is no support for Zero-width lookahead/behind assertion in EditControl.

Query 2: Can you suggest any way to accomplish something similar, where a lexem ends on a character literal OR any character followed by a double quote? This is just an example, but the EndBlock above using a zero-width lookahead assertion is perfectly valid regex in .NET, so I am a bit troubled that I cannot use it in a ConfigLexem EndBlock

We have checked the reported requirement with the EditControl, but we are not clear about the query “a lexem ends on a character literal OR any character followed by a double quote”. Since we observed that the provided regex for EndBlock uses the Positive lookahead assertion that has been matching the character which is preceded before the quote [“] follows as shown below screenshot:


So could you please clarify us whether you want to match the character which is preceded before [“] in Syncfusion EditControl as shown in the above screenshot? If not kindly brief your requirement clearly about which character should be matched by providing screenshot. Also provide us the Input file which you have used in your application.

Please provide us the requested details and let us know if we had misunderstood your requirement?

Regards,
Vijayalakshmi V.R.


TN Timothy N Tow August 21, 2017 08:54 AM UTC

Thanks for your response.  Yes, you understood my query correctly.  I want to end the "bracketed text" lexem on either the character "]" OR the last character before a quotation mark.  The reason for this is that bracketed text does not support sublexems, but quoted text does support them.  Bracketed text can be inside quotation marks, and it should highlight correctly, but quoted text cannot be inside brackets.  Without the requested support for lookaround assertions, we run into the problem that a "[" character inside of quotation marks will open a bracketed text lexem, which never gets closed because sublexems are not supported.

Here is an example of the problem:


I am currently ending the bracketed text lexem on "]" OR quotation marks, but then the quotation mark lexem remains open.  Being able to do lookahead/behind would prevent this problem from occurring.  Ending the bracketed text lexem on a quotation mark is "more" acceptable than not doing this, because quoted text allows all sublexems, but it is still not ideal, as it does not display correctly and it creates problems when processing the ConfigStack.

Thank you for your consideration of this issue, and I will be very pleased if there is any workaround to accomplish my goal.



VR Vijayalakshmi Roopkumar Syncfusion Team August 28, 2017 12:20 PM UTC

Hi  Timothy

Thank you for the patience.

A support incident to track the status of this reported requirement has been created under your account. Please log on to our support website to check for further updates.

https://www.syncfusion.com/account/login?ReturnUrl=%2fsupport%2fdirecttrac%2fincidents 

Regards,
Vijayalakshmi V.R. 


Loader.
Live Chat Icon For mobile
Up arrow icon