From: Martin Jambon <martin_jambon@emailuser.net>
To: Dmitry Bely <dbely@mail.ru>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] camlp4 pa_macro (doc request)
Date: Tue, 6 Sep 2005 12:35:35 -0700 (PDT) [thread overview]
Message-ID: <Pine.LNX.4.63.0509061217210.5451@droopy> (raw)
In-Reply-To: <wtluk4ap.fsf@mail.ru>
On Tue, 6 Sep 2005, Dmitry Bely wrote:
> Another question: is there an up-to-date Camlp4
> manual with all standard extensions (like pa_macro) properly documented?
I copy-pasted what the source file says.
I guess I could setup a web page with examples. Of course, it would be
better if it were included in the official documentation.
Thanks,
Martin
>From camlp4/meta/pa_macro.ml:
(*
Added statements:
At toplevel (structure item):
DEFINE <uident>
DEFINE <uident> = <expression>
DEFINE <uident> (<parameters>) = <expression>
IFDEF <uident> THEN <structure_items> (END | ENDIF)
IFDEF <uident> THEN <structure_items> ELSE <structure_items> (END | ENDIF)
IFNDEF <uident> THEN <structure_items> (END | ENDIF)
IFNDEF <uident> THEN <structure_items> ELSE <structure_items> (END | ENDIF)
INCLUDE <string>
In expressions:
IFDEF <uident> THEN <expression> ELSE <expression> (END | ENDIF)
IFNDEF <uident> THEN <expression> ELSE <expression> (END | ENDIF)
__FILE__
__LOCATION__
In patterns:
IFDEF <uident> THEN <pattern> ELSE <pattern> (END | ENDIF)
IFNDEF <uident> THEN <pattern> ELSE <pattern> (END | ENDIF)
As Camlp4 options:
-D<uident> define <uident>
-U<uident> undefine it
-I<dir> add <dir> to the search path for INCLUDE'd
files
After having used a DEFINE <uident> followed by "= <expression>", you
can use it in expressions *and* in patterns. If the expression defining
the macro cannot be used as a pattern, there is an error message if
it is used in a pattern.
The toplevel statement INCLUDE <string> can be used to include a
file containing macro definitions; note that files included in such
a way can not have any non-macro toplevel items. The included files
are looked up in directories passed in via the -I option, falling
back to the current directory.
The expression __FILE__ returns the current compiled file name.
The expression __LOCATION__ returns the current location of itself.
*)
next prev parent reply other threads:[~2005-09-06 19:36 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-09-06 8:07 camlp4 pa_macro Dmitry Bely
2005-09-06 19:35 ` Martin Jambon [this message]
2005-09-06 21:55 ` [Caml-list] camlp4 pa_macro (doc request) Remi Vanicat
2005-09-07 8:29 ` [Caml-list] camlp4 pa_macro Dmitry Bely
2005-09-07 8:40 ` Remi Vanicat
2005-09-07 12:03 ` Peter Jolly
2005-09-07 12:28 ` Basile STARYNKEVITCH
2005-09-07 19:46 ` Jonathan Roewen
2005-09-08 8:47 ` Dmitry Bely
2005-09-08 12:48 ` David MENTRE
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=Pine.LNX.4.63.0509061217210.5451@droopy \
--to=martin_jambon@emailuser.net \
--cc=caml-list@inria.fr \
--cc=dbely@mail.ru \
/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