Пример #1
0
        public static ArgumentsFact TryParse(ref Source s)
        {
            ArgumentsFact res = new ArgumentsFact();

            Spaces.Skip(ref s);
            if (!s.SkipIf("("))
            {
                return(null);
            }

            while (true)
            {
                Spaces.Skip(ref s);
                if (s.SkipIf(")"))
                {
                    break;
                }
                Source     tempSource = s.Clone();
                Expression expr       = new Expression(ref tempSource);
                if (!expr.Correct())
                {
                    throw new lolException();
                }
                s.currentPos = tempSource.currentPos;
                s.Save();
                res.AddArg(expr);

                Spaces.Skip(ref s);
                if (s.SkipIf(","))
                {
                    continue;
                }
                if (s.SkipIf(")"))
                {
                    break;
                }
            }
            //s.Rollback();

            return(res);
        }