English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
[Caml-list] start conditions in ocamllex
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2004-02-25 (19:03)
From: Shawn Wagner <shawnw@s...>
Subject: Re: [Caml-list] start conditions in ocamllex
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

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