~ubuntu-branches/debian/sid/nunit/sid

« back to all changes in this revision

Viewing changes to src/GuiException/UiException/CSharpParser/CSToken.cs

  • Committer: Package Import Robot
  • Author(s): Jo Shields
  • Date: 2014-09-16 13:43:36 UTC
  • mfrom: (1.1.5)
  • Revision ID: package-import@ubuntu.com-20140916134336-kjxz48tty6lx2ja5
Tags: 2.6.3+dfsg-1
* [c7bd1b5] Imported Upstream version 2.6.3+dfsg
* [bcb4bf8] Move nunit-console-runner to GAC-installed libnunit2.6, 
  don't treat it as a private lib. This lib is signed, and treated 
  as a GAC lib by consumers such as MonoDevelop.
* [7f08e99] Bump version to 2.6.3 as required
* [84535eb] Refreshed patches
* [8479f61] Split package up into per-assembly packages. This makes 
  ABI tracking easier in the future, as we can meaningfully have GAC 
  policy for cases where ABI isn't truly bumped, and no policy for 
  cases where it is. For example, if nunit.framework bumps ABI but 
  nunit.core does not, previously we would need to rebuild everything 
  using NUnit, but under the new split packaging, that rebuild would 
  not be needed for apps only using nunit.core.
* [17a7dc7] Add missing nunit.mocks.dll to nunit.pc

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
// ****************************************************************
2
 
// This is free software licensed under the NUnit license. You may
3
 
// obtain a copy of the license at http://nunit.org
4
 
// ****************************************************************
5
 
 
6
 
using System;
7
 
using System.Collections.Generic;
8
 
using System.Text;
9
 
 
10
 
namespace NUnit.UiException.CodeFormatters
11
 
{
12
 
    /// <summary>
13
 
    /// This enum indicate the kind of a string sequence.
14
 
    /// </summary>
15
 
    public enum ClassificationTag : byte
16
 
    {
17
 
        /// <summary>
18
 
        /// The string refer to C# source code.
19
 
        /// </summary>
20
 
        Code = 0,           // 0
21
 
 
22
 
        /// <summary>
23
 
        /// The string refers to C# keywords.
24
 
        /// </summary>
25
 
        Keyword = 1,        // 1
26
 
 
27
 
        /// <summary>
28
 
        /// The string refers to C# comments.
29
 
        /// </summary>
30
 
        Comment = 2,        // 2
31
 
 
32
 
        /// <summary>
33
 
        /// The string refers to a string/char value.
34
 
        /// </summary>
35
 
        String = 3          // 3
36
 
    }
37
 
 
38
 
    /// <summary>
39
 
    /// (formerly named CSToken)
40
 
    /// 
41
 
    /// Classifies a string and make it falls into one of the categories below:
42
 
    ///   - Code (the value should be interpreted as regular code)
43
 
    ///   - Keyword (the value should be interpreted as a language keyword)
44
 
    ///   - Comment (the value should be interpreted as comments)
45
 
    ///   - String (the value should be interpreted as a string)
46
 
    /// </summary>
47
 
    public class ClassifiedToken
48
 
    {
49
 
        /// <summary>
50
 
        /// The string held by this token.
51
 
        /// </summary>
52
 
        protected string _text; 
53
 
 
54
 
        /// <summary>
55
 
        /// The matching tag.
56
 
        /// </summary>
57
 
        protected ClassificationTag _tag;
58
 
 
59
 
        /// <summary>
60
 
        /// Starting startingPosition of the string.
61
 
        /// </summary>
62
 
        protected int _indexStart;
63
 
 
64
 
        /// <summary>
65
 
        /// This class cannot be build directly.
66
 
        /// </summary>
67
 
        protected ClassifiedToken()
68
 
        {
69
 
            // this class requires subclassing
70
 
        }
71
 
 
72
 
        /// <summary>
73
 
        /// Gets the string value.
74
 
        /// </summary>
75
 
        public string Text
76
 
        {
77
 
            get { return (_text); }
78
 
        }
79
 
 
80
 
        /// <summary>
81
 
        /// Gets the classification value for the string in Text.
82
 
        ///   - Code:  Text should be interpreted as regular code,
83
 
        ///   - Keyword: Text should be interpreted as a language keyword,
84
 
        ///   - Comments: Text should be interpreted as comments,
85
 
        ///   - String: Text should be interpreted as a string.
86
 
        /// </summary>
87
 
        public ClassificationTag Tag
88
 
        {
89
 
            get { return (_tag); }
90
 
        }
91
 
 
92
 
        /// <summary>
93
 
        /// Gets the string's starting startingPosition.
94
 
        /// </summary>
95
 
        public int IndexStart
96
 
        {
97
 
            get { return (_indexStart); }
98
 
        }
99
 
 
100
 
        /// <summary>
101
 
        /// Returns true if 'obj' is an instance of ClassifiedToken 
102
 
        /// that contains same data that the current instance.
103
 
        /// </summary>
104
 
        public override bool Equals(object obj)
105
 
        {
106
 
            ClassifiedToken token;
107
 
 
108
 
            if (obj == null || !(obj is ClassifiedToken))
109
 
                return (false);
110
 
 
111
 
            token = obj as ClassifiedToken;
112
 
 
113
 
            return (Text == token.Text &&
114
 
                    Tag == token.Tag);
115
 
        }
116
 
 
117
 
        public override int GetHashCode()
118
 
        {
119
 
            return base.GetHashCode();
120
 
        }
121
 
 
122
 
        public override string ToString()
123
 
        {
124
 
            return (String.Format(
125
 
                "ClassifiedToken {Text='{0}', Tag={1}}",
126
 
                Text,
127
 
                Tag));
128
 
        }
129
 
    }
130
 
}
 
1
// ****************************************************************
 
2
// This is free software licensed under the NUnit license. You may
 
3
// obtain a copy of the license at http://nunit.org
 
4
// ****************************************************************
 
5
 
 
6
using System;
 
7
using System.Collections.Generic;
 
8
using System.Text;
 
9
 
 
10
namespace NUnit.UiException.CodeFormatters
 
11
{
 
12
    /// <summary>
 
13
    /// This enum indicate the kind of a string sequence.
 
14
    /// </summary>
 
15
    public enum ClassificationTag : byte
 
16
    {
 
17
        /// <summary>
 
18
        /// The string refer to C# source code.
 
19
        /// </summary>
 
20
        Code = 0,           // 0
 
21
 
 
22
        /// <summary>
 
23
        /// The string refers to C# keywords.
 
24
        /// </summary>
 
25
        Keyword = 1,        // 1
 
26
 
 
27
        /// <summary>
 
28
        /// The string refers to C# comments.
 
29
        /// </summary>
 
30
        Comment = 2,        // 2
 
31
 
 
32
        /// <summary>
 
33
        /// The string refers to a string/char value.
 
34
        /// </summary>
 
35
        String = 3          // 3
 
36
    }
 
37
 
 
38
    /// <summary>
 
39
    /// (formerly named CSToken)
 
40
    /// 
 
41
    /// Classifies a string and make it falls into one of the categories below:
 
42
    ///   - Code (the value should be interpreted as regular code)
 
43
    ///   - Keyword (the value should be interpreted as a language keyword)
 
44
    ///   - Comment (the value should be interpreted as comments)
 
45
    ///   - String (the value should be interpreted as a string)
 
46
    /// </summary>
 
47
    public class ClassifiedToken
 
48
    {
 
49
        /// <summary>
 
50
        /// The string held by this token.
 
51
        /// </summary>
 
52
        protected string _text; 
 
53
 
 
54
        /// <summary>
 
55
        /// The matching tag.
 
56
        /// </summary>
 
57
        protected ClassificationTag _tag;
 
58
 
 
59
        /// <summary>
 
60
        /// Starting startingPosition of the string.
 
61
        /// </summary>
 
62
        protected int _indexStart;
 
63
 
 
64
        /// <summary>
 
65
        /// This class cannot be build directly.
 
66
        /// </summary>
 
67
        protected ClassifiedToken()
 
68
        {
 
69
            // this class requires subclassing
 
70
        }
 
71
 
 
72
        /// <summary>
 
73
        /// Gets the string value.
 
74
        /// </summary>
 
75
        public string Text
 
76
        {
 
77
            get { return (_text); }
 
78
        }
 
79
 
 
80
        /// <summary>
 
81
        /// Gets the classification value for the string in Text.
 
82
        ///   - Code:  Text should be interpreted as regular code,
 
83
        ///   - Keyword: Text should be interpreted as a language keyword,
 
84
        ///   - Comments: Text should be interpreted as comments,
 
85
        ///   - String: Text should be interpreted as a string.
 
86
        /// </summary>
 
87
        public ClassificationTag Tag
 
88
        {
 
89
            get { return (_tag); }
 
90
        }
 
91
 
 
92
        /// <summary>
 
93
        /// Gets the string's starting startingPosition.
 
94
        /// </summary>
 
95
        public int IndexStart
 
96
        {
 
97
            get { return (_indexStart); }
 
98
        }
 
99
 
 
100
        /// <summary>
 
101
        /// Returns true if 'obj' is an instance of ClassifiedToken 
 
102
        /// that contains same data that the current instance.
 
103
        /// </summary>
 
104
        public override bool Equals(object obj)
 
105
        {
 
106
            ClassifiedToken token;
 
107
 
 
108
            if (obj == null || !(obj is ClassifiedToken))
 
109
                return (false);
 
110
 
 
111
            token = obj as ClassifiedToken;
 
112
 
 
113
            return (Text == token.Text &&
 
114
                    Tag == token.Tag);
 
115
        }
 
116
 
 
117
        public override int GetHashCode()
 
118
        {
 
119
            return base.GetHashCode();
 
120
        }
 
121
 
 
122
        public override string ToString()
 
123
        {
 
124
            return (String.Format(
 
125
                "ClassifiedToken {Text='{0}', Tag={1}}",
 
126
                Text,
 
127
                Tag));
 
128
        }
 
129
    }
 
130
}