From: Daniel de Rauglaudre <daniel.de_rauglaudre@inria.fr>
To: caml-list@inria.fr
Subject: Re: [Caml-list] camlp4: pretty printing not to a file
Date: Fri, 30 Aug 2002 10:21:18 +0200 [thread overview]
Message-ID: <20020830102118.B8876@verdot.inria.fr> (raw)
In-Reply-To: <5B049D08-BB80-11D6-9EB3-00039375801A@yahoo.com>; from jehenrik@yahoo.com on Thu, Aug 29, 2002 at 02:51:41PM -0400
Hi,
On Thu, Aug 29, 2002 at 02:51:41PM -0400, jehenrik wrote:
> Also it seems like there might be a way to take the parsing offsets
> and look back in the original pre-parsed string to get the real
> source snippet.
let getsource fname (bp, ep) =
let ic = open_in_bin fname in
let s = String.create (ep - bp) in
seek_in ic bp;
really_input ic s 0 (ep - bp);
close_in ic;
s
> EXTEND
> expr: LEVEL "expr1"
> [ LEFTA [ "REFLECTLIST"; hd = expr; "::"; tl = expr ->
> map_expr reflect_arg <:expr< [$hd$::$tl$] >>
> ] ];
> END;;
>
> let r = Grammar.Entry.parse expr (Stream.of_string "REFLECTLIST
> [1;3;5;11]");;
Input: REFLECTLIST [1;3;5;11]
The rule recognizes the keyword REFLECTLIST.
Then the rule symbol "hd = expr" recognizes the expr "[1;3;5;11]"
Then the rule expects a "::".
There is no "::".
Therefore: syntax error.
> let r = Grammar.Entry.parse expr (Stream.of_string "REFLECTLIST
> 1::3::5::11::[]\
> ");;
Idem. The symbol "hd = expr" recognizes the expr "1::3::5::11::[]".
There is no "::" following it.
Therefore syntax error again.
> Can anyone please enlighten me?
And why not just:
EXTEND
expr: LEVEL "expr1"
[ LEFTA [ "REFLECTLIST"; e = expr ->
map_expr reflect_arg e
] ];
END;;
--
Daniel de RAUGLAUDRE
daniel.de_rauglaudre@inria.fr
http://cristal.inria.fr/~ddr/
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
prev parent reply other threads:[~2002-08-30 8:21 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-08-29 18:51 jehenrik
2002-08-30 7:46 ` Yann Régis-Gianas
2002-08-30 8:34 ` Daniel de Rauglaudre
2002-09-05 16:29 ` jehenrik
2002-09-06 1:36 ` Daniel de Rauglaudre
2002-09-06 9:09 ` Yann Régis-Gianas
2002-09-06 12:29 ` Daniel de Rauglaudre
2002-09-06 16:35 ` jehenrik
2002-09-06 17:13 ` Daniel de Rauglaudre
2002-09-06 16:45 ` jehenrik
2002-08-30 8:21 ` Daniel de Rauglaudre [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20020830102118.B8876@verdot.inria.fr \
--to=daniel.de_rauglaudre@inria.fr \
--cc=caml-list@inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox