Beispiel #1
0
        // input: text after "Plural-Forms:" (e.g. "nplurals=2; plural=(n != 1);"),
        // if s == 0, creates default handler
        // returns 0 if error
        public static PluralFormsCalculator Make(string str)
        {
            PluralFormsCalculator calculator = new PluralFormsCalculator();

            if (str != null)
            {
                PluralFormsScanner scanner = new PluralFormsScanner(str);
                PluralFormsParser  p       = new PluralFormsParser(scanner);
                if (!p.Parse(calculator))
                {
                    return(null);
                }
            }
            return(calculator);
        }
Beispiel #2
0
 public PluralFormsParser(PluralFormsScanner scanner)
 {
     this.scanner = scanner;
 }
		public PluralFormsParser (PluralFormsScanner scanner)
		{
			this.scanner = scanner;
		}
		// input: text after "Plural-Forms:" (e.g. "nplurals=2; plural=(n != 1);"),
		// if s == 0, creates default handler
		// returns 0 if error
		public static PluralFormsCalculator Make (string str)
		{
			PluralFormsCalculator calculator = new PluralFormsCalculator ();
			if (str != null)
			{
				PluralFormsScanner scanner = new PluralFormsScanner (str);
				PluralFormsParser p = new PluralFormsParser (scanner);
				if (!p.Parse (calculator))
				{
					return null;
				}
			}
			return calculator;
		}