el/dot-emacs.el: Fontify strings and characters for Go.
authorMark Wooding <mdw@distorted.org.uk>
Sat, 6 Apr 2013 17:20:20 +0000 (18:20 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Sat, 6 Apr 2013 17:21:03 +0000 (18:21 +0100)
Some versions of the mode don't do this themselves.  Our fontification
is more precise anyway.

el/dot-emacs.el

index b24e50c..a5b7300 100644 (file)
@@ -1674,6 +1674,24 @@ doesn't match any of the regular expressions in
           (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.
           ;;
           ;; The following isn't quite right, but it's close enough.