public IfStatementNode(ExpressionNode cond) { if (cond == null) throw new ParsingException("Parser: An If statmentent must conatain a condition!"); Condition = cond; }
public UnaryOperationNode(ExpressionOperationType opType, ExpressionNode operand) { if (!validOperators.Contains(opType)) throw new ArgumentException("Invalid unary operator given!", "opType"); OperationType = opType; Operand = operand; }
public VariableAssingmentNode(string name, ExpressionNode expr) { if (expr == null) throw new ParsingException("The assinged expression may not be null!"); VariableName = name; ValueExpression = expr; }
private static readonly ExpressionNode DefaultIntValueExpression = ExpressionNode.CreateConstantExpression(0); //the default value for an int is zero (0). #endregion Fields #region Constructors /// <summary> /// Creates a new instance of the VariableDeclarationNode class. /// </summary> /// <param name="type">The type of the variable.</param> /// <param name="name">The name of the variable.</param> /// <param name="initialValue">A expression used to initialise the variable initially or null to use the default value.</param> public VariableDeclarationNode(VariableType type, string name, ExpressionNode initialValue) { Type = type; Name = name; initialValue = initialValue ?? DefaultIntValueExpression; InitialValueExpression = initialValue; }
public BinaryOperationNode(ExpressionOperationType opType, ExpressionNode operandA, ExpressionNode operandB) { if (!validOperators.Contains(opType)) throw new ArgumentException("Invalid binary operator given!", "opType"); OperationType = opType; OperandA = operandA; OperandB = operandB; }
public void AddArgument(ExpressionNode arg) { arguments.Add(arg); }
public WhileLoopNode(ExpressionNode cond) { if (cond == null) throw new ParsingException("Parser: An while loop must conatain a condition!"); }
public ReturnStatementNode(ExpressionNode valueExpr) { ValueExpression = valueExpr; }