aboutsummaryrefslogtreecommitdiff
path: root/lux-mode
diff options
context:
space:
mode:
Diffstat (limited to 'lux-mode')
-rw-r--r--lux-mode/lux-mode.el127
1 files changed, 69 insertions, 58 deletions
diff --git a/lux-mode/lux-mode.el b/lux-mode/lux-mode.el
index 50313365f..4a7c05268 100644
--- a/lux-mode/lux-mode.el
+++ b/lux-mode/lux-mode.el
@@ -209,64 +209,75 @@ Called by `imenu--generic-function'."
(goto-char start)))))
(defconst lux-font-lock-keywords
- (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
- '("true" "false") t)
- "\\>")
- 0 font-lock-constant-face)
- ; Nat literals
- ("\\<\\+\\(0\\|[0-9][0-9_]*\\)\\>" 0 font-lock-constant-face)
- ; Int|Frac literals
- ("\\<-?\\(0\\|[0-9][0-9_]*\\)\\(\\.[0-9_]+\\)?\\>" 0 font-lock-constant-face)
- ("\\<-?\\(0\\|[--9][0-9_]*\\)\\(\\.[0-9_]+\\(\\(e\\|E\\)\\(-\\|\\+\\)?[0-9][0-9_]*\\)?\\)?\\>" 0 font-lock-constant-face)
- ; Frac "ratio" literals
- ("\\<-?[0-9][0-9_]*/[0-9][0-9_]*\\>" 0 font-lock-constant-face)
- ; Rev literals
- ("\\<\\.[0-9][0-9_]*\\>" 0 font-lock-constant-face)
- ; Tags
- ("#\\.[a-zA-Z0-9-\\+_=!@\\$%\\^&\\*<>\.,/\\\\\\|':~\\?]+" 0 font-lock-type-face)
- ("#\\.\\.[a-zA-Z0-9-\\+_=!@\\$%\\^&\\*<>\.,/\\\\\\|':~\\?]+" 0 font-lock-type-face)
- ("#[a-zA-Z0-9-\\+_=!@\\$%\\^&\\*<>;,/\\\\\\|':~\\?]+\\(\\.[a-zA-Z0-9-\\+_=!@\\$%\\^&\\*<>;,/\\\\\\|':~\\?]+\\)?" 0 font-lock-type-face)
- ))
+ (let ((digits "[0-9][0-9_]*")
+ (digits+ "[0-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)
+ ))))
"Default expressions to highlight in Lux mode.")
(defun lux-font-lock-syntactic-face-function (state)