pc and testing -> seperate files
This commit is contained in:
85
pc.mli
Normal file
85
pc.mli
Normal file
@@ -0,0 +1,85 @@
|
||||
type severity = Style | Warning | Error
|
||||
|
||||
type parse_error = {
|
||||
severity: severity;
|
||||
pos: int;
|
||||
message: string;
|
||||
expected: string list option;
|
||||
found: string option;
|
||||
other_case: parse_error option;
|
||||
}
|
||||
|
||||
type src_info = {
|
||||
source: string;
|
||||
path: string;
|
||||
}
|
||||
|
||||
type cursor = { source: string; pos: int }
|
||||
|
||||
type parse_result = {
|
||||
cursor: cursor;
|
||||
errors: parse_error list
|
||||
}
|
||||
|
||||
val pp_err : src_info -> Format.formatter -> parse_error -> unit
|
||||
val pp_errli : src_info -> Format.formatter -> parse_error list -> unit
|
||||
|
||||
val create : string -> cursor
|
||||
|
||||
exception Parser_Cant_Recover of parse_result
|
||||
exception Parser_No_Progress of cursor
|
||||
|
||||
type 'a parsr = cursor -> 'a * parse_result
|
||||
|
||||
val single_inline_white : unit parsr
|
||||
val single_white : unit parsr
|
||||
val any : char parsr
|
||||
val just : string -> string parsr
|
||||
val ex_end : unit parsr
|
||||
val digitch : char parsr
|
||||
val digit : int parsr
|
||||
val lower : char parsr
|
||||
val upper : char parsr
|
||||
val alpha : char parsr
|
||||
val alnum : char parsr
|
||||
val sign : int parsr (** '+'->1, '-'->-1, _->1 *)
|
||||
val p_uint : int parsr
|
||||
val p_int : int parsr
|
||||
val p_uflt : float parsr
|
||||
val p_flt : float parsr
|
||||
|
||||
|
||||
val repeat : 'a parsr -> 'a list parsr (** at lest 0 times *)
|
||||
val many : 'a parsr -> 'a list parsr (** at least 1 times *)
|
||||
|
||||
|
||||
(** repeat 'x parsr, as long as 'e parsr fails *)
|
||||
val until : 'e parsr -> 'x parsr -> 'x list parsr
|
||||
|
||||
val opt : 'x parsr -> 'x option parsr
|
||||
|
||||
val map : ('i -> 'o) -> 'i parsr -> 'o parsr
|
||||
val set : 'o -> 'i parsr -> 'o parsr
|
||||
|
||||
|
||||
(** if the given parser succeeds, this parser will fail, val the other way around *)
|
||||
val inv : 'x parsr -> unit parsr
|
||||
|
||||
(** requires that both parsers parse successfully at the same loc,
|
||||
but only uses first parser for progressing val returning result.
|
||||
combines warnings / errors from both parsers *)
|
||||
val also : 'a parsr -> 'b parsr -> 'a parsr
|
||||
|
||||
exception Recursive_Parser_Used_Before_Created
|
||||
val recursive : ('v parsr -> 'v parsr) -> 'v parsr
|
||||
|
||||
val chain : 'a parsr -> 'b parsr -> ('a * 'b) parsr
|
||||
val ignore_then : 'a parsr -> 'b parsr -> 'b parsr
|
||||
val then_ignore : 'a parsr -> 'b parsr -> 'a parsr
|
||||
val nd_of3 : 'a parsr -> 'b parsr -> 'c parsr -> 'b parsr
|
||||
val outer_of3 : 'a parsr -> 'b parsr -> 'c parsr -> ('a * 'c) parsr
|
||||
val ignore : 'a parsr -> unit parsr
|
||||
val either : 'a parsr -> 'a parsr -> 'a parsr
|
||||
|
||||
|
||||
val doparse : Format.formatter -> src_info -> 'a parsr -> 'a option
|
Reference in New Issue
Block a user