Code::Blocks syntax highlighting for Nim.
Nim[rod] syntax highlighting is absent in the Code::Blocks (at least in 16.01) thought nimrod is present in the sdk/wxscintilla/include/wx/wxscintilla.h. The required lexer files are attached to display Nim entry in the Settings / Editor / Syntax highlighting to be able to adjust the syntax highlighting.
The attached lexer files should be putted to codeblocks/lexers/
.
Note for the users: location fo the
codeblocks/lexers
on Linux Ubuntu is/usr/share/codeblocks/lexers
.Last edit: Artem VL 2018-04-05
I've tried this lexer config and it doesn't seem to be fully functional.
In current trunk (after the update of scintilla to 3.7.x) most of the colors doesn't affect the correct parts of the text:
1. the doxygen documentation doesn't affect anything
2. the comment block is affecting operators
I don't know or use nim, so I have no idea how to fix those, so an updated version would be welcomed.
I have not much experience with the lexers to fix there anything beyond the config file, the provided one works to some extend for me. I just took another CodeBlocks lexer, updated id to refer Nim(rod) and added Nim keywords .
Nim uses reStructured code docs similar to Python, so Doxygen is not applicable there.
Last edit: Artem VL 2018-04-29
Unfortunately the nimrod lexer doesn't use its own constants, but it seems that reuses others.
I've done a simple grep in the file for the constants.
Now all you need to do is find the numeric value for these constants and provide an options in the xml. Do some testing. Make sure that changing the colour for any option does something to the sample. When you're ready post the changes again and I'll apply them.
Any chance for an updated patch?
I used VSCode and Geany (when on battery) for Nim... But CodeBlocks would benefit from the Nim support and it's my favourite C++ IDE! It would be nice to not close this ticket without the fix.
I will try to devote time for it till the end of this week.
There are no plans to close the ticket. If Geany has a syntax highlight for Nim, then you can look how they've defined it and try to copy it to Code::Blocks. The values should be similar, because C::B and Geany use the same editor component underneath - Scintilla.
The latest Geany v 1.36 just restyles the Python highlighting for Nim:
The latest Scintilla has the dedicated Nim Lexer but it seems the Code::Blocks uses an outdated LexNimrod/cxx from wxWidgets , which also support Nim highlighting to some extend.
I fixed the ids for the greped definitions as you suggested using SciLexer.h from wxWidgets, the updated lexer is attached.
In trunk, thanks for the contribution.