diff --git a/sex-mode.el b/sex-mode.el index ea70571..e564d06 100644 --- a/sex-mode.el +++ b/sex-mode.el @@ -59,42 +59,55 @@ All commands in `lisp-mode-shared-map' are inherited by this map.") (defconst sex-font-lock-keywords (eval-when-compile (list - ;; Declarations + ;; Declarations. `pub' and `extern' are optional prefixes, so + ;; `(pub fn main' highlights both keywords and the name. (list (concat "(" - (regexp-opt '("chicken-define" - "chicken-define-syntax" - "chicken-import" - "chicken-load" - "define" + "\\(?:\\(pub\\|extern\\)[[:space:]]+\\)?" + (regexp-opt '("define" "defmacro" - "extern" + "enum" + "fn" "import" "include" - "fn" - "pub" "struct" - "var" - "union") - 'word) - "\\>" + "typedef" + "union" + "var") + 'words) "[[:space:]]*" "\\([[:word:]]*\\)") - '(1 font-lock-keyword-face) - '(2 font-lock-function-name-face)) - ;; Keywords + '(1 font-lock-keyword-face nil t) + '(2 font-lock-keyword-face) + '(3 font-lock-function-name-face nil t)) + ;; Statement and expression heads, plus the macro-language forms + ;; that appear in `defmacro' bodies. (list (concat "(" - (regexp-opt '("do" + (regexp-opt '("break" + "c-bit-or" + "c-bit-or=" + "c-or" "case" + "case/fallthrough" + "cast" + "closure" + "continue" "default" - "if" + "do" + "else" "for" "goto" + "if" + "lambda" + "map-fields" "return" + "sizeof" + "static-assert" "switch" - "var" - "while") - 'word) - "\\>") + "type-match" + "type-of" + "while" + ":") + 'words)) '(1 font-lock-builtin-face)))) "Font-lock keywords for Sex mode.")