GNU bug report logs - #2881
23.0.91; inconsistent regexps with "explicitly numbered group"

Previous Next

Package: emacs;

Reported by: Joe Corneli <holtzermann17 <at> gmail.com>

Date: Fri, 3 Apr 2009 19:20:03 UTC

Severity: normal

Done: Stefan Monnier <monnier <at> IRO.UMontreal.CA>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 2881 in the body.
You can then email your comments to 2881 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#2881; Package emacs. (Fri, 03 Apr 2009 19:20:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to Joe Corneli <holtzermann17 <at> gmail.com>:
New bug report received and forwarded. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Fri, 03 Apr 2009 19:20:03 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Joe Corneli <holtzermann17 <at> gmail.com>
To: emacs-pretest-bug <at> gnu.org
Subject: 23.0.91; inconsistent regexps with "explicitly numbered group"
Date: Fri, 3 Apr 2009 15:15:01 -0400
Please execute the following forms with C-x C-e.  Form 1
and Form 3 return `t' (Yes, we are looking at the
indicated regular expression), whereas Form 2 returns
`nil' (even though from the Elisp reference page "34.3.1.3
Backslash Constructs in Regular Expressions", it appears
that this form ought to return `t' like the others).

For comparison's sake, Form 4 and Form 5 show different
inconsistent behavior when using `search-forward-regexp'.
Form 4 only finds part of the match, whereas Form 5 finds
the full match.

Form #1.

(let ((possible-environments
       "\\(1?:lisp\\|idea\\|common\\)"))
  (looking-at
            (concat "\n*?\\\\begin{"
                    possible-environments
                    "}")))

\begin{idea}

Form #2.

(let ((possible-environments
       "\\(?1:lisp\\)\\|\\(?1:idea\\)\\|\\(?1:common\\)") )
      (looking-at
            (concat "\n*?\\\\begin{"
                    possible-environments
                    "}")))

\begin{idea}

Form #3.

(let ((possible-environments
       "\\(?1:lisp\\)\\|\\(?1:idea\\)\\|\\(?1:common\\)") )
      (looking-at
            (concat "\n*?\\\\begin{"
                    possible-environments
                    "}")))

\begin{lisp}

Form #4.

(let ((possible-environments
       "\\(?1:lisp\\)\\|\\(?1:idea\\)\\|\\(?1:common\\)") )
      (search-forward-regexp
            (concat "\n*?\\\\begin{"
                    possible-environments
                    "}")))

\begin{lisp}

Form #5.

(let ((possible-environments
       "\\(?1:lisp\\)\\|\\(?1:idea\\)\\|\\(?1:common\\)") )
      (search-forward-regexp
            (concat "\n*?\\\\begin{"
                    possible-environments
                    "}")))

\begin{common}


If Emacs crashed, and you have the Emacs process in the gdb debugger,
please include the output from the following gdb commands:
    `bt full' and `xbacktrace'.
If you would like to further debug the crash, please read the file
/Users/planetmath/emacs/etc/DEBUG for instructions.


In GNU Emacs 23.0.91.1 (i386-apple-darwin8.11.1, GTK+ Version 2.14.7)
 of 2009-03-31 on planet-maths-computer.local
Windowing system distributor `The XFree86 Project, Inc', version 11.0.40400000
configured using `configure  '--infodir=${prefix}/share/info'
'--mandir=${prefix}/share/man' '--libexecdir=${prefix}/lib''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: nil
  value of $XMODIFIERS: nil
  locale-coding-system: nil
  default-enable-multibyte-characters: t

Major mode: Lisp Interaction

Minor modes in effect:
  shell-dirtrack-mode: t
  show-paren-mode: t
  tooltip-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  global-auto-composition-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: 1

Recent input:
M-\ <down> <tab> <up> <up> <up> <up> <up> <up> <up>
<up> <up> <up> <up> C-SPC <C-right> M-w M-> <return>
<tab> C-y <tab> ) <return> <return> \ \ <backspace>
b e g j <backspace> i n { } <left> i d e a C-e <up>
<up> C-e C-x C-e <down> <down> <left> C-e M-< <down>
<down> <down> <down> <down> <down> <down> <down> <down>
<down> <down> <down> <down> <down> <down> <down> <down>
<down> <down> <down> <down> <down> <down> <down> <down>
<down> <down> <down> <down> <down> <down> <down> <down>
<down> <down> <down> M-< C-x C-f m <backspace> a r
x a n <tab> - <tab> m <tab> <return> g <down> <up>
<down> <return> C-s i m p o r t - c o d C-s C-s <down>
<down> C-a C-e C-SPC C-a <up> M-w C-x b * s c <tab>
<return> M-> <return> <return> C-y <C-left> <left>
<left> <left> <right> <backspace> <tab> <down> <up>
<down> M-f M-f M-f M-b <left> <left> <left> <left>
<left> <left> <left> C-SPC <C-right> <C-right> M-w
C-y M-b M-b M-f M-f <M-backspace> c o m m o n <up>
<up> <up> <up> <down> C-SPC C-a <up> <up> <up> <up>
<up> M-w M-> C-y <up> <up> C-e ) <up> <up> <up> <up>
C-e <up> C-e <up> <tab> C-e <C-left> <left> <backspace>
<return> <tab> <up> C-e ) <down> M-> <up> <up> C-e
<backspace> C-x C-e <down> <down> C-SPC C-a <up> <up>
<up> <up> <up> <up> <up> M-w M-> <return> <return>
C-y <up> <up> <up> <up> <down> <up> <down> <down> <down>
<down> <left> <M-backspace> l i s p <up> <up> C-e C-x
C-e <down> <down> C-SPC C-a <up> <up> <up> <up> <up>
<up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up>
<up> <up> <up> <up> <up> <up> <up> <up> <up> M-w M-x
r e p <tab> o r <tab> <return>

Recent messages:
t
Mark set [2 times]
Making completion list...
Mark saved where search started
Mark set [9 times]
nil
Mark set [3 times]
t
Mark set
Making completion list...




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#2881; Package emacs. (Fri, 03 Apr 2009 20:05:08 GMT) Full text and rfc822 format available.

Acknowledgement sent to Andreas Schwab <schwab <at> linux-m68k.org>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Fri, 03 Apr 2009 20:05:08 GMT) Full text and rfc822 format available.

Message #10 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Andreas Schwab <schwab <at> linux-m68k.org>
To: Joe Corneli <holtzermann17 <at> gmail.com>
Cc: 2881 <at> debbugs.gnu.org, emacs-pretest-bug <at> gnu.org
Subject: Re: bug#2881: 23.0.91; inconsistent regexps with "explicitly numbered group"
Date: Fri, 03 Apr 2009 21:55:42 +0200
Joe Corneli <holtzermann17 <at> gmail.com> writes:

> Please execute the following forms with C-x C-e.  Form 1
> and Form 3 return `t' (Yes, we are looking at the
> indicated regular expression), whereas Form 2 returns
> `nil' (even though from the Elisp reference page "34.3.1.3
> Backslash Constructs in Regular Expressions", it appears
> that this form ought to return `t' like the others).

     `\|' applies to the largest possible surrounding expressions.
     Only a surrounding `\( ... \)' grouping can limit the grouping
     power of `\|'.

> (let ((possible-environments
>        "\\(?1:lisp\\)\\|\\(?1:idea\\)\\|\\(?1:common\\)") )
>       (looking-at
>             (concat "\n*?\\\\begin{"
>                     possible-environments
>                     "}")))


The three alternatives of this regexp are "\n*?\\\\begin{\\(?1:lisp\\)",
"\\(?1:idea\\)" and "\\(?1:common\\)".

Andreas.

-- 
Andreas Schwab, schwab <at> linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#2881; Package emacs. (Fri, 03 Apr 2009 20:05:11 GMT) Full text and rfc822 format available.

Acknowledgement sent to Andreas Schwab <schwab <at> linux-m68k.org>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Fri, 03 Apr 2009 20:05:11 GMT) Full text and rfc822 format available.

Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#2881; Package emacs. (Fri, 03 Apr 2009 20:45:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Joe Corneli <holtzermann17 <at> gmail.com>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Fri, 03 Apr 2009 20:45:03 GMT) Full text and rfc822 format available.

Message #20 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Joe Corneli <holtzermann17 <at> gmail.com>
To: Andreas Schwab <schwab <at> linux-m68k.org>
Cc: 2881 <at> debbugs.gnu.org, emacs-pretest-bug <at> gnu.org
Subject: Re: bug#2881: 23.0.91; inconsistent regexps with "explicitly numbered 
	group"
Date: Fri, 3 Apr 2009 16:41:39 -0400
What about the comparison between Form 4 and Form 5,
which seems to not only go against the description of `\|'
you quoted, but to contain another internal inconsistency
(whether or not the final `}' is matched)?

On Fri, Apr 3, 2009 at 3:55 PM, Andreas Schwab <schwab <at> linux-m68k.org> wrote:
> Joe Corneli <holtzermann17 <at> gmail.com> writes:
>
>> Please execute the following forms with C-x C-e.  Form 1
>> and Form 3 return `t' (Yes, we are looking at the
>> indicated regular expression), whereas Form 2 returns
>> `nil' (even though from the Elisp reference page "34.3.1.3
>> Backslash Constructs in Regular Expressions", it appears
>> that this form ought to return `t' like the others).
>
>     `\|' applies to the largest possible surrounding expressions.
>     Only a surrounding `\( ... \)' grouping can limit the grouping
>     power of `\|'.
>
>> (let ((possible-environments
>>        "\\(?1:lisp\\)\\|\\(?1:idea\\)\\|\\(?1:common\\)") )
>>       (looking-at
>>             (concat "\n*?\\\\begin{"
>>                     possible-environments
>>                     "}")))
>
>
> The three alternatives of this regexp are "\n*?\\\\begin{\\(?1:lisp\\)",
> "\\(?1:idea\\)" and "\\(?1:common\\)".
>
> Andreas.
>
> --
> Andreas Schwab, schwab <at> linux-m68k.org
> GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
> "And now for something completely different."
>




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#2881; Package emacs. (Fri, 03 Apr 2009 20:45:04 GMT) Full text and rfc822 format available.

Acknowledgement sent to Joe Corneli <holtzermann17 <at> gmail.com>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Fri, 03 Apr 2009 20:45:05 GMT) Full text and rfc822 format available.

Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#2881; Package emacs. (Fri, 03 Apr 2009 21:40:06 GMT) Full text and rfc822 format available.

Acknowledgement sent to Andreas Schwab <schwab <at> linux-m68k.org>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Fri, 03 Apr 2009 21:40:06 GMT) Full text and rfc822 format available.

Message #30 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Andreas Schwab <schwab <at> linux-m68k.org>
To: 2881 <at> debbugs.gnu.org
Cc: Joe Corneli <holtzermann17 <at> gmail.com>, emacs-pretest-bug <at> gnu.org
Subject: Re: bug#2881: 23.0.91; inconsistent regexps with "explicitly numbered group"
Date: Fri, 03 Apr 2009 23:32:01 +0200
Andreas Schwab <schwab <at> linux-m68k.org> writes:

> Joe Corneli <holtzermann17 <at> gmail.com> writes:
>
>> Please execute the following forms with C-x C-e.  Form 1
>> and Form 3 return `t' (Yes, we are looking at the
>> indicated regular expression), whereas Form 2 returns
>> `nil' (even though from the Elisp reference page "34.3.1.3
>> Backslash Constructs in Regular Expressions", it appears
>> that this form ought to return `t' like the others).
>
>      `\|' applies to the largest possible surrounding expressions.
>      Only a surrounding `\( ... \)' grouping can limit the grouping
>      power of `\|'.
>
>> (let ((possible-environments
>>        "\\(?1:lisp\\)\\|\\(?1:idea\\)\\|\\(?1:common\\)") )
>>       (looking-at
>>             (concat "\n*?\\\\begin{"
>>                     possible-environments
>>                     "}")))
>
>
> The three alternatives of this regexp are "\n*?\\\\begin{\\(?1:lisp\\)",
> "\\(?1:idea\\)" and "\\(?1:common\\)".

The last one is "\\(?1:common\\)}", of course.

Andreas.

-- 
Andreas Schwab, schwab <at> linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#2881; Package emacs. (Fri, 03 Apr 2009 21:40:14 GMT) Full text and rfc822 format available.

Acknowledgement sent to Andreas Schwab <schwab <at> linux-m68k.org>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Fri, 03 Apr 2009 21:40:14 GMT) Full text and rfc822 format available.

Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#2881; Package emacs. (Fri, 03 Apr 2009 21:45:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to Joe Corneli <holtzermann17 <at> gmail.com>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Fri, 03 Apr 2009 21:45:04 GMT) Full text and rfc822 format available.

Message #40 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Joe Corneli <holtzermann17 <at> gmail.com>
To: Andreas Schwab <schwab <at> linux-m68k.org>
Cc: 2881 <at> debbugs.gnu.org, emacs-pretest-bug <at> gnu.org
Subject: Re: bug#2881: 23.0.91; inconsistent regexps with "explicitly numbered 
	group"
Date: Fri, 3 Apr 2009 17:38:30 -0400
Oh, OK, I see! Never mind!

On Fri, Apr 3, 2009 at 5:32 PM, Andreas Schwab <schwab <at> linux-m68k.org> wrote:
> Andreas Schwab <schwab <at> linux-m68k.org> writes:
>
>> Joe Corneli <holtzermann17 <at> gmail.com> writes:
>>
>>> Please execute the following forms with C-x C-e.  Form 1
>>> and Form 3 return `t' (Yes, we are looking at the
>>> indicated regular expression), whereas Form 2 returns
>>> `nil' (even though from the Elisp reference page "34.3.1.3
>>> Backslash Constructs in Regular Expressions", it appears
>>> that this form ought to return `t' like the others).
>>
>>      `\|' applies to the largest possible surrounding expressions.
>>      Only a surrounding `\( ... \)' grouping can limit the grouping
>>      power of `\|'.
>>
>>> (let ((possible-environments
>>>        "\\(?1:lisp\\)\\|\\(?1:idea\\)\\|\\(?1:common\\)") )
>>>       (looking-at
>>>             (concat "\n*?\\\\begin{"
>>>                     possible-environments
>>>                     "}")))
>>
>>
>> The three alternatives of this regexp are "\n*?\\\\begin{\\(?1:lisp\\)",
>> "\\(?1:idea\\)" and "\\(?1:common\\)".
>
> The last one is "\\(?1:common\\)}", of course.
>
> Andreas.
>
> --
> Andreas Schwab, schwab <at> linux-m68k.org
> GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
> "And now for something completely different."
>




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#2881; Package emacs. (Fri, 03 Apr 2009 21:45:11 GMT) Full text and rfc822 format available.

Acknowledgement sent to Joe Corneli <holtzermann17 <at> gmail.com>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Fri, 03 Apr 2009 21:45:11 GMT) Full text and rfc822 format available.

Reply sent to Stefan Monnier <monnier <at> IRO.UMontreal.CA>:
You have taken responsibility. (Fri, 03 Apr 2009 21:50:03 GMT) Full text and rfc822 format available.

Notification sent to Joe Corneli <holtzermann17 <at> gmail.com>:
bug acknowledged by developer. (Fri, 03 Apr 2009 21:50:03 GMT) Full text and rfc822 format available.

Message #50 received at 2881-done <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
To: Joe Corneli <holtzermann17 <at> gmail.com>
Cc: 2881-done <at> debbugs.gnu.org
Subject: Re: bug#2881: 23.0.91; inconsistent regexps with "explicitly numbered  group"
Date: Fri, 03 Apr 2009 17:43:37 -0400
> What about the comparison between Form 4 and Form 5,
> which seems to not only go against the description of `\|'
> you quoted, but to contain another internal inconsistency
> (whether or not the final `}' is matched)?

Still quite expected.  Your regexp is:

  "\n*?\\\\begin{\\(?1:lisp\\)\\|\\(?1:idea\\)\\|\\(?1:common\\)}"
i.e.
  "\n*?\\\\begin{\\(?1:lisp\\)" or "\\(?1:idea\\)" or "\\(?1:common\\)}"

Clearly, the "lisp" alternative doesn't match a closing }


        Stefan




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> emacsbugs.donarmstrong.com. (Sat, 02 May 2009 14:24:08 GMT) Full text and rfc822 format available.

This bug report was last modified 16 years and 54 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.