Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

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: -- (:)
From: Sean Proctor <sproctor@c...>
Subject: [Caml-list] start conditions in ocamllex

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

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.


To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: