private static void ProcessBinary(IList <Token> children, LETokenType currentoperation, List <Token> arguments) { if (2 > arguments.Count) { throw new Exception("insuficient parameters count for binary operation"); } var newtoken = new Token { Type = currentoperation }; var p = arguments.First().Parent; newtoken.Parent = p; children.Insert(0, newtoken); foreach (var arg in arguments.ToArray()) { arg.Remove(); children.Remove(arg); arguments.Remove(arg); arg.Parent = newtoken; newtoken.Children.Add(arg); } arguments.Insert(0, newtoken); }
private static void ProcessBinary(IList<Token> children, LETokenType currentoperation, List<Token> arguments) { if (2 > arguments.Count) { throw new Exception("insuficient parameters count for binary operation"); } var newtoken = new Token {Type = currentoperation}; var p = arguments.First().Parent; newtoken.Parent = p; children.Insert(0, newtoken); foreach (var arg in arguments.ToArray()) { arg.Remove(); children.Remove(arg); arguments.Remove(arg); arg.Parent = newtoken; newtoken.Children.Add(arg); } arguments.Insert(0, newtoken); }