static SyntaxTreeNode BinaryOperation(Operator op, SyntaxTreeNode leftExpression, SyntaxTreeNode rightExpression) { if (op.Name == "=") { return(AssignmentExpression(leftExpression, rightExpression)); } return(new ArithmeticOperation(op.Name, leftExpression, rightExpression)); }
static SyntaxTreeNode UnaryOperation(Operator op, SyntaxTreeNode argumentExpression) { return(new ArithmeticOperation(op.Name, argumentExpression)); }
/// <summary> /// Makes a new variable assignment node, given the name of the variable to change and /// the syntax tree for the expression for the value to change it to. /// </summary> /// <param name="variableName">The name variable to give a new value for</param> /// <param name="value">The syntax tree of the code to run to find the value to change the variable to.</param> public VariableAssignment(string variableName, SyntaxTreeNode value) { VariableName = variableName; ValueExpression = value; Children = new[] { value }; }