Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
emacs
emacs
Commits
ef4440a9
Commit
ef4440a9
authored
Feb 27, 2020
by
Mattias Engdegård
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "Signal an error for the regexp "[:alnum:]""
This reverts commit
8d5e8cdd
.
parent
4859e8db
Pipeline
#4887
passed with stage
in 81 minutes and 51 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
1 addition
and
30 deletions
+1
-30
etc/NEWS
etc/NEWS
+0
-5
src/regex-emacs.c
src/regex-emacs.c
+1
-20
test/src/regex-emacs-tests.el
test/src/regex-emacs-tests.el
+0
-5
No files found.
etc/NEWS
View file @
ef4440a9
...
...
@@ -202,11 +202,6 @@ Emacs now supports bignums so this old glitch is no longer needed.
'previous-system-time-locale'
have been removed, as they were created
by mistake and were not useful to Lisp code.
** The regexp mistake '[:digit:]' is now an error.
The correct syntax is '[[:digit:]]'. Previously, forgetting the extra
brackets silently resulted in a regexp that did not at all work as
intended.
*
Lisp Changes in Emacs 28.1
...
...
src/regex-emacs.c
View file @
ef4440a9
...
...
@@ -818,8 +818,7 @@ typedef enum
REG_ESIZE
,
/* Compiled pattern bigger than 2^16 bytes. */
REG_ERPAREN
,
/* Unmatched ) or \); not returned from regcomp. */
REG_ERANGEX
,
/* Range striding over charsets. */
REG_ESIZEBR
,
/* n or m too big in \{n,m\} */
REG_ECLASSBR
,
/* Missing [] around [:class:]. */
REG_ESIZEBR
/* n or m too big in \{n,m\} */
}
reg_errcode_t
;
static
const
char
*
re_error_msgid
[]
=
...
...
@@ -843,7 +842,6 @@ static const char *re_error_msgid[] =
[
REG_ERPAREN
]
=
"Unmatched ) or
\\
)"
,
[
REG_ERANGEX
]
=
"Range striding over charsets"
,
[
REG_ESIZEBR
]
=
"Invalid content of
\\
{
\\
}"
,
[
REG_ECLASSBR
]
=
"Class syntax is [[:digit:]]; missing brackets"
,
};
/* For 'regs_allocated'. */
...
...
@@ -2002,23 +2000,6 @@ regex_compile (re_char *pattern, ptrdiff_t size,
laststart
=
b
;
/* Check for the mistake of forgetting the extra square brackets,
as in "[:alpha:]". */
if
(
*
p
==
':'
)
{
re_char
*
q
=
p
+
1
;
while
(
q
!=
pend
&&
*
q
!=
']'
)
{
if
(
*
q
==
':'
)
{
if
(
q
+
1
!=
pend
&&
q
[
1
]
==
']'
&&
q
>
p
+
1
)
FREE_STACK_RETURN
(
REG_ECLASSBR
);
break
;
}
q
++
;
}
}
/* Test '*p == '^' twice, instead of using an if
statement, so we need only one BUF_PUSH. */
BUF_PUSH
(
*
p
==
'^'
?
charset_not
:
charset
);
...
...
test/src/regex-emacs-tests.el
View file @
ef4440a9
...
...
@@ -803,9 +803,4 @@ This evaluates the TESTS test cases from glibc."
(
should-not
(
string-match
"å"
"\xe5"
))
(
should-not
(
string-match
"[å]"
"\xe5"
)))
(
ert-deftest
regexp-invalid
()
;; relint suppression: Duplicated
(
should-error
(
string-match
"[:space:]"
""
)
:type
'invalid-regexp
))
;;; regex-emacs-tests.el ends here
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment