"default" "defer" "else" "fallthrough" "for"
"func" "go" "goto" "if" "import"
"interface" "map" "package" "range" "return"
- "select" "struct" "switch" "type" "var")))
+ "select" "struct" "switch" "type" "var"))
+ (go-intrinsics
+ (mdw-regexps "bool" "byte" "complex64" "complex128" "error"
+ "float32" "float64" "int" "uint8" "int16" "int32"
+ "int64" "rune" "string" "uint" "uint8" "uint16"
+ "uint32" "uint64" "uintptr" "void"
+ "false" "iota" "nil" "true"
+ "init" "main"
+ "append" "cap" "copy" "delete" "imag" "len" "make"
+ "new" "panic" "real" "recover")))
(setq font-lock-keywords
(list
;; Handle the keywords defined above.
(list (concat "\\<\\(" go-keywords "\\)\\>")
'(0 font-lock-keyword-face))
+ (list (concat "\\<\\(" go-intrinsics "\\)\\>")
+ '(0 font-lock-variable-name-face))
+
+ ;; Strings and characters.
+ (list (concat "'"
+ "\\(" "[^\\']" "\\|"
+ "\\\\"
+ "\\(" "[abfnrtv\\'\"]" "\\|"
+ "[0-7]\\{3\\}" "\\|"
+ "x" "[0-9A-Fa-f]\\{2\\}" "\\|"
+ "u" "[0-9A-Fa-f]\\{4\\}" "\\|"
+ "U" "[0-9A-Fa-f]\\{8\\}" "\\)" "\\)"
+ "'"
+ "\\|"
+ "\""
+ "\\(" "[^\n\\\"]+" "\\|" "\\\\." "\\)*"
+ "\\(\"\\|$\\)"
+ "\\|"
+ "`" "[^`]+" "`")
+ '(0 font-lock-string-face))
;; Handle numbers too.
;;
"t" "f")))
(setq font-lock-keywords
(list (list (concat "\\<\\(" dylan-keywords
- "\\|" (concat "with\\(out\\)?-" word)
- "\\|" (concat word ":")
+ "\\|" "with\\(out\\)?-" word
"\\)\\>")
'(0 font-lock-keyword-face))
- (list (concat "#\\(" sharp-keywords "\\)\\>")
+ (list (concat "\\<" word ":" "\\|"
+ "#\\(" sharp-keywords "\\)\\>")
'(0 font-lock-variable-name-face))
(list (concat "\\("
"\\([-+]\\|\\<\\)[0-9]+" "\\("
(defun mdw-fontify-haskell ()
;; Fiddle with syntax table to get comments right.
- (modify-syntax-entry ?' "\"")
- (modify-syntax-entry ?- ". 123")
- (modify-syntax-entry ?{ ". 1b")
- (modify-syntax-entry ?} ". 4b")
+ (modify-syntax-entry ?' "_")
+ (modify-syntax-entry ?- ". 12")
(modify-syntax-entry ?\n ">")
+ ;; Make punctuation be punctuation
+ (let ((punct "=<>+-*/|&%!@?$.^:#`"))
+ (do ((i 0 (1+ i)))
+ ((>= i (length punct)))
+ (modify-syntax-entry (aref punct i) ".")))
+
;; Set fill prefix.
(mdw-standard-fill-prefix "\\([ \t]*{?--?[ \t]*\\)")
;; Fiddle with fontification.
(make-local-variable 'font-lock-keywords)
(let ((haskell-keywords
- (mdw-regexps "as" "case" "ccall" "class" "data" "default"
- "deriving" "do" "else" "foreign" "hiding" "if"
- "import" "in" "infix" "infixl" "infixr" "instance"
- "let" "module" "newtype" "of" "qualified" "safe"
- "stdcall" "then" "type" "unsafe" "where")))
+ (mdw-regexps "as"
+ "case" "ccall" "class"
+ "data" "default" "deriving" "do"
+ "else" "exists"
+ "forall" "foreign"
+ "hiding"
+ "if" "import" "in" "infix" "infixl" "infixr" "instance"
+ "let"
+ "mdo" "module"
+ "newtype"
+ "of"
+ "proc"
+ "qualified"
+ "rec"
+ "safe" "stdcall"
+ "then" "type"
+ "unsafe"
+ "where"))
+ (control-sequences
+ (mdw-regexps "ACK" "BEL" "BS" "CAN" "CR" "DC1" "DC2" "DC3" "DC4"
+ "DEL" "DLE" "EM" "ENQ" "EOT" "ESC" "ETB" "ETX" "FF"
+ "FS" "GS" "HT" "LF" "NAK" "NUL" "RS" "SI" "SO" "SOH"
+ "SP" "STX" "SUB" "SYN" "US" "VT")))
(setq font-lock-keywords
(list
- (list "--.*$"
+ (list (concat "{-" "[^-]*" "\\(-+[^-}][^-]*\\)*"
+ "\\(-+}\\|-*\\'\\)"
+ "\\|"
+ "--.*$")
'(0 font-lock-comment-face))
- (list (concat "\\<\\(" haskell-keywords "\\)\\>")
+ (list (concat "\\_<\\(" haskell-keywords "\\)\\_>")
'(0 font-lock-keyword-face))
- (list (concat "\\<0\\([xX][0-9a-fA-F]+\\|[0-7]+\\)\\|"
- "\\<[0-9][0-9_]*\\(\\.[0-9]*\\|\\)"
+ (list (concat "'\\("
+ "[^\\]"
+ "\\|"
+ "\\\\"
+ "\\(" "[abfnrtv\\\"']" "\\|"
+ "^" "\\(" control-sequences "\\|"
+ "[]A-Z@[\\^_]" "\\)" "\\|"
+ "\\|"
+ "[0-9]+" "\\|"
+ "[oO][0-7]+" "\\|"
+ "[xX][0-9A-Fa-f]+"
+ "\\)"
+ "\\)'")
+ '(0 font-lock-string-face))
+ (list "\\_<[A-Z]\\(\\sw+\\|\\s_+\\)*\\_>"
+ '(0 font-lock-variable-name-face))
+ (list (concat "\\_<0\\([xX][0-9a-fA-F]+\\|[oO][0-7]+\\)\\|"
+ "\\_<[0-9]+\\(\\.[0-9]*\\|\\)"
"\\([eE]\\([-+]\\|\\)[0-9]+\\|\\)")
'(0 mdw-number-face))
(list "\\(\\s.\\|\\s(\\|\\s)\\|\\s\\\\|\\s/\\)"
;; Not much fontification needed.
(make-local-variable 'font-lock-keywords)
(setq font-lock-keywords
- (list
- (list "\\(\\s.\\|\\s(\\|\\s)\\|\\s\\\\|\\s/\\)"
- '(0 mdw-punct-face))))
+ (list (list (concat "\\("
+ "\\_<[-+]?"
+ "\\(" "[0-9]+/[0-9]+"
+ "\\|" "\\(" "[0-9]+" "\\(\\.[0-9]*\\)?" "\\|"
+ "\\.[0-9]+" "\\)"
+ "\\([dDeEfFlLsS][-+]?[0-9]+\\)?"
+ "\\)"
+ "\\|"
+ "#"
+ "\\(" "x" "[-+]?"
+ "[0-9A-Fa-f]+" "\\(/[0-9A-Fa-f]+\\)?"
+ "\\|" "o" "[-+]?" "[0-7]+" "\\(/[0-7]+\\)?"
+ "\\|" "b" "[-+]?" "[01]+" "\\(/[01]+\\)?"
+ "\\|" "[0-9]+" "r" "[-+]?"
+ "[0-9a-zA-Z]+" "\\(/[0-9a-zA-Z]+\\)?"
+ "\\)"
+ "\\)\\_>")
+ '(0 mdw-number-face))
+ (list "\\(\\s.\\|\\s(\\|\\s)\\|\\s\\\\|\\s/\\)"
+ '(0 mdw-punct-face))))
(mdw-post-config-mode-hack))