Move Jbuild.syntax to Stanza module
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
This commit is contained in:
parent
fc968efc4d
commit
f35d068836
|
@ -28,7 +28,7 @@ module Backend = struct
|
||||||
If we wanted to make the ppx system an extension, then we
|
If we wanted to make the ppx system an extension, then we
|
||||||
would create a new one.
|
would create a new one.
|
||||||
*)
|
*)
|
||||||
let syntax = Jbuild.syntax
|
let syntax = Stanza.syntax
|
||||||
|
|
||||||
open Sexp.Of_sexp
|
open Sexp.Of_sexp
|
||||||
|
|
||||||
|
@ -128,7 +128,7 @@ include Sub_system.Register_end_point(
|
||||||
let loc t = t.loc
|
let loc t = t.loc
|
||||||
let backends t = Option.map t.backend ~f:(fun x -> [x])
|
let backends t = Option.map t.backend ~f:(fun x -> [x])
|
||||||
|
|
||||||
let syntax = Jbuild.syntax
|
let syntax = Stanza.syntax
|
||||||
|
|
||||||
open Sexp.Of_sexp
|
open Sexp.Of_sexp
|
||||||
|
|
||||||
|
|
|
@ -5,12 +5,6 @@ open Sexp.Of_sexp
|
||||||
syntax for the various supported version of the specification.
|
syntax for the various supported version of the specification.
|
||||||
*)
|
*)
|
||||||
|
|
||||||
let syntax =
|
|
||||||
Syntax.create ~name:"dune" ~desc:"the dune language"
|
|
||||||
[ (0, 0) (* Jbuild syntax *)
|
|
||||||
; (1, 0)
|
|
||||||
]
|
|
||||||
|
|
||||||
(* Deprecated *)
|
(* Deprecated *)
|
||||||
module Jbuild_version = struct
|
module Jbuild_version = struct
|
||||||
type t =
|
type t =
|
||||||
|
@ -233,10 +227,11 @@ module Dep_conf = struct
|
||||||
; "package" , (sw >>| fun x -> Package x)
|
; "package" , (sw >>| fun x -> Package x)
|
||||||
; "universe" , return Universe
|
; "universe" , return Universe
|
||||||
; "files_recursively_in",
|
; "files_recursively_in",
|
||||||
(Syntax.renamed_in syntax (1, 0) ~to_:"source_tree" >>= fun () ->
|
(Syntax.renamed_in Stanza.syntax (1, 0) ~to_:"source_tree"
|
||||||
|
>>= fun () ->
|
||||||
sw >>| fun x -> Source_tree x)
|
sw >>| fun x -> Source_tree x)
|
||||||
; "source_tree",
|
; "source_tree",
|
||||||
(Syntax.since syntax (1, 0) >>= fun () ->
|
(Syntax.since Stanza.syntax (1, 0) >>= fun () ->
|
||||||
sw >>| fun x -> Source_tree x)
|
sw >>| fun x -> Source_tree x)
|
||||||
]
|
]
|
||||||
in
|
in
|
||||||
|
@ -915,7 +910,7 @@ module Executables = struct
|
||||||
let common names public_names ~multi =
|
let common names public_names ~multi =
|
||||||
Buildable.t >>= fun buildable ->
|
Buildable.t >>= fun buildable ->
|
||||||
field "link_executables" ~default:true
|
field "link_executables" ~default:true
|
||||||
(Syntax.deleted_in syntax (1, 0) >>> bool)
|
(Syntax.deleted_in Stanza.syntax (1, 0) >>> bool)
|
||||||
>>= fun (_ : bool) ->
|
>>= fun (_ : bool) ->
|
||||||
field "link_deps" (list Dep_conf.t) ~default:[] >>= fun link_deps ->
|
field "link_deps" (list Dep_conf.t) ~default:[] >>= fun link_deps ->
|
||||||
field_oslu "link_flags" >>= fun link_flags ->
|
field_oslu "link_flags" >>= fun link_flags ->
|
||||||
|
@ -1359,10 +1354,10 @@ module Stanzas = struct
|
||||||
(Documentation.t >>| fun d ->
|
(Documentation.t >>| fun d ->
|
||||||
[Documentation d])
|
[Documentation d])
|
||||||
; "jbuild_version",
|
; "jbuild_version",
|
||||||
(Syntax.deleted_in syntax (1, 0) >>= fun () ->
|
(Syntax.deleted_in Stanza.syntax (1, 0) >>= fun () ->
|
||||||
Jbuild_version.t >>| fun _ -> [])
|
Jbuild_version.t >>| fun _ -> [])
|
||||||
; "env",
|
; "env",
|
||||||
(Syntax.since syntax (1, 0) >>= fun () ->
|
(Syntax.since Stanza.syntax (1, 0) >>= fun () ->
|
||||||
loc >>= fun loc ->
|
loc >>= fun loc ->
|
||||||
repeat Env.rule >>| fun rules ->
|
repeat Env.rule >>| fun rules ->
|
||||||
[Env { loc; rules }])
|
[Env { loc; rules }])
|
||||||
|
@ -1380,10 +1375,10 @@ module Stanzas = struct
|
||||||
[Menhir.T { x with loc }])
|
[Menhir.T { x with loc }])
|
||||||
]
|
]
|
||||||
in
|
in
|
||||||
Syntax.set syntax (0, 0) (sum stanzas)
|
Syntax.set Stanza.syntax (0, 0) (sum stanzas)
|
||||||
|
|
||||||
let () =
|
let () =
|
||||||
Dune_project.Lang.register syntax stanzas
|
Dune_project.Lang.register Stanza.syntax stanzas
|
||||||
|
|
||||||
exception Include_loop of Path.t * (Loc.t * Path.t) list
|
exception Include_loop of Path.t * (Loc.t * Path.t) list
|
||||||
|
|
||||||
|
|
|
@ -2,11 +2,6 @@
|
||||||
|
|
||||||
open Import
|
open Import
|
||||||
|
|
||||||
(** Syntax identifier for the Dune language. [(0, X)] correspond to
|
|
||||||
the Jbuild language while versions from [(1, 0)] correspond to the
|
|
||||||
Dune one. *)
|
|
||||||
val syntax : Syntax.t
|
|
||||||
|
|
||||||
(** Ppx preprocessors *)
|
(** Ppx preprocessors *)
|
||||||
module Pp : sig
|
module Pp : sig
|
||||||
type t = private string
|
type t = private string
|
||||||
|
|
|
@ -38,7 +38,7 @@ module Driver = struct
|
||||||
If we wanted to make the ppx system an extension, then we
|
If we wanted to make the ppx system an extension, then we
|
||||||
would create a new one.
|
would create a new one.
|
||||||
*)
|
*)
|
||||||
let syntax = Jbuild.syntax
|
let syntax = Stanza.syntax
|
||||||
|
|
||||||
open Sexp.Of_sexp
|
open Sexp.Of_sexp
|
||||||
|
|
||||||
|
|
|
@ -5,3 +5,9 @@ type t = ..
|
||||||
module Parser = struct
|
module Parser = struct
|
||||||
type nonrec t = string * t list Sexp.Of_sexp.t
|
type nonrec t = string * t list Sexp.Of_sexp.t
|
||||||
end
|
end
|
||||||
|
|
||||||
|
let syntax =
|
||||||
|
Syntax.create ~name:"dune" ~desc:"the dune language"
|
||||||
|
[ (0, 0) (* Jbuild syntax *)
|
||||||
|
; (1, 0)
|
||||||
|
]
|
||||||
|
|
|
@ -11,3 +11,8 @@ module Parser : sig
|
||||||
of type [t], hence the [t list] here. *)
|
of type [t], hence the [t list] here. *)
|
||||||
type nonrec t = string * t list Sexp.Of_sexp.t
|
type nonrec t = string * t list Sexp.Of_sexp.t
|
||||||
end
|
end
|
||||||
|
|
||||||
|
(** Syntax identifier for the Dune language. [(0, X)] correspond to
|
||||||
|
the Jbuild language while versions from [(1, 0)] correspond to the
|
||||||
|
Dune one. *)
|
||||||
|
val syntax : Syntax.t
|
||||||
|
|
Loading…
Reference in New Issue