66 references to Precedence
Microsoft.ML.Transforms (66)
Expression\LambdaParser.cs (32)
443return ParseExpr(Precedence.None); 447private ExprNode ParseExpr(Precedence precMin) 451Contracts.Assert(Precedence.None <= precMin); 452Contracts.Assert(precMin <= Precedence.PrefixUnary); 464Contracts.Assert(precMin <= Precedence.Power); 466node = new BinaryOpNode(TokMove(), BinaryOp.Power, node, ParseExpr(Precedence.PrefixUnary)); 470if (precMin > Precedence.Mul) 472node = new BinaryOpNode(TokMove(), BinaryOp.Mul, node, ParseExpr(Precedence.Mul + 1)); 475if (precMin > Precedence.Mul) 477node = new BinaryOpNode(TokMove(), BinaryOp.Div, node, ParseExpr(Precedence.Mul + 1)); 480if (precMin > Precedence.Mul) 482node = new BinaryOpNode(TokMove(), BinaryOp.Mod, node, ParseExpr(Precedence.Mul + 1)); 486if (precMin > Precedence.Add) 488node = new BinaryOpNode(TokMove(), BinaryOp.Sub, node, ParseExpr(Precedence.Add + 1)); 491if (precMin > Precedence.Add) 493node = new BinaryOpNode(TokMove(), BinaryOp.Add, node, ParseExpr(Precedence.Add + 1)); 498if (precMin > Precedence.And) 500node = new BinaryOpNode(TokMove(), BinaryOp.And, node, ParseExpr(Precedence.And + 1)); 504if (precMin > Precedence.Or) 506node = new BinaryOpNode(TokMove(), BinaryOp.Or, node, ParseExpr(Precedence.Or + 1)); 510if (precMin > Precedence.Coalesce) 514node = new BinaryOpNode(TokMove(), BinaryOp.Coalesce, node, ParseExpr(Precedence.Coalesce)); 518if (precMin > Precedence.Conditional) 528if (precMin > Precedence.Compare) 535if (precMin > Precedence.Compare) 544if (precMin > Precedence.Compare) 553if (precMin > Precedence.Compare) 566node = new BinaryOpNode(TokCur, BinaryOp.Error, node, ParseExpr(Precedence.Error)); 585return new UnaryOpNode(TokMove(), UnaryOp.Minus, ParseExpr(Precedence.PrefixUnary)); 590return new UnaryOpNode(TokMove(), UnaryOp.Not, ParseExpr(Precedence.PrefixUnary)); 639list.Add(ParseExpr(Precedence.Compare + 1)); 708ExprNode node = ParseExpr(Precedence.None);
Expression\Printer.cs (34)
45private bool NeedParensLeft(Precedence precLeft, Precedence precOp) 53return precOp == Precedence.Power; 56private bool NeedParensRight(Precedence precOp, Precedence precRight) 58if (precOp == Precedence.Postfix) 71return precOp != Precedence.Power; 74private Precedence GetPrec(Node node) 84return Precedence.PrefixUnary; 87return Precedence.Compare; 91return Precedence.Primary; 97return Precedence.Atomic; 101return Precedence.None; 105private Precedence GetPrec(BinaryOp op) 110return Precedence.Or; 112return Precedence.And; 115return Precedence.Add; 119return Precedence.Mul; 121return Precedence.Power; 123return Precedence.None; 126return Precedence.None; 393Precedence prec = GetPrec(node.Arg); 395if (prec < Precedence.PrefixUnary) 398if (prec < Precedence.PrefixUnary) 410Precedence prec = GetPrec(node.Op); 411Precedence prec1 = GetPrec(node.Left); 412Precedence prec2 = GetPrec(node.Right); 440Precedence prec0 = GetPrec(node.Cond); 441Precedence prec1 = GetPrec(node.Left); 442Precedence prec2 = GetPrec(node.Right); 443bool parens0 = NeedParensLeft(prec0, Precedence.Conditional); 477var prec = GetPrec(arg); 478if (prec <= Precedence.Compare) 481if (prec <= Precedence.Compare)