Example #1
0
        Expression rel()
        {
            Token      temp = next;
            Expression x    = bitwise();

            while (true)
            {
                switch (t)
                {
                case TokenKind.LessThan:
                    move(); x = new LessThan(x, bitwise(), temp.line, temp.col); continue;

                case TokenKind.LessThanOrEqual:
                    move(); x = new LessThanOrEqual(x, bitwise(), temp.line, temp.col); continue;

                case TokenKind.GreaterThan:
                    move(); x = new GreaterThan(x, bitwise(), temp.line, temp.col); continue;

                case TokenKind.GreaterThanOrEqual:
                    move(); x = new GreaterThanOrEqual(x, bitwise(), temp.line, temp.col); continue;

                case TokenKind.Inequality:
                    move(); x = new NotEqual(x, bitwise(), temp.line, temp.col); continue;

                case TokenKind.Equality:
                case TokenKind.Assignment:
                    move(); x = new Equality(x, bitwise(), temp.line, temp.col); continue;

                default:
                    return(x);
                }
            }
        }
Example #2
0
 Expression rel()
 {
     Token temp = next;
     Expression x = bitwise();
     while (true)
     {
         switch (t)
         {
             case TokenKind.LessThan:
                 move(); x = new LessThan(x, bitwise(), temp.line, temp.col); continue;
             case TokenKind.LessThanOrEqual:
                 move(); x = new LessThanOrEqual(x, bitwise(), temp.line, temp.col); continue;
             case TokenKind.GreaterThan:
                 move(); x = new GreaterThan(x, bitwise(), temp.line, temp.col); continue;
             case TokenKind.GreaterThanOrEqual:
                 move(); x = new GreaterThanOrEqual(x, bitwise(), temp.line, temp.col); continue;
             case TokenKind.Inequality:
                 move(); x = new NotEqual(x, bitwise(), temp.line, temp.col); continue;
             case TokenKind.Equality:
             case TokenKind.Assignment:
                 move(); x = new Equality(x, bitwise(), temp.line, temp.col); continue;
             default:
                 return x;
         }
     }
 }