~ubuntu-branches/ubuntu/trusty/monodevelop/trusty-proposed

« back to all changes in this revision

Viewing changes to src/core/Mono.Texteditor/Mono.TextEditor.Highlighting/Rule.cs

  • Committer: Package Import Robot
  • Author(s): Jo Shields
  • Date: 2013-05-12 09:46:03 UTC
  • mto: This revision was merged to the branch mainline in revision 29.
  • Revision ID: package-import@ubuntu.com-20130512094603-mad323bzcxvmcam0
Tags: upstream-4.0.5+dfsg
ImportĀ upstreamĀ versionĀ 4.0.5+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
81
81
                
82
82
                public string Name {
83
83
                        get;
84
 
                        internal protected set;
 
84
                        set;
85
85
                }
86
86
                
87
87
                public IEnumerable<Keywords> Keywords {
88
88
                        get {
89
89
                                return keywords;
90
90
                        }
 
91
                        set {
 
92
                                keywords = new List<Mono.TextEditor.Highlighting.Keywords> (value);
 
93
                                keywordTable = null;
 
94
                                keywordTableIgnoreCase = null;
 
95
                                keywords.ForEach (kw => UpdateKeywordTable (kw));
 
96
                        }
91
97
                }
92
98
                
93
99
                public Span[] Spans {
110
116
                
111
117
                public bool IgnoreCase {
112
118
                        get;
113
 
                        internal protected set;
 
119
                        set;
114
120
                }
115
121
                
116
122
                public string DefaultColor {
119
125
                }
120
126
                
121
127
                string delimiter;
 
128
                bool delimiterSet;
122
129
                public string Delimiter {
123
130
                        get { 
124
 
                                return string.IsNullOrEmpty (delimiter) ? mode.Delimiter : delimiter; 
 
131
                                return !delimiterSet ? mode.Delimiter : delimiter; 
125
132
                        }
126
 
                        internal protected set { delimiter = value; }
 
133
                        set { delimiter = value; delimiterSet = true; }
127
134
                }
128
135
 
129
136
                public Marker[] PrevMarker {
209
216
                                return result;
210
217
                        return null;
211
218
                }
 
219
 
 
220
                void UpdateKeywordTable (Keywords keywords)
 
221
                {
 
222
                        foreach (string word in keywords.Words) {
 
223
                                if (keywords.IgnoreCase) {
 
224
                                        if (keywordTableIgnoreCase == null)
 
225
                                                keywordTableIgnoreCase = new Dictionary<string, Keywords> (StringComparer.InvariantCultureIgnoreCase);
 
226
                                        if (keywordTableIgnoreCase.ContainsKey (word)) {
 
227
                                                Console.WriteLine ("Error: duplicate keyword " + word);
 
228
                                                continue;
 
229
                                        }
 
230
                                        keywordTableIgnoreCase.Add (word, keywords);
 
231
                                } else {
 
232
                                        if (keywordTable == null)
 
233
                                                keywordTable = new Dictionary<string, Keywords> ();
 
234
                                        if (keywordTable.ContainsKey (word)) {
 
235
                                                Console.WriteLine ("Error: duplicate keyword " + word);
 
236
                                                continue;
 
237
                                        }
 
238
                                        keywordTable.Add (word, keywords);
 
239
                                }
 
240
                        }
 
241
                }
212
242
                
213
243
                protected bool ReadNode (XmlReader reader, List<Match> matchList, List<Span> spanList, List<Marker> prevMarkerList)
214
244
                {
234
264
                        case Mono.TextEditor.Highlighting.Keywords.Node:
235
265
                                Keywords keywords = Mono.TextEditor.Highlighting.Keywords.Read (reader, IgnoreCase);
236
266
                                this.keywords.Add (keywords);
237
 
                                foreach (string word in keywords.Words) {
238
 
                                        if (keywords.IgnoreCase) {
239
 
                                                if (keywordTableIgnoreCase == null)
240
 
                                                        keywordTableIgnoreCase = new Dictionary<string, Keywords> (StringComparer.InvariantCultureIgnoreCase);
241
 
                                                if (keywordTableIgnoreCase.ContainsKey (word)) {
242
 
                                                        Console.WriteLine ("Error: duplicate keyword " + word);
243
 
                                                        continue;
244
 
                                                }
245
 
                                                keywordTableIgnoreCase.Add (word, keywords);
246
 
                                        } else {
247
 
                                                if (keywordTable == null)
248
 
                                                        keywordTable = new Dictionary<string, Keywords> ();
249
 
                                                if (keywordTable.ContainsKey (word)) {
250
 
                                                        Console.WriteLine ("Error: duplicate keyword " + word);
251
 
                                                        continue;
252
 
                                                }
253
 
                                                keywordTable.Add (word, keywords);
254
 
                                        }
255
 
                                }
 
267
                                UpdateKeywordTable (keywords);
256
268
                                return true;
257
269
                        case Marker.PrevMarker:
258
270
                                prevMarkerList.Add (Marker.Read (reader));