Skip to content

Operator highlight extended and improved #50

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 7 additions & 10 deletions purescript-font-lock.el
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@
;; This is probably just wrong, but it used to use
;; `font-lock-function-name-face' with a result that was not consistent with
;; other major modes, so I just exchanged with `purescript-definition-face'.
(defvar purescript-operator-face 'font-lock-variable-name-face)
(defvar purescript-operator-face 'font-lock-builtin-face)
(defvar purescript-default-face nil)
(defvar purescript-literate-comment-face 'font-lock-doc-face
"Face with which to fontify literate comments.
Expand Down Expand Up @@ -165,12 +165,10 @@ Returns keywords suitable for `font-lock-keywords'."
;; be thrown for some reason by backslash's escape syntax.
"\\(\\s_\\|\\\\\\)+")

;; Reserved operations
(reservedsym
(operator
(concat "\\S_"
;; (regexp-opt '(".." "::" "=" "\\" "|" "<-" "->"
;; "@" "~" "=>") t)
"\\(->\\|\\.\\.\\|::\\|∷\\|<-\\|=>\\|[=@\\|~]\\)"
;; All punctuation, excluding (),;[]{}_"'`
"\\([!@#$%^&*+\\-./<=>?@|~:∷\\\\]+\\)"
"\\S_"))
;; These are only keywords when appear at top-level, optionally with
;; indentation. They are not reserved and in other levels would represent
Expand Down Expand Up @@ -210,7 +208,7 @@ Returns keywords suitable for `font-lock-keywords'."
;;
(,toplevel-keywords 1 (symbol-value 'purescript-keyword-face))
(,reservedid 1 (symbol-value 'purescript-keyword-face))
(,reservedsym 1 (symbol-value 'purescript-operator-face))
(,operator 1 (symbol-value 'purescript-operator-face))
;; Special case for `as', `hiding', `safe' and `qualified', which are
;; keywords in import statements but are not otherwise reserved.
("\\<import[ \t]+\\(?:\\(safe\\>\\)[ \t]*\\)?\\(?:\\(qualified\\>\\)[ \t]*\\)?[^ \t\n()]+[ \t]*\\(?:\\(\\<as\\>\\)[ \t]*[^ \t\n()]+[ \t]*\\)?\\(\\<hiding\\>\\)?"
Expand All @@ -232,13 +230,12 @@ Returns keywords suitable for `font-lock-keywords'."
(,topdecl-sym (2 (symbol-value 'purescript-definition-face)))
(,topdecl-sym2 (1 (symbol-value 'purescript-definition-face)))

;; These four are debatable...
("(\\(,*\\|->\\))" 0 (symbol-value 'purescript-constructor-face))
;; This one is debatable…
("\\[\\]" 0 (symbol-value 'purescript-constructor-face))
;; Expensive.
(,qvarid 0 (symbol-value 'purescript-default-face))
(,qconid 0 (symbol-value 'purescript-constructor-face))
(,(concat "\`" varid "\`") 0 (symbol-value 'purescript-operator-face))
(,(concat "`" varid "`") 0 (symbol-value 'purescript-operator-face))
;; Expensive.
(,conid 0 (symbol-value 'purescript-constructor-face))

Expand Down
Loading