This commit is contained in:
parent
c957aeb811
commit
1bf2699d77
1 changed files with 44 additions and 43 deletions
|
|
@ -1,3 +1,4 @@
|
|||
module Recfile = struct
|
||||
(* rudimentary recfile parser
|
||||
https://www.gnu.org/software/recutils/manual/recutils.html#The-Rec-Format *)
|
||||
open Angstrom
|
||||
|
|
@ -48,8 +49,7 @@ let recfile : record list t =
|
|||
skip_many (comment <|> blank) *> records <* skip_many (comment <|> blank)
|
||||
|
||||
let parse s = parse_string ~consume:All recfile s
|
||||
|
||||
(* -- *)
|
||||
end
|
||||
|
||||
let url =
|
||||
"https://git-www.gnunet.org/gana.git/plain/gnunet-signatures/registry.rec"
|
||||
|
|
@ -78,6 +78,7 @@ let parse_purposes records =
|
|||
|> List.filter_map (fun l ->
|
||||
match l with
|
||||
| a :: b :: c :: _ -> (
|
||||
let open Recfile in
|
||||
match a.k = "Number" && b.k = "Name" && c.k = "Comment" with
|
||||
| false -> None
|
||||
| true ->
|
||||
|
|
@ -93,7 +94,7 @@ let parse_purposes records =
|
|||
let () =
|
||||
download ();
|
||||
let content = read_file registry_file in
|
||||
match parse content with
|
||||
match Recfile.parse content with
|
||||
| Error msg -> Fmt.failwith "Recfile parse error: %s" msg
|
||||
| Ok records ->
|
||||
let purposes = parse_purposes records in
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue