summaryrefslogtreecommitdiffstats
path: root/ocamldoc/odoc_parser.mly
diff options
context:
space:
mode:
authorMaxence Guesdon <maxence.guesdon@inria.fr>2010-05-31 11:52:13 +0000
committerMaxence Guesdon <maxence.guesdon@inria.fr>2010-05-31 11:52:13 +0000
commitceccfea6b439a338c342dbcfde5f4485a1345631 (patch)
tree024a65cc7cf1f6a3ad29ea9aec89614e8e854d3b /ocamldoc/odoc_parser.mly
parentd7b5f7e6cbd9f3b9da64d488c13abc0a95da3e6e (diff)
PR#4831: handle @before tag in ocamldoc
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@10480 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'ocamldoc/odoc_parser.mly')
-rw-r--r--ocamldoc/odoc_parser.mly18
1 files changed, 18 insertions, 0 deletions
diff --git a/ocamldoc/odoc_parser.mly b/ocamldoc/odoc_parser.mly
index 0d9d814d2..e62dcc551 100644
--- a/ocamldoc/odoc_parser.mly
+++ b/ocamldoc/odoc_parser.mly
@@ -34,6 +34,7 @@ let print_DEBUG s = print_string s; print_newline ()
%token T_VERSION
%token T_SEE
%token T_SINCE
+%token T_BEFORE
%token T_DEPRECATED
%token T_RAISES
%token T_RETURN
@@ -81,6 +82,7 @@ element:
| version { () }
| see { () }
| since { () }
+| before { () }
| deprecated { () }
| raise_exc { () }
| return { () }
@@ -122,6 +124,22 @@ see:
since:
T_SINCE Desc { since := Some $2 }
;
+before:
+ T_BEFORE Desc
+ {
+ (* isolate the version name *)
+ let s = $2 in
+ match Str.split (Str.regexp (blank^"+")) s with
+ []
+ | _ :: [] ->
+ raise (Failure "usage: @before version description")
+ | id :: _ ->
+ print_DEBUG ("version "^id);
+ let remain = String.sub s (String.length id) ((String.length s) - (String.length id)) in
+ let remain2 = Str.replace_first (Str.regexp ("^"^blank^"+")) "" remain in
+ before := !before @ [(id, remain2)]
+ }
+;
deprecated:
T_DEPRECATED Desc { deprecated := Some $2 }
;