emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/js2-mode 7c43ea5480 1/2: Add support for the d (hasIndi


From: ELPA Syncer
Subject: [elpa] externals/js2-mode 7c43ea5480 1/2: Add support for the d (hasIndices) and s (dotAll) regexp flags
Date: Sun, 26 Jun 2022 07:57:40 -0400 (EDT)

branch: externals/js2-mode
commit 7c43ea548065361eb52d8ee8f38a3e609e5aba6f
Author: Damien Cassou <damien@cassou.me>
Commit: Damien Cassou <damien@cassou.me>

    Add support for the d (hasIndices) and s (dotAll) regexp flags
---
 NEWS.md         | 2 ++
 js2-mode.el     | 4 ++++
 tests/parser.el | 6 ++++++
 3 files changed, 12 insertions(+)

diff --git a/NEWS.md b/NEWS.md
index 930c17fd17..65b34745d3 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -2,6 +2,8 @@
 
 ## Next
 
+* Support the d (hasIndices) and s (dotAll) regexp flags
+  ([#590](https://github.com/mooz/js2-mode/pull/590)).
 * Support for `_` separator in numbers (i.e., numeric separator)
   ([#584](https://github.com/mooz/js2-mode/pull/584)).
 
diff --git a/js2-mode.el b/js2-mode.el
index 9d81065882..a430e2c9ce 100644
--- a/js2-mode.el
+++ b/js2-mode.el
@@ -6481,12 +6481,16 @@ its relevant fields and puts it into `js2-ti-tokens'."
                                   'syntax-table (string-to-syntax "\"/")))
       (while continue
         (cond
+         ((js2-match-char ?d)
+          (push ?d flags))
          ((js2-match-char ?g)
           (push ?g flags))
          ((js2-match-char ?i)
           (push ?i flags))
          ((js2-match-char ?m)
           (push ?m flags))
+         ((js2-match-char ?s)
+          (push ?s flags))
          ((and (js2-match-char ?u)
                (>= js2-language-version 200))
           (push ?u flags))
diff --git a/tests/parser.el b/tests/parser.el
index 339f17731b..015eb02768 100644
--- a/tests/parser.el
+++ b/tests/parser.el
@@ -122,6 +122,12 @@ the test."
 (js2-deftest-parse comma-after-regexp
   "d = /eee/, 42;")
 
+(js2-deftest-parse regexp-with-s-flag
+  "d = /eee/s;")
+
+(js2-deftest-parse regexp-with-d-flag
+  "d = /eee/d;")
+
 (js2-deftest-parse return-statement
   "function foo() {\n  return 2;\n}")
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]