aboutsummaryrefslogtreecommitdiff
path: root/lux-mode
diff options
context:
space:
mode:
authorEduardo Julian2018-07-18 23:44:51 -0400
committerEduardo Julian2018-07-18 23:44:51 -0400
commit15ba10ff986fa4fa5df8432ab47a8103b0200d30 (patch)
tree589869b8fd4c2c7925c5468f05b4bd3902fb0a45 /lux-mode
parent8b4f0ded7bddaa42cf432f74523bfd6aa1e76fed (diff)
Improvements to lux-mode.
Diffstat (limited to 'lux-mode')
-rw-r--r--lux-mode/lux-mode.el131
1 files changed, 65 insertions, 66 deletions
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)