Version française
Home     About     Download     Resources     Contact us    
Browse thread
Question re: camlp4 parser
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Paul Snively <psnively@m...>
Subject: Re: [Caml-list] Question re: camlp4 parser
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


On Jul 27, 2005, at 12:04 AM, Virgile Prevosto wrote:

> As any other pattern, stream patterns can be refined with a 'when'  
> condition:
>
> let printable s =
>  let buf = Buffer.create 100 in
>  let rec aux = parser
>    | [< '' '..'~' as c when c <> '=' && c <> '[';
>         x = (Buffer.add_char buf c; aux) >] -> x
>    | [< >] -> Buffer.contents buf
>  in aux s ;;
>
> should do the trick. It might not be that convenient for a more
> complex set of excluded characters, but it is possible to write a char
> -> bool test outside of the stream parser.
>
Of course: it's all becoming quite clear now. Thanks for the  
excellent suggestion and your patience with my naïvete. :-)

> -- 
> E tutto per oggi, a la prossima volta
> Virgile
>
> _______________________________________________
> Caml-list mailing list. Subscription management:
> http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
> Archives: http://caml.inria.fr
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs

Best regards,
Paul Snively



-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (Darwin)

iEYEARECAAYFAkLoNH8ACgkQO3fYpochAqI94gCfXosjSfFZAbtanYQstgCjYLfY
HqUAoIWd4QpsWhynHyj8A6WJDqWOP61B
=BKDa
-----END PGP SIGNATURE-----