You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
4316 lines
125 KiB
4316 lines
125 KiB
//------------------------------------------------------------------------------ |
|
// <auto-generated> |
|
// This code was generated by a tool. |
|
// Runtime Version:2.0.50727.42 |
|
// |
|
// Changes to this file may cause incorrect behavior and will be lost if |
|
// the code is regenerated. |
|
// </auto-generated> |
|
//------------------------------------------------------------------------------ |
|
|
|
namespace ICSharpCode.NRefactory.Parser.AST { |
|
using System; |
|
using System.Collections.Generic; |
|
using System.Diagnostics; |
|
using System.Drawing; |
|
|
|
|
|
public class AddHandlerStatement : Statement { |
|
|
|
Expression eventExpression; |
|
|
|
Expression handlerExpression; |
|
|
|
public AddHandlerStatement(Expression eventExpression, Expression handlerExpression) { |
|
EventExpression = eventExpression; |
|
HandlerExpression = handlerExpression; |
|
} |
|
|
|
public Expression EventExpression { |
|
get { |
|
return eventExpression; |
|
} |
|
set { |
|
eventExpression = value ?? Expression.Null; |
|
} |
|
} |
|
|
|
public Expression HandlerExpression { |
|
get { |
|
return handlerExpression; |
|
} |
|
set { |
|
handlerExpression = value ?? Expression.Null; |
|
} |
|
} |
|
|
|
public override object AcceptVisitor(IAstVisitor visitor, object data) { |
|
return visitor.Visit(this, data); |
|
} |
|
|
|
public override string ToString() { |
|
return string.Format("[AddHandlerStatement EventExpression={0} HandlerExpression={1}]", EventExpression, HandlerExpression); |
|
} |
|
} |
|
|
|
public class AddressOfExpression : Expression { |
|
|
|
Expression expression; |
|
|
|
public AddressOfExpression(Expression expression) { |
|
Expression = expression; |
|
} |
|
|
|
public Expression Expression { |
|
get { |
|
return expression; |
|
} |
|
set { |
|
expression = value ?? Expression.Null; |
|
} |
|
} |
|
|
|
public override object AcceptVisitor(IAstVisitor visitor, object data) { |
|
return visitor.Visit(this, data); |
|
} |
|
|
|
public override string ToString() { |
|
return string.Format("[AddressOfExpression Expression={0}]", Expression); |
|
} |
|
} |
|
|
|
public class AnonymousMethodExpression : Expression { |
|
|
|
List<ParameterDeclarationExpression> parameters; |
|
|
|
BlockStatement body; |
|
|
|
public AnonymousMethodExpression() { |
|
parameters = new List<ParameterDeclarationExpression>(); |
|
body = BlockStatement.Null; |
|
} |
|
|
|
public List<ParameterDeclarationExpression> Parameters { |
|
get { |
|
return parameters; |
|
} |
|
set { |
|
parameters = value ?? new List<ParameterDeclarationExpression>(); |
|
} |
|
} |
|
|
|
public BlockStatement Body { |
|
get { |
|
return body; |
|
} |
|
set { |
|
body = value ?? BlockStatement.Null; |
|
} |
|
} |
|
|
|
public override object AcceptVisitor(IAstVisitor visitor, object data) { |
|
return visitor.Visit(this, data); |
|
} |
|
|
|
public override string ToString() { |
|
return string.Format("[AnonymousMethodExpression Parameters={0} Body={1}]", GetCollectionString(Parameters), Body); |
|
} |
|
} |
|
|
|
public class ArrayCreateExpression : Expression { |
|
|
|
TypeReference createType; |
|
|
|
List<Expression> arguments; |
|
|
|
ArrayInitializerExpression arrayInitializer; |
|
|
|
public ArrayCreateExpression(TypeReference createType) { |
|
CreateType = createType; |
|
arguments = new List<Expression>(); |
|
arrayInitializer = ArrayInitializerExpression.Null; |
|
} |
|
|
|
public ArrayCreateExpression(TypeReference createType, List<Expression> arguments) { |
|
CreateType = createType; |
|
Arguments = arguments; |
|
arrayInitializer = ArrayInitializerExpression.Null; |
|
} |
|
|
|
public ArrayCreateExpression(TypeReference createType, ArrayInitializerExpression arrayInitializer) { |
|
CreateType = createType; |
|
ArrayInitializer = arrayInitializer; |
|
arguments = new List<Expression>(); |
|
} |
|
|
|
public TypeReference CreateType { |
|
get { |
|
return createType; |
|
} |
|
set { |
|
createType = value ?? TypeReference.Null; |
|
} |
|
} |
|
|
|
public List<Expression> Arguments { |
|
get { |
|
return arguments; |
|
} |
|
set { |
|
arguments = value ?? new List<Expression>(); |
|
} |
|
} |
|
|
|
public ArrayInitializerExpression ArrayInitializer { |
|
get { |
|
return arrayInitializer; |
|
} |
|
set { |
|
arrayInitializer = value ?? ArrayInitializerExpression.Null; |
|
} |
|
} |
|
|
|
public override object AcceptVisitor(IAstVisitor visitor, object data) { |
|
return visitor.Visit(this, data); |
|
} |
|
|
|
public override string ToString() { |
|
return string.Format("[ArrayCreateExpression CreateType={0} Arguments={1} ArrayInitializer={2}]", CreateType, GetCollectionString(Arguments), ArrayInitializer); |
|
} |
|
} |
|
|
|
public class ArrayInitializerExpression : Expression { |
|
|
|
List<Expression> createExpressions; |
|
|
|
public ArrayInitializerExpression() { |
|
createExpressions = new List<Expression>(); |
|
} |
|
|
|
public ArrayInitializerExpression(List<Expression> createExpressions) { |
|
CreateExpressions = createExpressions; |
|
} |
|
|
|
public List<Expression> CreateExpressions { |
|
get { |
|
return createExpressions; |
|
} |
|
set { |
|
createExpressions = value ?? new List<Expression>(); |
|
} |
|
} |
|
|
|
public new static ArrayInitializerExpression Null { |
|
get { |
|
return NullArrayInitializerExpression.Instance; |
|
} |
|
} |
|
|
|
public override object AcceptVisitor(IAstVisitor visitor, object data) { |
|
return visitor.Visit(this, data); |
|
} |
|
|
|
public override string ToString() { |
|
return string.Format("[ArrayInitializerExpression CreateExpressions={0}]", GetCollectionString(CreateExpressions)); |
|
} |
|
} |
|
|
|
public class NullArrayInitializerExpression : ArrayInitializerExpression { |
|
|
|
static NullArrayInitializerExpression instance = new NullArrayInitializerExpression(); |
|
|
|
private NullArrayInitializerExpression() { |
|
} |
|
|
|
public static NullArrayInitializerExpression Instance { |
|
get { |
|
return instance; |
|
} |
|
} |
|
|
|
public override bool IsNull { |
|
get { |
|
return true; |
|
} |
|
} |
|
|
|
public override object AcceptVisitor(IAstVisitor visitor, object data) { |
|
return null; |
|
} |
|
|
|
public override string ToString() { |
|
return "[NullArrayInitializerExpression]"; |
|
} |
|
} |
|
|
|
public class AssignmentExpression : Expression { |
|
|
|
Expression left; |
|
|
|
AssignmentOperatorType op; |
|
|
|
Expression right; |
|
|
|
public AssignmentExpression(Expression left, AssignmentOperatorType op, Expression right) { |
|
Left = left; |
|
Op = op; |
|
Right = right; |
|
} |
|
|
|
public Expression Left { |
|
get { |
|
return left; |
|
} |
|
set { |
|
left = value ?? Expression.Null; |
|
} |
|
} |
|
|
|
public AssignmentOperatorType Op { |
|
get { |
|
return op; |
|
} |
|
set { |
|
op = value; |
|
} |
|
} |
|
|
|
public Expression Right { |
|
get { |
|
return right; |
|
} |
|
set { |
|
right = value ?? Expression.Null; |
|
} |
|
} |
|
|
|
public override object AcceptVisitor(IAstVisitor visitor, object data) { |
|
return visitor.Visit(this, data); |
|
} |
|
|
|
public override string ToString() { |
|
return string.Format("[AssignmentExpression Left={0} Op={1} Right={2}]", Left, Op, Right); |
|
} |
|
} |
|
|
|
public class Attribute : AbstractNode { |
|
|
|
string name; |
|
|
|
List<Expression> positionalArguments; |
|
|
|
List<NamedArgumentExpression> namedArguments; |
|
|
|
public Attribute(string name, List<Expression> positionalArguments, List<NamedArgumentExpression> namedArguments) { |
|
Name = name; |
|
PositionalArguments = positionalArguments; |
|
NamedArguments = namedArguments; |
|
} |
|
|
|
public string Name { |
|
get { |
|
return name; |
|
} |
|
set { |
|
name = value ?? ""; |
|
} |
|
} |
|
|
|
public List<Expression> PositionalArguments { |
|
get { |
|
return positionalArguments; |
|
} |
|
set { |
|
positionalArguments = value ?? new List<Expression>(); |
|
} |
|
} |
|
|
|
public List<NamedArgumentExpression> NamedArguments { |
|
get { |
|
return namedArguments; |
|
} |
|
set { |
|
namedArguments = value ?? new List<NamedArgumentExpression>(); |
|
} |
|
} |
|
|
|
public override object AcceptVisitor(IAstVisitor visitor, object data) { |
|
return visitor.Visit(this, data); |
|
} |
|
|
|
public override string ToString() { |
|
return string.Format("[Attribute Name={0} PositionalArguments={1} NamedArguments={2}]", Name, GetCollectionString(PositionalArguments), GetCollectionString(NamedArguments)); |
|
} |
|
} |
|
|
|
public abstract class AttributedNode : AbstractNode { |
|
|
|
List<AttributeSection> attributes; |
|
|
|
Modifier modifier; |
|
|
|
public AttributedNode(List<AttributeSection> attributes) { |
|
Attributes = attributes; |
|
} |
|
|
|
public AttributedNode(Modifier modifier, List<AttributeSection> attributes) { |
|
Modifier = modifier; |
|
Attributes = attributes; |
|
} |
|
|
|
public List<AttributeSection> Attributes { |
|
get { |
|
return attributes; |
|
} |
|
set { |
|
attributes = value ?? new List<AttributeSection>(); |
|
} |
|
} |
|
|
|
public Modifier Modifier { |
|
get { |
|
return modifier; |
|
} |
|
set { |
|
modifier = value; |
|
} |
|
} |
|
} |
|
|
|
public class AttributeSection : AbstractNode { |
|
|
|
string attributeTarget; |
|
|
|
List<Attribute> attributes; |
|
|
|
public AttributeSection(string attributeTarget, List<Attribute> attributes) { |
|
AttributeTarget = attributeTarget; |
|
Attributes = attributes; |
|
} |
|
|
|
public string AttributeTarget { |
|
get { |
|
return attributeTarget; |
|
} |
|
set { |
|
attributeTarget = value ?? ""; |
|
} |
|
} |
|
|
|
public List<Attribute> Attributes { |
|
get { |
|
return attributes; |
|
} |
|
set { |
|
attributes = value ?? new List<Attribute>(); |
|
} |
|
} |
|
|
|
public override object AcceptVisitor(IAstVisitor visitor, object data) { |
|
return visitor.Visit(this, data); |
|
} |
|
|
|
public override string ToString() { |
|
return string.Format("[AttributeSection AttributeTarget={0} Attributes={1}]", AttributeTarget, GetCollectionString(Attributes)); |
|
} |
|
} |
|
|
|
public class BaseReferenceExpression : Expression { |
|
|
|
public BaseReferenceExpression() { |
|
} |
|
|
|
public override object AcceptVisitor(IAstVisitor visitor, object data) { |
|
return visitor.Visit(this, data); |
|
} |
|
|
|
public override string ToString() { |
|
return "[BaseReferenceExpression]"; |
|
} |
|
} |
|
|
|
public class BinaryOperatorExpression : Expression { |
|
|
|
Expression left; |
|
|
|
BinaryOperatorType op; |
|
|
|
Expression right; |
|
|
|
public BinaryOperatorExpression(Expression left, BinaryOperatorType op, Expression right) { |
|
Left = left; |
|
Op = op; |
|
Right = right; |
|
} |
|
|
|
public Expression Left { |
|
get { |
|
return left; |
|
} |
|
set { |
|
left = value ?? Expression.Null; |
|
} |
|
} |
|
|
|
public BinaryOperatorType Op { |
|
get { |
|
return op; |
|
} |
|
set { |
|
op = value; |
|
} |
|
} |
|
|
|
public Expression Right { |
|
get { |
|
return right; |
|
} |
|
set { |
|
right = value ?? Expression.Null; |
|
} |
|
} |
|
|
|
public override object AcceptVisitor(IAstVisitor visitor, object data) { |
|
return visitor.Visit(this, data); |
|
} |
|
|
|
public override string ToString() { |
|
return string.Format("[BinaryOperatorExpression Left={0} Op={1} Right={2}]", Left, Op, Right); |
|
} |
|
} |
|
|
|
public class BreakStatement : Statement { |
|
|
|
public BreakStatement() { |
|
} |
|
|
|
public override object AcceptVisitor(IAstVisitor visitor, object data) { |
|
return visitor.Visit(this, data); |
|
} |
|
|
|
public override string ToString() { |
|
return "[BreakStatement]"; |
|
} |
|
} |
|
|
|
public class CaseLabel : AbstractNode { |
|
|
|
Expression label; |
|
|
|
BinaryOperatorType binaryOperatorType; |
|
|
|
Expression toExpression; |
|
|
|
public CaseLabel() { |
|
label = Expression.Null; |
|
toExpression = Expression.Null; |
|
} |
|
|
|
public CaseLabel(Expression label) { |
|
Label = label; |
|
toExpression = Expression.Null; |
|
} |
|
|
|
public CaseLabel(Expression label, Expression toExpression) { |
|
Label = label; |
|
ToExpression = toExpression; |
|
} |
|
|
|
public CaseLabel(BinaryOperatorType binaryOperatorType, Expression label) { |
|
BinaryOperatorType = binaryOperatorType; |
|
Label = label; |
|
toExpression = Expression.Null; |
|
} |
|
|
|
public Expression Label { |
|
get { |
|
return label; |
|
} |
|
set { |
|
label = value ?? Expression.Null; |
|
} |
|
} |
|
|
|
public BinaryOperatorType BinaryOperatorType { |
|
get { |
|
return binaryOperatorType; |
|
} |
|
set { |
|
binaryOperatorType = value; |
|
} |
|
} |
|
|
|
public Expression ToExpression { |
|
get { |
|
return toExpression; |
|
} |
|
set { |
|
toExpression = value ?? Expression.Null; |
|
} |
|
} |
|
|
|
public bool IsDefault { |
|
get { |
|
return label.IsNull; |
|
} |
|
} |
|
|
|
public override object AcceptVisitor(IAstVisitor visitor, object data) { |
|
return visitor.Visit(this, data); |
|
} |
|
|
|
public override string ToString() { |
|
return string.Format("[CaseLabel Label={0} BinaryOperatorType={1} ToExpression={2}]", Label, BinaryOperatorType, ToExpression); |
|
} |
|
} |
|
|
|
public class CastExpression : Expression { |
|
|
|
TypeReference castTo; |
|
|
|
Expression expression; |
|
|
|
CastType castType; |
|
|
|
public CastExpression(TypeReference castTo) { |
|
CastTo = castTo; |
|
expression = Expression.Null; |
|
} |
|
|
|
public CastExpression(TypeReference castTo, Expression expression, CastType castType) { |
|
CastTo = castTo; |
|
Expression = expression; |
|
CastType = castType; |
|
} |
|
|
|
public TypeReference CastTo { |
|
get { |
|
return castTo; |
|
} |
|
set { |
|
castTo = value ?? TypeReference.Null; |
|
} |
|
} |
|
|
|
public Expression Expression { |
|
get { |
|
return expression; |
|
} |
|
set { |
|
expression = value ?? Expression.Null; |
|
} |
|
} |
|
|
|
public CastType CastType { |
|
get { |
|
return castType; |
|
} |
|
set { |
|
castType = value; |
|
} |
|
} |
|
|
|
public override object AcceptVisitor(IAstVisitor visitor, object data) { |
|
return visitor.Visit(this, data); |
|
} |
|
|
|
public override string ToString() { |
|
return string.Format("[CastExpression CastTo={0} Expression={1} CastType={2}]", CastTo, Expression, CastType); |
|
} |
|
} |
|
|
|
public class CatchClause : AbstractNode { |
|
|
|
TypeReference typeReference; |
|
|
|
string variableName; |
|
|
|
Statement statementBlock; |
|
|
|
Expression condition; |
|
|
|
public CatchClause(TypeReference typeReference, string variableName, Statement statementBlock) { |
|
TypeReference = typeReference; |
|
VariableName = variableName; |
|
StatementBlock = statementBlock; |
|
condition = Expression.Null; |
|
} |
|
|
|
public CatchClause(TypeReference typeReference, string variableName, Statement statementBlock, Expression condition) { |
|
TypeReference = typeReference; |
|
VariableName = variableName; |
|
StatementBlock = statementBlock; |
|
Condition = condition; |
|
} |
|
|
|
public CatchClause(Statement statementBlock) { |
|
StatementBlock = statementBlock; |
|
typeReference = TypeReference.Null; |
|
variableName = ""; |
|
condition = Expression.Null; |
|
} |
|
|
|
public TypeReference TypeReference { |
|
get { |
|
return typeReference; |
|
} |
|
set { |
|
typeReference = value ?? TypeReference.Null; |
|
} |
|
} |
|
|
|
public string VariableName { |
|
get { |
|
return variableName; |
|
} |
|
set { |
|
variableName = value ?? ""; |
|
} |
|
} |
|
|
|
public Statement StatementBlock { |
|
get { |
|
return statementBlock; |
|
} |
|
set { |
|
statementBlock = value ?? Statement.Null; |
|
} |
|
} |
|
|
|
public Expression Condition { |
|
get { |
|
return condition; |
|
} |
|
set { |
|
condition = value ?? Expression.Null; |
|
} |
|
} |
|
|
|
public override object AcceptVisitor(IAstVisitor visitor, object data) { |
|
return visitor.Visit(this, data); |
|
} |
|
|
|
public override string ToString() { |
|
return string.Format("[CatchClause TypeReference={0} VariableName={1} StatementBlock={2} Condition={3}]" + |
|
"", TypeReference, VariableName, StatementBlock, Condition); |
|
} |
|
} |
|
|
|
public class CheckedExpression : Expression { |
|
|
|
Expression expression; |
|
|
|
public CheckedExpression(Expression expression) { |
|
Expression = expression; |
|
} |
|
|
|
public Expression Expression { |
|
get { |
|
return expression; |
|
} |
|
set { |
|
expression = value ?? Expression.Null; |
|
} |
|
} |
|
|
|
public override object AcceptVisitor(IAstVisitor visitor, object data) { |
|
return visitor.Visit(this, data); |
|
} |
|
|
|
public override string ToString() { |
|
return string.Format("[CheckedExpression Expression={0}]", Expression); |
|
} |
|
} |
|
|
|
public class CheckedStatement : Statement { |
|
|
|
Statement block; |
|
|
|
public CheckedStatement(Statement block) { |
|
Block = block; |
|
} |
|
|
|
public Statement Block { |
|
get { |
|
return block; |
|
} |
|
set { |
|
block = value ?? Statement.Null; |
|
} |
|
} |
|
|
|
public override object AcceptVisitor(IAstVisitor visitor, object data) { |
|
return visitor.Visit(this, data); |
|
} |
|
|
|
public override string ToString() { |
|
return string.Format("[CheckedStatement Block={0}]", Block); |
|
} |
|
} |
|
|
|
public class ClassReferenceExpression : Expression { |
|
|
|
public ClassReferenceExpression() { |
|
} |
|
|
|
public override object AcceptVisitor(IAstVisitor visitor, object data) { |
|
return visitor.Visit(this, data); |
|
} |
|
|
|
public override string ToString() { |
|
return "[ClassReferenceExpression]"; |
|
} |
|
} |
|
|
|
public class ConditionalExpression : Expression { |
|
|
|
Expression condition; |
|
|
|
Expression trueExpression; |
|
|
|
Expression falseExpression; |
|
|
|
public ConditionalExpression(Expression condition, Expression trueExpression, Expression falseExpression) { |
|
Condition = condition; |
|
TrueExpression = trueExpression; |
|
FalseExpression = falseExpression; |
|
} |
|
|
|
public Expression Condition { |
|
get { |
|
return condition; |
|
} |
|
set { |
|
condition = value ?? Expression.Null; |
|
} |
|
} |
|
|
|
public Expression TrueExpression { |
|
get { |
|
return trueExpression; |
|
} |
|
set { |
|
trueExpression = value ?? Expression.Null; |
|
} |
|
} |
|
|
|
public Expression FalseExpression { |
|
get { |
|
return falseExpression; |
|
} |
|
set { |
|
falseExpression = value ?? Expression.Null; |
|
} |
|
} |
|
|
|
public override object AcceptVisitor(IAstVisitor visitor, object data) { |
|
return visitor.Visit(this, data); |
|
} |
|
|
|
public override string ToString() { |
|
return string.Format("[ConditionalExpression Condition={0} TrueExpression={1} FalseExpression={2}]", Condition, TrueExpression, FalseExpression); |
|
} |
|
} |
|
|
|
public class ConstructorDeclaration : ParametrizedNode { |
|
|
|
ConstructorInitializer constructorInitializer; |
|
|
|
BlockStatement body; |
|
|
|
public ConstructorDeclaration(string name, Modifier modifier, List<ParameterDeclarationExpression> parameters, List<AttributeSection> attributes) : |
|
base(modifier, attributes, name, parameters) { |
|
constructorInitializer = ConstructorInitializer.Null; |
|
body = BlockStatement.Null; |
|
} |
|
|
|
public ConstructorDeclaration(string name, Modifier modifier, List<ParameterDeclarationExpression> parameters, ConstructorInitializer constructorInitializer, List<AttributeSection> attributes) : |
|
base(modifier, attributes, name, parameters) { |
|
ConstructorInitializer = constructorInitializer; |
|
body = BlockStatement.Null; |
|
} |
|
|
|
public ConstructorInitializer ConstructorInitializer { |
|
get { |
|
return constructorInitializer; |
|
} |
|
set { |
|
constructorInitializer = value ?? ConstructorInitializer.Null; |
|
} |
|
} |
|
|
|
public BlockStatement Body { |
|
get { |
|
return body; |
|
} |
|
set { |
|
body = value ?? BlockStatement.Null; |
|
} |
|
} |
|
|
|
public override object AcceptVisitor(IAstVisitor visitor, object data) { |
|
return visitor.Visit(this, data); |
|
} |
|
|
|
public override string ToString() { |
|
return string.Format("[ConstructorDeclaration ConstructorInitializer={0} Body={1} Name={2} Parameters={" + |
|
"3} Attributes={4} Modifier={5}]", ConstructorInitializer, Body, Name, GetCollectionString(Parameters), GetCollectionString(Attributes), Modifier); |
|
} |
|
} |
|
|
|
public class ConstructorInitializer : AbstractNode, INullable { |
|
|
|
ConstructorInitializerType constructorInitializerType; |
|
|
|
List<Expression> arguments; |
|
|
|
public ConstructorInitializer() { |
|
arguments = new List<Expression>(); |
|
} |
|
|
|
public ConstructorInitializerType ConstructorInitializerType { |
|
get { |
|
return constructorInitializerType; |
|
} |
|
set { |
|
constructorInitializerType = value; |
|
} |
|
} |
|
|
|
public List<Expression> Arguments { |
|
get { |
|
return arguments; |
|
} |
|
set { |
|
arguments = value ?? new List<Expression>(); |
|
} |
|
} |
|
|
|
public virtual bool IsNull { |
|
get { |
|
return false; |
|
} |
|
} |
|
|
|
public static ConstructorInitializer Null { |
|
get { |
|
return NullConstructorInitializer.Instance; |
|
} |
|
} |
|
|
|
public override object AcceptVisitor(IAstVisitor visitor, object data) { |
|
return visitor.Visit(this, data); |
|
} |
|
|
|
public override string ToString() { |
|
return string.Format("[ConstructorInitializer ConstructorInitializerType={0} Arguments={1}]", ConstructorInitializerType, GetCollectionString(Arguments)); |
|
} |
|
} |
|
|
|
public class NullConstructorInitializer : ConstructorInitializer { |
|
|
|
static NullConstructorInitializer instance = new NullConstructorInitializer(); |
|
|
|
private NullConstructorInitializer() { |
|
} |
|
|
|
public static NullConstructorInitializer Instance { |
|
get { |
|
return instance; |
|
} |
|
} |
|
|
|
public override bool IsNull { |
|
get { |
|
return true; |
|
} |
|
} |
|
|
|
public override object AcceptVisitor(IAstVisitor visitor, object data) { |
|
return null; |
|
} |
|
|
|
public override string ToString() { |
|
return "[NullConstructorInitializer]"; |
|
} |
|
} |
|
|
|
public class ContinueStatement : Statement { |
|
|
|
ContinueType continueType; |
|
|
|
public ContinueStatement() { |
|
} |
|
|
|
public ContinueStatement(ContinueType continueType) { |
|
ContinueType = continueType; |
|
} |
|
|
|
public ContinueType ContinueType { |
|
get { |
|
return continueType; |
|
} |
|
set { |
|
continueType = value; |
|
} |
|
} |
|
|
|
public override object AcceptVisitor(IAstVisitor visitor, object data) { |
|
return visitor.Visit(this, data); |
|
} |
|
|
|
public override string ToString() { |
|
return string.Format("[ContinueStatement ContinueType={0}]", ContinueType); |
|
} |
|
} |
|
|
|
public class DeclareDeclaration : ParametrizedNode { |
|
|
|
string alias; |
|
|
|
string library; |
|
|
|
CharsetModifier charset; |
|
|
|
TypeReference typeReference; |
|
|
|
public DeclareDeclaration(string name, Modifier modifier, TypeReference typeReference, List<ParameterDeclarationExpression> parameters, List<AttributeSection> attributes, string library, string alias, CharsetModifier charset) : |
|
base(modifier, attributes, name, parameters) { |
|
TypeReference = typeReference; |
|
Library = library; |
|
Alias = alias; |
|
Charset = charset; |
|
} |
|
|
|
public string Alias { |
|
get { |
|
return alias; |
|
} |
|
set { |
|
alias = value ?? ""; |
|
} |
|
} |
|
|
|
public string Library { |
|
get { |
|
return library; |
|
} |
|
set { |
|
library = value ?? ""; |
|
} |
|
} |
|
|
|
public CharsetModifier Charset { |
|
get { |
|
return charset; |
|
} |
|
set { |
|
charset = value; |
|
} |
|
} |
|
|
|
public TypeReference TypeReference { |
|
get { |
|
return typeReference; |
|
} |
|
set { |
|
typeReference = value ?? TypeReference.Null; |
|
} |
|
} |
|
|
|
public override object AcceptVisitor(IAstVisitor visitor, object data) { |
|
return visitor.Visit(this, data); |
|
} |
|
|
|
public override string ToString() { |
|
return string.Format("[DeclareDeclaration Alias={0} Library={1} Charset={2} TypeReference={3} Name={4} " + |
|
"Parameters={5} Attributes={6} Modifier={7}]", Alias, Library, Charset, TypeReference, Name, GetCollectionString(Parameters), GetCollectionString(Attributes), Modifier); |
|
} |
|
} |
|
|
|
public class DefaultValueExpression : Expression { |
|
|
|
TypeReference typeReference; |
|
|
|
public DefaultValueExpression(TypeReference typeReference) { |
|
TypeReference = typeReference; |
|
} |
|
|
|
public TypeReference TypeReference { |
|
get { |
|
return typeReference; |
|
} |
|
set { |
|
typeReference = value ?? TypeReference.Null; |
|
} |
|
} |
|
|
|
public override object AcceptVisitor(IAstVisitor visitor, object data) { |
|
return visitor.Visit(this, data); |
|
} |
|
|
|
public override string ToString() { |
|
return string.Format("[DefaultValueExpression TypeReference={0}]", TypeReference); |
|
} |
|
} |
|
|
|
public class DelegateDeclaration : AttributedNode { |
|
|
|
string name; |
|
|
|
TypeReference returnType; |
|
|
|
List<ParameterDeclarationExpression> parameters; |
|
|
|
List<TemplateDefinition> templates; |
|
|
|
public DelegateDeclaration(Modifier modifier, List<AttributeSection> attributes) : |
|
base(attributes) { |
|
Modifier = modifier; |
|
name = "?"; |
|
returnType = TypeReference.Null; |
|
parameters = new List<ParameterDeclarationExpression>(); |
|
templates = new List<TemplateDefinition>(); |
|
} |
|
|
|
public string Name { |
|
get { |
|
return name; |
|
} |
|
set { |
|
name = string.IsNullOrEmpty(value) ? "?" : value; |
|
} |
|
} |
|
|
|
public TypeReference ReturnType { |
|
get { |
|
return returnType; |
|
} |
|
set { |
|
returnType = value ?? TypeReference.Null; |
|
} |
|
} |
|
|
|
public List<ParameterDeclarationExpression> Parameters { |
|
get { |
|
return parameters; |
|
} |
|
set { |
|
parameters = value ?? new List<ParameterDeclarationExpression>(); |
|
} |
|
} |
|
|
|
public List<TemplateDefinition> Templates { |
|
get { |
|
return templates; |
|
} |
|
set { |
|
templates = value ?? new List<TemplateDefinition>(); |
|
} |
|
} |
|
|
|
public override object AcceptVisitor(IAstVisitor visitor, object data) { |
|
return visitor.Visit(this, data); |
|
} |
|
|
|
public override string ToString() { |
|
return string.Format("[DelegateDeclaration Name={0} ReturnType={1} Parameters={2} Templates={3} Attribu" + |
|
"tes={4} Modifier={5}]", Name, ReturnType, GetCollectionString(Parameters), GetCollectionString(Templates), GetCollectionString(Attributes), Modifier); |
|
} |
|
} |
|
|
|
public class DestructorDeclaration : AttributedNode { |
|
|
|
string name; |
|
|
|
BlockStatement body; |
|
|
|
public DestructorDeclaration(string name, Modifier modifier, List<AttributeSection> attributes) : |
|
base(attributes) { |
|
Name = name; |
|
Modifier = modifier; |
|
body = BlockStatement.Null; |
|
} |
|
|
|
public string Name { |
|
get { |
|
return name; |
|
} |
|
set { |
|
name = value ?? ""; |
|
} |
|
} |
|
|
|
public BlockStatement Body { |
|
get { |
|
return body; |
|
} |
|
set { |
|
body = value ?? BlockStatement.Null; |
|
} |
|
} |
|
|
|
public override object AcceptVisitor(IAstVisitor visitor, object data) { |
|
return visitor.Visit(this, data); |
|
} |
|
|
|
public override string ToString() { |
|
return string.Format("[DestructorDeclaration Name={0} Body={1} Attributes={2} Modifier={3}]", Name, Body, GetCollectionString(Attributes), Modifier); |
|
} |
|
} |
|
|
|
public class DirectionExpression : Expression { |
|
|
|
FieldDirection fieldDirection; |
|
|
|
Expression expression; |
|
|
|
public DirectionExpression(FieldDirection fieldDirection, Expression expression) { |
|
FieldDirection = fieldDirection; |
|
Expression = expression; |
|
} |
|
|
|
public FieldDirection FieldDirection { |
|
get { |
|
return fieldDirection; |
|
} |
|
set { |
|
fieldDirection = value; |
|
} |
|
} |
|
|
|
public Expression Expression { |
|
get { |
|
return expression; |
|
} |
|
set { |
|
expression = value ?? Expression.Null; |
|
} |
|
} |
|
|
|
public override object AcceptVisitor(IAstVisitor visitor, object data) { |
|
return visitor.Visit(this, data); |
|
} |
|
|
|
public override string ToString() { |
|
return string.Format("[DirectionExpression FieldDirection={0} Expression={1}]", FieldDirection, Expression); |
|
} |
|
} |
|
|
|
public class DoLoopStatement : StatementWithEmbeddedStatement { |
|
|
|
Expression condition; |
|
|
|
ConditionType conditionType; |
|
|
|
ConditionPosition conditionPosition; |
|
|
|
public DoLoopStatement(Expression condition, Statement embeddedStatement, ConditionType conditionType, ConditionPosition conditionPosition) { |
|
Condition = condition; |
|
EmbeddedStatement = embeddedStatement; |
|
ConditionType = conditionType; |
|
ConditionPosition = conditionPosition; |
|
} |
|
|
|
public Expression Condition { |
|
get { |
|
return condition; |
|
} |
|
set { |
|
condition = value ?? Expression.Null; |
|
} |
|
} |
|
|
|
public ConditionType ConditionType { |
|
get { |
|
return conditionType; |
|
} |
|
set { |
|
conditionType = value; |
|
} |
|
} |
|
|
|
public ConditionPosition ConditionPosition { |
|
get { |
|
return conditionPosition; |
|
} |
|
set { |
|
conditionPosition = value; |
|
} |
|
} |
|
|
|
public override object AcceptVisitor(IAstVisitor visitor, object data) { |
|
return visitor.Visit(this, data); |
|
} |
|
|
|
public override string ToString() { |
|
return string.Format("[DoLoopStatement Condition={0} ConditionType={1} ConditionPosition={2} EmbeddedSt" + |
|
"atement={3}]", Condition, ConditionType, ConditionPosition, EmbeddedStatement); |
|
} |
|
} |
|
|
|
public class ElseIfSection : StatementWithEmbeddedStatement { |
|
|
|
Expression condition; |
|
|
|
public ElseIfSection(Expression condition, Statement embeddedStatement) { |
|
Condition = condition; |
|
EmbeddedStatement = embeddedStatement; |
|
} |
|
|
|
public Expression Condition { |
|
get { |
|
return condition; |
|
} |
|
set { |
|
condition = value ?? Expression.Null; |
|
} |
|
} |
|
|
|
public override object AcceptVisitor(IAstVisitor visitor, object data) { |
|
return visitor.Visit(this, data); |
|
} |
|
|
|
public override string ToString() { |
|
return string.Format("[ElseIfSection Condition={0} EmbeddedStatement={1}]", Condition, EmbeddedStatement); |
|
} |
|
} |
|
|
|
public class EmptyStatement : Statement { |
|
|
|
public EmptyStatement() { |
|
} |
|
|
|
public override object AcceptVisitor(IAstVisitor visitor, object data) { |
|
return visitor.Visit(this, data); |
|
} |
|
|
|
public override string ToString() { |
|
return "[EmptyStatement]"; |
|
} |
|
} |
|
|
|
public class EndStatement : Statement { |
|
|
|
public EndStatement() { |
|
} |
|
|
|
public override object AcceptVisitor(IAstVisitor visitor, object data) { |
|
return visitor.Visit(this, data); |
|
} |
|
|
|
public override string ToString() { |
|
return "[EndStatement]"; |
|
} |
|
} |
|
|
|
public class EraseStatement : Statement { |
|
|
|
List<Expression> expressions; |
|
|
|
public EraseStatement() { |
|
expressions = new List<Expression>(); |
|
} |
|
|
|
public EraseStatement(List<Expression> expressions) { |
|
Expressions = expressions; |
|
} |
|
|
|
public List<Expression> Expressions { |
|
get { |
|
return expressions; |
|
} |
|
set { |
|
expressions = value ?? new List<Expression>(); |
|
} |
|
} |
|
|
|
public override object AcceptVisitor(IAstVisitor visitor, object data) { |
|
return visitor.Visit(this, data); |
|
} |
|
|
|
public override string ToString() { |
|
return string.Format("[EraseStatement Expressions={0}]", GetCollectionString(Expressions)); |
|
} |
|
} |
|
|
|
public class ErrorStatement : Statement { |
|
|
|
Expression expression; |
|
|
|
public ErrorStatement(Expression expression) { |
|
Expression = expression; |
|
} |
|
|
|
public Expression Expression { |
|
get { |
|
return expression; |
|
} |
|
set { |
|
expression = value ?? Expression.Null; |
|
} |
|
} |
|
|
|
public override object AcceptVisitor(IAstVisitor visitor, object data) { |
|
return visitor.Visit(this, data); |
|
} |
|
|
|
public override string ToString() { |
|
return string.Format("[ErrorStatement Expression={0}]", Expression); |
|
} |
|
} |
|
|
|
public class EventAddRegion : EventAddRemoveRegion { |
|
|
|
public EventAddRegion(List<AttributeSection> attributes) : |
|
base(attributes) { |
|
} |
|
|
|
public static EventAddRegion Null { |
|
get { |
|
return NullEventAddRegion.Instance; |
|
} |
|
} |
|
|
|
public override object AcceptVisitor(IAstVisitor visitor, object data) { |
|
return visitor.Visit(this, data); |
|
} |
|
|
|
public override string ToString() { |
|
return string.Format("[EventAddRegion Block={0} Parameters={1} Attributes={2} Modifier={3}]", Block, GetCollectionString(Parameters), GetCollectionString(Attributes), Modifier); |
|
} |
|
} |
|
|
|
public class NullEventAddRegion : EventAddRegion { |
|
|
|
static NullEventAddRegion instance = new NullEventAddRegion(); |
|
|
|
private NullEventAddRegion() : |
|
base(null) { |
|
} |
|
|
|
public static NullEventAddRegion Instance { |
|
get { |
|
return instance; |
|
} |
|
} |
|
|
|
public override bool IsNull { |
|
get { |
|
return true; |
|
} |
|
} |
|
|
|
public override object AcceptVisitor(IAstVisitor visitor, object data) { |
|
return null; |
|
} |
|
|
|
public override string ToString() { |
|
return "[NullEventAddRegion]"; |
|
} |
|
} |
|
|
|
public abstract class EventAddRemoveRegion : AttributedNode, INullable { |
|
|
|
BlockStatement block; |
|
|
|
List<ParameterDeclarationExpression> parameters; |
|
|
|
public EventAddRemoveRegion(List<AttributeSection> attributes) : |
|
base(attributes) { |
|
block = BlockStatement.Null; |
|
parameters = new List<ParameterDeclarationExpression>(); |
|
} |
|
|
|
public BlockStatement Block { |
|
get { |
|
return block; |
|
} |
|
set { |
|
block = value ?? BlockStatement.Null; |
|
} |
|
} |
|
|
|
public List<ParameterDeclarationExpression> Parameters { |
|
get { |
|
return parameters; |
|
} |
|
set { |
|
parameters = value ?? new List<ParameterDeclarationExpression>(); |
|
} |
|
} |
|
|
|
public virtual bool IsNull { |
|
get { |
|
return false; |
|
} |
|
} |
|
} |
|
|
|
public class EventDeclaration : ParametrizedNode { |
|
|
|
TypeReference typeReference; |
|
|
|
List<InterfaceImplementation> interfaceImplementations; |
|
|
|
EventAddRegion addRegion; |
|
|
|
EventRemoveRegion removeRegion; |
|
|
|
EventRaiseRegion raiseRegion; |
|
|
|
Point bodyStart; |
|
|
|
Point bodyEnd; |
|
|
|
public EventDeclaration(TypeReference typeReference, string name, Modifier modifier, List<AttributeSection> attributes, List<ParameterDeclarationExpression> parameters) : |
|
base(modifier, attributes, name, parameters) { |
|
TypeReference = typeReference; |
|
interfaceImplementations = new List<InterfaceImplementation>(); |
|
addRegion = EventAddRegion.Null; |
|
removeRegion = EventRemoveRegion.Null; |
|
raiseRegion = EventRaiseRegion.Null; |
|
bodyStart = new Point(-1, -1); |
|
bodyEnd = new Point(-1, -1); |
|
} |
|
|
|
public EventDeclaration(TypeReference typeReference, Modifier modifier, List<ParameterDeclarationExpression> parameters, List<AttributeSection> attributes, string name, List<InterfaceImplementation> interfaceImplementations) : |
|
base(modifier, attributes, name, parameters) { |
|
TypeReference = typeReference; |
|
InterfaceImplementations = interfaceImplementations; |
|
addRegion = EventAddRegion.Null; |
|
removeRegion = EventRemoveRegion.Null; |
|
raiseRegion = EventRaiseRegion.Null; |
|
bodyStart = new Point(-1, -1); |
|
bodyEnd = new Point(-1, -1); |
|
} |
|
|
|
public TypeReference TypeReference { |
|
get { |
|
return typeReference; |
|
} |
|
set { |
|
typeReference = value ?? TypeReference.Null; |
|
} |
|
} |
|
|
|
public List<InterfaceImplementation> InterfaceImplementations { |
|
get { |
|
return interfaceImplementations; |
|
} |
|
set { |
|
interfaceImplementations = value ?? new List<InterfaceImplementation>(); |
|
} |
|
} |
|
|
|
public EventAddRegion AddRegion { |
|
get { |
|
return addRegion; |
|
} |
|
set { |
|
addRegion = value ?? EventAddRegion.Null; |
|
} |
|
} |
|
|
|
public EventRemoveRegion RemoveRegion { |
|
get { |
|
return removeRegion; |
|
} |
|
set { |
|
removeRegion = value ?? EventRemoveRegion.Null; |
|
} |
|
} |
|
|
|
public EventRaiseRegion RaiseRegion { |
|
get { |
|
return raiseRegion; |
|
} |
|
set { |
|
raiseRegion = value ?? EventRaiseRegion.Null; |
|
} |
|
} |
|
|
|
public Point BodyStart { |
|
get { |
|
return bodyStart; |
|
} |
|
set { |
|
bodyStart = value; |
|
} |
|
} |
|
|
|
public Point BodyEnd { |
|
get { |
|
return bodyEnd; |
|
} |
|
set { |
|
bodyEnd = value; |
|
} |
|
} |
|
|
|
public bool HasAddRegion { |
|
get { |
|
return !addRegion.IsNull; |
|
} |
|
} |
|
|
|
public bool HasRaiseRegion { |
|
get { |
|
return !raiseRegion.IsNull; |
|
} |
|
} |
|
|
|
public bool HasRemoveRegion { |
|
get { |
|
return !removeRegion.IsNull; |
|
} |
|
} |
|
|
|
public override object AcceptVisitor(IAstVisitor visitor, object data) { |
|
return visitor.Visit(this, data); |
|
} |
|
|
|
public override string ToString() { |
|
return string.Format("[EventDeclaration TypeReference={0} InterfaceImplementations={1} AddRegion={2} Re" + |
|
"moveRegion={3} RaiseRegion={4} BodyStart={5} BodyEnd={6} Name={7} Parameters={8}" + |
|
" Attributes={9} Modifier={10}]", TypeReference, GetCollectionString(InterfaceImplementations), AddRegion, RemoveRegion, RaiseRegion, BodyStart, BodyEnd, Name, GetCollectionString(Parameters), GetCollectionString(Attributes), Modifier); |
|
} |
|
} |
|
|
|
public class EventRaiseRegion : EventAddRemoveRegion { |
|
|
|
public EventRaiseRegion(List<AttributeSection> attributes) : |
|
base(attributes) { |
|
} |
|
|
|
public static EventRaiseRegion Null { |
|
get { |
|
return NullEventRaiseRegion.Instance; |
|
} |
|
} |
|
|
|
public override object AcceptVisitor(IAstVisitor visitor, object data) { |
|
return visitor.Visit(this, data); |
|
} |
|
|
|
public override string ToString() { |
|
return string.Format("[EventRaiseRegion Block={0} Parameters={1} Attributes={2} Modifier={3}]", Block, GetCollectionString(Parameters), GetCollectionString(Attributes), Modifier); |
|
} |
|
} |
|
|
|
public class NullEventRaiseRegion : EventRaiseRegion { |
|
|
|
static NullEventRaiseRegion instance = new NullEventRaiseRegion(); |
|
|
|
private NullEventRaiseRegion() : |
|
base(null) { |
|
} |
|
|
|
public static NullEventRaiseRegion Instance { |
|
get { |
|
return instance; |
|
} |
|
} |
|
|
|
public override bool IsNull { |
|
get { |
|
return true; |
|
} |
|
} |
|
|
|
public override object AcceptVisitor(IAstVisitor visitor, object data) { |
|
return null; |
|
} |
|
|
|
public override string ToString() { |
|
return "[NullEventRaiseRegion]"; |
|
} |
|
} |
|
|
|
public class EventRemoveRegion : EventAddRemoveRegion { |
|
|
|
public EventRemoveRegion(List<AttributeSection> attributes) : |
|
base(attributes) { |
|
} |
|
|
|
public static EventRemoveRegion Null { |
|
get { |
|
return NullEventRemoveRegion.Instance; |
|
} |
|
} |
|
|
|
public override object AcceptVisitor(IAstVisitor visitor, object data) { |
|
return visitor.Visit(this, data); |
|
} |
|
|
|
public override string ToString() { |
|
return string.Format("[EventRemoveRegion Block={0} Parameters={1} Attributes={2} Modifier={3}]", Block, GetCollectionString(Parameters), GetCollectionString(Attributes), Modifier); |
|
} |
|
} |
|
|
|
public class NullEventRemoveRegion : EventRemoveRegion { |
|
|
|
static NullEventRemoveRegion instance = new NullEventRemoveRegion(); |
|
|
|
private NullEventRemoveRegion() : |
|
base(null) { |
|
} |
|
|
|
public static NullEventRemoveRegion Instance { |
|
get { |
|
return instance; |
|
} |
|
} |
|
|
|
public override bool IsNull { |
|
get { |
|
return true; |
|
} |
|
} |
|
|
|
public override object AcceptVisitor(IAstVisitor visitor, object data) { |
|
return null; |
|
} |
|
|
|
public override string ToString() { |
|
return "[NullEventRemoveRegion]"; |
|
} |
|
} |
|
|
|
public class ExitStatement : Statement { |
|
|
|
ExitType exitType; |
|
|
|
public ExitStatement(ExitType exitType) { |
|
ExitType = exitType; |
|
} |
|
|
|
public ExitType ExitType { |
|
get { |
|
return exitType; |
|
} |
|
set { |
|
exitType = value; |
|
} |
|
} |
|
|
|
public override object AcceptVisitor(IAstVisitor visitor, object data) { |
|
return visitor.Visit(this, data); |
|
} |
|
|
|
public override string ToString() { |
|
return string.Format("[ExitStatement ExitType={0}]", ExitType); |
|
} |
|
} |
|
|
|
public class FieldDeclaration : AttributedNode { |
|
|
|
TypeReference typeReference; |
|
|
|
List<VariableDeclaration> fields; |
|
|
|
|
|
public TypeReference GetTypeForField(int fieldIndex) |
|
{ |
|
if (!typeReference.IsNull) { |
|
return typeReference; |
|
} |
|
|
|
for (int i = fieldIndex; i < Fields.Count;++i) { |
|
if (!((VariableDeclaration)Fields[i]).TypeReference.IsNull) { |
|
return ((VariableDeclaration)Fields[i]).TypeReference; |
|
} |
|
} |
|
return TypeReference.Null; |
|
} |
|
|
|
public VariableDeclaration GetVariableDeclaration(string variableName) |
|
{ |
|
foreach (VariableDeclaration variableDeclaration in Fields) { |
|
if (variableDeclaration.Name == variableName) { |
|
return variableDeclaration; |
|
} |
|
} |
|
return null; |
|
} |
|
|
|
public FieldDeclaration(List<AttributeSection> attributes) : |
|
base(attributes) { |
|
typeReference = TypeReference.Null; |
|
fields = new List<VariableDeclaration>(); |
|
} |
|
|
|
public FieldDeclaration(List<AttributeSection> attributes, TypeReference typeReference, Modifier modifier) : |
|
base(attributes) { |
|
TypeReference = typeReference; |
|
Modifier = modifier; |
|
fields = new List<VariableDeclaration>(); |
|
} |
|
|
|
public TypeReference TypeReference { |
|
get { |
|
return typeReference; |
|
} |
|
set { |
|
typeReference = value ?? TypeReference.Null; |
|
} |
|
} |
|
|
|
public List<VariableDeclaration> Fields { |
|
get { |
|
return fields; |
|
} |
|
set { |
|
fields = value ?? new List<VariableDeclaration>(); |
|
} |
|
} |
|
|
|
public override object AcceptVisitor(IAstVisitor visitor, object data) { |
|
return visitor.Visit(this, data); |
|
} |
|
|
|
public override string ToString() { |
|
return string.Format("[FieldDeclaration TypeReference={0} Fields={1} Attributes={2} Modifier={3}]", TypeReference, GetCollectionString(Fields), GetCollectionString(Attributes), Modifier); |
|
} |
|
} |
|
|
|
public class FieldReferenceExpression : Expression { |
|
|
|
Expression targetObject; |
|
|
|
string fieldName; |
|
|
|
public FieldReferenceExpression(Expression targetObject, string fieldName) { |
|
TargetObject = targetObject; |
|
FieldName = fieldName; |
|
} |
|
|
|
public Expression TargetObject { |
|
get { |
|
return targetObject; |
|
} |
|
set { |
|
targetObject = value ?? Expression.Null; |
|
} |
|
} |
|
|
|
public string FieldName { |
|
get { |
|
return fieldName; |
|
} |
|
set { |
|
fieldName = value ?? ""; |
|
} |
|
} |
|
|
|
public override object AcceptVisitor(IAstVisitor visitor, object data) { |
|
return visitor.Visit(this, data); |
|
} |
|
|
|
public override string ToString() { |
|
return string.Format("[FieldReferenceExpression TargetObject={0} FieldName={1}]", TargetObject, FieldName); |
|
} |
|
} |
|
|
|
public class FixedStatement : StatementWithEmbeddedStatement { |
|
|
|
TypeReference typeReference; |
|
|
|
List<VariableDeclaration> pointerDeclarators; |
|
|
|
public FixedStatement(TypeReference typeReference, List<VariableDeclaration> pointerDeclarators, Statement embeddedStatement) { |
|
TypeReference = typeReference; |
|
PointerDeclarators = pointerDeclarators; |
|
EmbeddedStatement = embeddedStatement; |
|
} |
|
|
|
public TypeReference TypeReference { |
|
get { |
|
return typeReference; |
|
} |
|
set { |
|
typeReference = value ?? TypeReference.Null; |
|
} |
|
} |
|
|
|
public List<VariableDeclaration> PointerDeclarators { |
|
get { |
|
return pointerDeclarators; |
|
} |
|
set { |
|
pointerDeclarators = value ?? new List<VariableDeclaration>(); |
|
} |
|
} |
|
|
|
public override object AcceptVisitor(IAstVisitor visitor, object data) { |
|
return visitor.Visit(this, data); |
|
} |
|
|
|
public override string ToString() { |
|
return string.Format("[FixedStatement TypeReference={0} PointerDeclarators={1} EmbeddedStatement={2}]", TypeReference, GetCollectionString(PointerDeclarators), EmbeddedStatement); |
|
} |
|
} |
|
|
|
public class ForeachStatement : StatementWithEmbeddedStatement { |
|
|
|
TypeReference typeReference; |
|
|
|
string variableName; |
|
|
|
Expression expression; |
|
|
|
Expression nextExpression; |
|
|
|
public ForeachStatement(TypeReference typeReference, string variableName, Expression expression, Statement embeddedStatement) { |
|
TypeReference = typeReference; |
|
VariableName = variableName; |
|
Expression = expression; |
|
EmbeddedStatement = embeddedStatement; |
|
nextExpression = Expression.Null; |
|
} |
|
|
|
public ForeachStatement(TypeReference typeReference, string variableName, Expression expression, Statement embeddedStatement, Expression nextExpression) { |
|
TypeReference = typeReference; |
|
VariableName = variableName; |
|
Expression = expression; |
|
EmbeddedStatement = embeddedStatement; |
|
NextExpression = nextExpression; |
|
} |
|
|
|
public TypeReference TypeReference { |
|
get { |
|
return typeReference; |
|
} |
|
set { |
|
typeReference = value ?? TypeReference.Null; |
|
} |
|
} |
|
|
|
public string VariableName { |
|
get { |
|
return variableName; |
|
} |
|
set { |
|
variableName = value ?? ""; |
|
} |
|
} |
|
|
|
public Expression Expression { |
|
get { |
|
return expression; |
|
} |
|
set { |
|
expression = value ?? Expression.Null; |
|
} |
|
} |
|
|
|
public Expression NextExpression { |
|
get { |
|
return nextExpression; |
|
} |
|
set { |
|
nextExpression = value ?? Expression.Null; |
|
} |
|
} |
|
|
|
public override object AcceptVisitor(IAstVisitor visitor, object data) { |
|
return visitor.Visit(this, data); |
|
} |
|
|
|
public override string ToString() { |
|
return string.Format("[ForeachStatement TypeReference={0} VariableName={1} Expression={2} NextExpressio" + |
|
"n={3} EmbeddedStatement={4}]", TypeReference, VariableName, Expression, NextExpression, EmbeddedStatement); |
|
} |
|
} |
|
|
|
public class ForNextStatement : StatementWithEmbeddedStatement { |
|
|
|
Expression start; |
|
|
|
Expression end; |
|
|
|
Expression step; |
|
|
|
List<Expression> nextExpressions; |
|
|
|
TypeReference typeReference; |
|
|
|
string variableName; |
|
|
|
public ForNextStatement(TypeReference typeReference, string variableName, Expression start, Expression end, Expression step, Statement embeddedStatement, List<Expression> nextExpressions) { |
|
TypeReference = typeReference; |
|
VariableName = variableName; |
|
Start = start; |
|
End = end; |
|
Step = step; |
|
EmbeddedStatement = embeddedStatement; |
|
NextExpressions = nextExpressions; |
|
} |
|
|
|
public Expression Start { |
|
get { |
|
return start; |
|
} |
|
set { |
|
start = value ?? Expression.Null; |
|
} |
|
} |
|
|
|
public Expression End { |
|
get { |
|
return end; |
|
} |
|
set { |
|
end = value ?? Expression.Null; |
|
} |
|
} |
|
|
|
public Expression Step { |
|
get { |
|
return step; |
|
} |
|
set { |
|
step = value ?? Expression.Null; |
|
} |
|
} |
|
|
|
public List<Expression> NextExpressions { |
|
get { |
|
return nextExpressions; |
|
} |
|
set { |
|
nextExpressions = value ?? new List<Expression>(); |
|
} |
|
} |
|
|
|
public TypeReference TypeReference { |
|
get { |
|
return typeReference; |
|
} |
|
set { |
|
typeReference = value ?? TypeReference.Null; |
|
} |
|
} |
|
|
|
public string VariableName { |
|
get { |
|
return variableName; |
|
} |
|
set { |
|
variableName = value ?? ""; |
|
} |
|
} |
|
|
|
public override object AcceptVisitor(IAstVisitor visitor, object data) { |
|
return visitor.Visit(this, data); |
|
} |
|
|
|
public override string ToString() { |
|
return string.Format("[ForNextStatement Start={0} End={1} Step={2} NextExpressions={3} TypeReference={4" + |
|
"} VariableName={5} EmbeddedStatement={6}]", Start, End, Step, GetCollectionString(NextExpressions), TypeReference, VariableName, EmbeddedStatement); |
|
} |
|
} |
|
|
|
public class ForStatement : StatementWithEmbeddedStatement { |
|
|
|
List<Statement> initializers; |
|
|
|
Expression condition; |
|
|
|
List<Statement> iterator; |
|
|
|
public ForStatement(List<Statement> initializers, Expression condition, List<Statement> iterator, Statement embeddedStatement) { |
|
Initializers = initializers; |
|
Condition = condition; |
|
Iterator = iterator; |
|
EmbeddedStatement = embeddedStatement; |
|
} |
|
|
|
public List<Statement> Initializers { |
|
get { |
|
return initializers; |
|
} |
|
set { |
|
initializers = value ?? new List<Statement>(); |
|
} |
|
} |
|
|
|
public Expression Condition { |
|
get { |
|
return condition; |
|
} |
|
set { |
|
condition = value ?? Expression.Null; |
|
} |
|
} |
|
|
|
public List<Statement> Iterator { |
|
get { |
|
return iterator; |
|
} |
|
set { |
|
iterator = value ?? new List<Statement>(); |
|
} |
|
} |
|
|
|
public override object AcceptVisitor(IAstVisitor visitor, object data) { |
|
return visitor.Visit(this, data); |
|
} |
|
|
|
public override string ToString() { |
|
return string.Format("[ForStatement Initializers={0} Condition={1} Iterator={2} EmbeddedStatement={3}]", GetCollectionString(Initializers), Condition, GetCollectionString(Iterator), EmbeddedStatement); |
|
} |
|
} |
|
|
|
public class GotoCaseStatement : Statement { |
|
|
|
Expression expression; |
|
|
|
public GotoCaseStatement(Expression expression) { |
|
Expression = expression; |
|
} |
|
|
|
public Expression Expression { |
|
get { |
|
return expression; |
|
} |
|
set { |
|
expression = value ?? Expression.Null; |
|
} |
|
} |
|
|
|
public bool IsDefaultCase { |
|
get { |
|
return expression.IsNull; |
|
} |
|
} |
|
|
|
public override object AcceptVisitor(IAstVisitor visitor, object data) { |
|
return visitor.Visit(this, data); |
|
} |
|
|
|
public override string ToString() { |
|
return string.Format("[GotoCaseStatement Expression={0}]", Expression); |
|
} |
|
} |
|
|
|
public class GotoStatement : Statement { |
|
|
|
string label; |
|
|
|
public GotoStatement(string label) { |
|
Label = label; |
|
} |
|
|
|
public string Label { |
|
get { |
|
return label; |
|
} |
|
set { |
|
label = value ?? ""; |
|
} |
|
} |
|
|
|
public override object AcceptVisitor(IAstVisitor visitor, object data) { |
|
return visitor.Visit(this, data); |
|
} |
|
|
|
public override string ToString() { |
|
return string.Format("[GotoStatement Label={0}]", Label); |
|
} |
|
} |
|
|
|
public class IdentifierExpression : Expression { |
|
|
|
string identifier; |
|
|
|
public IdentifierExpression(string identifier) { |
|
Identifier = identifier; |
|
} |
|
|
|
public string Identifier { |
|
get { |
|
return identifier; |
|
} |
|
set { |
|
identifier = value ?? ""; |
|
} |
|
} |
|
|
|
public override object AcceptVisitor(IAstVisitor visitor, object data) { |
|
return visitor.Visit(this, data); |
|
} |
|
|
|
public override string ToString() { |
|
return string.Format("[IdentifierExpression Identifier={0}]", Identifier); |
|
} |
|
} |
|
|
|
public class IfElseStatement : Statement { |
|
|
|
Expression condition; |
|
|
|
List<Statement> trueStatement; |
|
|
|
List<Statement> falseStatement; |
|
|
|
List<ElseIfSection> elseIfSections; |
|
|
|
|
|
public IfElseStatement(Expression condition, Statement trueStatement, Statement falseStatement) |
|
: this(condition) { |
|
this.trueStatement.Add(Statement.CheckNull(trueStatement)); |
|
this.falseStatement.Add(Statement.CheckNull(falseStatement)); |
|
} |
|
|
|
public IfElseStatement(Expression condition, Statement trueStatement) |
|
: this(condition) { |
|
this.trueStatement.Add(Statement.CheckNull(trueStatement)); |
|
} |
|
|
|
public IfElseStatement(Expression condition) { |
|
Condition = condition; |
|
trueStatement = new List<Statement>(); |
|
falseStatement = new List<Statement>(); |
|
elseIfSections = new List<ElseIfSection>(); |
|
} |
|
|
|
public Expression Condition { |
|
get { |
|
return condition; |
|
} |
|
set { |
|
condition = value ?? Expression.Null; |
|
} |
|
} |
|
|
|
public List<Statement> TrueStatement { |
|
get { |
|
return trueStatement; |
|
} |
|
set { |
|
trueStatement = value ?? new List<Statement>(); |
|
} |
|
} |
|
|
|
public List<Statement> FalseStatement { |
|
get { |
|
return falseStatement; |
|
} |
|
set { |
|
falseStatement = value ?? new List<Statement>(); |
|
} |
|
} |
|
|
|
public List<ElseIfSection> ElseIfSections { |
|
get { |
|
return elseIfSections; |
|
} |
|
set { |
|
elseIfSections = value ?? new List<ElseIfSection>(); |
|
} |
|
} |
|
|
|
public bool HasElseIfSections { |
|
get { |
|
return elseIfSections.Count > 0; |
|
} |
|
} |
|
|
|
public bool HasElseStatements { |
|
get { |
|
return falseStatement.Count > 0; |
|
} |
|
} |
|
|
|
public override object AcceptVisitor(IAstVisitor visitor, object data) { |
|
return visitor.Visit(this, data); |
|
} |
|
|
|
public override string ToString() { |
|
return string.Format("[IfElseStatement Condition={0} TrueStatement={1} FalseStatement={2} ElseIfSection" + |
|
"s={3}]", Condition, GetCollectionString(TrueStatement), GetCollectionString(FalseStatement), GetCollectionString(ElseIfSections)); |
|
} |
|
} |
|
|
|
public class IndexerDeclaration : AttributedNode { |
|
|
|
List<ParameterDeclarationExpression> parameters; |
|
|
|
List<InterfaceImplementation> interfaceImplementations; |
|
|
|
TypeReference typeReference; |
|
|
|
Point bodyStart; |
|
|
|
Point bodyEnd; |
|
|
|
PropertyGetRegion getRegion; |
|
|
|
PropertySetRegion setRegion; |
|
|
|
public IndexerDeclaration(Modifier modifier, List<ParameterDeclarationExpression> parameters, List<AttributeSection> attributes) : |
|
base(attributes) { |
|
Modifier = modifier; |
|
Parameters = parameters; |
|
interfaceImplementations = new List<InterfaceImplementation>(); |
|
typeReference = TypeReference.Null; |
|
bodyStart = new Point(-1, -1); |
|
bodyEnd = new Point(-1, -1); |
|
getRegion = PropertyGetRegion.Null; |
|
setRegion = PropertySetRegion.Null; |
|
} |
|
|
|
public IndexerDeclaration(TypeReference typeReference, List<ParameterDeclarationExpression> parameters, Modifier modifier, List<AttributeSection> attributes) : |
|
base(attributes) { |
|
TypeReference = typeReference; |
|
Parameters = parameters; |
|
Modifier = modifier; |
|
interfaceImplementations = new List<InterfaceImplementation>(); |
|
bodyStart = new Point(-1, -1); |
|
bodyEnd = new Point(-1, -1); |
|
getRegion = PropertyGetRegion.Null; |
|
setRegion = PropertySetRegion.Null; |
|
} |
|
|
|
public List<ParameterDeclarationExpression> Parameters { |
|
get { |
|
return parameters; |
|
} |
|
set { |
|
parameters = value ?? new List<ParameterDeclarationExpression>(); |
|
} |
|
} |
|
|
|
public List<InterfaceImplementation> InterfaceImplementations { |
|
get { |
|
return interfaceImplementations; |
|
} |
|
set { |
|
interfaceImplementations = value ?? new List<InterfaceImplementation>(); |
|
} |
|
} |
|
|
|
public TypeReference TypeReference { |
|
get { |
|
return typeReference; |
|
} |
|
set { |
|
typeReference = value ?? TypeReference.Null; |
|
} |
|
} |
|
|
|
public Point BodyStart { |
|
get { |
|
return bodyStart; |
|
} |
|
set { |
|
bodyStart = value; |
|
} |
|
} |
|
|
|
public Point BodyEnd { |
|
get { |
|
return bodyEnd; |
|
} |
|
set { |
|
bodyEnd = value; |
|
} |
|
} |
|
|
|
public PropertyGetRegion GetRegion { |
|
get { |
|
return getRegion; |
|
} |
|
set { |
|
getRegion = value ?? PropertyGetRegion.Null; |
|
} |
|
} |
|
|
|
public PropertySetRegion SetRegion { |
|
get { |
|
return setRegion; |
|
} |
|
set { |
|
setRegion = value ?? PropertySetRegion.Null; |
|
} |
|
} |
|
|
|
public bool IsReadOnly { |
|
get { |
|
return HasGetRegion && !HasSetRegion; |
|
} |
|
} |
|
|
|
public bool HasGetRegion { |
|
get { |
|
return !getRegion.IsNull; |
|
} |
|
} |
|
|
|
public bool IsWriteOnly { |
|
get { |
|
return !HasGetRegion && HasSetRegion; |
|
} |
|
} |
|
|
|
public bool HasSetRegion { |
|
get { |
|
return !setRegion.IsNull; |
|
} |
|
} |
|
|
|
public override object AcceptVisitor(IAstVisitor visitor, object data) { |
|
return visitor.Visit(this, data); |
|
} |
|
|
|
public override string ToString() { |
|
return string.Format("[IndexerDeclaration Parameters={0} InterfaceImplementations={1} TypeReference={2}" + |
|
" BodyStart={3} BodyEnd={4} GetRegion={5} SetRegion={6} Attributes={7} Modifier={" + |
|
"8}]", GetCollectionString(Parameters), GetCollectionString(InterfaceImplementations), TypeReference, BodyStart, BodyEnd, GetRegion, SetRegion, GetCollectionString(Attributes), Modifier); |
|
} |
|
} |
|
|
|
public class IndexerExpression : Expression { |
|
|
|
Expression targetObject; |
|
|
|
List<Expression> indices; |
|
|
|
public IndexerExpression(Expression targetObject, List<Expression> indices) { |
|
TargetObject = targetObject; |
|
Indices = indices; |
|
} |
|
|
|
public Expression TargetObject { |
|
get { |
|
return targetObject; |
|
} |
|
set { |
|
targetObject = value ?? Expression.Null; |
|
} |
|
} |
|
|
|
public List<Expression> Indices { |
|
get { |
|
return indices; |
|
} |
|
set { |
|
indices = value ?? new List<Expression>(); |
|
} |
|
} |
|
|
|
public override object AcceptVisitor(IAstVisitor visitor, object data) { |
|
return visitor.Visit(this, data); |
|
} |
|
|
|
public override string ToString() { |
|
return string.Format("[IndexerExpression TargetObject={0} Indices={1}]", TargetObject, GetCollectionString(Indices)); |
|
} |
|
} |
|
|
|
public class InterfaceImplementation : AbstractNode { |
|
|
|
TypeReference interfaceType; |
|
|
|
string memberName; |
|
|
|
public InterfaceImplementation(TypeReference interfaceType, string memberName) { |
|
InterfaceType = interfaceType; |
|
MemberName = memberName; |
|
} |
|
|
|
public TypeReference InterfaceType { |
|
get { |
|
return interfaceType; |
|
} |
|
set { |
|
interfaceType = value ?? TypeReference.Null; |
|
} |
|
} |
|
|
|
public string MemberName { |
|
get { |
|
return memberName; |
|
} |
|
set { |
|
memberName = string.IsNullOrEmpty(value) ? "?" : value; |
|
} |
|
} |
|
|
|
public override object AcceptVisitor(IAstVisitor visitor, object data) { |
|
return visitor.Visit(this, data); |
|
} |
|
|
|
public override string ToString() { |
|
return string.Format("[InterfaceImplementation InterfaceType={0} MemberName={1}]", InterfaceType, MemberName); |
|
} |
|
} |
|
|
|
public class InvocationExpression : Expression { |
|
|
|
Expression targetObject; |
|
|
|
List<Expression> arguments; |
|
|
|
List<TypeReference> typeArguments; |
|
|
|
public InvocationExpression(Expression targetObject) { |
|
TargetObject = targetObject; |
|
arguments = new List<Expression>(); |
|
typeArguments = new List<TypeReference>(); |
|
} |
|
|
|
public InvocationExpression(Expression targetObject, List<Expression> arguments) { |
|
TargetObject = targetObject; |
|
Arguments = arguments; |
|
typeArguments = new List<TypeReference>(); |
|
} |
|
|
|
public InvocationExpression(Expression targetObject, List<Expression> arguments, List<TypeReference> typeArguments) { |
|
TargetObject = targetObject; |
|
Arguments = arguments; |
|
TypeArguments = typeArguments; |
|
} |
|
|
|
public Expression TargetObject { |
|
get { |
|
return targetObject; |
|
} |
|
set { |
|
targetObject = value ?? Expression.Null; |
|
} |
|
} |
|
|
|
public List<Expression> Arguments { |
|
get { |
|
return arguments; |
|
} |
|
set { |
|
arguments = value ?? new List<Expression>(); |
|
} |
|
} |
|
|
|
public List<TypeReference> TypeArguments { |
|
get { |
|
return typeArguments; |
|
} |
|
set { |
|
typeArguments = value ?? new List<TypeReference>(); |
|
} |
|
} |
|
|
|
public override object AcceptVisitor(IAstVisitor visitor, object data) { |
|
return visitor.Visit(this, data); |
|
} |
|
|
|
public override string ToString() { |
|
return string.Format("[InvocationExpression TargetObject={0} Arguments={1} TypeArguments={2}]", TargetObject, GetCollectionString(Arguments), GetCollectionString(TypeArguments)); |
|
} |
|
} |
|
|
|
public class LabelStatement : Statement { |
|
|
|
string label; |
|
|
|
public LabelStatement(string label) { |
|
Label = label; |
|
} |
|
|
|
public string Label { |
|
get { |
|
return label; |
|
} |
|
set { |
|
label = value ?? ""; |
|
} |
|
} |
|
|
|
public override object AcceptVisitor(IAstVisitor visitor, object data) { |
|
return visitor.Visit(this, data); |
|
} |
|
|
|
public override string ToString() { |
|
return string.Format("[LabelStatement Label={0}]", Label); |
|
} |
|
} |
|
|
|
public class LockStatement : StatementWithEmbeddedStatement { |
|
|
|
Expression lockExpression; |
|
|
|
public LockStatement(Expression lockExpression, Statement embeddedStatement) { |
|
LockExpression = lockExpression; |
|
EmbeddedStatement = embeddedStatement; |
|
} |
|
|
|
public Expression LockExpression { |
|
get { |
|
return lockExpression; |
|
} |
|
set { |
|
lockExpression = value ?? Expression.Null; |
|
} |
|
} |
|
|
|
public override object AcceptVisitor(IAstVisitor visitor, object data) { |
|
return visitor.Visit(this, data); |
|
} |
|
|
|
public override string ToString() { |
|
return string.Format("[LockStatement LockExpression={0} EmbeddedStatement={1}]", LockExpression, EmbeddedStatement); |
|
} |
|
} |
|
|
|
public class MethodDeclaration : ParametrizedNode { |
|
|
|
TypeReference typeReference; |
|
|
|
BlockStatement body; |
|
|
|
List<string> handlesClause; |
|
|
|
List<InterfaceImplementation> interfaceImplementations; |
|
|
|
List<TemplateDefinition> templates; |
|
|
|
public MethodDeclaration(string name, Modifier modifier, TypeReference typeReference, List<ParameterDeclarationExpression> parameters, List<AttributeSection> attributes) : |
|
base(modifier, attributes, name, parameters) { |
|
TypeReference = typeReference; |
|
body = BlockStatement.Null; |
|
handlesClause = new List<String>(); |
|
interfaceImplementations = new List<InterfaceImplementation>(); |
|
templates = new List<TemplateDefinition>(); |
|
} |
|
|
|
public TypeReference TypeReference { |
|
get { |
|
return typeReference; |
|
} |
|
set { |
|
typeReference = value ?? TypeReference.Null; |
|
} |
|
} |
|
|
|
public BlockStatement Body { |
|
get { |
|
return body; |
|
} |
|
set { |
|
body = value ?? BlockStatement.Null; |
|
} |
|
} |
|
|
|
public List<string> HandlesClause { |
|
get { |
|
return handlesClause; |
|
} |
|
set { |
|
handlesClause = value ?? new List<String>(); |
|
} |
|
} |
|
|
|
public List<InterfaceImplementation> InterfaceImplementations { |
|
get { |
|
return interfaceImplementations; |
|
} |
|
set { |
|
interfaceImplementations = value ?? new List<InterfaceImplementation>(); |
|
} |
|
} |
|
|
|
public List<TemplateDefinition> Templates { |
|
get { |
|
return templates; |
|
} |
|
set { |
|
templates = value ?? new List<TemplateDefinition>(); |
|
} |
|
} |
|
|
|
public override object AcceptVisitor(IAstVisitor visitor, object data) { |
|
return visitor.Visit(this, data); |
|
} |
|
|
|
public override string ToString() { |
|
return string.Format("[MethodDeclaration TypeReference={0} Body={1} HandlesClause={2} InterfaceImplemen" + |
|
"tations={3} Templates={4} Name={5} Parameters={6} Attributes={7} Modifier={8}]", TypeReference, Body, GetCollectionString(HandlesClause), GetCollectionString(InterfaceImplementations), GetCollectionString(Templates), Name, GetCollectionString(Parameters), GetCollectionString(Attributes), Modifier); |
|
} |
|
} |
|
|
|
public class NamedArgumentExpression : Expression { |
|
|
|
string name; |
|
|
|
Expression expression; |
|
|
|
public NamedArgumentExpression(string name, Expression expression) { |
|
Name = name; |
|
Expression = expression; |
|
} |
|
|
|
public string Name { |
|
get { |
|
return name; |
|
} |
|
set { |
|
name = value ?? ""; |
|
} |
|
} |
|
|
|
public Expression Expression { |
|
get { |
|
return expression; |
|
} |
|
set { |
|
expression = value ?? Expression.Null; |
|
} |
|
} |
|
|
|
public override object AcceptVisitor(IAstVisitor visitor, object data) { |
|
return visitor.Visit(this, data); |
|
} |
|
|
|
public override string ToString() { |
|
return string.Format("[NamedArgumentExpression Name={0} Expression={1}]", Name, Expression); |
|
} |
|
} |
|
|
|
public class NamespaceDeclaration : AbstractNode { |
|
|
|
string name; |
|
|
|
public NamespaceDeclaration(string name) { |
|
Name = name; |
|
} |
|
|
|
public string Name { |
|
get { |
|
return name; |
|
} |
|
set { |
|
name = value ?? ""; |
|
} |
|
} |
|
|
|
public override object AcceptVisitor(IAstVisitor visitor, object data) { |
|
return visitor.Visit(this, data); |
|
} |
|
|
|
public override string ToString() { |
|
return string.Format("[NamespaceDeclaration Name={0}]", Name); |
|
} |
|
} |
|
|
|
public class ObjectCreateExpression : Expression { |
|
|
|
TypeReference createType; |
|
|
|
List<Expression> parameters; |
|
|
|
public ObjectCreateExpression(TypeReference createType, List<Expression> parameters) { |
|
CreateType = createType; |
|
Parameters = parameters; |
|
} |
|
|
|
public TypeReference CreateType { |
|
get { |
|
return createType; |
|
} |
|
set { |
|
createType = value ?? TypeReference.Null; |
|
} |
|
} |
|
|
|
public List<Expression> Parameters { |
|
get { |
|
return parameters; |
|
} |
|
set { |
|
parameters = value ?? new List<Expression>(); |
|
} |
|
} |
|
|
|
public override object AcceptVisitor(IAstVisitor visitor, object data) { |
|
return visitor.Visit(this, data); |
|
} |
|
|
|
public override string ToString() { |
|
return string.Format("[ObjectCreateExpression CreateType={0} Parameters={1}]", CreateType, GetCollectionString(Parameters)); |
|
} |
|
} |
|
|
|
public class OnErrorStatement : StatementWithEmbeddedStatement { |
|
|
|
public OnErrorStatement(Statement embeddedStatement) { |
|
EmbeddedStatement = embeddedStatement; |
|
} |
|
|
|
public override object AcceptVisitor(IAstVisitor visitor, object data) { |
|
return visitor.Visit(this, data); |
|
} |
|
|
|
public override string ToString() { |
|
return string.Format("[OnErrorStatement EmbeddedStatement={0}]", EmbeddedStatement); |
|
} |
|
} |
|
|
|
public class OperatorDeclaration : MethodDeclaration { |
|
|
|
ConversionType conversionType; |
|
|
|
List<AttributeSection> returnTypeAttributes; |
|
|
|
OverloadableOperatorType overloadableOperator; |
|
|
|
public OperatorDeclaration(Modifier modifier, List<AttributeSection> attributes, List<ParameterDeclarationExpression> parameters, TypeReference typeReference, ConversionType conversionType) : |
|
base(null, modifier, typeReference, parameters, attributes) { |
|
ConversionType = conversionType; |
|
returnTypeAttributes = new List<AttributeSection>(); |
|
} |
|
|
|
public OperatorDeclaration(Modifier modifier, List<AttributeSection> attributes, List<ParameterDeclarationExpression> parameters, TypeReference typeReference, OverloadableOperatorType overloadableOperator) : |
|
base(null, modifier, typeReference, parameters, attributes) { |
|
OverloadableOperator = overloadableOperator; |
|
returnTypeAttributes = new List<AttributeSection>(); |
|
} |
|
|
|
public ConversionType ConversionType { |
|
get { |
|
return conversionType; |
|
} |
|
set { |
|
conversionType = value; |
|
} |
|
} |
|
|
|
public List<AttributeSection> ReturnTypeAttributes { |
|
get { |
|
return returnTypeAttributes; |
|
} |
|
set { |
|
returnTypeAttributes = value ?? new List<AttributeSection>(); |
|
} |
|
} |
|
|
|
public OverloadableOperatorType OverloadableOperator { |
|
get { |
|
return overloadableOperator; |
|
} |
|
set { |
|
overloadableOperator = value; |
|
} |
|
} |
|
|
|
public bool IsConversionOperator { |
|
get { |
|
return conversionType != ConversionType.None; |
|
} |
|
} |
|
|
|
public override object AcceptVisitor(IAstVisitor visitor, object data) { |
|
return visitor.Visit(this, data); |
|
} |
|
|
|
public override string ToString() { |
|
return string.Format("[OperatorDeclaration ConversionType={0} ReturnTypeAttributes={1} OverloadableOper" + |
|
"ator={2} TypeReference={3} Body={4} HandlesClause={5} InterfaceImplementations={" + |
|
"6} Templates={7} Name={8} Parameters={9} Attributes={10} Modifier={11}]", ConversionType, GetCollectionString(ReturnTypeAttributes), OverloadableOperator, TypeReference, Body, GetCollectionString(HandlesClause), GetCollectionString(InterfaceImplementations), GetCollectionString(Templates), Name, GetCollectionString(Parameters), GetCollectionString(Attributes), Modifier); |
|
} |
|
} |
|
|
|
public class OptionDeclaration : AbstractNode { |
|
|
|
OptionType optionType; |
|
|
|
bool optionValue; |
|
|
|
public OptionDeclaration(OptionType optionType, bool optionValue) { |
|
OptionType = optionType; |
|
OptionValue = optionValue; |
|
} |
|
|
|
public OptionType OptionType { |
|
get { |
|
return optionType; |
|
} |
|
set { |
|
optionType = value; |
|
} |
|
} |
|
|
|
public bool OptionValue { |
|
get { |
|
return optionValue; |
|
} |
|
set { |
|
optionValue = value; |
|
} |
|
} |
|
|
|
public override object AcceptVisitor(IAstVisitor visitor, object data) { |
|
return visitor.Visit(this, data); |
|
} |
|
|
|
public override string ToString() { |
|
return string.Format("[OptionDeclaration OptionType={0} OptionValue={1}]", OptionType, OptionValue); |
|
} |
|
} |
|
|
|
public class ParameterDeclarationExpression : Expression { |
|
|
|
List<AttributeSection> attributes; |
|
|
|
string parameterName; |
|
|
|
TypeReference typeReference; |
|
|
|
ParamModifier paramModifier; |
|
|
|
Expression defaultValue; |
|
|
|
public ParameterDeclarationExpression(TypeReference typeReference, string parameterName) { |
|
TypeReference = typeReference; |
|
ParameterName = parameterName; |
|
attributes = new List<AttributeSection>(); |
|
defaultValue = Expression.Null; |
|
} |
|
|
|
public ParameterDeclarationExpression(TypeReference typeReference, string parameterName, ParamModifier paramModifier) { |
|
TypeReference = typeReference; |
|
ParameterName = parameterName; |
|
ParamModifier = paramModifier; |
|
attributes = new List<AttributeSection>(); |
|
defaultValue = Expression.Null; |
|
} |
|
|
|
public ParameterDeclarationExpression(TypeReference typeReference, string parameterName, ParamModifier paramModifier, Expression defaultValue) { |
|
TypeReference = typeReference; |
|
ParameterName = parameterName; |
|
ParamModifier = paramModifier; |
|
DefaultValue = defaultValue; |
|
attributes = new List<AttributeSection>(); |
|
} |
|
|
|
public List<AttributeSection> Attributes { |
|
get { |
|
return attributes; |
|
} |
|
set { |
|
attributes = value ?? new List<AttributeSection>(); |
|
} |
|
} |
|
|
|
public string ParameterName { |
|
get { |
|
return parameterName; |
|
} |
|
set { |
|
parameterName = string.IsNullOrEmpty(value) ? "?" : value; |
|
} |
|
} |
|
|
|
public TypeReference TypeReference { |
|
get { |
|
return typeReference; |
|
} |
|
set { |
|
typeReference = value ?? TypeReference.Null; |
|
} |
|
} |
|
|
|
public ParamModifier ParamModifier { |
|
get { |
|
return paramModifier; |
|
} |
|
set { |
|
paramModifier = value; |
|
} |
|
} |
|
|
|
public Expression DefaultValue { |
|
get { |
|
return defaultValue; |
|
} |
|
set { |
|
defaultValue = value ?? Expression.Null; |
|
} |
|
} |
|
|
|
public override object AcceptVisitor(IAstVisitor visitor, object data) { |
|
return visitor.Visit(this, data); |
|
} |
|
|
|
public override string ToString() { |
|
return string.Format("[ParameterDeclarationExpression Attributes={0} ParameterName={1} TypeReference={2" + |
|
"} ParamModifier={3} DefaultValue={4}]", GetCollectionString(Attributes), ParameterName, TypeReference, ParamModifier, DefaultValue); |
|
} |
|
} |
|
|
|
public abstract class ParametrizedNode : AttributedNode { |
|
|
|
string name; |
|
|
|
List<ParameterDeclarationExpression> parameters; |
|
|
|
public ParametrizedNode(Modifier modifier, List<AttributeSection> attributes, string name, List<ParameterDeclarationExpression> parameters) : |
|
base(attributes) { |
|
Modifier = modifier; |
|
Name = name; |
|
Parameters = parameters; |
|
} |
|
|
|
public ParametrizedNode(Modifier modifier, List<AttributeSection> attributes) : |
|
base(attributes) { |
|
Modifier = modifier; |
|
name = ""; |
|
parameters = new List<ParameterDeclarationExpression>(); |
|
} |
|
|
|
public string Name { |
|
get { |
|
return name; |
|
} |
|
set { |
|
name = value ?? ""; |
|
} |
|
} |
|
|
|
public List<ParameterDeclarationExpression> Parameters { |
|
get { |
|
return parameters; |
|
} |
|
set { |
|
parameters = value ?? new List<ParameterDeclarationExpression>(); |
|
} |
|
} |
|
} |
|
|
|
public class ParenthesizedExpression : Expression { |
|
|
|
Expression expression; |
|
|
|
public ParenthesizedExpression(Expression expression) { |
|
Expression = expression; |
|
} |
|
|
|
public Expression Expression { |
|
get { |
|
return expression; |
|
} |
|
set { |
|
expression = value ?? Expression.Null; |
|
} |
|
} |
|
|
|
public override object AcceptVisitor(IAstVisitor visitor, object data) { |
|
return visitor.Visit(this, data); |
|
} |
|
|
|
public override string ToString() { |
|
return string.Format("[ParenthesizedExpression Expression={0}]", Expression); |
|
} |
|
} |
|
|
|
public class PointerReferenceExpression : Expression { |
|
|
|
Expression targetObject; |
|
|
|
string identifier; |
|
|
|
public PointerReferenceExpression(Expression targetObject, string identifier) { |
|
TargetObject = targetObject; |
|
Identifier = identifier; |
|
} |
|
|
|
public Expression TargetObject { |
|
get { |
|
return targetObject; |
|
} |
|
set { |
|
targetObject = value ?? Expression.Null; |
|
} |
|
} |
|
|
|
public string Identifier { |
|
get { |
|
return identifier; |
|
} |
|
set { |
|
identifier = value ?? ""; |
|
} |
|
} |
|
|
|
public override object AcceptVisitor(IAstVisitor visitor, object data) { |
|
return visitor.Visit(this, data); |
|
} |
|
|
|
public override string ToString() { |
|
return string.Format("[PointerReferenceExpression TargetObject={0} Identifier={1}]", TargetObject, Identifier); |
|
} |
|
} |
|
|
|
public class PropertyDeclaration : ParametrizedNode { |
|
|
|
List<InterfaceImplementation> interfaceImplementations; |
|
|
|
TypeReference typeReference; |
|
|
|
Point bodyStart; |
|
|
|
Point bodyEnd; |
|
|
|
PropertyGetRegion getRegion; |
|
|
|
PropertySetRegion setRegion; |
|
|
|
|
|
public PropertyDeclaration(string name, TypeReference typeReference, Modifier modifier, List<AttributeSection> attributes) : this(modifier, attributes, name, null) |
|
{ |
|
this.TypeReference = typeReference; |
|
if ((modifier & Modifier.ReadOnly) == Modifier.ReadOnly) { |
|
this.GetRegion = new PropertyGetRegion(null, null); |
|
} else if ((modifier & Modifier.WriteOnly) == Modifier.WriteOnly) { |
|
this.SetRegion = new PropertySetRegion(null, null); |
|
} |
|
} |
|
|
|
public PropertyDeclaration(Modifier modifier, List<AttributeSection> attributes, string name, List<ParameterDeclarationExpression> parameters) : |
|
base(modifier, attributes, name, parameters) { |
|
interfaceImplementations = new List<InterfaceImplementation>(); |
|
typeReference = TypeReference.Null; |
|
bodyStart = new Point(-1, -1); |
|
bodyEnd = new Point(-1, -1); |
|
getRegion = PropertyGetRegion.Null; |
|
setRegion = PropertySetRegion.Null; |
|
} |
|
|
|
public List<InterfaceImplementation> InterfaceImplementations { |
|
get { |
|
return interfaceImplementations; |
|
} |
|
set { |
|
interfaceImplementations = value ?? new List<InterfaceImplementation>(); |
|
} |
|
} |
|
|
|
public TypeReference TypeReference { |
|
get { |
|
return typeReference; |
|
} |
|
set { |
|
typeReference = value ?? TypeReference.Null; |
|
} |
|
} |
|
|
|
public Point BodyStart { |
|
get { |
|
return bodyStart; |
|
} |
|
set { |
|
bodyStart = value; |
|
} |
|
} |
|
|
|
public Point BodyEnd { |
|
get { |
|
return bodyEnd; |
|
} |
|
set { |
|
bodyEnd = value; |
|
} |
|
} |
|
|
|
public PropertyGetRegion GetRegion { |
|
get { |
|
return getRegion; |
|
} |
|
set { |
|
getRegion = value ?? PropertyGetRegion.Null; |
|
} |
|
} |
|
|
|
public PropertySetRegion SetRegion { |
|
get { |
|
return setRegion; |
|
} |
|
set { |
|
setRegion = value ?? PropertySetRegion.Null; |
|
} |
|
} |
|
|
|
public bool HasGetRegion { |
|
get { |
|
return !getRegion.IsNull; |
|
} |
|
} |
|
|
|
public bool IsWriteOnly { |
|
get { |
|
return !HasGetRegion && HasSetRegion; |
|
} |
|
} |
|
|
|
public bool HasSetRegion { |
|
get { |
|
return !setRegion.IsNull; |
|
} |
|
} |
|
|
|
public bool IsReadOnly { |
|
get { |
|
return HasGetRegion && !HasSetRegion; |
|
} |
|
} |
|
|
|
public override object AcceptVisitor(IAstVisitor visitor, object data) { |
|
return visitor.Visit(this, data); |
|
} |
|
|
|
public override string ToString() { |
|
return string.Format("[PropertyDeclaration InterfaceImplementations={0} TypeReference={1} BodyStart={2}" + |
|
" BodyEnd={3} GetRegion={4} SetRegion={5} Name={6} Parameters={7} Attributes={8} " + |
|
"Modifier={9}]", GetCollectionString(InterfaceImplementations), TypeReference, BodyStart, BodyEnd, GetRegion, SetRegion, Name, GetCollectionString(Parameters), GetCollectionString(Attributes), Modifier); |
|
} |
|
} |
|
|
|
public class PropertyGetRegion : PropertyGetSetRegion { |
|
|
|
public PropertyGetRegion(BlockStatement block, List<AttributeSection> attributes) : |
|
base(block, attributes) { |
|
} |
|
|
|
public static PropertyGetRegion Null { |
|
get { |
|
return NullPropertyGetRegion.Instance; |
|
} |
|
} |
|
|
|
public override object AcceptVisitor(IAstVisitor visitor, object data) { |
|
return visitor.Visit(this, data); |
|
} |
|
|
|
public override string ToString() { |
|
return string.Format("[PropertyGetRegion Block={0} Attributes={1} Modifier={2}]", Block, GetCollectionString(Attributes), Modifier); |
|
} |
|
} |
|
|
|
public class NullPropertyGetRegion : PropertyGetRegion { |
|
|
|
static NullPropertyGetRegion instance = new NullPropertyGetRegion(); |
|
|
|
private NullPropertyGetRegion() : |
|
base(null, null) { |
|
} |
|
|
|
public static NullPropertyGetRegion Instance { |
|
get { |
|
return instance; |
|
} |
|
} |
|
|
|
public override bool IsNull { |
|
get { |
|
return true; |
|
} |
|
} |
|
|
|
public override object AcceptVisitor(IAstVisitor visitor, object data) { |
|
return null; |
|
} |
|
|
|
public override string ToString() { |
|
return "[NullPropertyGetRegion]"; |
|
} |
|
} |
|
|
|
public abstract class PropertyGetSetRegion : AttributedNode, INullable { |
|
|
|
BlockStatement block; |
|
|
|
public PropertyGetSetRegion(BlockStatement block, List<AttributeSection> attributes) : |
|
base(attributes) { |
|
Block = block; |
|
} |
|
|
|
public BlockStatement Block { |
|
get { |
|
return block; |
|
} |
|
set { |
|
block = value ?? BlockStatement.Null; |
|
} |
|
} |
|
|
|
public virtual bool IsNull { |
|
get { |
|
return false; |
|
} |
|
} |
|
} |
|
|
|
public class PropertySetRegion : PropertyGetSetRegion { |
|
|
|
List<ParameterDeclarationExpression> parameters; |
|
|
|
public PropertySetRegion(BlockStatement block, List<AttributeSection> attributes) : |
|
base(block, attributes) { |
|
parameters = new List<ParameterDeclarationExpression>(); |
|
} |
|
|
|
public List<ParameterDeclarationExpression> Parameters { |
|
get { |
|
return parameters; |
|
} |
|
set { |
|
parameters = value ?? new List<ParameterDeclarationExpression>(); |
|
} |
|
} |
|
|
|
public static PropertySetRegion Null { |
|
get { |
|
return NullPropertySetRegion.Instance; |
|
} |
|
} |
|
|
|
public override object AcceptVisitor(IAstVisitor visitor, object data) { |
|
return visitor.Visit(this, data); |
|
} |
|
|
|
public override string ToString() { |
|
return string.Format("[PropertySetRegion Parameters={0} Block={1} Attributes={2} Modifier={3}]", GetCollectionString(Parameters), Block, GetCollectionString(Attributes), Modifier); |
|
} |
|
} |
|
|
|
public class NullPropertySetRegion : PropertySetRegion { |
|
|
|
static NullPropertySetRegion instance = new NullPropertySetRegion(); |
|
|
|
private NullPropertySetRegion() : |
|
base(null, null) { |
|
} |
|
|
|
public static NullPropertySetRegion Instance { |
|
get { |
|
return instance; |
|
} |
|
} |
|
|
|
public override bool IsNull { |
|
get { |
|
return true; |
|
} |
|
} |
|
|
|
public override object AcceptVisitor(IAstVisitor visitor, object data) { |
|
return null; |
|
} |
|
|
|
public override string ToString() { |
|
return "[NullPropertySetRegion]"; |
|
} |
|
} |
|
|
|
public class RaiseEventStatement : Statement { |
|
|
|
string eventName; |
|
|
|
List<Expression> arguments; |
|
|
|
public RaiseEventStatement(string eventName, List<Expression> arguments) { |
|
EventName = eventName; |
|
Arguments = arguments; |
|
} |
|
|
|
public string EventName { |
|
get { |
|
return eventName; |
|
} |
|
set { |
|
eventName = value ?? ""; |
|
} |
|
} |
|
|
|
public List<Expression> Arguments { |
|
get { |
|
return arguments; |
|
} |
|
set { |
|
arguments = value ?? new List<Expression>(); |
|
} |
|
} |
|
|
|
public override object AcceptVisitor(IAstVisitor visitor, object data) { |
|
return visitor.Visit(this, data); |
|
} |
|
|
|
public override string ToString() { |
|
return string.Format("[RaiseEventStatement EventName={0} Arguments={1}]", EventName, GetCollectionString(Arguments)); |
|
} |
|
} |
|
|
|
public class ReDimStatement : Statement { |
|
|
|
List<InvocationExpression> reDimClauses; |
|
|
|
bool isPreserve; |
|
|
|
public ReDimStatement(bool isPreserve) { |
|
IsPreserve = isPreserve; |
|
reDimClauses = new List<InvocationExpression>(); |
|
} |
|
|
|
public List<InvocationExpression> ReDimClauses { |
|
get { |
|
return reDimClauses; |
|
} |
|
set { |
|
reDimClauses = value ?? new List<InvocationExpression>(); |
|
} |
|
} |
|
|
|
public bool IsPreserve { |
|
get { |
|
return isPreserve; |
|
} |
|
set { |
|
isPreserve = value; |
|
} |
|
} |
|
|
|
public override object AcceptVisitor(IAstVisitor visitor, object data) { |
|
return visitor.Visit(this, data); |
|
} |
|
|
|
public override string ToString() { |
|
return string.Format("[ReDimStatement ReDimClauses={0} IsPreserve={1}]", GetCollectionString(ReDimClauses), IsPreserve); |
|
} |
|
} |
|
|
|
public class RemoveHandlerStatement : Statement { |
|
|
|
Expression eventExpression; |
|
|
|
Expression handlerExpression; |
|
|
|
public RemoveHandlerStatement(Expression eventExpression, Expression handlerExpression) { |
|
EventExpression = eventExpression; |
|
HandlerExpression = handlerExpression; |
|
} |
|
|
|
public Expression EventExpression { |
|
get { |
|
return eventExpression; |
|
} |
|
set { |
|
eventExpression = value ?? Expression.Null; |
|
} |
|
} |
|
|
|
public Expression HandlerExpression { |
|
get { |
|
return handlerExpression; |
|
} |
|
set { |
|
handlerExpression = value ?? Expression.Null; |
|
} |
|
} |
|
|
|
public override object AcceptVisitor(IAstVisitor visitor, object data) { |
|
return visitor.Visit(this, data); |
|
} |
|
|
|
public override string ToString() { |
|
return string.Format("[RemoveHandlerStatement EventExpression={0} HandlerExpression={1}]", EventExpression, HandlerExpression); |
|
} |
|
} |
|
|
|
public class ResumeStatement : Statement { |
|
|
|
string labelName; |
|
|
|
bool isResumeNext; |
|
|
|
public ResumeStatement(bool isResumeNext) { |
|
IsResumeNext = isResumeNext; |
|
labelName = ""; |
|
} |
|
|
|
public ResumeStatement(string labelName) { |
|
LabelName = labelName; |
|
} |
|
|
|
public string LabelName { |
|
get { |
|
return labelName; |
|
} |
|
set { |
|
labelName = value ?? ""; |
|
} |
|
} |
|
|
|
public bool IsResumeNext { |
|
get { |
|
return isResumeNext; |
|
} |
|
set { |
|
isResumeNext = value; |
|
} |
|
} |
|
|
|
public override object AcceptVisitor(IAstVisitor visitor, object data) { |
|
return visitor.Visit(this, data); |
|
} |
|
|
|
public override string ToString() { |
|
return string.Format("[ResumeStatement LabelName={0} IsResumeNext={1}]", LabelName, IsResumeNext); |
|
} |
|
} |
|
|
|
public class ReturnStatement : Statement { |
|
|
|
Expression expression; |
|
|
|
public ReturnStatement(Expression expression) { |
|
Expression = expression; |
|
} |
|
|
|
public Expression Expression { |
|
get { |
|
return expression; |
|
} |
|
set { |
|
expression = value ?? Expression.Null; |
|
} |
|
} |
|
|
|
public override object AcceptVisitor(IAstVisitor visitor, object data) { |
|
return visitor.Visit(this, data); |
|
} |
|
|
|
public override string ToString() { |
|
return string.Format("[ReturnStatement Expression={0}]", Expression); |
|
} |
|
} |
|
|
|
public class SizeOfExpression : Expression { |
|
|
|
TypeReference typeReference; |
|
|
|
public SizeOfExpression(TypeReference typeReference) { |
|
TypeReference = typeReference; |
|
} |
|
|
|
public TypeReference TypeReference { |
|
get { |
|
return typeReference; |
|
} |
|
set { |
|
typeReference = value ?? TypeReference.Null; |
|
} |
|
} |
|
|
|
public override object AcceptVisitor(IAstVisitor visitor, object data) { |
|
return visitor.Visit(this, data); |
|
} |
|
|
|
public override string ToString() { |
|
return string.Format("[SizeOfExpression TypeReference={0}]", TypeReference); |
|
} |
|
} |
|
|
|
public class StackAllocExpression : Expression { |
|
|
|
TypeReference typeReference; |
|
|
|
Expression expression; |
|
|
|
public StackAllocExpression(TypeReference typeReference, Expression expression) { |
|
TypeReference = typeReference; |
|
Expression = expression; |
|
} |
|
|
|
public TypeReference TypeReference { |
|
get { |
|
return typeReference; |
|
} |
|
set { |
|
typeReference = value ?? TypeReference.Null; |
|
} |
|
} |
|
|
|
public Expression Expression { |
|
get { |
|
return expression; |
|
} |
|
set { |
|
expression = value ?? Expression.Null; |
|
} |
|
} |
|
|
|
public override object AcceptVisitor(IAstVisitor visitor, object data) { |
|
return visitor.Visit(this, data); |
|
} |
|
|
|
public override string ToString() { |
|
return string.Format("[StackAllocExpression TypeReference={0} Expression={1}]", TypeReference, Expression); |
|
} |
|
} |
|
|
|
public class StatementExpression : Statement { |
|
|
|
Expression expression; |
|
|
|
public StatementExpression(Expression expression) { |
|
Expression = expression; |
|
} |
|
|
|
public Expression Expression { |
|
get { |
|
return expression; |
|
} |
|
set { |
|
expression = value ?? Expression.Null; |
|
} |
|
} |
|
|
|
public override object AcceptVisitor(IAstVisitor visitor, object data) { |
|
return visitor.Visit(this, data); |
|
} |
|
|
|
public override string ToString() { |
|
return string.Format("[StatementExpression Expression={0}]", Expression); |
|
} |
|
} |
|
|
|
public class StopStatement : Statement { |
|
|
|
public StopStatement() { |
|
} |
|
|
|
public override object AcceptVisitor(IAstVisitor visitor, object data) { |
|
return visitor.Visit(this, data); |
|
} |
|
|
|
public override string ToString() { |
|
return "[StopStatement]"; |
|
} |
|
} |
|
|
|
public class SwitchSection : BlockStatement { |
|
|
|
List<CaseLabel> switchLabels; |
|
|
|
public SwitchSection() { |
|
switchLabels = new List<CaseLabel>(); |
|
} |
|
|
|
public SwitchSection(List<CaseLabel> switchLabels) { |
|
SwitchLabels = switchLabels; |
|
} |
|
|
|
public List<CaseLabel> SwitchLabels { |
|
get { |
|
return switchLabels; |
|
} |
|
set { |
|
switchLabels = value ?? new List<CaseLabel>(); |
|
} |
|
} |
|
|
|
public override object AcceptVisitor(IAstVisitor visitor, object data) { |
|
return visitor.Visit(this, data); |
|
} |
|
|
|
public override string ToString() { |
|
return string.Format("[SwitchSection SwitchLabels={0}]", GetCollectionString(SwitchLabels)); |
|
} |
|
} |
|
|
|
public class SwitchStatement : Statement { |
|
|
|
Expression switchExpression; |
|
|
|
List<SwitchSection> switchSections; |
|
|
|
public SwitchStatement(Expression switchExpression, List<SwitchSection> switchSections) { |
|
SwitchExpression = switchExpression; |
|
SwitchSections = switchSections; |
|
} |
|
|
|
public Expression SwitchExpression { |
|
get { |
|
return switchExpression; |
|
} |
|
set { |
|
switchExpression = value ?? Expression.Null; |
|
} |
|
} |
|
|
|
public List<SwitchSection> SwitchSections { |
|
get { |
|
return switchSections; |
|
} |
|
set { |
|
switchSections = value ?? new List<SwitchSection>(); |
|
} |
|
} |
|
|
|
public override object AcceptVisitor(IAstVisitor visitor, object data) { |
|
return visitor.Visit(this, data); |
|
} |
|
|
|
public override string ToString() { |
|
return string.Format("[SwitchStatement SwitchExpression={0} SwitchSections={1}]", SwitchExpression, GetCollectionString(SwitchSections)); |
|
} |
|
} |
|
|
|
public class TemplateDefinition : AttributedNode { |
|
|
|
string name; |
|
|
|
List<TypeReference> bases; |
|
|
|
public TemplateDefinition(string name, List<AttributeSection> attributes) : |
|
base(attributes) { |
|
Name = name; |
|
bases = new List<TypeReference>(); |
|
} |
|
|
|
public string Name { |
|
get { |
|
return name; |
|
} |
|
set { |
|
name = string.IsNullOrEmpty(value) ? "?" : value; |
|
} |
|
} |
|
|
|
public List<TypeReference> Bases { |
|
get { |
|
return bases; |
|
} |
|
set { |
|
bases = value ?? new List<TypeReference>(); |
|
} |
|
} |
|
|
|
public override object AcceptVisitor(IAstVisitor visitor, object data) { |
|
return visitor.Visit(this, data); |
|
} |
|
|
|
public override string ToString() { |
|
return string.Format("[TemplateDefinition Name={0} Bases={1} Attributes={2} Modifier={3}]", Name, GetCollectionString(Bases), GetCollectionString(Attributes), Modifier); |
|
} |
|
} |
|
|
|
public class ThisReferenceExpression : Expression { |
|
|
|
public ThisReferenceExpression() { |
|
} |
|
|
|
public override object AcceptVisitor(IAstVisitor visitor, object data) { |
|
return visitor.Visit(this, data); |
|
} |
|
|
|
public override string ToString() { |
|
return "[ThisReferenceExpression]"; |
|
} |
|
} |
|
|
|
public class ThrowStatement : Statement { |
|
|
|
Expression expression; |
|
|
|
public ThrowStatement(Expression expression) { |
|
Expression = expression; |
|
} |
|
|
|
public Expression Expression { |
|
get { |
|
return expression; |
|
} |
|
set { |
|
expression = value ?? Expression.Null; |
|
} |
|
} |
|
|
|
public override object AcceptVisitor(IAstVisitor visitor, object data) { |
|
return visitor.Visit(this, data); |
|
} |
|
|
|
public override string ToString() { |
|
return string.Format("[ThrowStatement Expression={0}]", Expression); |
|
} |
|
} |
|
|
|
public class TryCatchStatement : Statement { |
|
|
|
Statement statementBlock; |
|
|
|
List<CatchClause> catchClauses; |
|
|
|
Statement finallyBlock; |
|
|
|
public TryCatchStatement(Statement statementBlock, List<CatchClause> catchClauses, Statement finallyBlock) { |
|
StatementBlock = statementBlock; |
|
CatchClauses = catchClauses; |
|
FinallyBlock = finallyBlock; |
|
} |
|
|
|
public Statement StatementBlock { |
|
get { |
|
return statementBlock; |
|
} |
|
set { |
|
statementBlock = value ?? Statement.Null; |
|
} |
|
} |
|
|
|
public List<CatchClause> CatchClauses { |
|
get { |
|
return catchClauses; |
|
} |
|
set { |
|
catchClauses = value ?? new List<CatchClause>(); |
|
} |
|
} |
|
|
|
public Statement FinallyBlock { |
|
get { |
|
return finallyBlock; |
|
} |
|
set { |
|
finallyBlock = value ?? Statement.Null; |
|
} |
|
} |
|
|
|
public override object AcceptVisitor(IAstVisitor visitor, object data) { |
|
return visitor.Visit(this, data); |
|
} |
|
|
|
public override string ToString() { |
|
return string.Format("[TryCatchStatement StatementBlock={0} CatchClauses={1} FinallyBlock={2}]", StatementBlock, GetCollectionString(CatchClauses), FinallyBlock); |
|
} |
|
} |
|
|
|
public class TypeDeclaration : AttributedNode { |
|
|
|
string name; |
|
|
|
ClassType type; |
|
|
|
List<TypeReference> baseTypes; |
|
|
|
List<TemplateDefinition> templates; |
|
|
|
public TypeDeclaration(Modifier modifier, List<AttributeSection> attributes) : |
|
base(attributes) { |
|
Modifier = modifier; |
|
name = ""; |
|
baseTypes = new List<TypeReference>(); |
|
templates = new List<TemplateDefinition>(); |
|
} |
|
|
|
public string Name { |
|
get { |
|
return name; |
|
} |
|
set { |
|
name = value ?? ""; |
|
} |
|
} |
|
|
|
public ClassType Type { |
|
get { |
|
return type; |
|
} |
|
set { |
|
type = value; |
|
} |
|
} |
|
|
|
public List<TypeReference> BaseTypes { |
|
get { |
|
return baseTypes; |
|
} |
|
set { |
|
baseTypes = value ?? new List<TypeReference>(); |
|
} |
|
} |
|
|
|
public List<TemplateDefinition> Templates { |
|
get { |
|
return templates; |
|
} |
|
set { |
|
templates = value ?? new List<TemplateDefinition>(); |
|
} |
|
} |
|
|
|
public override object AcceptVisitor(IAstVisitor visitor, object data) { |
|
return visitor.Visit(this, data); |
|
} |
|
|
|
public override string ToString() { |
|
return string.Format("[TypeDeclaration Name={0} Type={1} BaseTypes={2} Templates={3} Attributes={4} Mod" + |
|
"ifier={5}]", Name, Type, GetCollectionString(BaseTypes), GetCollectionString(Templates), GetCollectionString(Attributes), Modifier); |
|
} |
|
} |
|
|
|
public class TypeOfExpression : Expression { |
|
|
|
TypeReference typeReference; |
|
|
|
public TypeOfExpression(TypeReference typeReference) { |
|
TypeReference = typeReference; |
|
} |
|
|
|
public TypeReference TypeReference { |
|
get { |
|
return typeReference; |
|
} |
|
set { |
|
typeReference = value ?? TypeReference.Null; |
|
} |
|
} |
|
|
|
public override object AcceptVisitor(IAstVisitor visitor, object data) { |
|
return visitor.Visit(this, data); |
|
} |
|
|
|
public override string ToString() { |
|
return string.Format("[TypeOfExpression TypeReference={0}]", TypeReference); |
|
} |
|
} |
|
|
|
public class TypeOfIsExpression : Expression { |
|
|
|
Expression expression; |
|
|
|
TypeReference typeReference; |
|
|
|
public TypeOfIsExpression(Expression expression, TypeReference typeReference) { |
|
Expression = expression; |
|
TypeReference = typeReference; |
|
} |
|
|
|
public Expression Expression { |
|
get { |
|
return expression; |
|
} |
|
set { |
|
expression = value ?? Expression.Null; |
|
} |
|
} |
|
|
|
public TypeReference TypeReference { |
|
get { |
|
return typeReference; |
|
} |
|
set { |
|
typeReference = value ?? TypeReference.Null; |
|
} |
|
} |
|
|
|
public override object AcceptVisitor(IAstVisitor visitor, object data) { |
|
return visitor.Visit(this, data); |
|
} |
|
|
|
public override string ToString() { |
|
return string.Format("[TypeOfIsExpression Expression={0} TypeReference={1}]", Expression, TypeReference); |
|
} |
|
} |
|
|
|
public class TypeReferenceExpression : Expression { |
|
|
|
TypeReference typeReference; |
|
|
|
public TypeReferenceExpression(string typeName) : this(new TypeReference(typeName)) {} |
|
|
|
public TypeReferenceExpression(TypeReference typeReference) { |
|
TypeReference = typeReference; |
|
} |
|
|
|
public TypeReference TypeReference { |
|
get { |
|
return typeReference; |
|
} |
|
set { |
|
typeReference = value ?? TypeReference.Null; |
|
} |
|
} |
|
|
|
public override object AcceptVisitor(IAstVisitor visitor, object data) { |
|
return visitor.Visit(this, data); |
|
} |
|
|
|
public override string ToString() { |
|
return string.Format("[TypeReferenceExpression TypeReference={0}]", TypeReference); |
|
} |
|
} |
|
|
|
public class UnaryOperatorExpression : Expression { |
|
|
|
UnaryOperatorType op; |
|
|
|
Expression expression; |
|
|
|
public UnaryOperatorExpression(UnaryOperatorType op) { |
|
Op = op; |
|
expression = Expression.Null; |
|
} |
|
|
|
public UnaryOperatorExpression(Expression expression, UnaryOperatorType op) { |
|
Expression = expression; |
|
Op = op; |
|
} |
|
|
|
public UnaryOperatorType Op { |
|
get { |
|
return op; |
|
} |
|
set { |
|
op = value; |
|
} |
|
} |
|
|
|
public Expression Expression { |
|
get { |
|
return expression; |
|
} |
|
set { |
|
expression = value ?? Expression.Null; |
|
} |
|
} |
|
|
|
public override object AcceptVisitor(IAstVisitor visitor, object data) { |
|
return visitor.Visit(this, data); |
|
} |
|
|
|
public override string ToString() { |
|
return string.Format("[UnaryOperatorExpression Op={0} Expression={1}]", Op, Expression); |
|
} |
|
} |
|
|
|
public class UncheckedExpression : Expression { |
|
|
|
Expression expression; |
|
|
|
public UncheckedExpression(Expression expression) { |
|
Expression = expression; |
|
} |
|
|
|
public Expression Expression { |
|
get { |
|
return expression; |
|
} |
|
set { |
|
expression = value ?? Expression.Null; |
|
} |
|
} |
|
|
|
public override object AcceptVisitor(IAstVisitor visitor, object data) { |
|
return visitor.Visit(this, data); |
|
} |
|
|
|
public override string ToString() { |
|
return string.Format("[UncheckedExpression Expression={0}]", Expression); |
|
} |
|
} |
|
|
|
public class UncheckedStatement : Statement { |
|
|
|
Statement block; |
|
|
|
public UncheckedStatement(Statement block) { |
|
Block = block; |
|
} |
|
|
|
public Statement Block { |
|
get { |
|
return block; |
|
} |
|
set { |
|
block = value ?? Statement.Null; |
|
} |
|
} |
|
|
|
public override object AcceptVisitor(IAstVisitor visitor, object data) { |
|
return visitor.Visit(this, data); |
|
} |
|
|
|
public override string ToString() { |
|
return string.Format("[UncheckedStatement Block={0}]", Block); |
|
} |
|
} |
|
|
|
public class UnsafeStatement : Statement { |
|
|
|
Statement block; |
|
|
|
public UnsafeStatement(Statement block) { |
|
Block = block; |
|
} |
|
|
|
public Statement Block { |
|
get { |
|
return block; |
|
} |
|
set { |
|
block = value ?? Statement.Null; |
|
} |
|
} |
|
|
|
public override object AcceptVisitor(IAstVisitor visitor, object data) { |
|
return visitor.Visit(this, data); |
|
} |
|
|
|
public override string ToString() { |
|
return string.Format("[UnsafeStatement Block={0}]", Block); |
|
} |
|
} |
|
|
|
public class Using : AbstractNode { |
|
|
|
string name; |
|
|
|
TypeReference alias; |
|
|
|
public Using(string name) { |
|
Name = name; |
|
alias = TypeReference.Null; |
|
} |
|
|
|
public Using(string name, TypeReference alias) { |
|
Name = name; |
|
Alias = alias; |
|
} |
|
|
|
public string Name { |
|
get { |
|
return name; |
|
} |
|
set { |
|
name = string.IsNullOrEmpty(value) ? "?" : value; |
|
} |
|
} |
|
|
|
public TypeReference Alias { |
|
get { |
|
return alias; |
|
} |
|
set { |
|
alias = value ?? TypeReference.Null; |
|
} |
|
} |
|
|
|
public bool IsAlias { |
|
get { |
|
return !alias.IsNull; |
|
} |
|
} |
|
|
|
public override object AcceptVisitor(IAstVisitor visitor, object data) { |
|
return visitor.Visit(this, data); |
|
} |
|
|
|
public override string ToString() { |
|
return string.Format("[Using Name={0} Alias={1}]", Name, Alias); |
|
} |
|
} |
|
|
|
public class UsingDeclaration : AbstractNode { |
|
|
|
List<Using> usings; |
|
|
|
public UsingDeclaration(string nameSpace) : this(nameSpace, null) {} |
|
public UsingDeclaration(string nameSpace, TypeReference alias) { usings = new List<Using>(1); usings.Add(new Using(nameSpace, alias)); } |
|
|
|
public UsingDeclaration(List<Using> usings) { |
|
Usings = usings; |
|
} |
|
|
|
public List<Using> Usings { |
|
get { |
|
return usings; |
|
} |
|
set { |
|
usings = value ?? new List<Using>(); |
|
} |
|
} |
|
|
|
public override object AcceptVisitor(IAstVisitor visitor, object data) { |
|
return visitor.Visit(this, data); |
|
} |
|
|
|
public override string ToString() { |
|
return string.Format("[UsingDeclaration Usings={0}]", GetCollectionString(Usings)); |
|
} |
|
} |
|
|
|
public class UsingStatement : StatementWithEmbeddedStatement { |
|
|
|
Statement resourceAcquisition; |
|
|
|
public UsingStatement(Statement resourceAcquisition, Statement embeddedStatement) { |
|
ResourceAcquisition = resourceAcquisition; |
|
EmbeddedStatement = embeddedStatement; |
|
} |
|
|
|
public Statement ResourceAcquisition { |
|
get { |
|
return resourceAcquisition; |
|
} |
|
set { |
|
resourceAcquisition = value ?? Statement.Null; |
|
} |
|
} |
|
|
|
public override object AcceptVisitor(IAstVisitor visitor, object data) { |
|
return visitor.Visit(this, data); |
|
} |
|
|
|
public override string ToString() { |
|
return string.Format("[UsingStatement ResourceAcquisition={0} EmbeddedStatement={1}]", ResourceAcquisition, EmbeddedStatement); |
|
} |
|
} |
|
|
|
public class VariableDeclaration : AbstractNode { |
|
|
|
string name; |
|
|
|
Expression initializer; |
|
|
|
TypeReference typeReference; |
|
|
|
public VariableDeclaration(string name) { |
|
Name = name; |
|
initializer = Expression.Null; |
|
typeReference = TypeReference.Null; |
|
} |
|
|
|
public VariableDeclaration(string name, Expression initializer) { |
|
Name = name; |
|
Initializer = initializer; |
|
typeReference = TypeReference.Null; |
|
} |
|
|
|
public VariableDeclaration(string name, Expression initializer, TypeReference typeReference) { |
|
Name = name; |
|
Initializer = initializer; |
|
TypeReference = typeReference; |
|
} |
|
|
|
public string Name { |
|
get { |
|
return name; |
|
} |
|
set { |
|
name = value ?? ""; |
|
} |
|
} |
|
|
|
public Expression Initializer { |
|
get { |
|
return initializer; |
|
} |
|
set { |
|
initializer = value ?? Expression.Null; |
|
} |
|
} |
|
|
|
public TypeReference TypeReference { |
|
get { |
|
return typeReference; |
|
} |
|
set { |
|
typeReference = value ?? TypeReference.Null; |
|
} |
|
} |
|
|
|
public override object AcceptVisitor(IAstVisitor visitor, object data) { |
|
return visitor.Visit(this, data); |
|
} |
|
|
|
public override string ToString() { |
|
return string.Format("[VariableDeclaration Name={0} Initializer={1} TypeReference={2}]", Name, Initializer, TypeReference); |
|
} |
|
} |
|
|
|
public class WithStatement : Statement { |
|
|
|
Expression expression; |
|
|
|
BlockStatement body; |
|
|
|
public WithStatement(Expression expression) { |
|
Expression = expression; |
|
body = BlockStatement.Null; |
|
} |
|
|
|
public Expression Expression { |
|
get { |
|
return expression; |
|
} |
|
set { |
|
expression = value ?? Expression.Null; |
|
} |
|
} |
|
|
|
public BlockStatement Body { |
|
get { |
|
return body; |
|
} |
|
set { |
|
body = value ?? BlockStatement.Null; |
|
} |
|
} |
|
|
|
public override object AcceptVisitor(IAstVisitor visitor, object data) { |
|
return visitor.Visit(this, data); |
|
} |
|
|
|
public override string ToString() { |
|
return string.Format("[WithStatement Expression={0} Body={1}]", Expression, Body); |
|
} |
|
} |
|
|
|
public class YieldStatement : Statement { |
|
|
|
Statement statement; |
|
|
|
public YieldStatement(Statement statement) { |
|
Statement = statement; |
|
} |
|
|
|
public Statement Statement { |
|
get { |
|
return statement; |
|
} |
|
set { |
|
statement = value ?? Statement.Null; |
|
} |
|
} |
|
|
|
public bool IsYieldReturn { |
|
get { |
|
return statement is ReturnStatement; |
|
} |
|
} |
|
|
|
public bool IsYieldBreak { |
|
get { |
|
return statement is BreakStatement; |
|
} |
|
} |
|
|
|
public override object AcceptVisitor(IAstVisitor visitor, object data) { |
|
return visitor.Visit(this, data); |
|
} |
|
|
|
public override string ToString() { |
|
return string.Format("[YieldStatement Statement={0}]", Statement); |
|
} |
|
} |
|
}
|
|
|