summaryrefslogtreecommitdiff
path: root/stream.sig
diff options
context:
space:
mode:
Diffstat (limited to 'stream.sig')
-rw-r--r--stream.sig31
1 files changed, 15 insertions, 16 deletions
diff --git a/stream.sig b/stream.sig
index 98cfb65..febd4b7 100644
--- a/stream.sig
+++ b/stream.sig
@@ -2,35 +2,34 @@ signature STREAM = sig
type fileId = int
type fileOffset = int
type pos = fileId * fileOffset
- type convPos = string * int * int option
-
- type filesInfo = (fileId * string * string) list
-
- exception EndOfStream
- exception EndOfFile
-
- exception LineWithoutNl
+ type ppos (* pretty pos *)
type t
+ type fileInfo
- val extractFilesInfo: t -> filesInfo
+ val recycle: t -> fileInfo
- val pos2str: convPos -> string
- val printPos: (fileId * string * string) list -> pos -> unit
+ val ppos2str: ppos -> string
+ val printPos: fileInfo -> pos -> unit
- val getchar: t -> char * t
+ 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 readline: t -> string * t
val getOffset: t -> fileOffset
val getPos: t -> pos
val getPosAfterCharRead: t -> pos
- val getPposFromPos: pos -> t -> convPos
+ 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
- val advanceToNewFile: t -> t
-
+ (* throws IO.Io *)
val streamInit: string -> t
end