[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master aaabd19 14/27: Switch to rx macro
From: |
Dmitry Gutov |
Subject: |
[elpa] master aaabd19 14/27: Switch to rx macro |
Date: |
Sat, 29 Oct 2016 00:04:18 +0000 (UTC) |
branch: master
commit aaabd192e7284e81f5cd0066ba92699a879477c0
Author: Pavel Matcula <address@hidden>
Commit: Pavel Matcula <address@hidden>
Switch to rx macro
---
highlight-escape-sequences.el | 94 ++++++++++++++++-------------------------
1 file changed, 37 insertions(+), 57 deletions(-)
diff --git a/highlight-escape-sequences.el b/highlight-escape-sequences.el
index 599e6b1..52b53b0 100644
--- a/highlight-escape-sequences.el
+++ b/highlight-escape-sequences.el
@@ -53,78 +53,58 @@
"Face to highlight an escape sequence.")
(defconst hes-common-escape-sequence-re
- (concat "\\(\\\\\\("
- "[0-7]\\{1,3\\}"
- "\\|"
- "x[[:xdigit:]]\\{2\\}"
- "\\|"
- "u[[:xdigit:]]\\{4\\}"
- "\\|"
- "[\'\"\\bfnrtv]"
- "\\)\\)")
+ (rx (submatch
+ (and ?\\ (submatch
+ (or (repeat 1 3 (in "0-7"))
+ (and ?x (repeat 2 xdigit))
+ (and ?u (repeat 4 xdigit))
+ (any "\"\'\\bfnrtv"))))))
"Regexp to match the most common escape sequences.
Handles octals (\\0-\\777), hexadecimals (\\x00-\\xFF), unicodes
\(\\u0000-\\uFFFF), and backslash followed by one of `bfnrtv'.")
(defconst hes-c/c++-escape-sequence-re
- (concat "\\(\\\\\\("
- "[0-7]\\{1,3\\}"
- "\\|"
- "x[[:xdigit:]]+"
- "\\|"
- "u[[:xdigit:]]\\{4\\}"
- "\\|"
- "U[[:xdigit:]]\\{8\\}"
- "\\|"
- "[\'\"\?\\abfnrtv]"
- "\\)\\)")
+ (rx (submatch
+ (and ?\\ (submatch
+ (or (repeat 1 3 (in "0-7"))
+ (and ?x (1+ xdigit))
+ (and ?u (repeat 4 xdigit))
+ (and ?U (repeat 8 xdigit))
+ (any "\"\'\?\\abfnrtv"))))))
"Regexp to match C/C++ escape sequences.")
(defconst hes-java-escape-sequence-re
- (concat "\\(\\\\\\("
- "[0-7]\\{1,3\\}"
- "\\|"
- "u[[:xdigit:]]\\{4\\}"
- "\\|"
- "[\'\"\\bfnrt]"
- "\\)\\)")
+ (rx (submatch
+ (and ?\\ (submatch
+ (or (repeat 1 3 (in "0-7"))
+ (and ?u (repeat 4 xdigit))
+ (any "\"\'\\bfnrt"))))))
"Regexp to match Java escape sequences.")
(defconst hes-js-escape-sequence-re
- (concat "\\(\\\\\\("
- "[0-7]\\{1,3\\}"
- "\\|"
- "x[[:xdigit:]]\\{2\\}"
- "\\|"
- "u[[:xdigit:]]\\{4\\}"
- "\\|"
- ;; "[\'\"\\bfnrtv]"
- ;; "\\|"
- "." ;; deprecated
- "\\)\\)")
+ (rx (submatch
+ (and ?\\ (submatch
+ (or (repeat 1 3 (in "0-7"))
+ (and ?x (repeat 2 xdigit))
+ (and ?u (repeat 4 xdigit))
+ ;; (any "\"\'\\bfnrtv")
+ any))))) ;; deprecated
"Regexp to match JavaScript escape sequences.")
(defconst hes-ruby-escape-sequence-re
- (concat "\\(\\\\\\("
- "[0-7]\\{1,3\\}"
- "\\|"
- "x[[:xdigit:]]\\{1,2\\}"
- "\\|"
- "u\\(?:"
- (concat "[[:xdigit:]]\\{4\\}"
- "\\|"
- "{"
- (concat "[[:xdigit:]]\\{1,6\\}"
- "\\(?:"
- "[[:space:]]+"
- "[[:xdigit:]]\\{1,6\\}"
- "\\)*")
- "}")
- "\\)"
- "\\|"
- "."
- "\\)\\)")
+ (rx (submatch
+ (and ?\\ (submatch
+ (or (repeat 1 3 (in "0-7"))
+ (and ?x (repeat 1 2 xdigit))
+ (and ?u
+ (or (repeat 4 xdigit)
+ (and ?{
+ (repeat 1 6 xdigit)
+ (0+ (1+ space)
+ (repeat 1 6 xdigit))
+ ?})))
+ any)))))
"Regexp to match Ruby escape sequences.
Currently doesn't handle \\C-, \\M- etc.")
- [elpa] master 1e79174 11/27: Fix extra indent, (continued)
- [elpa] master 1e79174 11/27: Fix extra indent, Dmitry Gutov, 2016/10/28
- [elpa] master fa6dd96 24/27: Delete the obsolete alias, Dmitry Gutov, 2016/10/28
- [elpa] master ffb8c5d 21/27: Merge pull request #3 from plexus/add-elisp-clojure, Dmitry Gutov, 2016/10/28
- [elpa] master 0e74c8c 27/27: Add hes to externals-list, Dmitry Gutov, 2016/10/28
- [elpa] master fc206ba 17/27: Untabify indents, Dmitry Gutov, 2016/10/28
- [elpa] master c3f28f2 25/27: Shorten some lines, Dmitry Gutov, 2016/10/28
- [elpa] master 9b2c607 26/27: Add 'packages/highlight-escape-sequences/' from commit 'c3f28f2003638e88e5cf0b03835412af7814f3b0', Dmitry Gutov, 2016/10/28
- [elpa] master 738f1e3 09/27: Add distinct regexps, Dmitry Gutov, 2016/10/28
- [elpa] master 460e92b 15/27: Add comments with the cases handled, Dmitry Gutov, 2016/10/28
- [elpa] master e86a466 23/27: Improve commentary, Dmitry Gutov, 2016/10/28
- [elpa] master aaabd19 14/27: Switch to rx macro,
Dmitry Gutov <=