From: Matthieu Wipliez <mwipliez@yahoo.fr>
To: O'Caml Mailing List <caml-list@yquem.inria.fr>
Subject: Re : Re : Re : [Caml-list] Re: camlp4 stream parser syntax
Date: Sun, 8 Mar 2009 11:45:56 +0000 (GMT) [thread overview]
Message-ID: <279881.54090.qm@web27008.mail.ukl.yahoo.com> (raw)
In-Reply-To: <46FCBABD-7E4A-4077-8227-3816FD6D635D@gmail.com>
Since I don't know how to use the filter either, I tried to find another way :-)
In your lexer, do you have something along the lines of the "calc" examples in ocamllex official documentation, like a hash table that associates strings to tokens?
In this case, here is a possible solution, you have your hash table associate a lowercase version of the token with what you'd like to use in the grammar:
"buytocover" => "BuyToCover"
"sellshort" => "SellShort"
...
And you replace the lookup with
try
IDENT (Hashtbl.find keyword_table (String.lowercase id))
with Not_found ->
IDENT id
This way identifiers that when lower-cased look like "buytocover" ("BuYTOCovEr", "bUytOcOVeR", etc.) are replaced by a single token "BuyToCover", against which you match in the grammar.
Could this satisfy your requirements?
Cheers,
Matthieu
----- Message d'origine ----
> De : Joel Reymont <joelr1@gmail.com>
> À : Matthieu Wipliez <mwipliez@yahoo.fr>
> Cc : O'Caml Mailing List <caml-list@yquem.inria.fr>
> Envoyé le : Dimanche, 8 Mars 2009, 9h25mn 23s
> Objet : Re: Re : Re : [Caml-list] Re: camlp4 stream parser syntax
>
> How can I make camlp4 parsing case-insensitive?
>
> The only approach I can think of so far is to build a really larger
> set of tokens and use them instead of strings in the parser.
>
> Any flag I can flip or way to do this without a large set of tokens?
>
> Thanks, Joel
>
> On Mar 8, 2009, at 1:08 AM, Matthieu Wipliez wrote:
>
> >
> >> Is the camlp4 grammar parser case-insensitive?
> >>
> >> Will both Delay and delay be accepted in the actionDelay rule?
> >>
> >> actionDelay: [ [ "delay"; expression ->
> >> Asthelper.failwith (convert_loc _loc)
> >> "RVC-CAL does not permit the use of delay." ] ];
> >
> > No, only "delay" is accepted.
>
>
>
> ---
> http://tinyco.de
> Mac, C++, OCaml
next prev parent reply other threads:[~2009-03-08 11:45 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-07 22:38 Joel Reymont
2009-03-07 22:52 ` Joel Reymont
2009-03-07 23:21 ` Re : [Caml-list] " Matthieu Wipliez
2009-03-07 23:42 ` Joel Reymont
2009-03-08 0:40 ` Joel Reymont
2009-03-08 1:08 ` Re : " Matthieu Wipliez
2009-03-08 8:25 ` Joel Reymont
2009-03-08 9:37 ` Daniel de Rauglaudre
2009-03-08 9:51 ` Joel Reymont
2009-03-08 10:27 ` Daniel de Rauglaudre
2009-03-08 10:35 ` Joel Reymont
2009-03-08 11:07 ` Joel Reymont
2009-03-08 11:28 ` Daniel de Rauglaudre
2009-03-08 11:45 ` Matthieu Wipliez [this message]
2009-03-08 11:52 ` Re : Re : " Joel Reymont
2009-03-08 13:33 ` Re : " Matthieu Wipliez
2009-03-08 13:59 ` Joel Reymont
2009-03-08 14:09 ` Re : " Matthieu Wipliez
2009-03-08 14:30 ` Joel Reymont
2009-03-08 15:07 ` Re : " Matthieu Wipliez
2009-03-08 15:24 ` Joel Reymont
2009-03-08 15:32 ` Re : " Matthieu Wipliez
2009-03-08 15:39 ` Joel Reymont
2009-03-08 15:46 ` Joel Reymont
2009-03-08 15:55 ` Re : " Matthieu Wipliez
2009-03-08 16:58 ` Joel Reymont
2009-03-08 17:04 ` Re : " Matthieu Wipliez
2009-03-08 17:15 ` Joel Reymont
2009-03-08 9:34 ` Joel Reymont
2009-03-07 23:52 ` [Caml-list] " Jon Harrop
2009-03-07 23:53 ` Joel Reymont
2009-03-08 0:12 ` Jon Harrop
2009-03-08 0:20 ` Re : " Matthieu Wipliez
2009-03-08 0:29 ` Jon Harrop
2009-03-08 0:30 ` Re : " Joel Reymont
2009-03-08 0:37 ` Re : " Matthieu Wipliez
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=279881.54090.qm@web27008.mail.ukl.yahoo.com \
--to=mwipliez@yahoo.fr \
--cc=caml-list@yquem.inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox