Skip to content
This repository was archived by the owner on Nov 26, 2025. It is now read-only.

Commit 0931dcb

Browse files
ve-ntjoachimschmidt557
authored andcommitted
Apply font-lock-custom-face to block labels
c-mode applies `font-lock-constant-face` to labels (e.g. `foo:`) and label references (e.g. `goto foo;`). Get zig-mode to do the equivalent with block labels.
1 parent f55e425 commit 0931dcb

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

zig-mode.el

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,9 @@ If given a SOURCE, execute the CMD on it."
141141
zig-re-optionals-pointers-arrays
142142
(zig-re-grab zig-re-type)))
143143

144+
(defconst zig-re-block-label-open " \\([[:word:]]:\\) *{")
145+
(defconst zig-re-block-label-break "break[[:space:]]*\\(:[[:word:]]+\\)")
146+
144147
(defun zig-re-definition (dtype)
145148
"Construct a regular expression for definitions of type DTYPE."
146149
(concat (zig-re-word dtype) "[[:space:]]+" (zig-re-grab zig-re-identifier)))
@@ -233,6 +236,10 @@ If given a SOURCE, execute the CMD on it."
233236
symbol-end)
234237
. font-lock-type-face)
235238

239+
;; Block labels
240+
(,zig-re-block-label-open 1 font-lock-constant-face)
241+
(,zig-re-block-label-break 1 font-lock-constant-face)
242+
236243
;; Type annotations (both variable and type)
237244
(,zig-re-type-annotation 1 font-lock-variable-name-face)
238245
(,zig-re-type-annotation 2 font-lock-type-face))

0 commit comments

Comments
 (0)