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

« back to all changes in this revision

Viewing changes to contrib/ICSharpCode.NRefactory.CSharp/Ast/GeneralScope/NewLineNode.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:
1
 
using System;
2
 
namespace ICSharpCode.NRefactory.CSharp
3
 
{
4
 
        public enum NewLineType {
5
 
                Unix,
6
 
                Windows,
7
 
                Mac
8
 
        }
9
 
 
10
 
        /// <summary>
11
 
        /// A New line node represents a line break in the text.
12
 
        /// </summary>
13
 
        public abstract class NewLineNode : AstNode
14
 
        {
15
 
                public override NodeType NodeType {
16
 
                        get {
17
 
                                return NodeType.Whitespace;
18
 
                        }
19
 
                }
20
 
 
21
 
                public abstract NewLineType NewLineType {
22
 
                        get;
23
 
                }
24
 
 
25
 
                TextLocation startLocation;
26
 
                public override TextLocation StartLocation {
27
 
                        get { 
28
 
                                return startLocation;
29
 
                        }
30
 
                }
31
 
                
32
 
                public override TextLocation EndLocation {
33
 
                        get {
34
 
                                return new TextLocation (startLocation.Line + 1, 1);
35
 
                        }
36
 
                }
37
 
 
38
 
                public NewLineNode() : this (TextLocation.Empty)
39
 
                {
40
 
                }
41
 
 
42
 
                public NewLineNode(TextLocation startLocation)
43
 
                {
44
 
                        this.startLocation = startLocation;
45
 
                }
46
 
 
47
 
                public override void AcceptVisitor(IAstVisitor visitor)
48
 
                {
49
 
                        visitor.VisitNewLine (this);
50
 
                }
51
 
                        
52
 
                public override T AcceptVisitor<T>(IAstVisitor<T> visitor)
53
 
                {
54
 
                        return visitor.VisitNewLine (this);
55
 
                }
56
 
                
57
 
                public override S AcceptVisitor<T, S>(IAstVisitor<T, S> visitor, T data)
58
 
                {
59
 
                        return visitor.VisitNewLine (this, data);
60
 
                }
61
 
        }
62
 
 
63
 
        public class UnixNewLine : NewLineNode
64
 
        {
65
 
                public override NewLineType NewLineType {
66
 
                        get {
67
 
                                return NewLineType.Unix;
68
 
                        }
69
 
                }
70
 
 
71
 
                public UnixNewLine()
72
 
                {
73
 
                }
74
 
 
75
 
                public UnixNewLine(TextLocation startLocation) : base (startLocation)
76
 
                {
77
 
                }
78
 
 
79
 
                protected internal override bool DoMatch(AstNode other, PatternMatching.Match match)
80
 
                {
81
 
                        var o = other as UnixNewLine;
82
 
                        return o != null;
83
 
                }
84
 
        }
85
 
 
86
 
        public class WindowsNewLine : NewLineNode
87
 
        {
88
 
                public override NewLineType NewLineType {
89
 
                        get {
90
 
                                return NewLineType.Windows;
91
 
                        }
92
 
                }
93
 
 
94
 
                public WindowsNewLine()
95
 
                {
96
 
                }
97
 
 
98
 
                public WindowsNewLine(TextLocation startLocation) : base (startLocation)
99
 
                {
100
 
                }
101
 
 
102
 
                protected internal override bool DoMatch(AstNode other, PatternMatching.Match match)
103
 
                {
104
 
                        var o = other as WindowsNewLine;
105
 
                        return o != null;
106
 
                }
107
 
        }
108
 
 
109
 
        public class MacNewLine : NewLineNode
110
 
        {
111
 
                public override NewLineType NewLineType {
112
 
                        get {
113
 
                                return NewLineType.Mac;
114
 
                        }
115
 
                }
116
 
 
117
 
                public MacNewLine()
118
 
                {
119
 
                }
120
 
 
121
 
                public MacNewLine(TextLocation startLocation) : base (startLocation)
122
 
                {
123
 
                }
124
 
 
125
 
                protected internal override bool DoMatch(AstNode other, PatternMatching.Match match)
126
 
                {
127
 
                        var o = other as MacNewLine;
128
 
                        return o != null;
129
 
                }
130
 
        }
131
 
}
132