On Fri, 21 Nov 2008 07:50:03 -0000, Chris Lattner <[EMAIL PROTECTED]> 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:
"%c0{0:something|1:somethingelse|2:yetanotherthing|:finaloption}"

This seems flexible enough to handle all cases. For simple s plural forms,
it's even pretty small.
"function%c0{1:|:s}"


Sebastian
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to