That was the correct code, except you shouldn't have tested it in the shell : $ camlp4of -str "DELETE_RULE Gram bar: \"foo\"; LIDENT; bar END" Gram.delete_rule bar [ Gram.Skeyword "foo"; Gram.Stoken (((fun | LIDENT ((_)) -> true | _ -> false), "LIDENT ((_))")); Gram.Snterm (Gram.Entry.obj (bar : 'bar Gram.Entry.t)) ] You can have the exact "LIDENT _" output with (`LIDENT _), though i'm not sure it changes the end result. On Wed, Jul 22, 2009 at 12:35 AM, Serge Leblanc<serge.leblanc@orange.fr> wrote: > In the attached exemple, the DELETE_RULE raise an exception Not_found. > The statement DELETE_RULE Gram foo: "foo"; LIDENT; END bar is exploded as > follows : > > $ camlp4of -str "DELETE_RULE Gram foo: "foo"; LIDENT; bar END" > > Gram.delete_rule foo > [ Gram.Snterm (Gram.Entry.obj (foo : 'foo Gram.Entry.t)); > Gram.Stoken > (((function | LIDENT ((_)) -> true | _ -> false), "LIDENT ((_))")); > Gram.Snterm (Gram.Entry.obj (bar : 'bar Gram.Entry.t)) ] > > while the running example is the following : > > Gram.delete_rule foo > [ Gram.Skeyword "foo"; > Gram.Stoken > (((function | LIDENT ((_)) -> true | _ -> false), "LIDENT _")); > Gram.Snterm (Gram.Entry.obj (bar : 'bar Gram.Entry.t)) ] > > How do I write the rule DELETE_RULE to work in this case? > -- > Serge Leblanc > gpg --keyserver hkp://keyserver.ubuntu.com:11371 --recv-keys 0x33243C1B > Fingerprint = 066C 005F 5595 D85C 7673 D969 1DD4 90C4 3324 3C1B
-- Serge Leblanc gpg --keyserver hkp://keyserver.ubuntu.com:11371 --recv-keys 0x33243C1B Fingerprint = 066C 005F 5595 D85C 7673 D969 1DD4 90C4 3324 3C1B |
|