From: Daniel Colascione Date: Fri, 9 Jan 2015 18:25:50 +0000 (-0800) Subject: Teach js-mode about ES6 generators X-Git-Tag: emacs-25.0.90~2605^2~16 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=9c64c52b27bbef0f252c19fd978feb81d53a4093;p=emacs.git 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()"). --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index bca8d28b1a5..c7ad41a800b 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2015-01-09 Daniel Colascione + + * progmodes/js.el (js--function-heading-1-re) + (js--function-prologue-beginning): Parse ES6 generator function + declarations. (That is, "function* name()"). + 2015-01-08 Stefan Monnier * emacs-lisp/eieio.el (defclass): Move from eieio-defclass all the code 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 (defconst js--function-heading-1-re (concat - "^\\s-*function\\s-+\\(" js--name-re "\\)") + "^\\s-*function\\(?:\\s-\\|\\*\\)+\\(" js--name-re "\\)") "Regexp matching the start of a JavaScript function header. Match group 1 is the name of the function.") @@ -796,6 +796,9 @@ determined. Otherwise, return nil." (let ((name t)) (forward-word) (forward-comment most-positive-fixnum) + (when (eq (char-after) ?*) + (forward-char) + (forward-comment most-positive-fixnum)) (when (looking-at js--name-re) (setq name (match-string-no-properties 0)) (goto-char (match-end 0)))