1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348
|
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under MIT X11 license (for details please see \doc\license.txt)
using System;
using System.Collections.Generic;
namespace ICSharpCode.NRefactory.VB.Ast
{
public class QueryExpression : Expression
{
public AstNodeCollection<QueryOperator> QueryOperators {
get { return GetChildrenByRole(QueryOperator.QueryOperatorRole); }
}
protected internal override bool DoMatch(AstNode other, ICSharpCode.NRefactory.PatternMatching.Match match)
{
throw new NotImplementedException();
}
public override S AcceptVisitor<T, S>(IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitQueryExpression(this, data);
}
}
public abstract class QueryOperator : AstNode
{
#region Null
public new static readonly QueryOperator Null = new NullQueryOperator();
sealed class NullQueryOperator : QueryOperator
{
public override bool IsNull {
get {
return true;
}
}
public override S AcceptVisitor<T, S> (IAstVisitor<T, S> visitor, T data)
{
return default (S);
}
protected internal override bool DoMatch(AstNode other, PatternMatching.Match match)
{
return other == null || other.IsNull;
}
}
#endregion
public static readonly Role<QueryOperator> QueryOperatorRole = new Role<QueryOperator>("QueryOperator", QueryOperator.Null);
}
public class FromQueryOperator : QueryOperator
{
public AstNodeCollection<CollectionRangeVariableDeclaration> Variables {
get { return GetChildrenByRole (CollectionRangeVariableDeclaration.CollectionRangeVariableDeclarationRole); }
}
protected internal override bool DoMatch(AstNode other, ICSharpCode.NRefactory.PatternMatching.Match match)
{
throw new NotImplementedException();
}
public override S AcceptVisitor<T, S>(IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitFromQueryOperator(this, data);
}
}
public class AggregateQueryOperator : QueryOperator
{
public CollectionRangeVariableDeclaration Variable {
get { return GetChildByRole(CollectionRangeVariableDeclaration.CollectionRangeVariableDeclarationRole); }
set { SetChildByRole(CollectionRangeVariableDeclaration.CollectionRangeVariableDeclarationRole, value); }
}
public AstNodeCollection<QueryOperator> SubQueryOperators {
get { return GetChildrenByRole(QueryOperatorRole); }
}
public AstNodeCollection<VariableInitializer> IntoExpressions {
get { return GetChildrenByRole(VariableInitializer.VariableInitializerRole); }
}
protected internal override bool DoMatch(AstNode other, ICSharpCode.NRefactory.PatternMatching.Match match)
{
throw new NotImplementedException();
}
public override S AcceptVisitor<T, S>(IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitAggregateQueryOperator(this, data);
}
}
public class SelectQueryOperator : QueryOperator
{
public AstNodeCollection<VariableInitializer> Variables {
get { return GetChildrenByRole(VariableInitializer.VariableInitializerRole); }
}
protected internal override bool DoMatch(AstNode other, ICSharpCode.NRefactory.PatternMatching.Match match)
{
throw new NotImplementedException();
}
public override S AcceptVisitor<T, S>(IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitSelectQueryOperator(this, data);
}
}
public class DistinctQueryOperator : QueryOperator
{
protected internal override bool DoMatch(AstNode other, ICSharpCode.NRefactory.PatternMatching.Match match)
{
throw new NotImplementedException();
}
public override S AcceptVisitor<T, S>(IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitDistinctQueryOperator(this, data);
}
}
public class WhereQueryOperator : QueryOperator
{
public Expression Condition {
get { return GetChildByRole (Roles.Expression); }
set { SetChildByRole (Roles.Expression, value); }
}
protected internal override bool DoMatch(AstNode other, ICSharpCode.NRefactory.PatternMatching.Match match)
{
throw new NotImplementedException();
}
public override S AcceptVisitor<T, S>(IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitWhereQueryOperator(this, data);
}
}
public class OrderExpression : AstNode
{
public static readonly Role<OrderExpression> OrderExpressionRole = new Role<OrderExpression>("OrderExpression");
public Expression Expression {
get { return GetChildByRole (Roles.Expression); }
set { SetChildByRole (Roles.Expression, value); }
}
public QueryOrderingDirection Direction { get; set; }
protected internal override bool DoMatch(AstNode other, ICSharpCode.NRefactory.PatternMatching.Match match)
{
throw new NotImplementedException();
}
public override S AcceptVisitor<T, S>(IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitOrderExpression(this, data);
}
}
public class OrderByQueryOperator : QueryOperator
{
public AstNodeCollection<OrderExpression> Expressions {
get { return GetChildrenByRole(OrderExpression.OrderExpressionRole); }
}
protected internal override bool DoMatch(AstNode other, ICSharpCode.NRefactory.PatternMatching.Match match)
{
throw new NotImplementedException();
}
public override S AcceptVisitor<T, S>(IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitOrderByQueryOperator(this, data);
}
}
public class PartitionQueryOperator : QueryOperator
{
public PartitionKind Kind { get; set; }
public Expression Expression {
get { return GetChildByRole (Roles.Expression); }
set { SetChildByRole (Roles.Expression, value); }
}
protected internal override bool DoMatch(AstNode other, ICSharpCode.NRefactory.PatternMatching.Match match)
{
throw new NotImplementedException();
}
public override S AcceptVisitor<T, S>(IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitPartitionQueryOperator(this, data);
}
}
public class LetQueryOperator : QueryOperator
{
public AstNodeCollection<VariableInitializer> Variables {
get { return GetChildrenByRole(VariableInitializer.VariableInitializerRole); }
}
protected internal override bool DoMatch(AstNode other, ICSharpCode.NRefactory.PatternMatching.Match match)
{
throw new NotImplementedException();
}
public override S AcceptVisitor<T, S>(IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitLetQueryOperator(this, data);
}
}
public class GroupByQueryOperator : QueryOperator
{
public static readonly Role<VariableInitializer> GroupExpressionRole = new Role<VariableInitializer>("GroupExpression");
public static readonly Role<VariableInitializer> ByExpressionRole = new Role<VariableInitializer>("ByExpression");
public static readonly Role<VariableInitializer> IntoExpressionRole = new Role<VariableInitializer>("IntoExpression");
public AstNodeCollection<VariableInitializer> GroupExpressions {
get { return GetChildrenByRole(GroupExpressionRole); }
}
public AstNodeCollection<VariableInitializer> ByExpressions {
get { return GetChildrenByRole(ByExpressionRole); }
}
public AstNodeCollection<VariableInitializer> IntoExpressions {
get { return GetChildrenByRole(IntoExpressionRole); }
}
protected internal override bool DoMatch(AstNode other, ICSharpCode.NRefactory.PatternMatching.Match match)
{
throw new NotImplementedException();
}
public override S AcceptVisitor<T, S>(IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitGroupByQueryOperator(this, data);
}
}
public class JoinQueryOperator : QueryOperator
{
#region Null
public new static readonly JoinQueryOperator Null = new NullJoinQueryOperator();
sealed class NullJoinQueryOperator : JoinQueryOperator
{
public override bool IsNull {
get {
return true;
}
}
public override S AcceptVisitor<T, S> (IAstVisitor<T, S> visitor, T data)
{
return default (S);
}
protected internal override bool DoMatch(AstNode other, PatternMatching.Match match)
{
return other == null || other.IsNull;
}
}
#endregion
public static readonly Role<JoinQueryOperator> JoinQueryOperatorRole = new Role<JoinQueryOperator>("JoinQueryOperator", JoinQueryOperator.Null);
public CollectionRangeVariableDeclaration JoinVariable {
get { return GetChildByRole(CollectionRangeVariableDeclaration.CollectionRangeVariableDeclarationRole); }
set { SetChildByRole(CollectionRangeVariableDeclaration.CollectionRangeVariableDeclarationRole, value); }
}
public JoinQueryOperator SubJoinQuery {
get { return GetChildByRole(JoinQueryOperatorRole); }
set { SetChildByRole(JoinQueryOperatorRole, value); }
}
public AstNodeCollection<JoinCondition> JoinConditions {
get { return GetChildrenByRole(JoinCondition.JoinConditionRole); }
}
protected internal override bool DoMatch(AstNode other, ICSharpCode.NRefactory.PatternMatching.Match match)
{
throw new NotImplementedException();
}
public override S AcceptVisitor<T, S>(IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitJoinQueryOperator(this, data);
}
}
public class JoinCondition : AstNode
{
public static readonly Role<JoinCondition> JoinConditionRole = new Role<JoinCondition>("JoinCondition");
public static readonly Role<Expression> LeftExpressionRole = BinaryOperatorExpression.LeftExpressionRole;
public static readonly Role<Expression> RightExpressionRole = BinaryOperatorExpression.RightExpressionRole;
public Expression Left {
get { return GetChildByRole (LeftExpressionRole); }
set { SetChildByRole (LeftExpressionRole, value); }
}
public Expression Right {
get { return GetChildByRole (RightExpressionRole); }
set { SetChildByRole (RightExpressionRole, value); }
}
protected internal override bool DoMatch(AstNode other, ICSharpCode.NRefactory.PatternMatching.Match match)
{
throw new NotImplementedException();
}
public override S AcceptVisitor<T, S>(IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitJoinCondition(this, data);
}
}
public class GroupJoinQueryOperator : JoinQueryOperator
{
public static readonly Role<VariableInitializer> IntoExpressionRole = GroupByQueryOperator.IntoExpressionRole;
public AstNodeCollection<VariableInitializer> IntoExpressions {
get { return GetChildrenByRole(IntoExpressionRole); }
}
protected internal override bool DoMatch(AstNode other, ICSharpCode.NRefactory.PatternMatching.Match match)
{
throw new NotImplementedException();
}
public override S AcceptVisitor<T, S>(IAstVisitor<T, S> visitor, T data)
{
return visitor.VisitGroupJoinQueryOperator(this, data);
}
}
}
|