PavelTorgashov / FastColoredTextBox

Fast Colored TextBox for Syntax Highlighting. The text editor component for .NET.
Other
1.23k stars 465 forks source link

Why there is no syntax highlighting for C/C++? #77

Open zbooa opened 8 years ago

zbooa commented 8 years ago

Many versions have been updated, and there is still no highlight for C/C++. I really need this. Developers can specifically for the development of syntax highlighting module. Can later do more expansion. I believe that there will be a great future.

caverna commented 8 years ago

I used this tool to develop a proprietary language to a CLP. It took some efforts from my side, but I was able to archive this goal. What about to help the developer, creating a highlight for C++ and do a pull request? It's a amazing tool, and it's free! Don't you think you're asking too much for someone to work for you for free? Come on! I can help you with RegEx, but I'm not able to do everything because C++ it's not my main language, and I don't know every facet of the language. There's enough documentation to create a customized highlight...

zbooa commented 8 years ago

@caverna OK.OK.OK。Sorry... So that you can talk about how to write regular expressions?For C++.Thank you.

caverna commented 8 years ago

I sugest you to start with baby steps. Try simple things first like highlighting [], {} and (), after that, try to highlight and then, detecting line breaks. This can be your start point... Looking at my books, I found that what I learned about RegEx came from a portuguese book (my main language), but the second best source about RegEx is http://www.regular-expressions.info/... Give it a look and get familiar with RegEx, then you can setup a Git repository where we can work together, what do you think?

zbooa commented 8 years ago

@caverna Thank you。 I think I've done it.You See it FOR C/C++ xaupe_20160417172439 //string e.ChangedRange.SetStyle(BrownStyle, @"""""|@""""|''|@"".*?""|(?<!@)(?<range>"".*?[^\\]"")|'.*?[^\\]'"); //comments e.ChangedRange.SetStyle(GreenStyle, @"//.*$", RegexOptions.Multiline); e.ChangedRange.SetStyle(GreenStyle, @"(/\*.*?\*/)|(/\*.*)", RegexOptions.Singleline); e.ChangedRange.SetStyle(GreenStyle, @"(/\*.*?\*/)|(.*\*/)", RegexOptions.Singleline | RegexOptions.RightToLeft); //number e.ChangedRange.SetStyle(MagentaStyle, @"\b\d+[\.]?\d*([eE]\-?\d+)?[lLdDfF]?\b|\b0x[a-fA-F\d]+\b"); //class name e.ChangedRange.SetStyle(BoldStyle, @"\b(class|struct|enum|interface)\s+(?<range>\w+?)\b"); //keyword e.ChangedRange.SetStyle(BlueStyle, @"\b(LRESULT|CString|String|WORD|DWORD|TCHAR|BYTE|BOOL|unsigned|signed|int|bool|char|short|long|float|double|string|wchar|wchar_t|__int8|__int16|__int32|__int64|struct|class|enum|interface|if|else|switch|case|break|defalut|return|true|false|for|do|while|continue|goto|new|list|map|using|namespace|private|protected|public|const|delete|cout|cin)\b"); //Preprocessing command e.ChangedRange.SetStyle(MagentaStyle, @"#\b(include|pragma|if|else|elif|ifndef|ifdef|endif|undef|define|line|error)\b|__[^>]*__", RegexOptions.Singleline); //<> e.ChangedRange.SetStyle(BrownStyle, @"<[^>]*>", RegexOptions.Singleline); //Pointer e.ChangedRange.SetStyle(MagentaStyle, @"\*", RegexOptions.Singleline); //function // e.ChangedRange.ClearFoldingMarkers(); // e.ChangedRange.SetFoldingMarkers("{", "}");//allow to collapse brackets block e.ChangedRange.SetFoldingMarkers(@"/\*", @"\*/");//allow to collapse comment block

zbooa commented 8 years ago

@caverna I just want it to be a normal display of Chinese or non English characters. In the next month, I will complete the Java, Ruby and Python of the highlight support, and package to the inside.

caverna commented 8 years ago

I don't know about Chinese chars, but \w also means for non-English chars. Ex: \w+ matches for 'coração'

zbooa commented 8 years ago

Thank you for your answer. But you say I already know, I mean, this is not normal Chinese controls appear. Chinese is a wide character. I am Chinese. My country is the use of text.

78

snorepion commented 7 years ago

RegexOne is a great resource for learning Regex if you're still looking. I'm also working on a scripting language to help people learn Regex through human-readable text - in fact, it uses this very library for syntax highlighting.

Of course, I'm about 18 months late, so you're probably not looking anymore.

Hexman768 commented 5 years ago

It would be great if you could post a link to the code, I would love to create a PR with this, or you could make the PR!

flier268 commented 4 years ago

@zbooa 對於python跟ruby的修改已經完成了嗎?