From 15ba10ff986fa4fa5df8432ab47a8103b0200d30 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Wed, 18 Jul 2018 23:44:51 -0400 Subject: Improvements to lux-mode. --- lux-mode/lux-mode.el | 131 +++++++++++++++++++++++++-------------------------- 1 file changed, 65 insertions(+), 66 deletions(-) (limited to 'lux-mode') diff --git a/lux-mode/lux-mode.el b/lux-mode/lux-mode.el index 4a7c05268..cdad49f8b 100644 --- a/lux-mode/lux-mode.el +++ b/lux-mode/lux-mode.el @@ -211,73 +211,72 @@ Called by `imenu--generic-function'." (defconst lux-font-lock-keywords (let ((digits "[0-9][0-9_]*") (digits+ "[0-9_]+") - (symbol_h "[a-zA-Z\\-\\+_=!@\\$%\\^&\\*<>;,/\\\\\\|':~\\?]") - (symbol_t "[a-zA-Z0-9\\-\\+_=!@\\$%\\^&\\*<>;,/\\\\\\|':~\\?]")) + (symbol_h "[a-zA-Z-\\+_=!@\\$%\\^&\\*<>;,/\\\\\\|':~\\?]") + (symbol_t "[a-zA-Z0-9-\\+_=!@\\$%\\^&\\*<>;,/\\\\\\|':~\\?]")) (let ((symbol (concat symbol_h symbol_t "*"))) - (eval-when-compile - `(;; Special forms - (,(concat - "(" - (regexp-opt - '(".module:" - "def:" "type:" "macro:" "syntax:" "program:" - "signature:" "structure:" "context:" "template:" - "class:" "interface:" - "poly:" "derived:" - "actor:" "message:" "on:" - "exception:" - "word:" - "abstract:" - "unit:" "scale:" - "import:" - ":" ":coerce" ":assume" ":of" ":cast" ":share" ":abstraction" ":representation" "^:representation" ":~" - "function" "case" "undefined" "ident-for" "static" - "and" "or" - "char" - "exec" "let" "if" "cond" "do" "be" "open:" "loop" "recur" "comment" "for" - "list" "list&" "io" "row" "tree" - "get@" "set@" "update@" "|>" "|>>" "<|" "<<|" "_$" "$_" "~" "~+" "~!" "~'" "::" ":::" - "|" "&" "->" "All" "Ex" "Rec" "primitive" "$" "type" - "^" "^or" "^slots" "^multi" "^@" "^template" "^open" "^|>" "^code" "^sequence&" "^regex" - "bin" "oct" "hex" - "pre" "post" - "structure" "derive" - "infix" - "format" - "`" "`'" "'" "do-template" "with-expansions" "``" "~~" - "object" "do-to" "synchronized" "class-for" - "doc" - "regex" - ) t) - "\\>") - 1 font-lock-builtin-face) - ;; Bit literals - (,(concat - "\\<" - (regexp-opt - '("#0" "#1") t) - "\\>") - 0 font-lock-constant-face) - ;; Nat literals - (,(concat "\\<\\+" digits "\\>") - 0 font-lock-constant-face) - ;; Int literals && Frac literals - (,(concat "\\<-?" digits "\\(\\." digits+ "\\(\\(e\\|E\\)\\(-\\|\\+\\)?" digits "\\)?\\)?\\>") - 0 font-lock-constant-face) - ;; Frac "ratio" literals - (,(concat "\\<-?" digits "/" digits "\\>") - 0 font-lock-constant-face) - ;; Rev literals - (,(concat "\\<\\." digits "\\>") - 0 font-lock-constant-face) - ;; Tags - (,(concat "#\\." symbol) - 0 font-lock-type-face) - (,(concat "#\\.\\." symbol) - 0 font-lock-type-face) - (,(concat "#" symbol "\\(\\." symbol "\\)?") - 0 font-lock-type-face) - )))) + (let ((bitRE (concat "\\<" (regexp-opt '("#0" "#1") t) "\\>")) + (natRE (concat "\\<\\+" digits "\\>")) + (int&fracRE (concat "\\<-?" digits "\\(\\." digits+ "\\(\\(e\\|E\\)\\(-\\|\\+\\)?" digits "\\)?\\)?\\>")) + (frac-ratioRE (concat "\\<-?" digits "/" digits "\\>")) + (revRE (concat "\\<\\." digits "\\>")) + (tagRE (let ((separator "\\.")) + (let ((in-prelude separator) + (in-current-module (concat separator separator)) + (in-module (concat symbol separator)) + (in-local "")) + (concat "#" + "\\(" in-prelude "\\|" in-current-module "\\|" in-module "\\|" in-local "\\)" + symbol))))) + (eval-when-compile + `(;; Special forms + (,(concat + "(" + (regexp-opt + '(".module:" + "def:" "type:" "macro:" "syntax:" "program:" + "signature:" "structure:" "context:" "template:" + "class:" "interface:" + "poly:" "derived:" + "actor:" "message:" "on:" + "exception:" + "word:" + "abstract:" + "unit:" "scale:" + "import:" + ":" ":coerce" ":assume" ":of" ":cast" ":share" ":abstraction" ":representation" "^:representation" ":~" + "function" "case" "undefined" "ident-for" "static" + "and" "or" + "char" + "exec" "let" "if" "cond" "do" "be" "open:" "loop" "recur" "comment" "for" + "list" "list&" "io" "row" "tree" + "get@" "set@" "update@" "|>" "|>>" "<|" "<<|" "_$" "$_" "~" "~+" "~!" "~'" "::" ":::" + "|" "&" "->" "All" "Ex" "Rec" "primitive" "$" "type" + "^" "^or" "^slots" "^multi" "^@" "^template" "^open" "^|>" "^code" "^sequence&" "^regex" + "bin" "oct" "hex" + "pre" "post" + "structure" "derive" + "infix" + "format" + "`" "`'" "'" "do-template" "with-expansions" "``" "~~" + "object" "do-to" "synchronized" "class-for" + "doc" + "regex" + ) t) + "\\>") + 1 font-lock-builtin-face) + ;; Bit literals + (,bitRE 0 font-lock-constant-face) + ;; Nat literals + (,natRE 0 font-lock-constant-face) + ;; Int literals && Frac literals + (,int&fracRE 0 font-lock-constant-face) + ;; Frac "ratio" literals + (,frac-ratioRE 0 font-lock-constant-face) + ;; Rev literals + (,revRE 0 font-lock-constant-face) + ;; Tags + (,tagRE 0 font-lock-type-face) + ))))) "Default expressions to highlight in Lux mode.") (defun lux-font-lock-syntactic-face-function (state) -- cgit v1.2.3