* [Caml-list] [PATCH] genlex documentation fix
@ 2004-04-09 14:02 Paul Guyot
0 siblings, 0 replies; only message in thread
From: Paul Guyot @ 2004-04-09 14:02 UTC (permalink / raw)
To: caml-list
[-- Attachment #1: Type: text/plain, Size: 1180 bytes --]
Hello,
The sample code in the genlex module documentation is broken.
Attached (and below) is a patch to fix it from the CVS version.
Paul
----
Index: genlex.mli
===================================================================
RCS file: /caml/ocaml/stdlib/genlex.mli,v
retrieving revision 1.8
diff -u -r1.8 genlex.mli
--- genlex.mli 2001/12/07 13:40:51 1.8
+++ genlex.mli 2004/04/09 13:59:13
@@ -29,12 +29,16 @@
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
- and parse_remainder n1 = parser
+
+ let rec parse_expr = parser
+ [< 'Int n>] -> n
+ | [< 'Kwd "(";
+ n = parse_expr;
+ n2 = parse_remainder n;
+ 'Kwd ")" >] -> n2
+ and parse_remainder n1 = parser
[< 'Kwd "+"; n2 = parse_expr >] -> n1+n2
+ | [< 'Kwd "-"; n2 = parse_expr >] -> n1-n2
| ...
]}
*)
[-- Attachment #2.1: %genlex.mli.diff --]
[-- Type: application/applefile, Size: 125 bytes --]
[-- Attachment #2.2: genlex.mli.diff --]
[-- Type: application/octet-stream, Size: 1025 bytes --]
Index: genlex.mli
===================================================================
RCS file: /caml/ocaml/stdlib/genlex.mli,v
retrieving revision 1.8
diff -u -r1.8 genlex.mli
--- genlex.mli 2001/12/07 13:40:51 1.8
+++ genlex.mli 2004/04/09 14:01:42
@@ -29,12 +29,16 @@
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
- and parse_remainder n1 = parser
+
+ let rec parse_expr = parser
+ [< 'Int n>] -> n
+ | [< 'Kwd "(";
+ n = parse_expr;
+ n2 = parse_remainder n;
+ 'Kwd ")" >] -> n2
+ and parse_remainder n1 = parser
[< 'Kwd "+"; n2 = parse_expr >] -> n1+n2
+ | [< 'Kwd "-"; n2 = parse_expr >] -> n1-n2
| ...
]}
*)
[-- Attachment #3: Type: text/plain, Size: 151 bytes --]
--
Philosophie de baignoire - consultations sur rendez-vous.
NPDS/NewtonOS: http://newton.kallisys.net:8080/
Apache/FreeBSD: http://www.kallisys.com/
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2004-04-09 14:08 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-04-09 14:02 [Caml-list] [PATCH] genlex documentation fix Paul Guyot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox