Files
RedBear-OS/local/recipes/dev/libclc/source/mlir/utils/pygments/README.md
T
vasilito cb424d7448 build: static patch-sanity linter (shift-left the malformed-patch class)
verify-patch-sanity.py validates every active recipe .patch has internally-
consistent hunk line counts — catching the 'malformed patch at line N' failure
at commit/CI/preflight time instead of hours into a cook. This cycle hit that
class three times (qtwaylandscanner, sddm, xwayland), each only discovered when
cookbook tried to apply the patch.

Running it across the repo found 29 latent malformed patches (validated against
GNU patch: e.g. relibc/P3-sysv-ipc reproduces 'malformed patch at line 22').
They were harmless only because they sit in vendored recipes (baked, not re-
applied) — but would fail on any version-bump re-derivation. --fix recounts the
hunk headers (body untouched) and repaired all 29.

Wired into build-preflight.sh (Phase 1.0D) and redbear-ci.yml, with a unit test
(test-patch-sanity.sh). Skips archived/legacy trees and unvalidatable formats
(empty placeholders, bare-@@ git hunks).
2026-08-01 05:13:02 +03:00

1.4 KiB

Pygments Lexer for MLIR

This file contains a simple Pygments lexer configuration for MLIR, derived from the version used in the original CGO paper. Pygments allows for advanced configurable syntax highlighting of any code. This lexer is known to be incomplete and support mostly core IR with a subset of built-in types. Additions and customizations are welcome.

Standalone Usage

Install Pygments, e.g., by running pip install Pygments or a Python package manager of your choosing. Use the standalone pygmentize command by instructing it to load the custom lexer:

pygmentize -l /path/to/mlir_lexer.py:MlirLexer -x myfile.mlir

This will produce highlighted output in the terminal. Other output formats are available, see Pygments documentation for more information.

LaTeX Usage

First, make sure your distribution includes the minted package and list in the preamble.

\usepackage{minted}

Place the mlir_lexer.py in a place where the latex binary can find it, typically in the working directory next to the main .tex file. Note that you will have to invoke latex with the -shell-escape flag. See the minted package documentation for more information.

Leverage the custom lexer facility of minted to use this lexer in your document as:

\begin{minted}{mlir_lexer.py:MlirLexer -x}
   ... your code here ...
\end{minted}