[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/xr 8d052d6 09/13: Check for errors in \_
From: |
Mattias Engdegård |
Subject: |
[elpa] externals/xr 8d052d6 09/13: Check for errors in \_ |
Date: |
Wed, 13 Feb 2019 04:03:28 -0500 (EST) |
branch: externals/xr
commit 8d052d617f1e604143856b3b2b6657cac707d4c6
Author: Mattias Engdegård <address@hidden>
Commit: Mattias Engdegård <address@hidden>
Check for errors in \_
---
xr-test.el | 1 +
xr.el | 14 +++++++++++---
2 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/xr-test.el b/xr-test.el
index bd04bcb..7929e2a 100644
--- a/xr-test.el
+++ b/xr-test.el
@@ -75,6 +75,7 @@
'(seq bol nonl wordchar not-wordchar bos eos point
word-boundary not-word-boundary bow eow
symbol-start symbol-end eol)))
+ (should-error (xr "\\_a"))
)
(ert-deftest xr-syntax ()
diff --git a/xr.el b/xr.el
index 3133906..d7d28e3 100644
--- a/xr.el
+++ b/xr.el
@@ -356,7 +356,7 @@
;; various simple substitutions
((looking-at (rx (or "." "\\w" "\\W" "\\`" "\\'" "\\="
- "\\b" "\\B" "\\<" "\\>" "\\_<" "\\_>")))
+ "\\b" "\\B" "\\<" "\\>")))
(goto-char (match-end 0))
(let ((sym (cdr (assoc
(match-string 0)
@@ -365,10 +365,18 @@
("\\`" . bos) ("\\'" . eos)
("\\=" . point)
("\\b" . word-boundary) ("\\B" . not-word-boundary)
- ("\\<" . bow) ("\\>" . eow)
- ("\\_<" . symbol-start) ("\\_>" . symbol-end))))))
+ ("\\<" . bow) ("\\>" . eow))))))
(push sym sequence)))
+ ;; symbol-start, symbol-end
+ ((looking-at (rx "\\_" (opt (group (any "<>")))))
+ (let ((arg (match-string 1)))
+ (unless arg
+ (error "Invalid \\_ sequence"))
+ (forward-char 3)
+ (push (if (string-equal arg "<") 'symbol-start 'symbol-end)
+ sequence)))
+
;; character syntax
((looking-at (rx "\\" (group (any "sS")) (group anything)))
(let ((negated (string-equal (match-string 1) "S"))
- [elpa] externals/xr updated (7ba1fc6 -> e1c7734), Mattias Engdegård, 2019/02/13
- [elpa] externals/xr 4e2bd17 04/13: Export xr-pp-rx-to-str and fix a typo, Mattias Engdegård, 2019/02/13
- [elpa] externals/xr c2ede95 08/13: Improved errors for bad \s and \c sequences, Mattias Engdegård, 2019/02/13
- [elpa] externals/xr 8425772 01/13: Sync with ELPA: compilation workaround, Mattias Engdegård, 2019/02/13
- [elpa] externals/xr f79d50c 12/13: Add categories L, R, . and SPC, Mattias Engdegård, 2019/02/13
- [elpa] externals/xr 2a1de75 03/13: Correct parsing of group and backref, Mattias Engdegård, 2019/02/13
- [elpa] externals/xr 8d052d6 09/13: Check for errors in \_,
Mattias Engdegård <=
- [elpa] externals/xr 37b2bcb 06/13: Merge branch 'master' of https://github.com/mattiase/xr, Mattias Engdegård, 2019/02/13
- [elpa] externals/xr 41474cb 11/13: Accept unknown character categories, Mattias Engdegård, 2019/02/13
- [elpa] externals/xr e1c7734 13/13: Merge branch 'externals/xr' of elpa.git (no actual change), Mattias Engdegård, 2019/02/13
- [elpa] externals/xr e8ec2d9 07/13: Add reference to the pcre2el package, Mattias Engdegård, 2019/02/13
- [elpa] externals/xr 4bf6043 05/13: Export xr-pp-rx-to-str and fix a typo, Mattias Engdegård, 2019/02/13
- [elpa] externals/xr 8532df8 02/13: Move tests to separate file, Mattias Engdegård, 2019/02/13
- [elpa] externals/xr 0331e00 10/13: Recognise \sW as alias for \sw, Mattias Engdegård, 2019/02/13