The textmate reference grammar comes from upstream. This is also the grammar that GitHub (as in, linguist
) uses for MLIR code (though it lives outside of llvm/llvm-project
it appears to be — as of this writing — identical).
This grammar also draws from the grammar bundled with mlir-vscode
; available separately in this repo. As this README notes that grammar has specific support for several MLIR dialects.
Docs for the sublime-syntax
format are here.
Names of the scopes are available here.
The real reason this exists is for use with bat
which uses syntect
(meaning grammars used with it have to be in sublime-syntax
form) and supports external language definitions.
# Download it to the right dir:
mkdir -p "$(bat --config-dir)/syntaxes"
curl -Ls https://raw.githubusercontent.com/rrbutani/sublime-mlir-syntax/main/mlir.sublime-syntax > "$(bat --config-dir)/syntaxes/mlir.sublime-syntax"
# Get `bat` to pick it up:
bat cache --build
# Test it out:
curl -Ls https://raw.githubusercontent.com/rrbutani/sublime-mlir-syntax/main/sample.mlir | bat -lmlir
(TODO! make a package, link to it here and in the repo's tagline)