示例#1
0
        //creates a completion list for non-terminals. The names included in the
        // list will match any that exist in the document, not just those that
        // have been defined already
        HashSet<CompletionData> createCompletionsForNonTerminals()
        {
            var completionList = new HashSet<CompletionData> ();
            var namesFound = new AnyCaseStringSet ();

            var tokenList = doc.FindTokensByType (DefinitionType.NonTerminal);
            foreach (Token token in tokenList)
            {
                //completion lists should contain each item only once
                if (!namesFound.Contains (token.Text) &&
                    //always ignore literal expressions
                    !token.Text.StartsWith("\'",System.StringComparison.Ordinal))
                {
                    namesFound.Add (token.Text);
                    completionList.Add (tokenToCompletionData (token));
                }
            }
            return completionList;
        }
示例#2
0
        //creates a completions list for the given defintion type - so only symbols
        // that have been defined will appear in the list
        HashSet<CompletionData> createCompletionsForType(DefinitionType type)
        {
            var completionList = new HashSet<CompletionData> ();

            //we want only defined symbols in the completion list
            var definitions = doc.FindDefinitionsByType(type);
            //...and no duplicates of names
            var names = new AnyCaseStringSet ();

            foreach (DefinitionNode def in definitions)
            {
                string name = def.Name;
                if (!names.Contains (name))
                {
                    names.Add (name);
                    var completion = newCompletionData (name, type);
                    completionList.Add (completion);
                }
            }
            return completionList;
        }
示例#3
0
 public void ContainsTest()
 {
     var target = new AnyCaseStringSet ();
     target.Add ("{abcdef}");
     Assert.IsTrue (target.Contains ("{AbcDef}"));
 }