1 | // Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team |
---|
2 | // |
---|
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this |
---|
4 | // software and associated documentation files (the "Software"), to deal in the Software |
---|
5 | // without restriction, including without limitation the rights to use, copy, modify, merge, |
---|
6 | // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons |
---|
7 | // to whom the Software is furnished to do so, subject to the following conditions: |
---|
8 | // |
---|
9 | // The above copyright notice and this permission notice shall be included in all copies or |
---|
10 | // substantial portions of the Software. |
---|
11 | // |
---|
12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, |
---|
13 | // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR |
---|
14 | // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE |
---|
15 | // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR |
---|
16 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
---|
17 | // DEALINGS IN THE SOFTWARE. |
---|
18 | |
---|
19 | using System; |
---|
20 | using System.Text.RegularExpressions; |
---|
21 | |
---|
22 | namespace ICSharpCode.AvalonEdit.Highlighting |
---|
23 | { |
---|
24 | /// <summary> |
---|
25 | /// A highlighting span is a region with start+end expression that has a different RuleSet inside |
---|
26 | /// and colors the region. |
---|
27 | /// </summary> |
---|
28 | [Serializable] |
---|
29 | public class HighlightingSpan |
---|
30 | { |
---|
31 | /// <summary> |
---|
32 | /// Gets/Sets the start expression. |
---|
33 | /// </summary> |
---|
34 | public Regex StartExpression { get; set; } |
---|
35 | |
---|
36 | /// <summary> |
---|
37 | /// Gets/Sets the end expression. |
---|
38 | /// </summary> |
---|
39 | public Regex EndExpression { get; set; } |
---|
40 | |
---|
41 | /// <summary> |
---|
42 | /// Gets/Sets the rule set that applies inside this span. |
---|
43 | /// </summary> |
---|
44 | public HighlightingRuleSet RuleSet { get; set; } |
---|
45 | |
---|
46 | /// <summary> |
---|
47 | /// Gets the color used for the text matching the start expression. |
---|
48 | /// </summary> |
---|
49 | public HighlightingColor StartColor { get; set; } |
---|
50 | |
---|
51 | /// <summary> |
---|
52 | /// Gets the color used for the text between start and end. |
---|
53 | /// </summary> |
---|
54 | public HighlightingColor SpanColor { get; set; } |
---|
55 | |
---|
56 | /// <summary> |
---|
57 | /// Gets the color used for the text matching the end expression. |
---|
58 | /// </summary> |
---|
59 | public HighlightingColor EndColor { get; set; } |
---|
60 | |
---|
61 | /// <summary> |
---|
62 | /// Gets/Sets whether the span color includes the start. |
---|
63 | /// The default is <c>false</c>. |
---|
64 | /// </summary> |
---|
65 | public bool SpanColorIncludesStart { get; set; } |
---|
66 | |
---|
67 | /// <summary> |
---|
68 | /// Gets/Sets whether the span color includes the end. |
---|
69 | /// The default is <c>false</c>. |
---|
70 | /// </summary> |
---|
71 | public bool SpanColorIncludesEnd { get; set; } |
---|
72 | |
---|
73 | /// <inheritdoc/> |
---|
74 | public override string ToString() |
---|
75 | { |
---|
76 | return "[" + GetType().Name + " Start=" + StartExpression + ", End=" + EndExpression + "]"; |
---|
77 | } |
---|
78 | } |
---|
79 | } |
---|