示例#1
0
 public ExpressionPropertyFunctionInvocation(int offset, int length, ExpressionPropertyNode target, string methodName, ExpressionArgumentList arguments)
     : base(offset, length)
 {
     Target     = target;
     MethodName = methodName;
     Arguments  = arguments;
 }
示例#2
0
 public ExpressionPropertyFunctionInvocation(int offset, int length, ExpressionPropertyNode target, ExpressionFunctionName function, ExpressionArgumentList arguments)
     : base(offset, length)
 {
     Target = target;
     target?.SetParent(this);
     Function = function;
     function?.SetParent(this);
     Arguments = arguments;
     arguments?.SetParent(this);
 }
示例#3
0
        static ExpressionNode ParsePropertyStringFunction(string buffer, ref int offset, int endOffset, int baseOffset, ExpressionPropertyNode target)
        {
            offset++;

            ConsumeSpace(buffer, ref offset, endOffset);

            var methodName = ReadName(buffer, ref offset, endOffset);

            if (methodName == null)
            {
                return(new IncompleteExpressionError(
                           baseOffset + offset,
                           offset > endOffset,
                           ExpressionErrorKind.ExpectingMethodName,
                           new ExpressionPropertyFunctionInvocation(target.Offset, (offset + baseOffset) - target.Offset, target, methodName, null)));
            }

            ConsumeSpace(buffer, ref offset, endOffset);

            if (offset > endOffset || buffer [offset] != '(')
            {
                return(new IncompleteExpressionError(
                           baseOffset + offset,
                           offset > endOffset,
                           ExpressionErrorKind.ExpectingLeftParen,
                           new ExpressionPropertyFunctionInvocation(target.Offset, (offset + baseOffset) - target.Offset, target, methodName, null)
                           ));
            }

            if (WrapError(
                    ParseFunctionArgumentList(buffer, ref offset, endOffset, baseOffset),
                    out ExpressionArgumentList args,
                    out IncompleteExpressionError error,
                    (n, o) => new ExpressionPropertyFunctionInvocation(target.Offset, o - target.Offset, target, methodName, n)
                    ))
            {
                return(error);
            }

            return(new ExpressionPropertyFunctionInvocation(target.Offset, (offset + baseOffset) - target.Offset, target, methodName, args));
        }