Module Parser_utils

Various parser utilities.

val split_into_key_value : char -> char Stream.t -> (Imandra_prelude.string * Imandra_prelude.string) Stream.t

Splits a stream of characters into a stream of (key * value) pairs.

val split_into_messages : (Imandra_prelude.string * Imandra_prelude.string) Stream.t -> (Imandra_prelude.string * Imandra_prelude.string) list Stream.t

Splits a stream of key-value paris into stream of messages.

val take : Imandra_prelude.string -> (Imandra_prelude.string * Imandra_prelude.string) list -> Imandra_prelude.string option * (Imandra_prelude.string * Imandra_prelude.string) list

Extract a value given a tag, returns a pair with the value and the rest of the list.

val split_on_tag : Imandra_prelude.string -> (Imandra_prelude.string * Imandra_prelude.string) list -> (Imandra_prelude.string * Imandra_prelude.string) list * (Imandra_prelude.string * Imandra_prelude.string) list

Splits a list of (tag * value) pairs into two lists on a given tag. The tag itself goes into the second list. If the tag is absent -- returnes an empty second list.

split_on_tag 4 [(1,0); (2,0); (3,0); (4,0); (5,0); (6,0)] =>
( [ (1,0); (2,0); (3,0) ] , 
  [ (4,0); (5,0); (6,0) ]
)
val cut_on_separator : (Imandra_prelude.string * Imandra_prelude.string) list -> (Imandra_prelude.string * Imandra_prelude.string) list list

Uses the first entry tag in the input list to split the list into a list of lists, each starting with the tag.

module Parser : sig ... end

The Parser module collects an API of parser-combinators for parsing FIX messages into OCaml types. Each combinator takes a continuation function that returns a ( 'a Parser.t * msg ) type