mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
misc/emacs: Add support for methods with unnamed receiver
This fixes fontification, navigation and indentation for methods of the form `func (Foo) Bar...` R=adonovan CC=gobot, golang-dev https://golang.org/cl/8951043
This commit is contained in:
parent
c691ae6764
commit
72b14cbb75
1 changed files with 7 additions and 1 deletions
|
|
@ -77,7 +77,12 @@
|
||||||
(defconst go-label-regexp go-identifier-regexp)
|
(defconst go-label-regexp go-identifier-regexp)
|
||||||
(defconst go-type-regexp "[[:word:][:multibyte:]*]+")
|
(defconst go-type-regexp "[[:word:][:multibyte:]*]+")
|
||||||
(defconst go-func-regexp (concat (go--regexp-enclose-in-symbol "func") "\\s *\\(" go-identifier-regexp "\\)"))
|
(defconst go-func-regexp (concat (go--regexp-enclose-in-symbol "func") "\\s *\\(" go-identifier-regexp "\\)"))
|
||||||
(defconst go-func-meth-regexp (concat (go--regexp-enclose-in-symbol "func") "\\s *\\(?:(\\s *" go-identifier-regexp "\\s +" go-type-regexp "\\s *)\\s *\\)?\\(" go-identifier-regexp "\\)("))
|
(defconst go-func-meth-regexp (concat
|
||||||
|
(go--regexp-enclose-in-symbol "func") "\\s *\\(?:(\\s *"
|
||||||
|
"\\(" go-identifier-regexp "\\s +\\)?" go-type-regexp
|
||||||
|
"\\s *)\\s *\\)?\\("
|
||||||
|
go-identifier-regexp
|
||||||
|
"\\)("))
|
||||||
(defconst go-builtins
|
(defconst go-builtins
|
||||||
'("append" "cap" "close" "complex" "copy"
|
'("append" "cap" "close" "complex" "copy"
|
||||||
"delete" "imag" "len" "make" "new"
|
"delete" "imag" "len" "make" "new"
|
||||||
|
|
@ -159,6 +164,7 @@
|
||||||
;; TODO do we actually need this one or isn't it just a function call?
|
;; TODO do we actually need this one or isn't it just a function call?
|
||||||
(,(concat "\\.\\s *(" go-type-name-regexp) 1 font-lock-type-face) ;; Type conversion
|
(,(concat "\\.\\s *(" go-type-name-regexp) 1 font-lock-type-face) ;; Type conversion
|
||||||
(,(concat (go--regexp-enclose-in-symbol "func") "[[:space:]]+(" go-identifier-regexp "[[:space:]]+" go-type-name-regexp ")") 1 font-lock-type-face) ;; Method receiver
|
(,(concat (go--regexp-enclose-in-symbol "func") "[[:space:]]+(" go-identifier-regexp "[[:space:]]+" go-type-name-regexp ")") 1 font-lock-type-face) ;; Method receiver
|
||||||
|
(,(concat (go--regexp-enclose-in-symbol "func") "[[:space:]]+(" go-type-name-regexp ")") 1 font-lock-type-face) ;; Method receiver without variable name
|
||||||
;; Like the original go-mode this also marks compound literal
|
;; Like the original go-mode this also marks compound literal
|
||||||
;; fields. There, it was marked as to fix, but I grew quite
|
;; fields. There, it was marked as to fix, but I grew quite
|
||||||
;; accustomed to it, so it'll stay for now.
|
;; accustomed to it, so it'll stay for now.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue