D syntax highlight support by Chroma in Hugo
Dennis
dkorpel at gmail.com
Wed May 22 09:52:13 UTC 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.
More information about the Digitalmars-d-announce
mailing list