aboutsummaryrefslogtreecommitdiff
path: root/lib/turtle/ast.ml
diff options
context:
space:
mode:
Diffstat (limited to 'lib/turtle/ast.ml')
-rw-r--r--lib/turtle/ast.ml37
1 files changed, 26 insertions, 11 deletions
diff --git a/lib/turtle/ast.ml b/lib/turtle/ast.ml
index 6957ed8..c9a4fe3 100644
--- a/lib/turtle/ast.ml
+++ b/lib/turtle/ast.ml
@@ -170,7 +170,7 @@ module Predicate = struct
| _ -> false
let pp ppf = function
- | Pred_a -> Fmt.pf ppf "@<pred_a>@]"
+ | Pred_a -> Fmt.pf ppf "a"
| Pred_iri i -> Fmt.pf ppf "@[<hov 1>%a@]" Iri.pp i
end
@@ -232,17 +232,32 @@ and subject_pp ppf = function
| Sub_coll collection -> Fmt.pf ppf "@[<hov 1>%a@]" collection_pp collection
and bnodps_pp ppf (BnodPs predobjs) =
Fmt.pf ppf "@[<hov 1>[%a]@]" predobjs_pp predobjs
-and predobjs_pp ppf l =
- let objlist_pp ppf l =
+and predobjs_pp ppf predobjs =
+ let objlist_pp ppf objs =
+ match objs with
+ | [obj] -> object_pp ppf obj
+ | head :: tail ->
+ object_pp ppf head;
+ (List.iter
+ (fun o -> Fmt.pf ppf "@[<hov 1>,%a@]" object_pp o) tail)
+ | _ -> raise @@ Invalid_argument "An empty list should not be possible"
+ in
+ match predobjs with
+ | [(p, objs)] ->
+ Fmt.pf ppf "@[<hov 1>%a %a@]"
+ Predicate.pp p
+ objlist_pp objs
+ | (p, objs) :: tail ->
+ Fmt.pf ppf "@[<hov 1>%a %a@]"
+ Predicate.pp p
+ objlist_pp objs;
List.iter
- (fun o -> Fmt.pf ppf "@[<hov 1>%a,@]" object_pp o)
- l in
- List.iter
- (fun (p, objlist) ->
- Fmt.pf ppf "@[<hov 1>%a; %a@]"
- Predicate.pp p
- objlist_pp objlist)
- l
+ (fun (p, objs) ->
+ Fmt.pf ppf "@[<hov 1> ;\n %a %a@]"
+ Predicate.pp p
+ objlist_pp objs)
+ tail
+ | _ -> raise @@ Invalid_argument "An empty list should not be possible"
module Triples = struct