| 1 |
(* Copyright (C) 1999-2006 Henry Cejtin, Matthew Fluet, Suresh |
| 2 |
* Jagannathan, and Stephen Weeks. |
| 3 |
* Copyright (C) 1997-2000 NEC Research Institute. |
| 4 |
* |
| 5 |
* MLton is released under a HPND-style license. |
| 6 |
* See the file MLton-LICENSE for details. |
| 7 |
*) |
| 8 |
|
| 9 |
signature READER = |
| 10 |
sig |
| 11 |
type ('a, 'b) reader = 'b -> ('a * 'b) option |
| 12 |
|
| 13 |
(* read as many items as possible (never returns NONE) *) |
| 14 |
val list: ('a, 'b) reader -> ('a list, 'b) reader |
| 15 |
|
| 16 |
(* never return NONE *) |
| 17 |
(* val tokens: ('a -> bool) -> ('a, 'b) reader -> ('a list list, 'b) reader *) |
| 18 |
(* val fields: ('a -> bool) -> ('a, 'b) reader -> ('a list list, 'b) reader *) |
| 19 |
|
| 20 |
val map: ('a -> 'c) -> ('a, 'b) reader -> ('c, 'b) reader |
| 21 |
val mapOpt: ('a -> 'c option) -> ('a, 'b) reader -> ('c, 'b) reader |
| 22 |
|
| 23 |
val ignore: ('a -> bool) -> ('a, 'b) reader -> ('a, 'b) reader |
| 24 |
|
| 25 |
(* read excatly N items *) |
| 26 |
val readerN: ('a, 'b) reader * int -> ('a list, 'b) reader |
| 27 |
val reader2: ('a, 'b) reader -> ('a * 'a, 'b) reader |
| 28 |
val reader3: ('a, 'b) reader -> ('a * 'a * 'a, 'b) reader |
| 29 |
val reader4: ('a, 'b) reader -> ('a * 'a * 'a * 'a, 'b) reader |
| 30 |
end |