Tcl Source Code

View Ticket
Login
Ticket UUID: 1178541
Title: REG_BOSONLY incorrect with |
Type: Bug Version: obsolete: 8.5a3
Submitter: wielemaker Created on: 2005-04-07 13:37:44
Subsystem: 43. Regexp Assigned To: aku
Priority: 5 Medium Severity: Minor
Status: Open Last Modified: 2015-11-06 22:14:19
Resolution: None Closed By: nobody
    Closed on:
Description:
Hi,

I've incorporated the Tcl regex code in my project
(www.swi-prolog.org) and found a bug in the regex
code.  I guess that will also affect Tcl.  I didn't
find a patch yet, I have some trouble sorting out the
internals.

In my app it shows as

?-send(regex('foo|bar'), match, 'xxx bar').

which succeeds!

Match (instead of search) sets REG_BOSONLY, but this causes
the regex to be read as \Afoo|bar rather than \A(foo|bar).

Using foo|\Abar, all works fine as well.

      Cheers --- Jan
User Comments: tgl added on 2015-11-06 22:14:19:
The complained-of behavior certainly seems to be a bug, but I do not like Jan's proposed fix much --- it's taking an implementation that was a kluge to start with and making it even more messy.  I suggest the attached instead, which works by not generating arcs corresponding to the forbidden cases to begin with.

Another idea worth considering is to remove REG_BOSONLY altogether ... does anyone know if Expect still uses it?

wielemaker added on 2005-04-07 21:42:01:

File Added - 128932: x

wielemaker added on 2005-04-07 21:42:00:
Logged In: YES 
user_id=1222641

After a bit if hacking I came up with the following patch. 
Its not
tested very much, but it does run the fairly limited test
set I have.
Note that the lines may be shifted a bit as I made some more
modifications to interface the code with the rest of the
environment,

    Cheers --- Jan

Attachments: