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).
;; 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