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