Skip to content

Commit ef4440a

Browse files
committed
Revert "Signal an error for the regexp "[:alnum:]""
This reverts commit 8d5e8cd.
1 parent 4859e8d commit ef4440a

File tree

3 files changed

+1
-30
lines changed

3 files changed

+1
-30
lines changed

etc/NEWS

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -202,11 +202,6 @@ Emacs now supports bignums so this old glitch is no longer needed.
202202
'previous-system-time-locale' have been removed, as they were created
203203
by mistake and were not useful to Lisp code.
204204

205-
** The regexp mistake '[:digit:]' is now an error.
206-
The correct syntax is '[[:digit:]]'. Previously, forgetting the extra
207-
brackets silently resulted in a regexp that did not at all work as
208-
intended.
209-
210205

211206
* Lisp Changes in Emacs 28.1
212207

src/regex-emacs.c

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -818,8 +818,7 @@ typedef enum
818818
REG_ESIZE, /* Compiled pattern bigger than 2^16 bytes. */
819819
REG_ERPAREN, /* Unmatched ) or \); not returned from regcomp. */
820820
REG_ERANGEX, /* Range striding over charsets. */
821-
REG_ESIZEBR, /* n or m too big in \{n,m\} */
822-
REG_ECLASSBR, /* Missing [] around [:class:]. */
821+
REG_ESIZEBR /* n or m too big in \{n,m\} */
823822
} reg_errcode_t;
824823

825824
static const char *re_error_msgid[] =
@@ -843,7 +842,6 @@ static const char *re_error_msgid[] =
843842
[REG_ERPAREN] = "Unmatched ) or \\)",
844843
[REG_ERANGEX ] = "Range striding over charsets",
845844
[REG_ESIZEBR ] = "Invalid content of \\{\\}",
846-
[REG_ECLASSBR] = "Class syntax is [[:digit:]]; missing brackets",
847845
};
848846

849847
/* For 'regs_allocated'. */
@@ -2002,23 +2000,6 @@ regex_compile (re_char *pattern, ptrdiff_t size,
20022000

20032001
laststart = b;
20042002

2005-
/* Check for the mistake of forgetting the extra square brackets,
2006-
as in "[:alpha:]". */
2007-
if (*p == ':')
2008-
{
2009-
re_char *q = p + 1;
2010-
while (q != pend && *q != ']')
2011-
{
2012-
if (*q == ':')
2013-
{
2014-
if (q + 1 != pend && q[1] == ']' && q > p + 1)
2015-
FREE_STACK_RETURN (REG_ECLASSBR);
2016-
break;
2017-
}
2018-
q++;
2019-
}
2020-
}
2021-
20222003
/* Test '*p == '^' twice, instead of using an if
20232004
statement, so we need only one BUF_PUSH. */
20242005
BUF_PUSH (*p == '^' ? charset_not : charset);

test/src/regex-emacs-tests.el

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -803,9 +803,4 @@ This evaluates the TESTS test cases from glibc."
803803
(should-not (string-match "å" "\xe5"))
804804
(should-not (string-match "[å]" "\xe5")))
805805

806-
(ert-deftest regexp-invalid ()
807-
;; relint suppression: Duplicated
808-
(should-error (string-match "[:space:]" "")
809-
:type 'invalid-regexp))
810-
811806
;;; regex-emacs-tests.el ends here

0 commit comments

Comments
 (0)