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

« back to all changes in this revision

Viewing changes to external/nrefactory/ICSharpCode.NRefactory.VB/Ast/Statements/SelectStatement.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
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
 
2
// This code is distributed under MIT X11 license (for details please see \doc\license.txt)
 
3
 
 
4
using System;
 
5
using System.IO;
 
6
 
 
7
namespace ICSharpCode.NRefactory.VB.Ast
 
8
{
 
9
        public class SelectStatement : Statement
 
10
        {
 
11
                public Expression Expression {
 
12
                        get { return GetChildByRole(Roles.Expression); }
 
13
                        set { SetChildByRole(Roles.Expression, value); }
 
14
                }
 
15
                
 
16
                public AstNodeCollection<CaseStatement> Cases {
 
17
                        get { return GetChildrenByRole(CaseStatement.CaseStatementRole); }
 
18
                }
 
19
                
 
20
                protected internal override bool DoMatch(AstNode other, ICSharpCode.NRefactory.PatternMatching.Match match)
 
21
                {
 
22
                        throw new NotImplementedException();
 
23
                }
 
24
                
 
25
                public override S AcceptVisitor<T, S>(IAstVisitor<T, S> visitor, T data)
 
26
                {
 
27
                        return visitor.VisitSelectStatement(this, data);
 
28
                }
 
29
        }
 
30
        
 
31
        public class CaseStatement : Statement
 
32
        {
 
33
                public static readonly Role<CaseStatement> CaseStatementRole = new Role<CaseStatement>("CaseStatement");
 
34
                
 
35
                public AstNodeCollection<CaseClause> Clauses {
 
36
                        get { return GetChildrenByRole(CaseClause.CaseClauseRole); }
 
37
                }
 
38
                
 
39
                public BlockStatement Body {
 
40
                        get { return GetChildByRole(Roles.Body); }
 
41
                        set { SetChildByRole(Roles.Body, value); }
 
42
                }
 
43
                
 
44
                protected internal override bool DoMatch(AstNode other, ICSharpCode.NRefactory.PatternMatching.Match match)
 
45
                {
 
46
                        throw new NotImplementedException();
 
47
                }
 
48
                
 
49
                public override S AcceptVisitor<T, S>(IAstVisitor<T, S> visitor, T data)
 
50
                {
 
51
                        return visitor.VisitCaseStatement(this, data);
 
52
                }
 
53
        }
 
54
        
 
55
        public abstract class CaseClause : AstNode
 
56
        {
 
57
                #region Null
 
58
                public new static readonly CaseClause Null = new NullCaseClause();
 
59
                
 
60
                sealed class NullCaseClause : CaseClause
 
61
                {
 
62
                        public override bool IsNull {
 
63
                                get {
 
64
                                        return true;
 
65
                                }
 
66
                        }
 
67
                        
 
68
                        public override S AcceptVisitor<T, S> (IAstVisitor<T, S> visitor, T data)
 
69
                        {
 
70
                                return default (S);
 
71
                        }
 
72
                        
 
73
                        protected internal override bool DoMatch(AstNode other, PatternMatching.Match match)
 
74
                        {
 
75
                                return other == null || other.IsNull;
 
76
                        }
 
77
                }
 
78
                #endregion
 
79
                
 
80
                public static readonly Role<CaseClause> CaseClauseRole = new Role<CaseClause>("CaseClause", CaseClause.Null);
 
81
                
 
82
                public Expression Expression {
 
83
                        get { return GetChildByRole(Roles.Expression); }
 
84
                        set { SetChildByRole(Roles.Expression, value); }
 
85
                }
 
86
        }
 
87
 
 
88
        public class SimpleCaseClause : CaseClause
 
89
        {
 
90
                protected internal override bool DoMatch(AstNode other, ICSharpCode.NRefactory.PatternMatching.Match match)
 
91
                {
 
92
                        throw new NotImplementedException();
 
93
                }
 
94
                
 
95
                public override S AcceptVisitor<T, S>(IAstVisitor<T, S> visitor, T data)
 
96
                {
 
97
                        return visitor.VisitSimpleCaseClause(this, data);
 
98
                }
 
99
        }
 
100
 
 
101
        public class RangeCaseClause : CaseClause
 
102
        {
 
103
                public static readonly Role<Expression> ToExpressionRole = ForStatement.ToExpressionRole;
 
104
                
 
105
                public Expression ToExpression {
 
106
                        get { return GetChildByRole(ToExpressionRole); }
 
107
                        set { SetChildByRole(ToExpressionRole, value); }
 
108
                }
 
109
                
 
110
                protected internal override bool DoMatch(AstNode other, ICSharpCode.NRefactory.PatternMatching.Match match)
 
111
                {
 
112
                        throw new NotImplementedException();
 
113
                }
 
114
                
 
115
                public override S AcceptVisitor<T, S>(IAstVisitor<T, S> visitor, T data)
 
116
                {
 
117
                        return visitor.VisitRangeCaseClause(this, data);
 
118
                }
 
119
        }
 
120
 
 
121
        public class ComparisonCaseClause : CaseClause
 
122
        {
 
123
                public static readonly Role<VBTokenNode> OperatorRole = BinaryOperatorExpression.OperatorRole;
 
124
                
 
125
                public ComparisonOperator Operator { get; set; }
 
126
                
 
127
                protected internal override bool DoMatch(AstNode other, ICSharpCode.NRefactory.PatternMatching.Match match)
 
128
                {
 
129
                        throw new NotImplementedException();
 
130
                }
 
131
                
 
132
                public override S AcceptVisitor<T, S>(IAstVisitor<T, S> visitor, T data)
 
133
                {
 
134
                        return visitor.VisitComparisonCaseClause(this, data);
 
135
                }
 
136
        }
 
137
 
 
138
        public enum ComparisonOperator
 
139
        {
 
140
                Equality = BinaryOperatorType.Equality,
 
141
                InEquality = BinaryOperatorType.InEquality,
 
142
                LessThan = BinaryOperatorType.LessThan,
 
143
                GreaterThan = BinaryOperatorType.GreaterThan,
 
144
                LessThanOrEqual = BinaryOperatorType.LessThanOrEqual,
 
145
                GreaterThanOrEqual = BinaryOperatorType.GreaterThanOrEqual
 
146
        }
 
147
}