コード例 #1
0
 void MulExpr(out NBase res)
 {
     res = null; NBase right = null;
     UnaryExpr(out res);
     while (la.kind == 35 || la.kind == 36 || la.kind == 37)
     {
         if (la.kind == 35)
         {
             Get();
             UnaryExpr(out right);
             res = new NBinary(NBinary.NKind.Mul, res, right);
         }
         else if (la.kind == 36)
         {
             Get();
             UnaryExpr(out right);
             res = new NBinary(NBinary.NKind.Div, res, right);
         }
         else
         {
             Get();
             UnaryExpr(out right);
             res = new NBinary(NBinary.NKind.Mod, res, right);
         }
     }
 }
コード例 #2
0
 void ShiftExpr(out NBase res)
 {
     res = null; NBase right = null;
     AddExpr(out res);
     while (StartOf(4))
     {
         if (la.kind == 29 || la.kind == 30)
         {
             if (la.kind == 29)
             {
                 Get();
             }
             else
             {
                 Get();
             }
             AddExpr(out right);
             res = new NBinary(NBinary.NKind.ShiftLeft, res, right);
         }
         else
         {
             if (la.kind == 31)
             {
                 Get();
             }
             else
             {
                 Get();
             }
             AddExpr(out right);
             res = new NBinary(NBinary.NKind.ShiftRight, res, right);
         }
     }
 }
コード例 #3
0
 void EqlExpr(out NBase res)
 {
     res = null; NBase right = null;
     RelExpr(out res);
     while (StartOf(2))
     {
         if (la.kind == 15 || la.kind == 16)
         {
             if (la.kind == 15)
             {
                 Get();
             }
             else
             {
                 Get();
             }
             RelExpr(out right);
             res = new NBinary(NBinary.NKind.NotEqual, res, right);
         }
         else
         {
             if (la.kind == 17)
             {
                 Get();
             }
             else
             {
                 Get();
             }
             RelExpr(out right);
             res = new NBinary(NBinary.NKind.Equal, res, right);
         }
     }
 }
コード例 #4
0
 void BitAndExpr(out NBase res)
 {
     res = null; NBase right = null;
     EqlExpr(out res);
     while (la.kind == 14)
     {
         Get();
         EqlExpr(out right);
         res = new NBinary(NBinary.NKind.And, res, right);
     }
 }
コード例 #5
0
 void BitXorExpr(out NBase res)
 {
     res = null; NBase right = null;
     BitAndExpr(out res);
     while (la.kind == 13)
     {
         Get();
         BitAndExpr(out right);
         res = new NBinary(NBinary.NKind.Xor, res, right);
     }
 }
コード例 #6
0
 void NullCoalescingExpr(out NBase res)
 {
     res = null; NBase right = null;
     OrExpr(out res);
     while (la.kind == 7)
     {
         Get();
         OrExpr(out right);
         res = new NBinary(NBinary.NKind.Coalesce, res, right);
     }
 }
コード例 #7
0
 void AndExpr(out NBase res)
 {
     res = null; NBase right = null;
     BitOrExpr(out res);
     while (la.kind == 10 || la.kind == 11)
     {
         if (la.kind == 10)
         {
             Get();
         }
         else
         {
             Get();
         }
         BitOrExpr(out right);
         res = new NBinary(NBinary.NKind.AndAlso, res, right);
     }
 }
コード例 #8
0
 void OrExpr(out NBase res)
 {
     res = null; NBase right = null;
     AndExpr(out res);
     while (la.kind == 8 || la.kind == 9)
     {
         if (la.kind == 8)
         {
             Get();
         }
         else
         {
             Get();
         }
         AndExpr(out right);
         res = new NBinary(NBinary.NKind.OrElse, res, right);
     }
 }
コード例 #9
0
 void AddExpr(out NBase res)
 {
     res = null; NBase right = null;
     MulExpr(out res);
     while (la.kind == 33 || la.kind == 34)
     {
         if (la.kind == 33)
         {
             Get();
             MulExpr(out right);
             res = new NBinary(NBinary.NKind.Plus, res, right);
         }
         else
         {
             Get();
             MulExpr(out right);
             res = new NBinary(NBinary.NKind.Minus, res, right);
         }
     }
 }
コード例 #10
0
        void RelExpr(out NBase res)
        {
            res = null; NBase right = null;
            ShiftExpr(out res);
            while (StartOf(3))
            {
                switch (la.kind)
                {
                case 19:
                case 20: {
                    if (la.kind == 19)
                    {
                        Get();
                    }
                    else
                    {
                        Get();
                    }
                    ShiftExpr(out right);
                    res = new NBinary(NBinary.NKind.Less, res, right);
                    break;
                }

                case 21:
                case 22: {
                    if (la.kind == 21)
                    {
                        Get();
                    }
                    else
                    {
                        Get();
                    }
                    ShiftExpr(out right);
                    res = new NBinary(NBinary.NKind.Greater, res, right);
                    break;
                }

                case 23:
                case 24: {
                    if (la.kind == 23)
                    {
                        Get();
                    }
                    else
                    {
                        Get();
                    }
                    ShiftExpr(out right);
                    res = new NBinary(NBinary.NKind.LessOrEqual, res, right);
                    break;
                }

                case 25:
                case 26: {
                    if (la.kind == 25)
                    {
                        Get();
                    }
                    else
                    {
                        Get();
                    }
                    ShiftExpr(out right);
                    res = new NBinary(NBinary.NKind.GreaterOrEqual, res, right);
                    break;
                }

                case 27: {
                    Get();
                    TypeExpr(out right);
                    res = new NCast(NCast.NKind.Is, res, (NType)right);
                    break;
                }

                case 28: {
                    Get();
                    TypeExpr(out right);
                    res = new NCast(NCast.NKind.As, res, (NType)right);
                    break;
                }
                }
            }
        }