From: Daniel de Rauglaudre <daniel.de_rauglaudre@inria.fr>
To: caml-list@inria.fr
Subject: Re: [Caml-list] camlp4 -- troubles with printer
Date: Thu, 12 Sep 2002 16:36:05 +0200 [thread overview]
Message-ID: <20020912163605.D12219@verdot.inria.fr> (raw)
In-Reply-To: <20020911235922.A633@max.home>; from max630@mail.ru on Wed, Sep 11, 2002 at 11:59:22PM +0700
Hi,
On Wed, Sep 11, 2002 at 11:59:22PM +0700, Max Kirillov wrote:
> Let's consider the attached file. It splits a file at words
> "WHERE", reverses the order of the pieces, and concat them
> back.
> [...]
> : $camlp4o ./syntax1.cmo pr_o.cmo test.ml
> : let _ = print_string "1\n"; flush stdout
> : WHERE
> : let _ = print_string "2\n"; flush stdoutUncaught exception: End_of_file
The problem is indeed due to the locations in your resulting syntax tree
which are not (no more) in order.
By default pr_o.cmo considers that the locations of the phrases of the
resulting syntax tree are in increasing order. It uses them to print
the comments and/or the empty lines between the phrases (and in the
beginning and the end of the file).
The first two lines of your printed result:
let _ = print_string "1\n"; flush stdout
WHERE
corresponds for pr_o.cmo to the "comments" of the beginning of the file,
since your first phrase is actually the one with print_string "2\n".
If your resulting syntax tree does not respect the order of locations,
the solution is to use the option -sep added by pr_o.cmo:
camlp4o ./syntax1.cmo pr_o.cmo -sep "\n\n" test.ml
This options tells pr_o.cmo not to read the source file to print the
comments between phrases, but print an empty line ("\n\n") instead.
--
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
next prev parent reply other threads:[~2002-09-12 14:36 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-09-11 16:59 Max Kirillov
2002-09-12 14:36 ` Daniel de Rauglaudre [this message]
2002-09-12 17:59 ` Max Kirillov
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=20020912163605.D12219@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