コード例 #1
0
 public ExpressionConditionFunction(int offset, int length, ExpressionFunctionName name, ExpressionNode arguments)
     : base(offset, length)
 {
     Name = name;
     name?.SetParent(this);
     Arguments = arguments;
     arguments?.SetParent(this);
 }
コード例 #2
0
        static ExpressionNode ParseItemFunction(string buffer, ref int offset, int endOffset, int baseOffset, ExpressionItemNode target)
        {
            int nameOffset  = offset;
            var funcNameStr = ReadName(buffer, ref offset, endOffset);

            if (funcNameStr == null)
            {
                return(new IncompleteExpressionError(
                           baseOffset + offset,
                           offset > endOffset,
                           ExpressionErrorKind.ExpectingMethodName,
                           new ExpressionItemFunctionInvocation(target.Offset, (offset + baseOffset) - target.Offset, target, null, null)));
            }
            var funcName = new ExpressionFunctionName(nameOffset + baseOffset, funcNameStr);

            ConsumeSpace(buffer, ref offset, endOffset);

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

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

            return(new ExpressionItemFunctionInvocation(target.Offset, (offset + baseOffset) - target.Offset, target, funcName, args));
        }