Article View: vmsnet.tpu
Article #82Matching multi-character delimiters?
From: fairfield
Date: Wed, 11 Nov 1992 21:44
Date: Wed, 11 Nov 1992 21:44
32 lines
1851 bytes
1851 bytes
All this discussion about matching up delimiters brought to mind a
case I don't think is handled by any of the procedures posted: has
anyone thought about the problem of, for example, matching opening and
closing comment delimitors in C?
/* Hi! I'm a comment, what are you? */
I've thought of two possiblities:
1) Create an _array_ of left-delimitors and an array of
right-delimitors with each array entry being a string
of arbitrary length. You might need to order the array
elements so as to check the multi-character delimiters
before the single character ones if the multi's included
characters in the single-character set...
2) Use SELECT to highlight a string of characters, then do
a "MATCH SELECTED". Eve_Match_Selected would extract the
selected string of characters and reverse them to form the
match delimiter string. Problem here is you don't know
whether to search FORWARD or REVERSE sine there is no
intrinsic left- or rightness to the strings.
Comments?
Cheers, 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.134400.1@slacvx.slac.stanford.edu>Path:
arc1-ca.pugleaf.net!sparky!uunet!stanford.edu!unixhub!slacvx.slac.stanford.edu!fairfieldShow Full Headers
Complete Article Headers
Newsgroups: vmsnet.tpu Path: arc1-ca.pugleaf.net!sparky!uunet!stanford.edu!unixhub!slacvx.slac.stanford.edu!fairfield From: fairfield@slacvx.slac.stanford.edu Subject: Matching multi-character delimiters? Message-ID: <1992Nov11.134400.1@slacvx.slac.stanford.edu> Lines: 32 Sender: news@unixhub.SLAC.Stanford.EDU Organization: Stanford Linear Accelerator Center Date: Wed, 11 Nov 1992 21:44:00 GMT