Ar an dara lá is fiche de mí Aibréan, scríobh Ilya Shlyakhter:
The following expression:
(progn (posix-string-match "i\\|ii" "ii")(match-data))
returns (0 1). Should it return (0 2) instead?
thanks,
It should; this is original sin on the part of XEmacs, as far as I can tell
from
https://bitbucket.org/xemacs/xemacs/src/376386a54a3c/src/search.c#cl-376 ,
the first version imported. Thanks!
APPROVE COMMIT
NOTE: This patch has been committed.
# HG changeset patch
# User Aidan Kehoe <kehoea(a)parhasard.net>
# Date 1335381933 -3600
# Node ID d026b665014fda7a8d6148e8cc8fb9d046bff7f7
# Parent 3f4a234f4672ab40f61811656bc674bcd80664db
Actually obey POSIX rules in #'posix-string-match, don't ignore them.
src/ChangeLog addition:
2012-04-25 Aidan Kehoe <kehoea(a)parhasard.net>
* search.c (string_match_1): Actually use the POSIX argument here,
pass it to compile_pattern(). Thank you for the bug report, Ilya
Shlyakhter!
tests/ChangeLog addition:
2012-04-25 Aidan Kehoe <kehoea(a)parhasard.net>
* automated/regexp-tests.el: Check that #'posix-string-match
actually returns the longest match; thank you Ilya Shlyakhter in
jn1j8t$ujq$1(a)dough.gmane.org !
diff -r 3f4a234f4672 -r d026b665014f src/ChangeLog
--- a/src/ChangeLog Sat Apr 21 18:58:28 2012 +0100
+++ b/src/ChangeLog Wed Apr 25 20:25:33 2012 +0100
@@ -1,3 +1,9 @@
+2012-04-25 Aidan Kehoe <kehoea(a)parhasard.net>
+
+ * search.c (string_match_1): Actually use the POSIX argument here,
+ pass it to compile_pattern(). Thank you for the bug report, Ilya
+ Shlyakhter!
+
2012-04-21 Aidan Kehoe <kehoea(a)parhasard.net>
Support non-ASCII correctly in character classes ([:alnum:] and
diff -r 3f4a234f4672 -r d026b665014f src/search.c
--- a/src/search.c Sat Apr 21 18:58:28 2012 +0100
+++ b/src/search.c Wed Apr 25 20:25:33 2012 +0100
@@ -419,7 +419,7 @@
static Lisp_Object
string_match_1 (Lisp_Object regexp, Lisp_Object string, Lisp_Object start,
- struct buffer *buf, int UNUSED (posix))
+ struct buffer *buf, int posix)
{
Bytecount val;
Charcount s;
@@ -450,7 +450,7 @@
bufp = compile_pattern (regexp, &search_regs,
(!NILP (buf->case_fold_search)
? XCASE_TABLE_DOWNCASE (buf->case_table) : Qnil),
- string, buf, 0, ERROR_ME);
+ string, buf, posix, ERROR_ME);
QUIT;
{
Bytecount bis = string_index_char_to_byte (string, s);
diff -r 3f4a234f4672 -r d026b665014f tests/ChangeLog
--- a/tests/ChangeLog Sat Apr 21 18:58:28 2012 +0100
+++ b/tests/ChangeLog Wed Apr 25 20:25:33 2012 +0100
@@ -1,3 +1,9 @@
+2012-04-25 Aidan Kehoe <kehoea(a)parhasard.net>
+
+ * automated/regexp-tests.el: Check that #'posix-string-match
+ actually returns the longest match; thank you Ilya Shlyakhter in
+ jn1j8t$ujq$1(a)dough.gmane.org !
+
2012-04-21 Aidan Kehoe <kehoea(a)parhasard.net>
* automated/regexp-tests.el:
diff -r 3f4a234f4672 -r d026b665014f tests/automated/regexp-tests.el
--- a/tests/automated/regexp-tests.el Sat Apr 21 18:58:28 2012 +0100
+++ b/tests/automated/regexp-tests.el Wed Apr 25 20:25:33 2012 +0100
@@ -69,6 +69,15 @@
(Assert (string-match "�" "�"))
(Assert (not (string-match "�" "�"))))
+;; Is posix-string-match passing the POSIX flag correctly?
+
+(Assert
+ (equal
+ (save-match-data
+ (progn (posix-string-match "i\\|ii" "ii") (match-data)))
+ '(0 2))
+ "checking #'posix-string-match actually returns the longest match"))
+
;; looking-at
(with-temp-buffer
(insert "��")
--
‘Iodine deficiency was endemic in parts of the UK until, through what has been
described as “an unplanned and accidental public health triumph”, iodine was
added to cattle feed to improve milk production in the 1930s.’
(EN Pearce, Lancet, June 2011)
_______________________________________________
XEmacs-Beta mailing list
XEmacs-Beta(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-beta