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.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

ConfigLexems - Support for Zero-Width Lookahead Assertion?

Thread ID:

Created:

Updated:

Platform:

Replies:

132063 Aug 10,2017 02:33 PM UTC Aug 28,2017 12:20 PM UTC Windows Forms 4
loading
Tags: EditControl
Timothy N Tow
Asked On August 10, 2017 02:33 PM UTC

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!

Timothy N Tow
Replied On 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 = @"\[";

Vijayalakshmi Roopkumar [Syncfusion]
Replied On 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.

Timothy N Tow
Replied On 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.


Vijayalakshmi Roopkumar [Syncfusion]
Replied On 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. 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;