aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/progmodes
diff options
context:
space:
mode:
authorDaniel Colascione2015-01-09 10:25:50 -0800
committerDaniel Colascione2015-01-09 10:25:50 -0800
commit9c64c52b27bbef0f252c19fd978feb81d53a4093 (patch)
tree61980799b5b2a50fc3cc867ec48ad5d5e921b1e8 /lisp/progmodes
parentd1f848ffb9896fe2bd8eb9e7d70a49ca9ff9522f (diff)
downloademacs-9c64c52b27bbef0f252c19fd978feb81d53a4093.tar.gz
emacs-9c64c52b27bbef0f252c19fd978feb81d53a4093.zip
Teach js-mode about ES6 generators
* lisp/progmodes/js.el (js--function-heading-1-re) (js--function-prologue-beginning): Parse ES6 generator function declarations. (That is, "function* name()").
Diffstat (limited to 'lisp/progmodes')
-rw-r--r--lisp/progmodes/js.el5
1 files changed, 4 insertions, 1 deletions
diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el
index de6a33988a4..c25e52cdc6a 100644
--- a/lisp/progmodes/js.el
+++ b/lisp/progmodes/js.el
@@ -248,7 +248,7 @@ name as matched contains
248 248
249(defconst js--function-heading-1-re 249(defconst js--function-heading-1-re
250 (concat 250 (concat
251 "^\\s-*function\\s-+\\(" js--name-re "\\)") 251 "^\\s-*function\\(?:\\s-\\|\\*\\)+\\(" js--name-re "\\)")
252 "Regexp matching the start of a JavaScript function header. 252 "Regexp matching the start of a JavaScript function header.
253Match group 1 is the name of the function.") 253Match group 1 is the name of the function.")
254 254
@@ -796,6 +796,9 @@ determined. Otherwise, return nil."
796 (let ((name t)) 796 (let ((name t))
797 (forward-word) 797 (forward-word)
798 (forward-comment most-positive-fixnum) 798 (forward-comment most-positive-fixnum)
799 (when (eq (char-after) ?*)
800 (forward-char)
801 (forward-comment most-positive-fixnum))
799 (when (looking-at js--name-re) 802 (when (looking-at js--name-re)
800 (setq name (match-string-no-properties 0)) 803 (setq name (match-string-no-properties 0))
801 (goto-char (match-end 0))) 804 (goto-char (match-end 0)))