caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Joel Reymont <joelr1@gmail.com>
To: OCaml List <caml-list@inria.fr>
Cc: Nicolas Pouillard <nicolas.pouillard@gmail.com>
Subject: GenerateFold
Date: Thu, 31 May 2007 13:18:55 +0100	[thread overview]
Message-ID: <5F8F1647-A4A8-4C71-9958-9370C44ECB84@gmail.com> (raw)

What is the proper use of GenerateFold here?

What I'm trying to do is dig into my AST tree, starting with a list  
of statements at the top, to find out if I have any `FunArgDecl bits.

At the top of the AST I have

statement =
     [
     | `InputDecls of input_decl list
     ]

and then

input_decl =
     [
     | `InputDecl of id * ty * expr
     | `FunArgDecl of id * ty * subscript
     ]

I tried the following approach but it's obviously wrong.

class fold = Camlp4Filters.GenerateFold.generated;;

let is_fun_arg = object
   inherit fold as super
   method input_decl x =
     match super#input_decl x with
       | `FunArgDecl _ -> true
       | _             -> false
end

let is_fun x = is_fun_arg#statement x;;

	Thanks, Joel

--
http://topdog.cc      - EasyLanguage to C# translator
http://wagerlabs.com  - Blog






             reply	other threads:[~2007-05-31 12:18 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-31 12:18 Joel Reymont [this message]
2007-05-31 15:29 ` GenerateFold Nicolas Pouillard
2007-05-31 17:41   ` GenerateFold Joel Reymont
2007-05-31 18:58   ` GenerateFold Joel Reymont
2007-05-31 22:05     ` GenerateFold Nicolas Pouillard
2007-05-31 22:16       ` GenerateFold Joel Reymont
2007-05-31 22:34       ` GenerateFold Joel Reymont
2007-06-01  6:08         ` [Caml-list] GenerateFold Edgar Friendly
2007-06-01 13:22           ` Joel Reymont
2007-06-01 13:30             ` Nicolas Pouillard
2007-06-01 13:44               ` Joel Reymont
2007-06-01 16:07                 ` Nicolas Pouillard
2007-06-05 12:25                   ` Nicolas Pouillard

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=5F8F1647-A4A8-4C71-9958-9370C44ECB84@gmail.com \
    --to=joelr1@gmail.com \
    --cc=caml-list@inria.fr \
    --cc=nicolas.pouillard@gmail.com \
    /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;
as well as URLs for NNTP newsgroup(s).