digitalmars.D.announce - D syntax highlight support by Chroma in Hugo
- Shigeki Karita (11/11) May 21 2019 Recently, I sent a PR [1] in Chroma (syntax highlighter) to
- Dennis (19/24) May 22 2019 Some observations:
- Vladimir Panteleev (9/13) May 23 2019 Thank you for working on this.
Recently, I sent a PR [1] in Chroma (syntax highlighter) to support D. I think my implementation is not perfect. I made this announcement to ask some experts for help and to ask Dlang blogger to use this. At this time, if you wanna write D code snippet in Hugo (static site generator), you can use my forked Hugo [2] or Linux x64 binary [3]. [1] https://github.com/alecthomas/chroma/pull/249 [2] https://github.com/ShigekiKarita/hugo/tree/dlang [3] https://github.com/ShigekiKarita/hugo/releases/download/dlang-v1/hugo.tar.xz
May 21 2019
On Wednesday, 22 May 2019 at 01:36:46 UTC, Shigeki Karita wrote:Recently, I sent a PR [1] in Chroma (syntax highlighter) to support D.Thanks for doing that!I think my implementation is not perfect. I made this announcement to ask some experts for help and to ask Dlang blogger to use this.Some observations: - Multi-line comments starting with /+ are nested. You can't express this with pure regular expressions however, it requires a context-free grammar. Maybe Go has some regex extensions that allow it to parse context-free constructs however, I don't know. - Integer literals can end with L, u, U, Lu, LU, uL, UL. Your regex doesn't allow u or U and does allow lower case l. - "TODO support delimited strings" that will be hard, as delimited strings are not even context-free, let alone regular. I've never seen them used, so I don't think it's bad if they can't be highlighted properly. - octal literals are not longer supported in D. - In character literals you support \u but no \U or octal numbers - string, wstring and dstring are not actually keywords, they are aliases that are automatically imported. I do think it makes sense to highlight them as keywords however, given how they are used like basic types.
May 22 2019
On Wednesday, 22 May 2019 at 01:36:46 UTC, Shigeki Karita wrote:Recently, I sent a PR [1] in Chroma (syntax highlighter) to support D. I think my implementation is not perfect. I made this announcement to ask some experts for help and to ask Dlang blogger to use this.Thank you for working on this. Did you have a practical reason to work on this considering that Hugo supports Pygments, and Pygments has decent support for D already? Here are the test files I used when working on D syntax highlighting in other projects, perhaps they can be useful: https://github.com/colorer/Colorer-schemes/blob/master/hrc/test/other/d-sample.d https://github.com/Emacs-D-Mode-Maintainers/Emacs-D-Mode/tree/master/tests
May 23 2019