コード例 #1
0
        public override ResolveResultWithInfo ResolveWithoutCache()
        {
            ISymbolTable table = GetReferenceSymbolTable(true);
            IList <DeclaredElementInstance> elements = new List <DeclaredElementInstance>();

            {
                IList <ISymbolInfo> infos = table.GetSymbolInfos(GetName());
                foreach (ISymbolInfo info in infos)
                {
                    var element = new DeclaredElementInstance(info.GetDeclaredElement(), EmptySubstitution.INSTANCE);
                    elements.Add(element);
                }
            }
            if (elements.Count == 0)
            {
                var ruleName = myOwner as RuleName;
                if (PsiTreeUtil.HasParent <InterfacesDefinition>(myOwner) && (ruleName != null))
                {
                    elements = new List <DeclaredElementInstance> {
                        new DeclaredElementInstance(new UnresolvedRuleInterfacesDeclaredElement(ruleName.GetSourceFile(), GetName(), myOwner.GetPsiServices()))
                    };
                }
            }

            return(new ResolveResultWithInfo(ResolveResultFactory.CreateResolveResultFinaly(elements),
                                             ResolveErrorType.OK));
        }
コード例 #2
0
        public override IReference BindTo(IDeclaredElement element)
        {
            var namespacePrefix = (IPrefixUri)this.GetTreeNode();

            if (namespacePrefix.Parent != null)
            {
                PsiTreeUtil.ReplaceChild(namespacePrefix, namespacePrefix.FirstChild, element.ShortName);
                namespacePrefix.SetName(element.ShortName);
            }
            return(this);
        }
コード例 #3
0
        public override IReference BindTo(IDeclaredElement element)
        {
            var variableName = (IVariableName)GetTreeNode();

            if (variableName.Parent != null)
            {
                PsiTreeUtil.ReplaceChild(variableName, variableName.FirstChild, element.ShortName);
                variableName.SetName(element.ShortName);
            }
            return(this);
        }
コード例 #4
0
        public override IReference BindTo(IDeclaredElement element)
        {
            var uriString = (IUriString)this.GetTreeNode();

            if (uriString.Parent != null)
            {
                PsiTreeUtil.ReplaceChild(uriString, uriString.FirstChild, element.ShortName);
                uriString.SetReferenceName(element.ShortName);
            }

            return(this);
        }
コード例 #5
0
        public override IReference BindTo(IDeclaredElement element)
        {
            var localName = (ILocalName)this.GetTreeNode();

            if (localName.Parent != null)
            {
                PsiTreeUtil.ReplaceChild(localName, localName.FirstChild, element.ShortName);
                localName.SetReferenceName(element.ShortName);
            }

            return(this);
        }
コード例 #6
0
        public override IReference BindTo(IDeclaredElement element)
        {
            var optionName = (IOptionName)GetTreeNode();

            if (optionName.Parent != null && optionName.FirstChild != null)
            {
                if (!(element.ShortName.Equals(optionName.FirstChild.GetText())))
                {
                    PsiTreeUtil.ReplaceChild(optionName, optionName.FirstChild, element.ShortName);
                }
            }
            return(this);
        }
コード例 #7
0
        public override IReference BindTo(IDeclaredElement element)
        {
            var pathName = (IPathName)GetTreeNode();

            if (pathName.Parent != null)
            {
                PsiTreeUtil.ReplaceChild(pathName, pathName.FirstChild, element.ShortName);
            }
            IReference reference = new PsiPathReference(pathName);

            pathName.SetReference(reference);
            return(reference);
        }
コード例 #8
0
        public override IReference BindTo(IDeclaredElement element)
        {
            var optionName = (IRoleName)GetTreeNode();

            if (optionName.Parent != null)
            {
                if (((RoleDeclaredElement)element).ChangeName)
                {
                    PsiTreeUtil.ReplaceChild(optionName, optionName.FirstChild, ((RoleDeclaredElement)element).NewName);
                }
            }
            return(this);
        }
コード例 #9
0
        public override void VisitRuleDeclaration(IRuleDeclaration ruleDeclaration, IHighlightingConsumer consumer)
        {
            IRuleBody body     = ruleDeclaration.Body;
            ITreeNode child    = PsiTreeUtil.GetFirstChild <IRuleName>(body);
            var       ruleName = child as IRuleName;

            if (ruleName != null)
            {
                if (ruleName.GetText().Equals(ruleDeclaration.DeclaredName))
                {
                    consumer.AddHighlighting(new LeftRecursionWarning(ruleName), File);
                }
            }
            base.VisitRuleDeclaration(ruleDeclaration, consumer);
        }
コード例 #10
0
        public override void VisitPsiExpression(IPsiExpression psiExpression, IHighlightingConsumer consumer)
        {
            ITreeNode         child = psiExpression.FirstChild;
            IList <ISequence> list  = new List <ISequence>();

            while (child != null)
            {
                if (child is ISequence)
                {
                    list.Add(child as ISequence);
                }
                if (child is IChoiceTail)
                {
                    list.Add((child as IChoiceTail).Sequence);
                }
                child = child.NextSibling;
            }

            if (list.Count > 1)
            {
                ISequence[] sequences  = list.ToArray();
                var         isRepeated = new bool[sequences.Count()];
                for (int i = 0; i < sequences.Count() - 1; ++i)
                {
                    if (!isRepeated[i])
                    {
                        ISequence sequence1 = sequences[i];
                        for (int j = i + 1; j < sequences.Count(); ++j)
                        {
                            ISequence sequence2 = sequences[j];
                            if (PsiTreeUtil.EqualsElements(sequence1, sequence2))
                            {
                                if (!isRepeated[i])
                                {
                                    consumer.AddHighlighting(new RepeatedChoiceWarning(sequence1), File);
                                    isRepeated[i] = true;
                                }
                                consumer.AddHighlighting(new RepeatedChoiceWarning(sequence2), File);
                                isRepeated[j] = true;
                            }
                        }
                    }
                }
            }
            base.VisitPsiExpression(psiExpression, consumer);
        }
コード例 #11
0
 public void SetName(string name)
 {
     PsiTreeUtil.ReplaceChild(PathName, PathName.FirstChild, name);
 }
コード例 #12
0
 protected override IReference BindToInternal(IDeclaredElement declaredElement, ISubstitution substitution)
 {
     PsiTreeUtil.ReplaceChild(myOwner, myOwner.FirstChild, declaredElement.ShortName);
     return(this);
 }
コード例 #13
0
 public void SetName(string name)
 {
     PsiTreeUtil.ReplaceChild(this.PrefixName, this.PrefixName.FirstChild, name);
 }
コード例 #14
0
 public void SetName(string name)
 {
     Assertion.Assert(FirstChild != null, "FirstChild != null");
     PsiTreeUtil.ReplaceChild(FirstChild, FirstChild.FirstChild, name);
 }
コード例 #15
0
 public void SetName(string name)
 {
     PsiTreeUtil.ReplaceChild(this, this.Value, name);
 }