Skip to content

Commit

Permalink
bootstrap
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeremie Dimino committed Apr 17, 2014
1 parent 9c66aad commit cedd52a
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 49 deletions.
4 changes: 2 additions & 2 deletions camlp4/Camlp4/Printers/OCaml.ml
Expand Up @@ -845,7 +845,7 @@ module Make (Syntax : Sig.Camlp4Syntax) = struct
| <:sig_item< module rec $mb$ >> ->
pp f "@[<2>module rec %a%(%)@]"
o#module_rec_binding mb semisep
| <:sig_item< # $_$ $_$ >> -> ()
| Ast.SgDir _ _ _ -> ()
| <:sig_item< $anti:s$ >> ->
pp f "%a%(%)" o#anti s semisep ];

Expand Down Expand Up @@ -901,7 +901,7 @@ module Make (Syntax : Sig.Camlp4Syntax) = struct
pp f "@[<hv2>class %a%(%)@]" o#class_declaration ce semisep
| <:str_item< module rec $mb$ >> ->
pp f "@[<2>module rec %a%(%)@]" o#module_rec_binding mb semisep
| <:str_item< # $_$ $_$ >> -> ()
| Ast.StDir _ _ _ -> ()
| <:str_item< $anti:s$ >> -> pp f "%a%(%)" o#anti s semisep
| Ast.StExc _ _ (Ast.OAnt _) -> assert False ];

Expand Down
34 changes: 19 additions & 15 deletions camlp4/boot/Camlp4.ml
Expand Up @@ -1142,7 +1142,7 @@ module Sig =
| (* sg ; sg *)
SgSem of loc * sig_item * sig_item
| (* # s or # s e *)
SgDir of loc * string * expr
SgDir of loc * string * expr list
| (* exception t *)
SgExc of loc * ctyp
| (* external s : t = s ... s *)
Expand Down Expand Up @@ -1242,7 +1242,7 @@ module Sig =
| (* st ; st *)
StSem of loc * str_item * str_item
| (* # s or # s e *)
StDir of loc * string * expr
StDir of loc * string * expr list
| (* exception t or exception t = i *)
StExc of loc * ctyp * (*FIXME*) ident meta_option
| (* e *)
Expand Down Expand Up @@ -1948,7 +1948,7 @@ module Sig =
| SgCls of loc * class_type
| SgClt of loc * class_type
| SgSem of loc * sig_item * sig_item
| SgDir of loc * string * expr
| SgDir of loc * string * expr list
| SgExc of loc * ctyp
| SgExt of loc * string * ctyp * string meta_list
| SgInc of loc * module_type
Expand Down Expand Up @@ -2003,7 +2003,7 @@ module Sig =
| StCls of loc * class_expr
| StClt of loc * class_type
| StSem of loc * str_item * str_item
| StDir of loc * string * expr
| StDir of loc * string * expr list
| StExc of loc * ctyp * ident meta_option
| StExp of loc * expr
| StExt of loc * string * ctyp * string meta_list
Expand Down Expand Up @@ -9642,7 +9642,7 @@ module Struct =
(Ast.IdUid (_loc, "SgDir")))))),
(meta_loc _loc x0))),
(meta_string _loc x1))),
(meta_expr _loc x2))
(meta_list meta_expr _loc x2))
| Ast.SgSem (x0, x1, x2) ->
Ast.ExApp (_loc,
(Ast.ExApp (_loc,
Expand Down Expand Up @@ -9796,7 +9796,7 @@ module Struct =
(Ast.IdUid (_loc, "StDir")))))),
(meta_loc _loc x0))),
(meta_string _loc x1))),
(meta_expr _loc x2))
(meta_list meta_expr _loc x2))
| Ast.StSem (x0, x1, x2) ->
Ast.ExApp (_loc,
(Ast.ExApp (_loc,
Expand Down Expand Up @@ -12079,7 +12079,7 @@ module Struct =
(Ast.IdUid (_loc, "SgDir")))))),
(meta_loc _loc x0))),
(meta_string _loc x1))),
(meta_expr _loc x2))
(meta_list meta_expr _loc x2))
| Ast.SgSem (x0, x1, x2) ->
Ast.PaApp (_loc,
(Ast.PaApp (_loc,
Expand Down Expand Up @@ -12233,7 +12233,7 @@ module Struct =
(Ast.IdUid (_loc, "StDir")))))),
(meta_loc _loc x0))),
(meta_string _loc x1))),
(meta_expr _loc x2))
(meta_list meta_expr _loc x2))
| Ast.StSem (x0, x1, x2) ->
Ast.PaApp (_loc,
(Ast.PaApp (_loc,
Expand Down Expand Up @@ -12414,7 +12414,8 @@ module Struct =
| StDir (_x, _x_i1, _x_i2) ->
let _x = o#loc _x in
let _x_i1 = o#string _x_i1 in
let _x_i2 = o#expr _x_i2 in StDir (_x, _x_i1, _x_i2)
let _x_i2 = o#list (fun o -> o#expr) _x_i2
in StDir (_x, _x_i1, _x_i2)
| StExc (_x, _x_i1, _x_i2) ->
let _x = o#loc _x in
let _x_i1 = o#ctyp _x_i1 in
Expand Down Expand Up @@ -12477,7 +12478,8 @@ module Struct =
| SgDir (_x, _x_i1, _x_i2) ->
let _x = o#loc _x in
let _x_i1 = o#string _x_i1 in
let _x_i2 = o#expr _x_i2 in SgDir (_x, _x_i1, _x_i2)
let _x_i2 = o#list (fun o -> o#expr) _x_i2
in SgDir (_x, _x_i1, _x_i2)
| SgExc (_x, _x_i1) ->
let _x = o#loc _x in
let _x_i1 = o#ctyp _x_i1 in SgExc (_x, _x_i1)
Expand Down Expand Up @@ -13405,7 +13407,8 @@ module Struct =
let o = o#str_item _x_i2 in o
| StDir (_x, _x_i1, _x_i2) ->
let o = o#loc _x in
let o = o#string _x_i1 in let o = o#expr _x_i2 in o
let o = o#string _x_i1 in
let o = o#list (fun o -> o#expr) _x_i2 in o
| StExc (_x, _x_i1, _x_i2) ->
let o = o#loc _x in
let o = o#ctyp _x_i1 in
Expand Down Expand Up @@ -13454,7 +13457,8 @@ module Struct =
let o = o#sig_item _x_i2 in o
| SgDir (_x, _x_i1, _x_i2) ->
let o = o#loc _x in
let o = o#string _x_i1 in let o = o#expr _x_i2 in o
let o = o#string _x_i1 in
let o = o#list (fun o -> o#expr) _x_i2 in o
| SgExc (_x, _x_i1) ->
let o = o#loc _x in let o = o#ctyp _x_i1 in o
| SgExt (_x, _x_i1, _x_i2, _x_i3) ->
Expand Down Expand Up @@ -16258,9 +16262,8 @@ module Struct =

let str_item ast = str_item ast []

let directive =
let directive_arg =
function
| Ast.ExNil _ -> Pdir_none
| ExStr (_, s) -> Pdir_string s
| ExInt (_, i) -> Pdir_int (int_of_string i)
| Ast.ExId (_, (Ast.IdUid (_, "True"))) -> Pdir_bool true
Expand All @@ -16269,7 +16272,8 @@ module Struct =

let phrase =
function
| StDir (_, d, dp) -> Ptop_dir (d, (directive dp))
| StDir (_, d, args) ->
Ptop_dir (d, (List.map directive_arg args))
| si -> Ptop_def (str_item si)

let attribute loc s str =
Expand Down
72 changes: 40 additions & 32 deletions camlp4/boot/camlp4boot.ml
Expand Up @@ -8178,15 +8178,16 @@ New syntax:\
Gram.Snterm
(Gram.Entry.obj
(a_LIDENT : 'a_LIDENT Gram.Entry.t));
Gram.Snterm
(Gram.Entry.obj
(opt_expr : 'opt_expr Gram.Entry.t));
Gram.Slist0
(Gram.Snterm
(Gram.Entry.obj
(expr : 'expr Gram.Entry.t)));
Gram.Snterm
(Gram.Entry.obj (semi : 'semi Gram.Entry.t)) ],
(Gram.Action.mk
(fun _ (dp : 'opt_expr) (n : 'a_LIDENT) _
(fun _ (args : 'expr list) (n : 'a_LIDENT) _
(_loc : Gram.Loc.t) ->
(([ Ast.SgDir (_loc, n, dp) ],
(([ Ast.SgDir (_loc, n, args) ],
(stopped_at _loc)) : 'interf)))) ]) ]))
());
Gram.extend (sig_items : 'sig_items Gram.Entry.t)
Expand Down Expand Up @@ -8279,15 +8280,16 @@ New syntax:\
Gram.Snterm
(Gram.Entry.obj
(a_LIDENT : 'a_LIDENT Gram.Entry.t));
Gram.Snterm
(Gram.Entry.obj
(opt_expr : 'opt_expr Gram.Entry.t));
Gram.Slist0
(Gram.Snterm
(Gram.Entry.obj
(expr : 'expr Gram.Entry.t)));
Gram.Snterm
(Gram.Entry.obj (semi : 'semi Gram.Entry.t)) ],
(Gram.Action.mk
(fun _ (dp : 'opt_expr) (n : 'a_LIDENT) _
(fun _ (args : 'expr list) (n : 'a_LIDENT) _
(_loc : Gram.Loc.t) ->
(([ Ast.StDir (_loc, n, dp) ],
(([ Ast.StDir (_loc, n, args) ],
(stopped_at _loc)) : 'implem)))) ]) ]))
());
Gram.extend (str_items : 'str_items Gram.Entry.t)
Expand Down Expand Up @@ -8400,15 +8402,16 @@ New syntax:\
Gram.Snterm
(Gram.Entry.obj
(a_LIDENT : 'a_LIDENT Gram.Entry.t));
Gram.Snterm
(Gram.Entry.obj
(opt_expr : 'opt_expr Gram.Entry.t));
Gram.Slist0
(Gram.Snterm
(Gram.Entry.obj
(expr : 'expr Gram.Entry.t)));
Gram.Snterm
(Gram.Entry.obj (semi : 'semi Gram.Entry.t)) ],
(Gram.Action.mk
(fun _ (dp : 'opt_expr) (n : 'a_LIDENT) _
(fun _ (args : 'expr list) (n : 'a_LIDENT) _
(_loc : Gram.Loc.t) ->
(([ Ast.StDir (_loc, n, dp) ],
(([ Ast.StDir (_loc, n, args) ],
(stopped_at _loc)) : 'use_file)))) ]) ]))
());
Gram.extend (phrase : 'phrase Gram.Entry.t)
Expand All @@ -8427,15 +8430,16 @@ New syntax:\
Gram.Snterm
(Gram.Entry.obj
(a_LIDENT : 'a_LIDENT Gram.Entry.t));
Gram.Snterm
(Gram.Entry.obj
(opt_expr : 'opt_expr Gram.Entry.t));
Gram.Slist0
(Gram.Snterm
(Gram.Entry.obj
(expr : 'expr Gram.Entry.t)));
Gram.Snterm
(Gram.Entry.obj (semi : 'semi Gram.Entry.t)) ],
(Gram.Action.mk
(fun _ (dp : 'opt_expr) (n : 'a_LIDENT) _
(fun _ (args : 'expr list) (n : 'a_LIDENT) _
(_loc : Gram.Loc.t) ->
(Ast.StDir (_loc, n, dp) : 'phrase)))) ]) ]))
(Ast.StDir (_loc, n, args) : 'phrase)))) ]) ]))
());
Gram.extend (a_INT : 'a_INT Gram.Entry.t)
((fun () ->
Expand Down Expand Up @@ -9137,13 +9141,15 @@ New syntax:\
Gram.Snterm
(Gram.Entry.obj
(a_LIDENT : 'a_LIDENT Gram.Entry.t));
Gram.Snterm
(Gram.Entry.obj
(opt_expr : 'opt_expr Gram.Entry.t)) ],
Gram.Slist0
(Gram.Snterm
(Gram.Entry.obj
(expr : 'expr Gram.Entry.t))) ],
(Gram.Action.mk
(fun (dp : 'opt_expr) (n : 'a_LIDENT) _
(fun (args : 'expr list) (n : 'a_LIDENT) _
(_loc : Gram.Loc.t) ->
(Ast.StDir (_loc, n, dp) : 'str_item_quot)))) ]) ]))
(Ast.StDir (_loc, n, args) :
'str_item_quot)))) ]) ]))
());
Gram.extend (sig_item_quot : 'sig_item_quot Gram.Entry.t)
((fun () ->
Expand Down Expand Up @@ -9176,13 +9182,15 @@ New syntax:\
Gram.Snterm
(Gram.Entry.obj
(a_LIDENT : 'a_LIDENT Gram.Entry.t));
Gram.Snterm
(Gram.Entry.obj
(opt_expr : 'opt_expr Gram.Entry.t)) ],
Gram.Slist0
(Gram.Snterm
(Gram.Entry.obj
(expr : 'expr Gram.Entry.t))) ],
(Gram.Action.mk
(fun (dp : 'opt_expr) (n : 'a_LIDENT) _
(fun (args : 'expr list) (n : 'a_LIDENT) _
(_loc : Gram.Loc.t) ->
(Ast.SgDir (_loc, n, dp) : 'sig_item_quot)))) ]) ]))
(Ast.SgDir (_loc, n, args) :
'sig_item_quot)))) ]) ]))
());
Gram.extend
(module_type_quot : 'module_type_quot Gram.Entry.t)
Expand Down Expand Up @@ -15995,12 +16003,12 @@ module B =

let gind =
function
| Ast.SgDir (loc, n, (Ast.ExStr (_, s))) -> Some ((loc, n, s))
| Ast.SgDir (loc, n, ([ Ast.ExStr (_, s) ])) -> Some ((loc, n, s))
| _ -> None

let gimd =
function
| Ast.StDir (loc, n, (Ast.ExStr (_, s))) -> Some ((loc, n, s))
| Ast.StDir (loc, n, ([ Ast.ExStr (_, s) ])) -> Some ((loc, n, s))
| _ -> None

let process_intf dyn_loader name =
Expand Down

0 comments on commit cedd52a

Please sign in to comment.