From 134c12a5c10702d4d0ca39f398a01bc38366e2fa Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Wed, 9 Oct 2019 01:08:44 -0400 Subject: Updated lux-mode to work with the latest Emacs --- lux-mode/lux-mode.el | 217 ++++++++++++++++++++++++++------------------------- 1 file changed, 110 insertions(+), 107 deletions(-) (limited to 'lux-mode') diff --git a/lux-mode/lux-mode.el b/lux-mode/lux-mode.el index ca8178c6a..860952e43 100644 --- a/lux-mode/lux-mode.el +++ b/lux-mode/lux-mode.el @@ -217,113 +217,116 @@ Called by `imenu--generic-function'." (concat "#" normal)) (defconst lux-font-lock-keywords - (let ((natural "[0-9][0-9,]*") - (identifier_h "[a-zA-Z-\\+_=!@\\$%\\^&\\*<>;,/\\\\\\|':~\\?]") - (identifier_t "[a-zA-Z0-9-\\+_=!@\\$%\\^&\\*<>;,/\\\\\\|':~\\?]") - (sign (altRE "-" "\\+"))) - (let ((identifier (concat identifier_h identifier_t "*")) - (integer (concat sign natural))) - (let ((bitRE (literal (special (altRE "0" "1")))) - (natRE (literal natural)) - (int&fracRE (literal (concat integer "\\(\\." natural "\\(\\(e\\|E\\)" integer "\\)?\\)?"))) - (revRE (literal (concat "\\." natural))) - (tagRE (let ((separator "\\.")) - (let ((in-prelude separator) - (in-current-module (concat separator separator)) - (in-module (concat identifier separator)) - (in-local "")) - (special (concat (altRE in-prelude in-current-module in-module in-local) identifier)))))) - (eval-when-compile - `(;; Special forms - (,(let (;; Control - (control//flow (altRE "case" "exec" "let" "if" "cond" "loop" "recur" "do" "be")) - (control//pattern-matching (altRE "\\^" "\\^or" "\\^slots" - "\\^multi" "\\^@" "\\^template" - "\\^open" "\\^|>" "\\^code" - "\\^sequence&" "\\^regex")) - (control//logic (altRE "and" "or")) - (control//contract (altRE "pre" "post")) - ;; Type - (type//syntax (altRE "|" "&" "->" "All" "Ex" "Rec" "primitive" "\\$" "type")) - (type//checking (altRE ":" ":coerce" ":let" ":~" ":assume" ":of" ":cast" ":share" ":by-example" ":hole")) - (type//abstract (altRE "abstract:" ":abstraction" ":representation" ":transmutation" "\\^:representation")) - (type//unit (altRE "unit:" "scale:")) - (type//poly (altRE "poly:" "derived:")) - (type//dynamic (altRE ":dynamic" ":check")) - (type//capability (altRE "capability:")) - ;; Data - (data//record (altRE "get@" "set@" "update@")) - (data//signature (altRE "signature:" "structure:" "open:" "structure" "::")) - (data//implicit (altRE "implicit:" "implicit" ":::")) - (data//collection (altRE "list" "list&" "row" "tree")) - ;; Code - (code//quotation (altRE "`" "`'" "'" "~" "~\\+" "~!" "~'")) - (code//super-quotation (altRE "``" "~~")) - (code//template (altRE "template" "template:")) - ;; Miscellaneous - (actor (altRE "actor:" "message:" "on:")) - (jvm-host (altRE "class:" "interface:" "import:" "object" "do-to" "synchronized" "class-for")) - (alternative-format (altRE "char" "bin" "oct" "hex")) - (documentation (altRE "doc" "comment")) - (function-application (altRE "|>" "|>>" "<|" "<<|" "_\\$" "\\$_")) - (remember (altRE "remember" "to-do" "fix-me"))) - (let ((control (altRE control//flow - control//pattern-matching - control//logic - control//contract)) - (type (altRE type//syntax - type//checking - type//abstract - type//unit - type//poly - type//dynamic - type//capability)) - (data (altRE data//record - data//signature - data//implicit - data//collection)) - (code (altRE code//quotation - code//super-quotation - code//template))) - (concat - "(" - (altRE - control - type - data - code - ;;;;;;;;;;;;;;;;;;;;;;;; - actor - jvm-host - alternative-format - documentation - function-application - remember - ;;;;;;;;;;;;;;;;;;;;;;;; - "\\.module:" - "def:" "type:" "program:" - "macro:" "syntax:" - "with-expansions" - "exception:" - "word:" - "function" "undefined" "name-of" "static" - "for" "io" - "infix" - "format" - "regex") - "\\>"))) - 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) - ;; Rev literals - (,revRE 0 font-lock-constant-face) - ;; Tags - (,tagRE 0 font-lock-type-face) - ))))) + (eval-when-compile + (let ((natural "[0-9][0-9,]*") + (identifier_h "[a-zA-Z-\\+_=!@\\$%\\^&\\*<>;,/\\\\\\|':~\\?]") + (identifier_t "[a-zA-Z0-9-\\+_=!@\\$%\\^&\\*<>;,/\\\\\\|':~\\?]") + (sign (altRE "-" "\\+"))) + (let ((identifier (concat identifier_h identifier_t "*")) + (integer (concat sign natural))) + (let ((bitRE (literal (special (altRE "0" "1")))) + (natRE (literal natural)) + (int&fracRE (literal (concat integer "\\(\\." natural "\\(\\(e\\|E\\)" integer "\\)?\\)?"))) + (revRE (literal (concat "\\." natural))) + (tagRE (let ((separator "\\.")) + (let ((in-prelude separator) + (in-current-module (concat separator separator)) + (in-module (concat identifier separator)) + (in-local "")) + (special (concat (altRE in-prelude + in-current-module + in-module in-local) + identifier))))) + (specialRE (let (;; Control + (control//flow (altRE "case" "exec" "let" "if" "cond" "loop" "recur" "do" "be")) + (control//pattern-matching (altRE "\\^" "\\^or" "\\^slots" + "\\^multi" "\\^@" "\\^template" + "\\^open" "\\^|>" "\\^code" + "\\^sequence&" "\\^regex")) + (control//logic (altRE "and" "or")) + (control//contract (altRE "pre" "post")) + ;; Type + (type//syntax (altRE "|" "&" "->" "All" "Ex" "Rec" "primitive" "\\$" "type")) + (type//checking (altRE ":" ":coerce" ":let" ":~" ":assume" ":of" ":cast" ":share" ":by-example" ":hole")) + (type//abstract (altRE "abstract:" ":abstraction" ":representation" ":transmutation" "\\^:representation")) + (type//unit (altRE "unit:" "scale:")) + (type//poly (altRE "poly:" "derived:")) + (type//dynamic (altRE ":dynamic" ":check")) + (type//capability (altRE "capability:")) + ;; Data + (data//record (altRE "get@" "set@" "update@")) + (data//signature (altRE "signature:" "structure:" "open:" "structure" "::")) + (data//implicit (altRE "implicit:" "implicit" ":::")) + (data//collection (altRE "list" "list&" "row" "tree")) + ;; Code + (code//quotation (altRE "`" "`'" "'" "~" "~\\+" "~!" "~'")) + (code//super-quotation (altRE "``" "~~")) + (code//template (altRE "template" "template:")) + ;; Miscellaneous + (actor (altRE "actor:" "message:" "on:")) + (jvm-host (altRE "class:" "interface:" "import:" "object" "do-to" "synchronized" "class-for")) + (alternative-format (altRE "char" "bin" "oct" "hex")) + (documentation (altRE "doc" "comment")) + (function-application (altRE "|>" "|>>" "<|" "<<|" "_\\$" "\\$_")) + (remember (altRE "remember" "to-do" "fix-me"))) + (let ((control (altRE control//flow + control//pattern-matching + control//logic + control//contract)) + (type (altRE type//syntax + type//checking + type//abstract + type//unit + type//poly + type//dynamic + type//capability)) + (data (altRE data//record + data//signature + data//implicit + data//collection)) + (code (altRE code//quotation + code//super-quotation + code//template))) + (concat + "(" + (altRE + control + type + data + code +;;;;;;;;;;;;;;;;;;;;;;;; + actor + jvm-host + alternative-format + documentation + function-application + remember +;;;;;;;;;;;;;;;;;;;;;;;; + "\\.module:" + "def:" "type:" "program:" + "macro:" "syntax:" + "with-expansions" + "exception:" + "word:" + "function" "undefined" "name-of" "static" + "for" "io" + "infix" + "format" + "regex") + "\\>"))))) + `(;; Special forms + (,specialRE 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) + ;; 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