[cfe-commits] r59803 - in /cfe/trunk:

Sebastian Redl sebastian.redl at getdesigned.at
Fri Nov 21 04:23:31 PST 2008

On Fri, 21 Nov 2008 07:50:03 -0000, Chris Lattner <sabre at nondot.org> wrote:
> Author: lattner
> Date: Fri Nov 21 01:50:02 2008
> New Revision: 59803
> For now, I've added two example modifiers.  One is a very useful
> tool that allows you to factor commonality across diagnostics
> that need single words or phrases combined.  Basically you can
> use %select{a|b|c}4 with with an integer argument that selects
> either a/b/c based on an integer value in the range [0..3).
> The second modifier is also an integer modifier, aimed to help
> English diagnostics handle plurality.  "%s3" prints to 's' if 
> integer argument #3 is not 1, otherwise it prints to nothing.
> I'm fully aware that 's' is an English concept and doesn't
> apply to all situations (mouse vs mice).  However, this is very
> useful and we can add other crazy modifiers once we add support
> for polish! ;-)

I was planning to implement a modifier that works like this:
"We have %0 %c0{1:mouse|:mice}"
i.e. a simple case statement. ("case parameter 0 in") The modifer picks an
integral argument and executes the case. It could be more complicated for
languages that, say, have different forms for 0, 1, 2, and more cases:

This seems flexible enough to handle all cases. For simple s plural forms,
it's even pretty small.


More information about the cfe-commits mailing list