This utility library features combinators for assembling scanners
(parsers) from more basic scanners. The library is designed to work
well together with the scanner functionality provided in the Standard
ML Basis Library (i.e., StringCvt.reader).
A scanner (or parser) of type `('a,'st) p` parses values of type
`'a`. Such a parser is a function that takes a char-reader (of type
`(char,'st) reader`, and returns a reader that reads values of type
`'a`.
When opening ScanUtil, include the following infix-declaration:
infix >>> ->> >>- >>? || >>@ >>* ??
signature SCAN_UTIL =
sigtype ('a,'st) reader = ('a,'st) StringCvt.reader
type ('a,'st) p = (char,'st) reader -> ('a,'st) reader
val>>> : ('a,'st) p * ('b,'st) p -> ('a * 'b,'st) p
val>>@ : ('a,'st) p * ('a -> 'b) -> ('b,'st) p
val|| : ('a,'st) p * ('a,'st) p -> ('a,'st) p
val->> : ('a,'st) p * ('b,'st) p -> ('b,'st) p
val>>- : ('a,'st) p * ('b,'st) p -> ('a,'st) p
val>>? : ('a,'st) p * ('b,'st) p -> ('a * 'b -> 'a) -> ('a,'st) p
val>>* : ('a,'st) p * ('b,'st) p -> ('a * 'b -> 'a) -> ('a,'st) p
val?? : ('a,'st) p * ('a -> 'b option) -> ('b,'st) p
valign : ('a,'st) p -> (unit,'st) p
valcon : string * 'a -> ('a,'st) p
valstr : string -> (string,'st) p
valeos : (unit,'st) p
valscanChar : (char -> bool) -> (char,'st) p
valscanChars : (char -> bool) -> (string,'st) p
vallist : ('a,'st) p -> ('a list,'st) p
valoption : ('a,'st) p -> ('a option,'st) p
valskipChars : (char -> bool) -> ('a,'st) p -> ('a,'st) p
valskipWS : ('a,'st) p -> ('a,'st) p
valnoSkipWS : ('a,'st) p -> ('a,'st) p
valremainder : (string,'st) p
valscanId : (string,'st) p
end
[type ('a,'st) reader]
The generic reader type, which is a type
abbreviation for the type `'st -> ('a * 'st) option`.