From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id UAA26020; Wed, 25 Feb 2004 20:03:24 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id UAA24665 for ; Wed, 25 Feb 2004 20:03:22 +0100 (MET) Received: from speakeasy.org (dialup-67.75.199.144.Dial1.Seattle.Level3.net [67.75.199.144]) by nez-perce.inria.fr (8.12.10/8.12.10) with ESMTP id i1PJ3KIq004537 for ; Wed, 25 Feb 2004 20:03:22 +0100 Received: (from shawnw@localhost) by speakeasy.org (8.10.1/8.10.1) id i1PJ0vL12696 for caml-list@inria.fr; Wed, 25 Feb 2004 11:00:57 -0800 Date: Wed, 25 Feb 2004 11:00:56 -0800 From: Shawn Wagner To: caml-list@inria.fr Subject: Re: [Caml-list] start conditions in ocamllex Message-ID: <20040225190056.GE27866@speakeasy.org> Mail-Followup-To: caml-list@inria.fr References: <20040225180744.GA23865@ccs.neu.edu> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20040225180744.GA23865@ccs.neu.edu> User-Agent: Mutt/1.4.2i X-Miltered: at nez-perce by Joe's j-chkmail ("http://j-chkmail.ensmp.fr")! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; shawnw:01 caml-list:01 2004:99 sean:99 proctor:99 internals:01 implementor:01 entrypoint:01 shawnw:01 regexp:01 speakeasy:01 speakeasy:01 token:01 token:01 syntax:02 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Wed, Feb 25, 2004 at 01:07:44PM -0500, Sean Proctor wrote: > Hi, > > Has anyone thought of implementing start conditions for ocamllex? I have some > problems that require keeping some state. They would be very simply solved > with start conditions. I don't know much about the internals of ocamllex, but > if the implementor of it thinks this is a good idea, I would be interested in > writing this. > > I was thinking a good syntax would be something like: > regexp where condition > > ex: > condition startcondition > rule entrypoint = > parse 'a' { start startcondition; A_TOKEN } > | 'a' where startcondition { finish startcondition; B_TOKEN } > > so a string of a's would give alternating A_TOKEN and B_TOKEN. Can't you get the same effect with multiple entrypoints? Though this syntax is probably cleaner. -- Shawn Wagner shawnw@speakeasy.org ------------------- 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