> > So to sum up: when you declare a rule with a token "MyToken", the grammar 
> > is 
> configured to recognize a "MyToken" keyword.
> 
> The issue here is that it must be lower case in the camlp4 rules, i.e. 
> "mytoken".

Why "it must"? You need it to be lower-case? Or parsing does not work if it is 
not lower-case?

Maybe I did not understand correctly what you want...
I thought you wanted to recognize
  BuyOrSell something
  buyORsell something

using a single rule, say
  buy : [ [ "buyOrSell"; ... ] ]

If that is the case, I think my solution works.
You might even do that:
  buy : [ [ "buy_or_sell"; ... ] ]

and at lexing time do
  if String.lowercase s = "buyorsell" then
    IDENT "buy_or_sell"
  else
    IDENT s

In this case it is more than a matter of case, but the argument is still valid: 
I have declared a rule with "buy_or_sell", so the rule will be taken when a 
"buy_or_sell" keyword is found, and the lexer produces "buy_or_sell" 
identifiers from anything that matches case-insensitively "BuyOrSell".

Cheers,
Matthieu





_______________________________________________
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

Reply via email to