Browse thread
camlp4 stream parser syntax
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Daniel de Rauglaudre <daniel.de_rauglaudre@i...> |
| Subject: | Re: Re : Re : [Caml-list] Re: camlp4 stream parser syntax |
Hi
On Sun, Mar 08, 2009 at 08:25:23AM +0000, Joel Reymont wrote:
> How can I make camlp4 parsing case-insensitive?
I think it should work with doing the two following things (both):
1/ Change your lexer to generate case-insensitive tokens.
2/ Use the field "tok_match" of the interface with the lexer. Redefining
it allows you to match some token pattern with the corresponding token.
See doc (camlp5) in:
http://pauillac.inria.fr/~ddr/camlp5/doc/htmlc/grammars.html#b:The-lexer-record
In the example "default_match", change the test "if con = p_con" into
"if String.lowercase con = p_con".
Don't know if it still works with Camlp4, but you can often use the
Camlp5 documentation even for many Camlp4 features.
--
Daniel de Rauglaudre
http://pauillac.inria.fr/~ddr/