home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / lang / rexx / 918 < prev    next >
Encoding:
Text File  |  1992-09-08  |  2.3 KB  |  52 lines

  1. Newsgroups: comp.lang.rexx
  2. Path: sparky!uunet!mcsun!sunic!sejnet.sunet.se!eric
  3. From: eric@sejnet.sunet.se (Eric Thomas)
  4. Subject: Re: Blanks, REXX, and portability...
  5. Message-ID: <1992Sep7.163041.1@sejnet.sunet.se>
  6. Lines: 39
  7. Sender: news@sunic.sunet.se
  8. Reply-To: ERIC@SEARN.SUNET.SE
  9. Organization: SUNET, Stockholm, Sweden
  10. References: <REXXLIST%92090516060285@UGA.CC.UGA.EDU> <MARTINC.92Sep6183949@grover.cs.unc.edu>
  11. Date: Mon, 7 Sep 1992 16:30:41 GMT
  12.  
  13. In article <MARTINC.92Sep6183949@grover.cs.unc.edu>, martinc@grover.cs.unc.edu (Charles R. Martin) writes:
  14. > I think the problem lies in repeated applications of parse, say with
  15. > columnar fields.  Say I parse the string "ab\tc" -- importing a little C
  16. > terminology to make clear where the tab lies -- with parse expand.  The
  17. > tab char should come out to be some number of blanks, as I understand
  18. > it. (Probably 6 for canonical tabs.)  But if I parse off the first
  19. > field, THEN parse the resulting "\tc", the tab now wants to expand to 8
  20. > characters.
  21.  
  22. Good point, but this is a hasty conclusion. IF you are worried about exact
  23. column positions and have to cope with data containing tabs and blanks, you
  24. will have to think carefully in any case. As you pointed out,
  25.  
  26.                             Parse var line a +2 b
  27.                             Parse expand var b <whatever>
  28.  
  29. will not work, but
  30.                             Parse expand var line a +2 b
  31.                             Parse var b <whatever>
  32.  
  33. does what you want. If you expand, you have to expand at the source. Now, with
  34. a REXX that has built-in white space recognition rather than expand, the code
  35. fragment would have to be:
  36.  
  37.                             Parse var line a +2 b
  38.                             Parse var b <whatever>
  39.  
  40. The first PARSE gives you a variable 'b' that starts with a tab, the second
  41. PARSE throws it away (since it is white space) unless you use columnar or
  42. pattern based parsing. Losing the tab will surely screw up your column
  43. positioning, since it will yield exactly the same result as if the tab had been
  44. a blank. So the only way to handle this situation properly is to use a form of
  45. parsing which does NOT treat tabs as white space. You are not making use of the
  46. interpreter's automatic handling of tabs.
  47.  
  48. In other words, the situation is not better with a REXX that automatically
  49. treats tabs as white space; in fact, it is worse.
  50.  
  51.   Eric
  52.