diff options
author | Gabriel Scherer <gabriel.scherer@gmail.com> | 2013-04-28 14:28:55 +0000 |
---|---|---|
committer | Gabriel Scherer <gabriel.scherer@gmail.com> | 2013-04-28 14:28:55 +0000 |
commit | c089c9a6dd8336e7be30cdc20a2f513cffd9fa2b (patch) | |
tree | ac7b1dbb2c9d0bbc12661ab9974a56257d4dc711 /stdlib | |
parent | 35d1dde122fe33f61becc4ab8f668add07ab87f9 (diff) |
fix the buggy parser example in the Genlex documentation (issue reported by Armael Geneau)
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@13613 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'stdlib')
-rw-r--r-- | stdlib/genlex.mli | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/stdlib/genlex.mli b/stdlib/genlex.mli index 8ab9902b1..961012870 100644 --- a/stdlib/genlex.mli +++ b/stdlib/genlex.mli @@ -27,13 +27,14 @@ to, for instance, [int], and would have rules such as: {[ - let parse_expr = parser - [< 'Int n >] -> n - | [< 'Kwd "("; n = parse_expr; 'Kwd ")" >] -> n - | [< n1 = parse_expr; n2 = parse_remainder n1 >] -> n2 + let rec parse_expr = parser + | [< n1 = parse_atom; n2 = parse_remainder n1 >] -> n2 + and parse_atom = parser + | [< 'Int n >] -> n + | [< 'Kwd "("; n = parse_expr; 'Kwd ")" >] -> n and parse_remainder n1 = parser - [< 'Kwd "+"; n2 = parse_expr >] -> n1+n2 - | ... + | [< 'Kwd "+"; n2 = parse_expr >] -> n1+n2 + | [< >] -> n1 ]} One should notice that the use of the [parser] keyword and associated |