On 07-10-2010, Obelisk <[email protected]> wrote:
> How can you use regexp to declare the rule "ignore all /* ... */". I
> tried and come up with :
>
> rule token = parse
>| "/*"[^'*''/']*"*/"                       { token lexbuf }
>
> But if I use that, my "comment" may not contain the * or / although it
> isn 't form the term "*/"
> My mean is how can you check for a comment block, then ignore it, then
> start a new check forward ... and so on .. ?

A quick answer (you will need to check):

You need to define a rule comment and call it recursively:

rule token = parse
| "/*"     { comment lexbuf }
....
and comment = parse
| "*/"     { token lexbuf }   (* Go back to normal parsing *)
| .        { comment lexbuf } (* Skip a char *)

Regards,
Sylvain Le Gall

-- 
You received this message because you are subscribed to the Google Groups 
"ocaml-developer" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/ocaml-developer?hl=en
For other OCaml forums, see http://caml.inria.fr/resources/forums.en.html

Reply via email to