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

  1. Newsgroups: vmsnet.tpu
  2. Path: 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
  3. From: fairfield@slacvx.slac.stanford.edu
  4. Subject: Re: Procedure to matchup (){}[]  ???
  5. Message-ID: <1992Nov11.103109.1@slacvx.slac.stanford.edu>
  6. Lines: 37
  7. Sender: news@unixhub.SLAC.Stanford.EDU
  8. Organization: Stanford Linear Accelerator Center
  9. References: <DAVIS.92Nov11085239@pacific.mps.ohio-state.edu>
  10. Date: Wed, 11 Nov 1992 18:31:09 GMT
  11.  
  12. In article <DAVIS.92Nov11085239@pacific.mps.ohio-state.edu>, davis@pacific.mps.ohio-state.edu ("John E. Davis") writes:
  13. > While these procedures that have been posted may work fine for most purposes,
  14. > I do not think they will as expected work for:
  15. >
  16. > if ((ch == ')') || (ch == '('))
  17. >   {...}
  18. >
  19. > Does anyone have one that works properly for this case?  If so, does it also
  20. > work for this:
  21. >
  22. > if ((ch == '\'') || (ch == '\\'))
  23. >   {...}
  24.  
  25.     The EVE_MATCH_DELIMITORS I posted early last week works correctly in
  26. matching the parentheses (you didn't say WHAT you thought the unexpected
  27. behaviour to be) for the _second_ case (perhaps you ought to _try_ the
  28. procedures rather than just guessing :-), but the first case is tougher
  29. because there's an "extra" copy of the delimiter you're trying to match
  30. within a quoted string.
  31.  
  32.     I believe you're be asking the MATCH procedure to know a given
  33. language's syntax for "quoting" a string, and to ignore  delimiters
  34. embedded within those strings.  I can think of ways to do that, but I can
  35. imagine more cases of it making the _wrong_ choice rather than the right
  36. one... You basically have to search the WHOLE buffer to see if you're
  37. within a (language-specific-syntax) quoted string.  I wouldn't want to
  38. attempt that, I'd rather let the compiler catch _those_ cases...  "Operator
  39. intervention" in the relatively infrequent cases, like your first example,
  40. shouldn't be to ask :-)
  41.  
  42.             -Ken
  43. --
  44.  Dr. Kenneth H. Fairfield    |  Internet: Fairfield@Slac.Stanford.Edu
  45.  SLAC, P.O.Box 4349, MS 98   |  DECnet:   45537::FAIRFIELD (45537=SLACVX)
  46.  Stanford, CA   94309        |  BITNET    Fairfield@Slacvx
  47.  ----------------------------------------------------------------------------
  48.  These opinions are mine, not SLAC's, Stanford's, nor the DOE's...
  49.