示例#1
0
 private bool TestRight(Operator top, INode rhs)
 {
     if ((this.mode & 1) == 0)
     {
         if (!(rhs is ASTOpNode))
         {
             return(false);
         }
         Operator @operator = ((ASTOpNode)rhs).GetOperator();
         if (top == @operator)
         {
             return(!top.IsRightBinding() && !top.IsAssociative());
         }
         if (top.GetPrecedence() == @operator.GetPrecedence())
         {
             if (top.IsLeftBinding() && top.IsAssociative())
             {
                 return(false);
             }
             return(true);
         }
         if (top.GetPrecedence() > @operator.GetPrecedence())
         {
             return(false);
         }
     }
     return(true);
 }
示例#2
0
 private bool TestLeft(Operator top, INode lhs)
 {
     if ((this.mode & 1) == 0)
     {
         if (!(lhs is ASTOpNode))
         {
             return(false);
         }
         Operator @operator = ((ASTOpNode)lhs).GetOperator();
         if (top == @operator)
         {
             if (top.IsLeftBinding() && top.IsAssociative())
             {
                 return(false);
             }
             if (top.UseBindingForPrint())
             {
                 return(false);
             }
             return(true);
         }
         if (top.GetPrecedence() == @operator.GetPrecedence())
         {
             if (@operator.IsLeftBinding() && @operator.IsAssociative())
             {
                 return(false);
             }
             if (@operator.UseBindingForPrint())
             {
                 return(false);
             }
             return(true);
         }
         if (top.GetPrecedence() > @operator.GetPrecedence())
         {
             return(false);
         }
     }
     return(true);
 }