Exemplo n.º 1
0
        private State ParseStart(Reader r, IList <ExpressionNode> nodes)
        {
            if (ParseNot(r))
            {
                nodes.Add(new LogicalNotNode());
                return(State.Start);
            }
            else if (ParseOpenBrace(r))
            {
                return(State.AttachedProperty);
            }
            else if (PeekOpenBracket(r))
            {
                return(State.Indexer);
            }
            else
            {
                var identifier = IdentifierParser.Parse(r);

                if (identifier != null)
                {
                    nodes.Add(new PropertyAccessorNode(identifier, _enableValidation));
                    return(State.AfterMember);
                }
            }

            return(State.End);
        }
Exemplo n.º 2
0
        private State ParseAttachedProperty(Reader r, List <ExpressionNode> nodes)
        {
            var owner = IdentifierParser.Parse(r);

            if (r.End || !r.TakeIf('.'))
            {
                throw new ExpressionParseException(r.Position, "Invalid attached property name.");
            }

            var name = IdentifierParser.Parse(r);

            if (r.End || !r.TakeIf(')'))
            {
                throw new ExpressionParseException(r.Position, "Expected ')'.");
            }

            nodes.Add(new PropertyAccessorNode(owner + '.' + name, _enableValidation));
            return(State.AfterMember);
        }
Exemplo n.º 3
0
        private State ParseBeforeMember(Reader r, IList <ExpressionNode> nodes)
        {
            if (ParseOpenBrace(r))
            {
                return(State.AttachedProperty);
            }
            else
            {
                var identifier = IdentifierParser.Parse(r);

                if (identifier != null)
                {
                    nodes.Add(new PropertyAccessorNode(identifier, _enableValidation));
                    return(State.AfterMember);
                }

                return(State.End);
            }
        }