Ignore:
Timestamp:
Jul 17, 2006, 9:40:42 PM (15 years ago)
Author:
orlov
Message:
  • Stream.Get-Line and StdIO.Read-Line! consider a line to be terminated

by any one of a line feed ('\n'), a carriage return ('\r'),
or a carriage return followed immediately by a linefeed.

  • New function Stream.Scanc.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • to-imperative/trunk/library/Stream/refal/Stream.rf

    r1643 r2027  
    8787
    8888
     89*** $func  Scanc  stream t1   = empty-or-t1;
     90
     91Scanc stream t1, {
     92  <Getc stream> : {
     93    t1 = t1;
     94    t2 = <Ungets stream t2>;
     95  };
     96  /*empty*/;
     97};
     98
     99
    89100*** $func Get-Delim stream t.delim = expr;
    90101
     
    106117*** $func Get-Line stream = expr;
    107118
    108 Get-Line stream = <Get-Delim stream '\n'>;
     119//Get-Line stream = <Get-Delim stream '\n'>;
     120
     121$func? Not-EOL t1 = ;
     122Not-EOL t1 = # t1 : \{ '\n'; '\r'; };
     123
     124Get-Line stream =
     125  <Get-While stream &Not-EOL> <Scanc stream '\r'> <Scanc stream '\n'>;
    109126
    110127
Note: See TracChangeset for help on using the changeset viewer.