branch: master
commit c0801b25d6ada38cc93e7a6d33d5de0d1ad5bc1a
Author: Dmitry Gutov <[email protected]>
Commit: Dmitry Gutov <[email protected]>

    Propertize regexp literals like js-mode does
    
    Closes #368.
---
 js2-mode.el |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/js2-mode.el b/js2-mode.el
index 31fe0d4..5f0f3c1 100644
--- a/js2-mode.el
+++ b/js2-mode.el
@@ -6403,6 +6403,8 @@ its relevant fields and puts it into `js2-ti-tokens'."
         flags
         (continue t)
         (token (js2-new-token 0)))
+    (js2-record-text-property (1- js2-ts-cursor) js2-ts-cursor
+                              'syntax-table (string-to-syntax "\"/"))
     (setq js2-ts-string-buffer nil)
     (if (eq start-tt js2-ASSIGN_DIV)
         ;; mis-scanned /=
@@ -6429,6 +6431,8 @@ its relevant fields and puts it into `js2-ti-tokens'."
             (setq in-class nil)))
           (js2-add-to-string c))))
     (unless err
+      (js2-record-text-property (1- js2-ts-cursor) js2-ts-cursor
+                                'syntax-table (string-to-syntax "\"/"))
       (while continue
         (cond
          ((js2-match-char ?g)
@@ -10430,8 +10434,7 @@ array-literals, array comprehensions and regular 
expressions."
                                   :len (- end px-pos)
                                   :value (js2-current-token-string)
                                   :flags flags)
-          (js2-set-face px-pos end 'font-lock-string-face 'record)
-          (js2-record-text-property px-pos end 'syntax-table '(2)))))
+          (js2-set-face px-pos end 'font-lock-string-face 'record))))
      ((or (= tt js2-NULL)
           (= tt js2-THIS)
           (= tt js2-SUPER)

Reply via email to