Version française
Home     About     Download     Resources     Contact us    
Browse thread
GenerateFold
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Joel Reymont <joelr1@g...>
Subject: GenerateFold
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