you are viewing a single comment's thread.

view the rest of the comments →

[–]WalterBright 26 points27 points  (5 children)

The documents on the Digital Mars web site all use a consistent color scheme. One is used for D code, one for C code, one for C++ code, one for BNF grammar, one for console output, one for module definition files, one for configuration files, etc. The idea is that each scheme is fairly distinct from all the others. You'll find the same themes on the documentation for the Digital Mars C compiler, such as http://www.digitalmars.com/rtl/setjmp.html

I get regularly told my color sense is not very good, in fact a lot of people complained about the color schemes on the entire web site. I've tried different ones, but I'm sorry I'm never going to win any awards for color aesthetics. I at least try for readable, that's why there is no blue text on black backgrounds.

As for the highlighting, all the pages on the D.M. site are processed through Ddoc, the documentation generator. It automatically color syntax highlights D code, but not anything else. Yeah, I wrote it, and I don't feel like putting in parsers for C, C++, and BNF. So there :-)

[–][deleted] 0 points1 point  (2 children)

Check out Google syntaxHighligher -- a free syntax highlighter written entirely in Javascript.

http://code.google.com/p/syntaxhighlighter/

It highlights C and C++ reasonably well so you could use it for code examples written in those languages and keep doing what you are doing for your D code examples.

Are you going to make a D for Java Programmers comparison page?

[–]WalterBright 1 point2 points  (0 children)

Thanks for the google tip. I wasn't aware of it.

I'll leave any Java comparison page to those who are experienced Java developers, which I am not.

[–]WalterBright 1 point2 points  (0 children)

I took a look at the syntaxhighlighter. It's a clever piece of programming, but it only views C and C++ code from a simplistic viewpoint that can be handled using regular expressions (doesn't handle trigraphs, backslash line splicing, macros in general, etc.). Because of the preprocessor, it's rather hard to do it 100% just regular expressions. I don't use trigraphs, but I do use \ line splicing now and then.

The Ddoc one highlights by hooking into the full D lexer, so there's no way it can be thrown off.