do not edit — generated by btf.
git.druid.rocksindexdruid520radiumradium-lang-nsc.el

radium-lang-nsc.el


;;; radium-lang-nsc.el, nsc (druid520/nscc.git) editing, c-derived -*- lexical-binding: t; -*-
;;
;; nsc is genuinely c-like (explicit-width types, braces, the same
;; struct/typedef/unsigned/enum/const/sizeof/if/else/while/return/
;; break/continue/switch/case/default keyword set c-mode already
;; fontifies), and kaboom's own real .nsc source already uses this
;; config's exact c89/allman style (brace on its own line, tabs, see
;; radium-lang-c.el's "radium-c89" style) - not a coincidence to
;; imitate by hand, so nsc-mode derives from c-mode directly rather
;; than getting written from scratch the way kona/btf were: cc-mode's
;; preprocessor handling is keyed on a leading "#", and nsc's `include
;; "x.nsh";` is a real statement (not spelled with one), so there's no
;; conflict with cc-mode's own directive parsing to work around.
;; verified directly, not assumed: a derived nsc-mode buffer runs
;; c-mode-hook same as a real c-mode buffer (cc-mode's own derived-mode
;; convention), so radium-lang-c.el's tabs+radium-c89 setup there
;; applies automatically - confirmed with a real indent-region round
;; trip before writing this file.
;;
;; two real differences from c that font-lock needs to know about:
;; nsc's own explicit-width types (i8/i16/i32/i64/u8/u16/u32/u64/ptr -
;; none of these are c keywords, c-mode has no idea they're types) and
;; two real nsc keywords c has no equivalent for at all (`global`,
;; linkage; `include`, a real statement, not text substitution).
 
(require 'cc-mode)
 
(define-derived-mode nsc-mode c-mode "nsc"
  "major mode for .nsc/.nsh (druid520/nscc.git): c-mode plus nsc's
own explicit-width types and its `global'/`include' keywords.")
 
(font-lock-add-keywords
 'nsc-mode
 '(("\\_<\\(global\\|include\\)\\_>" 1 font-lock-keyword-face)
   ("\\_<\\(i8\\|i16\\|i32\\|i64\\|u8\\|u16\\|u32\\|u64\\|ptr\\)\\_>" 1 font-lock-type-face)))
 
(add-to-list 'auto-mode-alist '("\\.nsc\\'" . nsc-mode))
(add-to-list 'auto-mode-alist '("\\.nsh\\'" . nsc-mode))
 
(provide 'radium-lang-nsc)
powered by btf.