ed

[hare] The standard editor
Log | Files | Refs | README | LICENSE

interaction.ha (407B)


      1 use bufio;
      2 use encoding::utf8;
      3 use io;
      4 use os;
      5 use strings;
      6 use types;
      7 
      8 type InteractionError = !(
      9 	Quit
     10 	| io::EOF
     11 	| UnexpectedEOF
     12 	| encoding::utf8::invalid
     13 	| io::error
     14 );
     15 
     16 type Quit = !void;
     17 
     18 type UnexpectedEOF = !io::EOF;
     19 
     20 fn scanline(s: *Session) (str | InteractionError) = {
     21 	match (bufio::scan_line(s.input)?) {
     22 	case let s: const str =>
     23 		return s;
     24 	case io::EOF =>
     25 		return UnexpectedEOF;
     26 	};
     27 };