Code Coverage Statistics for Source File
c:\Tools\SD3\src\Libraries\ICSharpCode.TextEditor\Project\Src\Document\HighlightingStrategy\Span.cs
|
Sequence Point Coverage
N/A
0 of 0
|
Branch Coverage
N/A
0 of 0
|
Lines
157
|
Highlight:
Uncovered Code
Covered Code
| L | V | Source |
|---|---|---|
1 |
// <file> |
|
2 |
// <copyright see="prj:///doc/copyright.txt"/> |
|
3 |
// <license see="prj:///doc/license.txt"/> |
|
4 |
// <owner name="Mike Krüger" email="mike@icsharpcode.net"/> |
|
5 |
// <version>$Revision: 2115 $</version> |
|
6 |
// </file> |
|
7 |
||
8 |
using System; |
|
9 |
using System.Xml; |
|
10 |
||
11 |
namespace ICSharpCode.TextEditor.Document |
|
12 |
{ |
|
13 |
public sealed class Span |
|
14 |
{ |
|
15 |
bool stopEOL; |
|
16 |
HighlightColor color; |
|
17 |
HighlightColor beginColor; |
|
18 |
HighlightColor endColor; |
|
19 |
char[] begin; |
|
20 |
char[] end; |
|
21 |
string name; |
|
22 |
string rule; |
|
23 |
HighlightRuleSet ruleSet; |
|
24 |
char escapeCharacter; |
|
25 |
bool ignoreCase; |
|
26 |
bool isBeginSingleWord; |
|
27 |
bool? isBeginStartOfLine; |
|
28 |
bool isEndSingleWord; |
|
29 |
||
30 |
internal HighlightRuleSet RuleSet { |
|
31 |
get { |
|
32 |
return ruleSet; |
|
33 |
} |
|
34 |
set { |
|
35 |
ruleSet = value; |
|
36 |
} |
|
37 |
} |
|
38 |
||
39 |
public bool IgnoreCase { |
|
40 |
get { |
|
41 |
return ignoreCase; |
|
42 |
} |
|
43 |
set { |
|
44 |
ignoreCase = value; |
|
45 |
} |
|
46 |
} |
|
47 |
||
48 |
public bool StopEOL { |
|
49 |
get { |
|
50 |
return stopEOL; |
|
51 |
} |
|
52 |
} |
|
53 |
||
54 |
public bool? IsBeginStartOfLine { |
|
55 |
get { |
|
56 |
return isBeginStartOfLine; |
|
57 |
} |
|
58 |
} |
|
59 |
||
60 |
public bool IsBeginSingleWord { |
|
61 |
get { |
|
62 |
return isBeginSingleWord; |
|
63 |
} |
|
64 |
} |
|
65 |
||
66 |
public bool IsEndSingleWord { |
|
67 |
get { |
|
68 |
return isEndSingleWord; |
|
69 |
} |
|
70 |
} |
|
71 |
||
72 |
public HighlightColor Color { |
|
73 |
get { |
|
74 |
return color; |
|
75 |
} |
|
76 |
} |
|
77 |
||
78 |
public HighlightColor BeginColor { |
|
79 |
get { |
|
80 |
if(beginColor != null) { |
|
81 |
return beginColor; |
|
82 |
} else { |
|
83 |
return color; |
|
84 |
} |
|
85 |
} |
|
86 |
} |
|
87 |
||
88 |
public HighlightColor EndColor { |
|
89 |
get { |
|
90 |
return endColor!=null ? endColor : color; |
|
91 |
} |
|
92 |
} |
|
93 |
||
94 |
public char[] Begin { |
|
95 |
get { return begin; } |
|
96 |
} |
|
97 |
||
98 |
public char[] End { |
|
99 |
get { return end; } |
|
100 |
} |
|
101 |
||
102 |
public string Name { |
|
103 |
get { return name; } |
|
104 |
} |
|
105 |
||
106 |
public string Rule { |
|
107 |
get { return rule; } |
|
108 |
} |
|
109 |
||
110 |
/// <summary> |
|
111 |
/// Gets the escape character of the span. The escape character is a character that can be used in front |
|
112 |
/// of the span end to make it not end the span. The escape character followed by another escape character |
|
113 |
/// means the escape character was escaped like in @"a "" b" literals in C#. |
|
114 |
/// The default value '\0' means no escape character is allowed. |
|
115 |
/// </summary> |
|
116 |
public char EscapeCharacter { |
|
117 |
get { return escapeCharacter; } |
|
118 |
} |
|
119 |
||
120 |
public Span(XmlElement span) |
|
121 |
{ |
|
122 |
color = new HighlightColor(span); |
|
123 |
||
124 |
if (span.HasAttribute("rule")) { |
|
125 |
rule = span.GetAttribute("rule"); |
|
126 |
} |
|
127 |
||
128 |
if (span.HasAttribute("escapecharacter")) { |
|
129 |
escapeCharacter = span.GetAttribute("escapecharacter")[0]; |
|
130 |
} |
|
131 |
||
132 |
name = span.GetAttribute("name"); |
|
133 |
if (span.HasAttribute("stopateol")) { |
|
134 |
stopEOL = Boolean.Parse(span.GetAttribute("stopateol")); |
|
135 |
} |
|
136 |
||
137 |
begin = span["Begin"].InnerText.ToCharArray(); |
|
138 |
beginColor = new HighlightColor(span["Begin"], color); |
|
139 |
||
140 |
if (span["Begin"].HasAttribute("singleword")) { |
|
141 |
this.isBeginSingleWord = Boolean.Parse(span["Begin"].GetAttribute("singleword")); |
|
142 |
} |
|
143 |
if (span["Begin"].HasAttribute("startofline")) { |
|
144 |
this.isBeginStartOfLine = Boolean.Parse(span["Begin"].GetAttribute("startofline")); |
|
145 |
} |
|
146 |
||
147 |
if (span["End"] != null) { |
|
148 |
end = span["End"].InnerText.ToCharArray(); |
|
149 |
endColor = new HighlightColor(span["End"], color); |
|
150 |
if (span["End"].HasAttribute("singleword")) { |
|
151 |
this.isEndSingleWord = Boolean.Parse(span["End"].GetAttribute("singleword")); |
|
152 |
} |
|
153 |
||
154 |
} |
|
155 |
} |
|
156 |
} |
|
157 |
} |