[Oberon] Newlines and Carriage-Returns
andreas_pirklbauer at yahoo.com
Mon Jan 7 13:31:02 CET 2019
PS: Sorry. I didn’t realize that you had already answered this … as per our exchange yesterday.
Like so many other topics, it could of course be endlessly debated whether (a) or (b) is the
“right” approach. When I originally suggested the fix to the WHILE loop in Scan, the intent was
mainly to be in line with the rest of Oberon, where S.eot is always used to check for EOT.
> Both lines
> (a) WHILE ~S.eot & (ch <= " ") DO .. END;
> (b) WHILE (ch = " ") OR (ch = TAB) OR (ch = CR) DO .. END;
> will not hang the system. (b) will not hang due to the fact that ch = 0X if S.eot is TRUE.
> (a) has the beauty that it's shorter and will "swallow" the LF as well. But also other characters with ORD() values smaller than space are "swallowed".
> (b) is didactically cleaner, as it exactly states what characters are defined as "white spaces" and hence eaten away.
> (a) is more kind of "error recovery" until Scan hits something known.
> (b) is an explicit list of allowed white spaces.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Oberon