Hey guys,
sorry for the bad rep.
But, recently i've obtained a code in c++ which highlights c# syntax in a Richtextbox.
LINK
I think the basic idea behind it is to specify an array of strings, and now the program should search and highlight the defined strings in a file.

Any help.

Anurag

What I mean is . . . You download a program which already does all the hard work (parsing etc)

http://qbnz.com/highlighter/

Then you can use that to colour your code however you wish! I'm not sure if the source code is released or how much effort is required to port that to c++. It seems like it's only available for use with php and html.

I reckon if you want to this this yourself, and build an accurate syntax highlighter, you'll have to use regular expressions, especially for multiple nesting within comments and quotes.

Edited 6 Years Ago by iamthwee: n/a

I think we have Colorer Take 5 To port it to c++
I don't know how to port it..

Looks like that only interfaces with certain IDEs. I don't think that will help.

How does daniweb do it?

It uses geSHi, but that uses php with regular expressions and formats the output in HTML.

To stand any hope of doing this properly you will need to use regular expressions.

Edited 6 Years Ago by iamthwee: n/a

for eg:
if i define a n array of strings as equal to include,void,int,float etc.
and then ask the program to search for the strings and then highlight them...
Then i think it will be fine.

But my main problem is finding a specific string in a paragraph of code.

Anurag

for eg:
if i define a n array of strings as equal to include,void,int,float etc.
and then ask the program to search for the strings and then highlight them...
Then i think it will be fine.

Not if you want it to be accurate.

But my main problem is finding a specific string in a paragraph of code.

If you can't to this then this is a bit beyond your capabilities.

Edited 6 Years Ago by iamthwee: n/a

This question has already been answered. Start a new discussion instead.