diff options
| author | Daniel Colascione | 2015-01-09 10:25:50 -0800 |
|---|---|---|
| committer | Daniel Colascione | 2015-01-09 10:25:50 -0800 |
| commit | 9c64c52b27bbef0f252c19fd978feb81d53a4093 (patch) | |
| tree | 61980799b5b2a50fc3cc867ec48ad5d5e921b1e8 | |
| parent | d1f848ffb9896fe2bd8eb9e7d70a49ca9ff9522f (diff) | |
| download | emacs-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()").
| -rw-r--r-- | lisp/ChangeLog | 6 | ||||
| -rw-r--r-- | lisp/progmodes/js.el | 5 |
2 files changed, 10 insertions, 1 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index bca8d28b1a5..c7ad41a800b 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2015-01-09 Daniel Colascione <dancol@dancol.org> | ||
| 2 | |||
| 3 | * progmodes/js.el (js--function-heading-1-re) | ||
| 4 | (js--function-prologue-beginning): Parse ES6 generator function | ||
| 5 | declarations. (That is, "function* name()"). | ||
| 6 | |||
| 1 | 2015-01-08 Stefan Monnier <monnier@iro.umontreal.ca> | 7 | 2015-01-08 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 8 | ||
| 3 | * emacs-lisp/eieio.el (defclass): Move from eieio-defclass all the code | 9 | * 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 | |||
| 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. |
| 253 | Match group 1 is the name of the function.") | 253 | Match 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))) |