This is an archive of the discontinued LLVM Phabricator instance.

[docs] Enable syntax highlight of MIR (requires pygments 2.6.1)
Needs ReviewPublic

Authored by dsanders on May 18 2020, 10:38 AM.
This revision needs review, but there are no reviewers specified.

Details

Reviewers
None
Summary

pygments 2.6.1 contains support for MIR syntax highlighting.
It's been a couple months since that was released so I'd like
to suggest enabling it in our docs. There are two lexers
available, llvm-mir is for full MIR examples, and
llvm-mir-body is for examples of the body section without the
usual YAML wrapper.

It looks like I missed a few things in the pygments lexer as
some of these MIR examples don't highlight. Some like 'BUNDLE'
I intentionally didn't cover in the first attempt but it seems
I missed some keywords too (e.g. implicit-def, frame-setup,
frame-destroy), some LLVM-IR variable characters, and <regmask...>
Unfortunately, sphinx doesn't warn when pygments emits an
Error token (it silently drops all highlighting) so there may be more.

A few subsections in MIR are also not highlighted but they
don't cause unrelated highlights to disappear. E.g. the constants
section.

Diff Detail

Event Timeline

dsanders created this revision.May 18 2020, 10:38 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 18 2020, 10:38 AM