コード例 #1
0
ファイル: Marker.cs プロジェクト: yayanyang/monodevelop
		public static Marker Read (XmlReader reader)
		{
			Marker result = new Marker ();
			result.Color = reader.GetAttribute ("color");
			result.Tag   = reader.ReadElementString ();
			return result;
		}
コード例 #2
0
        protected bool ReadNode(XmlReader reader, List <Match> matchList, List <Span> spanList, List <Marker> prevMarkerList)
        {
            switch (reader.LocalName)
            {
            case "Delimiters":
                this.Delimiter = reader.ReadElementString();
                return(true);

            case "Property":
                string name  = reader.GetAttribute("name");
                string value = reader.ReadElementString();

                if (!properties.ContainsKey(name))
                {
                    properties [name] = new List <string> ();
                }
                properties [name].Add(value);
                return(true);

            case Match.Node:
                matchList.Add(Match.Read(reader));
                return(true);

            case Span.Node:
            case Span.AltNode:
                spanList.Add(Span.Read(reader));
                return(true);

            case Mono.TextEditor.Highlighting.Keywords.Node:
                Keywords keywords = Mono.TextEditor.Highlighting.Keywords.Read(reader, IgnoreCase);
                this.keywords.Add(keywords);
                foreach (string word in keywords.Words)
                {
                    if (keywords.IgnoreCase)
                    {
                        if (keywordTableIgnoreCase == null)
                        {
                            keywordTableIgnoreCase = new Dictionary <string, Keywords> (StringComparer.InvariantCultureIgnoreCase);
                        }
                        if (keywordTableIgnoreCase.ContainsKey(word))
                        {
                            Console.WriteLine("Error: duplicate keyword " + word);
                            continue;
                        }
                        keywordTableIgnoreCase.Add(word, keywords);
                    }
                    else
                    {
                        if (keywordTable == null)
                        {
                            keywordTable = new Dictionary <string, Keywords> ();
                        }
                        if (keywordTable.ContainsKey(word))
                        {
                            Console.WriteLine("Error: duplicate keyword " + word);
                            continue;
                        }
                        keywordTable.Add(word, keywords);
                    }
                }
                return(true);

            case Marker.PrevMarker:
                prevMarkerList.Add(Marker.Read(reader));
                return(true);
            }
            return(false);
        }