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

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

[nongnu] elpa/zig-mode fead48b 002/104: Initial revision.


From: ELPA Syncer
Subject: [nongnu] elpa/zig-mode fead48b 002/104: Initial revision.
Date: Sun, 29 Aug 2021 11:36:52 -0400 (EDT)

branch: elpa/zig-mode
commit fead48b6369e538c1f4c2c98d45d2d26fe973329
Author: Andrea Orru <andreaorru1991@gmail.com>
Commit: Andrea Orru <andreaorru1991@gmail.com>

    Initial revision.
---
 zig-mode.el | 135 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 135 insertions(+)

diff --git a/zig-mode.el b/zig-mode.el
new file mode 100644
index 0000000..eaad3b0
--- /dev/null
+++ b/zig-mode.el
@@ -0,0 +1,135 @@
+;;; zig-mode.el --- A major mode for the Zig programming language -*- 
lexical-binding: t -*-
+
+;; Version: 0.0.1
+;; Author: Andrea Orru <andreaorru1991@gmail.com>, Andrew Kelley 
<superjoe30@gmail.com>
+;; Keywords: zig, languages
+;; Package-Requires: ((emacs "24.0"))
+;; URL: https://github.com/AndreaOrru/zig-mode
+
+;;; Commentary:
+;;
+
+;;; Code:
+(defvar zig-mode-builtins
+  '("@addWithOverflow"
+    "@alignOf"
+    "@alloca"
+    "@cDefine"
+    "@cImport"
+    "@cInclude"
+    "@cUndef"
+    "@canImplicitCast"
+    "@clz"
+    "@cmpxchg"
+    "@compileError"
+    "@compileLog"
+    "@compileVar"
+    "@ctz"
+    "@divExact"
+    "@embedFile"
+    "@errorName"
+    "@fence"
+    "@generatedCode"
+    "@import"
+    "@intType"
+    "@isFloat"
+    "@isInteger"
+    "@maxValue"
+    "@memberCount"
+    "@minValue"
+    "@mulWithOverflow"
+    "@setDebugSafety"
+    "@setGlobalAlign"
+    "@setGlobalLinkage"
+    "@setGlobalSection"
+    "@shlWithOverflow"
+    "@sizeOf"
+    "@subWithOverflow"
+    "@truncate"
+    "@typeName"
+    "@typeOf"
+    "@unreachable"))
+
+(defvar zig-mode-keywords
+  '("asm"
+    "break"
+    "coldcc"
+    "comptime"
+    "const"
+    "continue"
+    "defer"
+    "else"
+    "enum"
+    "export"
+    "extern"
+    "fn"
+    "for"
+    "goto"
+    "if"
+    "inline"
+    "nakedcc"
+    "noalias"
+    "packed"
+    "pub"
+    "return"
+    "struct"
+    "switch"
+    "try"
+    "union"
+    "unreachable"
+    "use"
+    "var"
+    "volatile"
+    "while"))
+
+(defvar zig-mode-constants
+  '("null"
+    "this"
+    "undefined"))
+
+(defvar zig-mode-types
+  '("Unreachable"
+    "bool"
+    "c_int"
+    "c_long"
+    "c_long_double"
+    "c_longlong"
+    "c_short"
+    "c_uint"
+    "c_ulong"
+    "c_ulonglong"
+    "c_ushort"
+    "error"
+    "f32"
+    "f64"
+    "i16"
+    "i32"
+    "i64"
+    "i8"
+    "isize"
+    "type"
+    "u16"
+    "u32"
+    "u64"
+    "u8"
+    "usize"
+    "void"
+    ))
+
+(defvar zig-mode-font-lock-keywords
+  `((,(regexp-opt zig-mode-keywords)  . font-lock-keyword-face)
+    (,(regexp-opt zig-mode-builtins)  . font-lock-builtin-face)
+    (,(regexp-opt zig-mode-constants) . font-lock-constant-face)
+    (,(regexp-opt zig-mode-types)     . font-lock-type-face)))
+
+;;;###autoload
+(define-derived-mode zig-mode c-mode "Zig"
+  "A major mode for the Zig programming language."
+  :group 'zig-mode
+  (setq-local font-lock-defaults '(zig-mode-font-lock-keywords)))
+
+;;;###autoload
+(add-to-list 'auto-mode-alist '("\\.zig\\'" . zig-mode))
+
+(provide 'zig-mode)
+;;; zig-mode.el ends here



reply via email to

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