I am trying to write generic code that can lex any character stream ( dchar s) anywhere ... whether from a file or from stdin to another file or stdout .
How to do it?
It seems that stdin and stdout painful for use with InputRange and OutputRange (since I have to wrap them every time), and I cannot use std.stdio.Stream because it gives me bytes, not strings ... and I canβt find any adapter to convert from one to another easily.
So efficiently, I cannot find a good way to use stdin / stdout in my programs.
Is there something for example. like .NET TextReader , which can abstractly read text as InputRange!dchar , regardless of whether its input is a string, console, or file?
source share