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.

Create lexems on the fly

Thread ID:

Created:

Updated:

Platform:

Replies:

51015 Oct 26,2006 05:28 AM Nov 30,2006 01:44 AM Windows Forms 11
loading
Tags: EditControl
Olga
Asked On October 26, 2006 05:28 AM

Hi,
I have the following problem: I'd like that users of my control based on Syncfusion.Edit could provide list of lexems dynamically (for example, list of the tables in the database). XML file would contain a template lexem for such table and I will create a copy of it, changing only BeginBlock entry.

What is the best way to create a copy of ConfigLexem (I suppose that shallow copy will be enough)? It is not support ICloneable and it's inconvenient to copy field by field.

Thanks in advance,
Olga

Administrator [Syncfusion]
Replied On October 26, 2006 11:15 AM

Hi Olga,

We are looking into this issue and will get back to you shortly.

Thanks for your patience.

Regards,
Manohari,

Administrator [Syncfusion]
Replied On October 30, 2006 09:43 AM

Hi Olga,

Our apologies for the delayed response. It is possible to copy lexems and change the BeginBlock alone using the Lexems.CopyTo() method. I have attached a sample that illustrates this in this link given below.

Sample



Please let me know if this meets your requirements.

Thanks for your patience.

Regards,
Manohari.R

Administrator [Syncfusion]
Replied On October 31, 2006 04:08 AM

No, your example is absolutely incorrect. You suggest copying the existing array of lexems into the other array. This array contains references to the same lexems. If you will look at the lexem in the first this.editControl1.Language.Lexems array, corresponding to the lexem, changed in the second array, you will see, that initial lexem has also been changed.
What I need, this is a creation of the absolutely new lexem, and copying to it all the fields from the existiong lexem.
The only possibility, I've found in your source code is to use serialization like that:
//serialize

XmlSerializer ser = new XmlSerializer(typeof(ConfigLexem));

ser.Serialize(stream, cfg);

//deserialize

XmlSerializer ser = new XmlSerializer(typeof(ConfigLexem));
stream.Seek(0, 0);
ConfigLexem res = (ConfigLexem) ser.Deserialize(stream);

res.ParentConfig = container;
res.UpdateSublexems();

res.BeginBlock = word;

Is there a better approach?

Administrator [Syncfusion]
Replied On November 3, 2006 10:30 AM

New status:
I refused to create new lexem for every table. Instead, I modify one lexem, setting regex expression with "or", i.e. Table1|Table2.

Config is processed rather frequently, but while trying to change text of the editor I have to wait about 5-8 seconds, while regexp will compile. The compilation is regulated by DEF_COMPILED_REGEX flag but I can't set up it outside of the editor.

Is there any possibility to compile regexps asyncroniosly or to cancel compilation?

Olga
Replied On November 8, 2006 04:12 AM

Hey, is anybody there?

I'll try to reformulate my question.
I want to use syntax coloring for tables from my database (there are about 1000 tables).

I've tried to add a new lexem for each table or create one lexem and use regular expression where all tables are enumerated using "or"

The second way works faster but in both cases when I try to type in (or insert programmatically) any text in the edit box, the reqular expressions start to compile and it takes 5-8 seconds).

How could I accellerate this process?
How can I color large set of objects quickly?
Any suggestions?

Administrator [Syncfusion]
Replied On November 8, 2006 05:41 AM

Hi Olga,

We regret very much for the delayed response. we are looking into this issue with ConfigLexem and will get back to you shortly.

Thanks for your patience.

Regards,
Manohari.R

Administrator [Syncfusion]
Replied On November 13, 2006 07:26 AM

Hi Olga,

We regret very much for the delayed response. Could you please let us know whether the table names using which lexems are to be created have any unique properties.

Thanks for your patience.

Regards,
Manohari.R

Administrator [Syncfusion]
Replied On November 14, 2006 04:07 AM

May be I don't understand your question, but their unique property is table name.

Administrator [Syncfusion]
Replied On November 29, 2006 09:19 AM

Hi Olga,

We regret vrey much for the delayed response. It is possible to create lexems at runtime using the this.editControl1.Language.Lexems.Add() method.

I have attached a sample that illustrates this in this link below.

Sample1

It is also possible to type text immediately in EditControl as soon as lexems are created without using regular expressions. I have attached a sample that creates 500 lexems in this link below.

Sample2.

Please let me know if this meets you requirements.

Thanks for your patience.

Regards,
Manohari.R

Administrator [Syncfusion]
Replied On November 30, 2006 01:23 AM

Thank you for your response.

I have not found .mdb file used in example.


Administrator [Syncfusion]
Replied On November 30, 2006 01:44 AM

Sorry for previous comment, this mdb is not necessary.

Well, yes. With 500 lexems it works acceptable - about 7 sec on my computer in debug build. But with 1000-2000 - it nearly hangs.

The only decision I can use here - add new lexems, for example, table, only when they are used in text. I have to parse text on load and monitor its changes :(

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.

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.

;