예제 #1
0
        private static Expression ParseComparisonExpression(Scanner scanner)
        {
            Expression left = ParseBitshiftExpression(scanner);

            while (true)
            {
                if (scanner.TryGetDelimiter("<"))
                {
                    Expression right = ParseBitshiftExpression(scanner);
                    left = new LessExpression(left, right);
                }
                else if (scanner.TryGetDelimiter("<="))
                {
                    Expression right = ParseBitshiftExpression(scanner);
                    left = new LessOrEqualExpression(left, right);
                }
                else if (scanner.TryGetDelimiter(">"))
                {
                    Expression right = ParseBitshiftExpression(scanner);
                    left = new GreaterExpression(left, right);
                }
                else if (scanner.TryGetDelimiter(">="))
                {
                    Expression right = ParseBitshiftExpression(scanner);
                    left = new GreaterOrEqualExpression(left, right);
                }
                else
                {
                    return(left);
                }
            }
        }
예제 #2
0
 private static Expression ParseComparisonExpression(Scanner scanner)
 {
     Expression left = ParseBitshiftExpression(scanner);
     while (true)
     {
         if (scanner.TryGetDelimiter("<"))
         {
             Expression right = ParseBitshiftExpression(scanner);
             left = new LessExpression(left,right);
         }
         else if (scanner.TryGetDelimiter("<="))
         {
             Expression right = ParseBitshiftExpression(scanner);
             left = new LessOrEqualExpression(left,right);
         }
         else if (scanner.TryGetDelimiter(">"))
         {
             Expression right = ParseBitshiftExpression(scanner);
             left = new GreaterExpression(left,right);
         }
         else if (scanner.TryGetDelimiter(">="))
         {
             Expression right = ParseBitshiftExpression(scanner);
             left = new GreaterOrEqualExpression(left,right);
         }
         else
         {
             return left;
         }
     }
 }