Just wanted to point you to my working D lexer (needs a CTFE bugfix http://d.puremagic.com/issues/show_bug.cgi?id=6815). https://gist.github.com/1262321 D part https://gist.github.com/1255439 Generic part