|
18 | 18 | table)
|
19 | 19 | "Syntax table used while in LLVM mode.")
|
20 | 20 |
|
| 21 | +(defconst llvm-mode-primitive-type-regexp |
| 22 | + (concat |
| 23 | + "\\(i[0-9]+\\|" |
| 24 | + (regexp-opt |
| 25 | + '("void" "half" "bfloat" "float" "double" "fp128" "x86_fp80" "ppc_fp128" |
| 26 | + "x86_mmx" "x86_amx" "ptr" "type" "label" "opaque" "token") t) |
| 27 | + "\\)")) |
| 28 | + |
21 | 29 | (defvar llvm-font-lock-keywords
|
22 | 30 | (list
|
23 | 31 | ;; Attributes
|
|
34 | 42 | '("[-a-zA-Z$._0-9]+:" . font-lock-variable-name-face)
|
35 | 43 | ;; Unnamed variable slots
|
36 | 44 | '("%[-]?[0-9]+" . font-lock-variable-name-face)
|
37 |
| - ;; Types |
38 |
| - `(,(regexp-opt |
39 |
| - '("void" "i1" "i8" "i16" "i32" "i64" "i128" "half" "bfloat" "float" "double" "fp128" "x86_fp80" "ppc_fp128" "x86_mmx" "x86_amx" "ptr" |
40 |
| - "type" "label" "opaque" "token") 'symbols) . font-lock-type-face) |
| 45 | + ;; Function names |
| 46 | + '("@[-a-zA-Z$._][-a-zA-Z$._0-9]*" . font-lock-function-name-face) |
| 47 | + ;; Fixed vector types |
| 48 | + `(,(concat "<[ \t]*\\([0-9]+\\)[ \t]*x[ \t]+" |
| 49 | + llvm-mode-primitive-type-regexp |
| 50 | + "[ \t]*>") |
| 51 | + (1 'font-lock-type-face) |
| 52 | + (2 'font-lock-type-face)) |
| 53 | + ;; Scalable vector types |
| 54 | + `(,(concat "<[ \t]*\\(vscale[ \t]\\)+x[ \t]+\\([0-9]+\\)[ \t]*x[ \t]+" |
| 55 | + llvm-mode-primitive-type-regexp |
| 56 | + "[ \t]*>") |
| 57 | + (1 'font-lock-keyword-face) |
| 58 | + (2 'font-lock-type-face) |
| 59 | + (3 'font-lock-type-face)) |
| 60 | + ;; Primitive types |
| 61 | + `(,(concat "\\<" llvm-mode-primitive-type-regexp "\\>") . font-lock-type-face) |
41 | 62 | ;; Integer literals
|
42 | 63 | '("\\b[-]?[0-9]+\\b" . font-lock-preprocessor-face)
|
43 | 64 | ;; Floating point constants
|
|
0 commit comments