[m-dev.] diff: mtags fix
Fergus Henderson
fjh at cs.mu.OZ.AU
Sun Nov 19 03:23:07 AEDT 2000
On 07-Oct-2000, David Overton <dmo at cs.mu.OZ.AU> wrote:
> `\b' in Perl doesn't seem to be doing what it is documented to do.
> I've got no idea why, but here is a workaround.
...
> # Is this an "interface" or "implementation" declaration?
> # If so, change context.
> - if ($decl =~ "\binterface\b" || $decl =~ "\bimplementation\b") {
> + if ($decl =~ "interface" || $decl =~ "implementation") {
> $context = $decl;
The reason that it wasn't working is that the syntax for pattern
matching is
if ($var =~ /pattern/)
whereas
if ($var =~ "string")
does an exact string match.
----------
Estimated hours taken: 0.25
scripts/mtags:
Use /\b...\b/ to skip whitespace when matching the
`:- interface' and `:- implementation' declarations.
Workspace: /home/pgrad/fjh/ws/hg
Index: scripts/mtags
===================================================================
RCS file: /home/mercury1/repository/mercury/scripts/mtags,v
retrieving revision 1.21
diff -u -d -r1.21 mtags
--- scripts/mtags 2000/10/06 06:37:15 1.21
+++ scripts/mtags 2000/11/18 16:18:22
@@ -186,7 +186,7 @@
} elsif ($ext) {
# In ``ext'' mode, print the extra attributes used by
# vim 5.0+ and elvis 2.1+.
- if ($context =~ /implementation/) {
+ if ($context =~ /\bimplementation\b/) {
$static = "\tfile:";
$sfile = $file;
} else {
@@ -294,7 +294,7 @@
# Is this an "interface" or "implementation" declaration?
# If so, change context.
- if ($decl =~ "interface" || $decl =~ "implementation") {
+ if ($decl =~ /\binterface\b/ || $decl =~ /\bimplementation\b/) {
$context = $decl;
}
--
Fergus Henderson <fjh at cs.mu.oz.au> | "I have always known that the pursuit
| of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh> | -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to: mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions: mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------
More information about the developers
mailing list