authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2017-03-02 23:03:44-05:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2017-03-02 23:03:44-05:00
logeb9f1e2d532aa88199fb6afb3e2cfcef43c2ed14
tree82ed5f75b06a6e21cb7d03f5e9e3f9735872ee2a
parentb78752e2d23846763b77a21f183184668762f6d0

add basic emacs syntax file


2 files changed, 25 insertions(+), 0 deletions(-)

doc/emacs/README.md created+7
...@@ -0,0 +1,7 @@
1To use this emacs syntax file, add this to your emacs configuration file:
2
3```emacs
4(add-to-list 'load-path "/path/to/zig/doc/emacs/")
5(autoload 'zig-mode "zig-mode" nil t)
6(add-to-list 'auto-mode-alist '("\\.zig\\'" . zig-mode))
7```
doc/emacs/zig-mode.el created+18
...@@ -0,0 +1,18 @@
1(setq zig
2 '(("\\b\\(@sizeOf\\|@alignOf\\|@maxValue\\|@minValue\\|@memberCount\\|@typeOf\\|@addWithOverflow\\|@subWithOverflow\\|@mulWithOverflow\\|@shlWithOverflow\\|@cInclude\\|@cDefine\\|@cUndef\\|@compileVar\\|@generatedCode\\|@ctz\\|@clz\\|@import\\|@cImport\\|@errorName\\|@typeName\\|@isInteger\\|@isFloat\\|@canImplicitCast\\|@embedFile\\|@cmpxchg\\|@fence\\|@divExact\\|@truncate\\|@compileError\\|@compileLog\\|@intType\\|@unreachable\\|@setFnTest\\|@setFnVisible\\|@setDebugSafety\\|@alloca\\|@setGlobalAlign\\|@setGlobalSection\\)" . font-lock-builtin-face)
3
4("\\b\\(fn\\|use\\|while\\|for\\|break\\|continue\\|goto\\|if\\|else\\|switch\\|try\\|return\\|defer\\|asm\\|unreachable\\|const\\|var\\|extern\\|packed\\|export\\|pub\\|noalias\\|inline\\|comptime\\|nakedcc\\|coldcc\\|volatile\\|struct\\|enum\\|union\\)\\b" . font-lock-keyword-face)
5
6 ("\\b\\(null\\|undefined\\|this\\)\\b" . font-lock-constant-face)
7
8("\\b\\(bool\\|f32\\|f64\\|void\\|Unreachable\\|type\\|error\\|i8\\|\\|u8\\|\\|i16\\|\\|u16\\|\\|i32\\|\\|u32\\|\\|64\\|u64\\|isize\\|usize\\|c_short\\|c_ushort\\|c_int\\|c_uint\\|c_long\\|c_ulong\\|c_longlong\\|c_ulonglong\\|c_long_double\\)\\b" . font-lock-type-face)
9
10 ))
11
12
13
14(define-derived-mode zig-mode c-mode "zig mode"
15 "Major mode for editing Zig language"
16 (setq font-lock-defaults '(zig)))
17
18(provide 'zig-mode)