regexp improvements
Deleted218694ffffffffffffffffffffffffffffffffffCreated 26 years agoUpdated 26 years ago
Descriptionplain2000-10-26 01:04:12
OriginalBugID: 1772 RFE
Version: 8.1b3
SubmitDate: '1999-04-09'
LastModified: '1999-07-02'
Severity: LOW
Status: Released
Submitter: pat
ChangedBy: stanton
OS: Windows 98
Machine: X86
FixedDate: '1999-07-02'
FixedInVersion: 8.2
ClosedDate: '2000-10-25'
Name:
Frederic BONNET
CustomShell:
Applied patch to the regexp engine (the exec part)
DesiredBehavior:
As previously requested by Don Libes:
> I see no way for Tcl_RegExpExec to indicate "could match" meaning
> "could match if more characters arrive that were suitable for a
> match". This is required for a class of applications involving
> matching on a stream required by Expect's interact command. Henry
> assured me that this facility would be in the engine (I'm not the only
> one that needs it). Note that it is not sufficient to add one more
> return value to Tcl_RegExpExec (i.e., 2) because one needs to know
> both if something matches now and can match later. I recommend
> another argument (canMatch *int) be added to Tcl_RegExpExec.
The following patch adds this feature to the Tcl8.1 regexp engine. To do
so, it checks if the end of the string is reached during the matching.
I've also modified TclRegExpExecUniChar so that it takes an extra flag
to report such cases by returning -2 (previous return values were -1, 0
and 1). But directly calling TclReExec allows more precise treatment.
The other feature added to the regexp engine is a flag that limits the
search to the beginning of the string. I need it for my tcLex extension,
and it can prove useful for other stream-based string processing (it
avoids the input to be scanned to its end). It is different from using
anchored REs (ie using ^ at the beginning) since they can have different
behavior in newline-sensitive and insensitive modes, and they are
defined at compilation level whereas the flag I've added can be set at
execution level (thus avoiding the need for a recompilation).
In order for these features to be fully useable, either
TclRegExpExecUniChar or
TclReExec (and all the other public functions from Henry Spencer's
regexp package) should be made public and exported in the stub table.
Also the script-level API needs to be defined (probably through an extra
flag to regexp and regsub).
I've made similar modifications to the Tcl8.0 regexp engine. If someone
is interested, I could post the patch to Scriptics' Request Form.
This patch has been extensively tested during several months as part of
my tcLex extension.
Patch:
http://www.multimania.com/fbonnet/pub/regexp81.patch
PatchFiles:
generic/rege_dfa.c
generic/regex.h
generic/regexec.c
generic/tclRegexp.c
07/02/1999 10:49 - stanton - Made numerous changes to the regexp interface that address all of Frederic and Don's concerns.
welch Deleted ticket [218694ffff].
[History diff]2000-10-26 08:27:11
Log in (anonymous is fine) to add a comment.