Use syntax extension for parsing stanza

Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
This commit is contained in:
Rudi Grinberg 2018-07-18 13:45:10 +02:00
parent bac0a35785
commit 655c10164d
2 changed files with 7 additions and 5 deletions

View File

@ -1,7 +1,6 @@
type stanza = Stanza.t = ..
module Stanza = struct
open Import
open Stanza.Of_sexp
let field_oslu name = Ordered_set_lang.Unexpanded.field name
@ -38,9 +37,10 @@ module Stanza = struct
(pat, configs))
let t =
Syntax.since Stanza.syntax (1, 0) >>= fun () ->
loc >>= fun loc ->
repeat rule >>| fun rules ->
let%map () = Syntax.since Stanza.syntax (1, 0)
and loc = loc
and rules = repeat rule
in
{ loc; rules }
end

View File

@ -1592,7 +1592,9 @@ module Stanzas = struct
(let%map () = Syntax.since Stanza.syntax (1, 0)
and t = Tests.single in
[Tests t])
; "env", Dune_env.Stanza.t >>| fun x -> [Dune_env.T x]
; "env",
(let%map x = Dune_env.Stanza.t in
[Dune_env.T x])
]
let jbuild_parser =