mirror of
https://github.com/compiler-explorer/compiler-explorer.git
synced 2026-07-16 17:26:58 -04:00
Resolves #8901 ### Problem `static/modes/mojo-mode.ts` was a copy of `static/modes/asm-mode.ts`, likely as a placeholder. Mojo source code was highlighted as if it were assembly. ### Solution This PR replaces the assembly placeholder with proper highlighting rules for Mojo. ### Details * Supports standard Python lexical rules * Includes legacy/deprecated keywords (`let`, `inout`, `borrowed`, `owned`, `alias`, `fn`, ...) for backward compatibility with older Mojo compilers on Compiler Explorer * Prevents keyword mis-highlighting during attribute access (`file.read()` doesn't highlight `read` as a keyword) ### Screenshots Before: <img width="174" height="116" alt="image" src="https://github.com/user-attachments/assets/ad561ff2-eae4-423e-8319-e2095da7838d" /> After: <img width="174" height="116" alt="image" src="https://github.com/user-attachments/assets/b52d9e25-2c9c-4162-a105-106ad868b31d" /> Before: <img width="327" height="113" alt="image" src="https://github.com/user-attachments/assets/257e3b94-b4c8-443a-93ae-71bbdd023b05" /> After: <img width="327" height="113" alt="image" src="https://github.com/user-attachments/assets/247e1e73-c1da-4df2-9781-cf2da3476c78" /> ### Testing * Verified visually in the local Compiler Explorer `make dev` environment.