This is an archive of the discontinued LLVM Phabricator instance.

[mlir] Significantly overhaul the textmate grammar
ClosedPublic

Authored by rriddle on May 12 2022, 3:03 AM.

Details

Summary

The current grammar is really crusty, only supports a handful of
cases, and is also out-of-date after various refactorings. This commit
refactors the textmate grammar to handle significantly more cases,
and now provides proper coloring for a majority of cases (including
dialect attributes, operations, types, etc.)

Diff Detail

Event Timeline

rriddle created this revision.May 12 2022, 3:03 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 12 2022, 3:03 AM
rriddle requested review of this revision.May 12 2022, 3:03 AM

I validated the results using most of our upstream test cases. I may have missed some potential edge cases, but this is a much better iteration point that what we had before. There are a few places where we miscolor, but that is mostly because it's impossible in some cases to differentiate a region from an attribute dictionary.

rriddle updated this revision to Diff 428991.May 12 2022, 10:16 AM
jpienaar accepted this revision.May 12 2022, 3:09 PM

LGTM, could you add a before and after screenshot of a test? (Just for easy visual check)

This revision is now accepted and ready to land.May 12 2022, 3:09 PM

Here is a quick screencap of PDL before and after:

This revision was automatically updated to reflect the committed changes.