ExpressionList ParseFunctionArguments(ref int start, int end)
        {
            var args = new ExpressionList();

            do
            {
                SkipSpaces(ref start);
                if (start == source.Length)
                {
                    throw new InvalidProjectFileException("unterminated function call arguments.");
                }
                if (source [start] == ')')
                {
                    break;
                }
                else if (args.Any())
                {
                    if (source [start] != ',')
                    {
                        throw new InvalidProjectFileException(string.Format("invalid function call arguments specification. ',' is expected, got '{0}'", source [start]));
                    }
                    start++;
                    SkipSpaces(ref start);
                }
                args.Add(ParseSingle(ref start, end));
            } while (true);
            start++;
            return(args);
        }
예제 #2
0
 string Evaluate(string source, ExpressionList exprList)
 {
     if (exprList == null)
     {
         throw new ArgumentNullException("exprList");
     }
     return(string.Concat(exprList.Select(e => e.EvaluateAsString(CreateContext(source)))));
 }
        ExpressionList Parse(int start, int end)
        {
            if (string.IsNullOrWhiteSpace(source))
            {
                return(new ExpressionList());
            }

            var ret = new ExpressionList();

            while (start < end)
            {
                int bak = start;
                ret.Add(ParseSingle(ref start, end));
                if (bak == start)
                {
                    throw new Exception("Parser failed to progress token position: " + source);
                }
            }
            return(ret);
        }