Article View: vmsnet.tpu
Article #80Re: Procedure to matchup (){}[] ???
From: fairfield
Date: Wed, 11 Nov 1992 18:31
Date: Wed, 11 Nov 1992 18:31
37 lines
2420 bytes
2420 bytes
In article <DAVIS.92Nov11085239@pacific.mps.ohio-state.edu>, davis@pacific.mps.ohio-state.edu ("John E. Davis") writes:
> While these procedures that have been posted may work fine for most purposes,
> I do not think they will as expected work for:
>
> if ((ch == ')') || (ch == '('))
> {...}
>
> Does anyone have one that works properly for this case? If so, does it also
> work for this:
>
> if ((ch == '\'') || (ch == '\\'))
> {...}
The EVE_MATCH_DELIMITORS I posted early last week works correctly in
matching the parentheses (you didn't say WHAT you thought the unexpected
behaviour to be) for the _second_ case (perhaps you ought to _try_ the
procedures rather than just guessing :-), but the first case is tougher
because there's an "extra" copy of the delimiter you're trying to match
within a quoted string.
I believe you're be asking the MATCH procedure to know a given
language's syntax for "quoting" a string, and to ignore delimiters
embedded within those strings. I can think of ways to do that, but I can
imagine more cases of it making the _wrong_ choice rather than the right
one... You basically have to search the WHOLE buffer to see if you're
within a (language-specific-syntax) quoted string. I wouldn't want to
attempt that, I'd rather let the compiler catch _those_ cases... "Operator
intervention" in the relatively infrequent cases, like your first example,
shouldn't be to ask :-)
-Ken
--
Dr. Kenneth H. Fairfield | Internet: Fairfield@Slac.Stanford.Edu
SLAC, P.O.Box 4349, MS 98 | DECnet: 45537::FAIRFIELD (45537=SLACVX)
Stanford, CA 94309 | BITNET Fairfield@Slacvx
----------------------------------------------------------------------------
These opinions are mine, not SLAC's, Stanford's, nor the DOE's...
Technical Details
Message-ID:
<1992Nov11.103109.1@slacvx.slac.stanford.edu>Path:
arc1-ca.pugleaf.net!sparky!uunet!stanford.edu!agate!spool.mu.edu!nigel.msen.com!emory!swrinde!cs.utexas.edu!usc!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!pacific.mps.ohio-state.edu!linac!unixhub!slacvx.slac.stanford.edu!fairfieldReferences:
<DAVIS.92Nov11085239@pacific.mps.ohio-state.edu>Show Full Headers
Complete Article Headers
Newsgroups: vmsnet.tpu
Path: arc1-ca.pugleaf.net!sparky!uunet!stanford.edu!agate!spool.mu.edu!nigel.msen.com!emory!swrinde!cs.utexas.edu!usc!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!pacific.mps.ohio-state.edu!linac!unixhub!slacvx.slac.stanford.edu!fairfield
From: fairfield@slacvx.slac.stanford.edu
Subject: Re: Procedure to matchup (){}[] ???
Message-ID: <1992Nov11.103109.1@slacvx.slac.stanford.edu>
Lines: 37
Sender: news@unixhub.SLAC.Stanford.EDU
Organization: Stanford Linear Accelerator Center
References: <DAVIS.92Nov11085239@pacific.mps.ohio-state.edu>
Date: Wed, 11 Nov 1992 18:31:09 GMT