home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / vmsnet / tpu / 492 < prev    next >
Encoding:
Text File  |  1992-11-11  |  1.8 KB  |  43 lines

  1. Newsgroups: vmsnet.tpu
  2. Path: sparky!uunet!stanford.edu!unixhub!slacvx.slac.stanford.edu!fairfield
  3. From: fairfield@slacvx.slac.stanford.edu
  4. Subject: Matching multi-character delimiters?
  5. Message-ID: <1992Nov11.134400.1@slacvx.slac.stanford.edu>
  6. Lines: 32
  7. Sender: news@unixhub.SLAC.Stanford.EDU
  8. Organization: Stanford Linear Accelerator Center
  9. Date: Wed, 11 Nov 1992 21:44:00 GMT
  10.  
  11.     All this discussion about matching up delimiters brought to mind a
  12. case I don't think is handled by any of the procedures posted: has
  13. anyone thought about the problem of, for example, matching opening and
  14. closing comment delimitors in C?  
  15.  
  16.     /* Hi! I'm a comment, what are you? */
  17.  
  18. I've thought of two possiblities:
  19.  
  20.     1) Create an _array_ of left-delimitors and an array of 
  21.        right-delimitors with each array entry being a string
  22.        of arbitrary length.  You might need to order the array
  23.        elements so as to check the multi-character delimiters 
  24.        before the single character ones if the multi's included
  25.        characters in the single-character set...
  26.  
  27.     2) Use SELECT to highlight a string of characters, then do
  28.        a "MATCH SELECTED".  Eve_Match_Selected would extract the
  29.        selected string of characters and reverse them to form the
  30.        match delimiter string.  Problem here is you don't know
  31.        whether to search FORWARD or REVERSE sine there is no
  32.        intrinsic left- or rightness to the strings.
  33.  
  34. Comments?
  35.  
  36.         Cheers, Ken
  37. -- 
  38.  Dr. Kenneth H. Fairfield    |  Internet: Fairfield@Slac.Stanford.Edu
  39.  SLAC, P.O.Box 4349, MS 98   |  DECnet:   45537::FAIRFIELD (45537=SLACVX)
  40.  Stanford, CA   94309        |  BITNET    Fairfield@Slacvx
  41.  ----------------------------------------------------------------------------
  42.  These opinions are mine, not SLAC's, Stanford's, nor the DOE's...
  43.