示例#1
0
        public static WholeNumberPart Produce(IEnumerable <Symbol> symbols,
                                              out IEnumerable <Symbol> symbolsToProcess)
        {
            // whole-number-part = digit-sequence

            IEnumerable <Symbol> s = null;
            DigitSequence        d = DigitSequence.Produce(symbols, out s);

            if (d != null)
            {
                symbolsToProcess = s;
                return(new WholeNumberPart(d));
            }
            symbolsToProcess = null;
            return(null);
        }
示例#2
0
        public static FractionalPart Produce(IEnumerable <Symbol> symbols)
        {
            // fractional-part = full-stop digit-sequence

            if (!symbols.Any())
            {
                return(null);
            }
            if (symbols.First() is FullStop)
            {
                IEnumerable <Symbol> s = null;
                DigitSequence        d = DigitSequence.Produce(symbols.Skip(1), out s);
                if (d == null || s.Any())
                {
                    return(null);
                }
                return(new FractionalPart(new FullStop(), d));
            }
            return(null);
        }