Skip to content

Commit

Permalink
deriving yojson
Browse files Browse the repository at this point in the history
  • Loading branch information
Niols committed Nov 6, 2019
1 parent 093bcbf commit 0ac6e8c
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 14 deletions.
4 changes: 3 additions & 1 deletion morsmall.opam
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ depends: [
"dune" {build}
"morbig" {>= "0.10.0"}
"ocaml" {>= "4.04"}
"ppx_deriving"
"ppx_deriving" {build}
"ppx_deriving_yojson" {build}
"yojson"
]

build: [
Expand Down
17 changes: 9 additions & 8 deletions src/AST.ml
Original file line number Diff line number Diff line change
Expand Up @@ -232,14 +232,15 @@ and kind =

[@@deriving
eq,
show{with_path=false},
visitors { variety = "iter"; ancestors=["Location.located_iter"]; nude=true },
visitors { variety = "map"; ancestors=["Location.located_map"]; nude=true },
visitors { variety = "reduce"; ancestors=["Location.located_reduce"]; nude=true },
visitors { variety = "mapreduce"; ancestors=["Location.located_mapreduce"]; nude=true },
visitors { variety = "iter2"; ancestors=["Location.located_iter2"]; nude=true },
visitors { variety = "map2"; ancestors=["Location.located_map2"]; nude=true },
visitors { variety = "reduce2"; ancestors=["Location.located_reduce2"]; nude=true }
show {with_path=false},
yojson {exn=true},
visitors {variety = "iter"; ancestors=["Location.located_iter"]; nude=true},
visitors {variety = "map"; ancestors=["Location.located_map"]; nude=true},
visitors {variety = "reduce"; ancestors=["Location.located_reduce"]; nude=true},
visitors {variety = "mapreduce"; ancestors=["Location.located_mapreduce"]; nude=true},
visitors {variety = "iter2"; ancestors=["Location.located_iter2"]; nude=true},
visitors {variety = "map2"; ancestors=["Location.located_map2"]; nude=true},
visitors {variety = "reduce2"; ancestors=["Location.located_reduce2"]; nude=true}
]

let default_redirection_descriptor = function
Expand Down
4 changes: 2 additions & 2 deletions src/dune
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
(library
(name morsmall)
(public_name morsmall)
(preprocess (pps ppx_deriving.std visitors.ppx))
(libraries morbig morsmall.utilities visitors.runtime)
(preprocess (pps ppx_deriving.std visitors.ppx ppx_deriving_yojson))
(libraries morbig morsmall.utilities visitors.runtime yojson)
(flags :standard -w +A-4-30-42))
6 changes: 3 additions & 3 deletions src/location.ml
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,17 @@ type lexing_position = Morbig.CST.lexing_position =
pos_lnum : int ;
pos_bol : int ;
pos_cnum : int }
[@@deriving eq, show{with_path=false}]
[@@deriving eq, show {with_path=false}, yojson]

type position = Morbig.CST.position =
{ start_p : lexing_position ;
end_p : lexing_position }
[@@deriving eq, show{with_path=false}]
[@@deriving eq, show {with_path=false}, yojson]

type 'a located = 'a Morbig.CST.located =
{ value : 'a ;
position : position }
[@@deriving eq, show{with_path=false}]
[@@deriving eq, show {with_path=false}, yojson]

class virtual ['a] located_iter = ['a] Morbig.CST.located_iter
class virtual ['a] located_map = ['a] Morbig.CST.located_map
Expand Down

0 comments on commit 0ac6e8c

Please sign in to comment.