Question

How to define special syntax for the editor

Posted 2 years ago by Avatar Emmad

Hello

I want to use your editor. I have special syntax requirements, that are simple. For example:

[

string <tag1> <tagX>

string lines

[

   string lines

   string <tagN>...<tagM>

   string lines

]

string lines

]

My application should allow coloring and operations on thags and the strings, and the string lines.

I want to know how to define the syntax requirements for such a structure to the editor. I can attempt the parsing via code, but I need the editor functions such as collapse/expand, indentiation, etc.

Could you provide any hint? The example above is not accurate, it is a large subset of my requirements.

Thanks.


Comments (3)

Posted 2 years ago by Actipro Software Support - Cleveland, OH, USA

Hello,

First, for the tags, do you want them to all be one color or do you want the delimiters (<. >) to be separate colors?  If you make them separate, then they will be three tokens instead of one.


Actipro Software Support
Posted 2 years ago by Emmad

Thank you for your help, I guess the color groups are:

Text strings have color 1

<> have color 2

[ ] have color 3

I will also need to color words with color 4 while search and find

I also may need to be able to programatically open a list of choices at any point (similar to spell checking but not only for spell checking).

That should do it as a starting point.

Is this something the control can support?

Thank you.

Posted 2 years ago by Actipro Software Support - Cleveland, OH, USA

Yes, you can make a lexical parser to tokenize the text however you want.  So strings can be one token, <...> ranges can be another token, and [ and ] character can be tokens too.  Each token kind can be assigned to use a specific highlighting style.  That's how syntax highlighting works.  Take a look at our dynamic lexer examples to see how we built pattern-based lexical parsers for various common languages.

You can even drive code outlining with tokens if you like.

For coloring words while searching, you could possibly do that with span indicators (see the indicators sample).

And we support IntelliPrompt member lists for picking options to replace text with, similar to the Intellisense in Visual Studio.

You can start looking at the samples and documentation to make sure everything is working for your needs.  They show off most of the features.


Actipro Software Support
Information The latest build of this product (2018.1 build 0340) was released 6 months ago, which was after the last post in this thread.

Add a Comment

Please log in to a validated account to post comments.