emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/zig-mode 0931dcbdbe: Apply font-lock-custom-face to block


From: ELPA Syncer
Subject: [nongnu] elpa/zig-mode 0931dcbdbe: Apply font-lock-custom-face to block labels
Date: Fri, 1 Nov 2024 19:17:47 -0400 (EDT)

branch: elpa/zig-mode
commit 0931dcbdbe66966b8149178b201c033e5d073120
Author: vent <ventlark@gmail.com>
Commit: Joachim Schmidt <joachim.schmidt557@outlook.com>

    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.
---
 zig-mode.el | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/zig-mode.el b/zig-mode.el
index dfccd3f52f..7f80b7dd53 100644
--- a/zig-mode.el
+++ b/zig-mode.el
@@ -141,6 +141,9 @@ If given a SOURCE, execute the CMD on it."
           zig-re-optionals-pointers-arrays
           (zig-re-grab zig-re-type)))
 
+(defconst zig-re-block-label-open " \\([[:word:]]:\\) *{")
+(defconst zig-re-block-label-break "break[[:space:]]*\\(:[[:word:]]+\\)")
+
 (defun zig-re-definition (dtype)
   "Construct a regular expression for definitions of type DTYPE."
   (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."
            symbol-end)
       . font-lock-type-face)
 
+     ;; Block labels
+     (,zig-re-block-label-open 1 font-lock-constant-face)
+     (,zig-re-block-label-break 1 font-lock-constant-face)
+
      ;; Type annotations (both variable and type)
      (,zig-re-type-annotation 1 font-lock-variable-name-face)
      (,zig-re-type-annotation 2 font-lock-type-face))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]