diff options
author | Alain Frisch <alain@frisch.fr> | 2013-04-10 17:26:55 +0000 |
---|---|---|
committer | Alain Frisch <alain@frisch.fr> | 2013-04-10 17:26:55 +0000 |
commit | ee5f754a42fa42f69cc70283bb033ea2be1ce6f1 (patch) | |
tree | 58967ecffa45177a8d93a104c9d70e10f05e41a4 /parsing/ast_helper.ml | |
parent | cb38ccc346a8ef0a240d70cdd02375ca90c15005 (diff) |
Attributes and extension points in class_expr.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/extension_points@13500 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'parsing/ast_helper.ml')
-rw-r--r-- | parsing/ast_helper.ml | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/parsing/ast_helper.ml b/parsing/ast_helper.ml index d87353e13..e5720bbf3 100644 --- a/parsing/ast_helper.ml +++ b/parsing/ast_helper.ml @@ -162,14 +162,21 @@ module Str = struct end module Cl = struct - let mk ?(loc = Location.none) d = {pcl_desc = d; pcl_loc = loc} - - let constr ?loc a b = mk ?loc (Pcl_constr (a, b)) - let structure ?loc a = mk ?loc (Pcl_structure a) - let fun_ ?loc a b c d = mk ?loc (Pcl_fun (a, b, c, d)) - let apply ?loc a b = mk ?loc (Pcl_apply (a, b)) - let let_ ?loc a b c = mk ?loc (Pcl_let (a, b, c)) - let constraint_ ?loc a b = mk ?loc (Pcl_constraint (a, b)) + let mk ?(loc = Location.none) ?(attrs = []) d = + { + pcl_desc = d; + pcl_loc = loc; + pcl_attributes = attrs; + } + let attr d a = {d with pcl_attributes = d.pcl_attributes @ [a]} + + let constr ?loc ?attrs a b = mk ?loc ?attrs (Pcl_constr (a, b)) + let structure ?loc ?attrs a = mk ?loc ?attrs (Pcl_structure a) + let fun_ ?loc ?attrs a b c d = mk ?loc ?attrs (Pcl_fun (a, b, c, d)) + let apply ?loc ?attrs a b = mk ?loc ?attrs (Pcl_apply (a, b)) + let let_ ?loc ?attrs a b c = mk ?loc ?attrs (Pcl_let (a, b, c)) + let constraint_ ?loc ?attrs a b = mk ?loc ?attrs (Pcl_constraint (a, b)) + let extension ?loc ?attrs a = mk ?loc ?attrs (Pcl_extension a) end module Cty = struct |