diff options
author | Drup <drupyog@zoho.com> | 2015-12-02 15:20:26 +0100 |
---|---|---|
committer | Drup <drupyog@zoho.com> | 2015-12-09 14:26:06 +0100 |
commit | 4f6e4144ffb339eb785d475fa342c47aa8682daf (patch) | |
tree | b930dcc911a7310347f55f16af5a2185485bfd18 | |
parent | f8f68bd329375fd61e33781f61deeaeec2733f4b (diff) | |
download | ocaml-4f6e4144ffb339eb785d475fa342c47aa8682daf.tar.gz |
Add signature payloads for extension and attributes.
-rw-r--r-- | parsing/ast_mapper.ml | 1 | ||||
-rw-r--r-- | parsing/parser.mly | 1 | ||||
-rw-r--r-- | parsing/parsetree.mli | 1 | ||||
-rw-r--r-- | parsing/pprintast.ml | 1 | ||||
-rw-r--r-- | parsing/printast.ml | 1 |
5 files changed, 5 insertions, 0 deletions
diff --git a/parsing/ast_mapper.ml b/parsing/ast_mapper.ml index cf405af921..0b6a4ee895 100644 --- a/parsing/ast_mapper.ml +++ b/parsing/ast_mapper.ml @@ -618,6 +618,7 @@ let default_mapper = payload = (fun this -> function | PStr x -> PStr (this.structure this x) + | PSig x -> PSig (this.signature this x) | PTyp x -> PTyp (this.typ this x) | PPat (x, g) -> PPat (this.pat this x, map_opt (this.expr this) g) ); diff --git a/parsing/parser.mly b/parsing/parser.mly index c8c05d1591..fa403dfb9c 100644 --- a/parsing/parser.mly +++ b/parsing/parser.mly @@ -2400,6 +2400,7 @@ item_extension: ; payload: structure { PStr $1 } + | COLON signature { PSig $2 } | COLON core_type { PTyp $2 } | QUESTION pattern { PPat ($2, None) } | QUESTION pattern WHEN seq_expr { PPat ($2, Some $4) } diff --git a/parsing/parsetree.mli b/parsing/parsetree.mli index 8f9083dd5d..5e6edbf140 100644 --- a/parsing/parsetree.mli +++ b/parsing/parsetree.mli @@ -41,6 +41,7 @@ and attributes = attribute list and payload = | PStr of structure + | PSig of signature (* : SIG *) | PTyp of core_type (* : T *) | PPat of pattern * expression option (* ? P or ? P when E *) diff --git a/parsing/pprintast.ml b/parsing/pprintast.ml index 0ed6e34eef..03dcfb0ac7 100644 --- a/parsing/pprintast.ml +++ b/parsing/pprintast.ml @@ -1019,6 +1019,7 @@ class printer ()= object(self:'self) self#item_attributes attrs | PStr x -> self#structure f x | PTyp x -> pp f ":"; self#core_type f x + | PSig x -> pp f ":"; self#signature f x | PPat (x, None) -> pp f "?"; self#pattern f x | PPat (x, Some e) -> pp f "?"; self#pattern f x; diff --git a/parsing/printast.ml b/parsing/printast.ml index c3bb4b0289..c29a8c118a 100644 --- a/parsing/printast.ml +++ b/parsing/printast.ml @@ -402,6 +402,7 @@ and attributes i ppf l = and payload i ppf = function | PStr x -> structure i ppf x + | PSig x -> signature i ppf x | PTyp x -> core_type i ppf x | PPat (x, None) -> pattern i ppf x | PPat (x, Some g) -> |