Commit 4640dd88 authored by Stefan Monnier's avatar Stefan Monnier
Browse files

* lisp/progmodes/js.el (js--regexp-literal): Accept regexps at the beginning

of statements and in a few more cases.

Fixes: debbugs:9183
parent 673e08bb
2011-08-05 Stefan Monnier <monnier@iro.umontreal.ca>
* progmodes/js.el (js--regexp-literal): Accept regexps at the beginning
of statements and in a few more cases (bug#9183).
* emacs-lisp/cl-macs.el (cl--make-usage-var, cl--make-usage-args):
New functions.
(cl-transform-lambda): Use them (bug#9239).
......
......@@ -1658,15 +1658,19 @@ This performs fontification according to `js--class-styles'."
;; below.
(eval-and-compile
(defconst js--regexp-literal
"[=(,:]\\(?:\\s-\\|\n\\)*\\(/\\)\\(?:\\\\.\\|[^/*\\]\\)\\(?:\\\\.\\|[^/\\]\\)*\\(/\\)"
(concat
;; We want to match regular expressions only at the beginning of
;; expressions.
;; FIXME: Should we also allow /regexp/ after infix operators such as +,
;; /, -, *, >, ...?
"\\(?:\\`\\|[=([{,:;]\\)\\(?:\\s-\\|\n\\)*"
"\\(/\\)\\(?:\\\\.\\|[^/*\\]\\)\\(?:\\\\.\\|[^/\\]\\)*\\(/\\)")
"Regexp matching a JavaScript regular expression literal.
Match groups 1 and 2 are the characters forming the beginning and
end of the literal."))
(defconst js-syntax-propertize-function
(syntax-propertize-rules
;; We want to match regular expressions only at the beginning of
;; expressions.
(js--regexp-literal (1 "\"") (2 "\""))))
;;; Indentation
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment