signature STREAM = sig type fileId = int type fileOffset = int type pos = fileId * fileOffset type ppos (* pretty pos *) type t type fileInfo val recycle: t -> fileInfo val ppos2str: ppos -> string val printPos: fileInfo -> pos -> unit val getchar: t -> char option * t (* Will throw UngetcError, if applied at the beginning of the stream. * Can be always avoided, so is not provided in sig file *) val ungetc: t -> t val getOffset: t -> fileOffset val getPos: t -> pos val getPosAfterCharRead: t -> pos val getPposFromPos: pos -> t -> ppos (* Assumed to be called once for given pos, so will throw Unreachable on * second call *) val pposWithoutCol: ppos -> ppos val getSubstr: fileOffset -> fileOffset -> t -> string val isFirstOnLine: pos -> t -> bool (* throws IO.Io *) val streamInit: string -> t end