[Oberon] Newlines and Carriage-Returns
andreas_pirklbauer at yahoo.com
Sat Jan 5 21:51:30 CET 2019
> If anyone is curious it can be found at:
> in PROCEDURE Scan use WHILE (ch = " ") OR (ch = TAB) OR (ch = NL) OR (ch = CR) DO
> in PROCEDURE Scan use IF (ch = NL) OR (ch = CR) THEN INC(S.line) END ;
For procedure Texts.Scan it is actually slightly better to use the following code for the WHILE loop instead:
WHILE ~S.eot & (ch <= " ") DO
Reason: This code will *not* hang the system if an EOT is encountered in the file before any of
the characters in the WHILE condition.. for example with a file which consists *just* of an EOT.
This “bug” was already fixed at one point at www.projectoberon.com, but now the old version is back.
More information about the Oberon