コード例 #1
0
ファイル: CallNode.cs プロジェクト: jgrisham/Power-Fx
        public override Span GetTextSpan()
        {
            if (ParenClose == null)
            {
                return(base.GetTextSpan());
            }
            // If the call is a Service call then adjust the span for the entire call
            DottedNameNode dotted;

            if (HeadNode != null && (dotted = HeadNode.AsDottedName()) != null)
            {
                return(new Span(dotted.GetCompleteSpan().Min, ParenClose.Span.Lim));
            }
            return(new Span(Head.Token.Span.Min, ParenClose.Span.Lim));
        }
コード例 #2
0
ファイル: DottedNameNode.cs プロジェクト: jgrisham/Power-Fx
        public override Span GetCompleteSpan()
        {
            int      min      = Token.Span.Min;
            TexlNode leftNode = Left;

            while (leftNode != null)
            {
                DottedNameNode dottedLeft;
                if ((dottedLeft = leftNode.AsDottedName()) != null)
                {
                    leftNode = dottedLeft.Left;
                }
                else
                {
                    min = leftNode.GetCompleteSpan().Min;
                    break;
                }
            }
            return(new Span(min, Right.VerifyValue().Token.VerifyValue().Span.Lim));
        }
コード例 #3
0
ファイル: DottedNameNode.cs プロジェクト: jgrisham/Power-Fx
        public DottedNameNode(ref int idNext, Token primaryToken, SourceList sourceList, TexlNode left, Identifier right, TexlNode rightNode)
            : base(ref idNext, primaryToken, sourceList)
        {
            Contracts.AssertValue(primaryToken);
            Contracts.Assert(primaryToken.IsDottedNamePunctuator);
            Contracts.AssertValue(left);
            Contracts.AssertValue(right);

            // The LHS of a [] can only be a first name node. E.g. foo[bar] is valid, but foo!bar[car] is not.
            // Also, dotted names can't mix tokens, except for []. E.g. foo[bar]!car is valid, but foo.bar!car is not.
            Contracts.Assert(primaryToken.Kind == TokKind.BracketOpen ?
                             left is FirstNameNode :
                             !(left is DottedNameNode) || left.AsDottedName().Token.Kind == TokKind.BracketOpen || left.AsDottedName().Token.Kind == primaryToken.Kind);

            Left                          = left;
            Left.Parent                   = this;
            Right                         = right;
            RightNode                     = rightNode;
            HasOnlyIdentifiers            = left is FirstNameNode || (left is DottedNameNode && left.AsDottedName().HasOnlyIdentifiers);
            HasPossibleNamespaceQualifier = HasOnlyIdentifiers || left is ParentNode || left is SelfNode;
            _depth                        = left.Depth + 1;

            MinChildID = Math.Min(left.MinChildID, rightNode?.MinChildID ?? MinChildID);
        }