Programming Error: expected primary-expression before token

This compiles. See comments. I fixed errors and omissions pointed out previously by the other members plus the original error (extra parenthesis).

int M1a = 5;
int M2a = 6;
int sensor1 = 7;
int sensor2 = 8;

void setup()
{
   // put your setup code here, to run once:
  pinMode(M1a, OUTPUT);  // ***************  added
  pinMode(M2a, OUTPUT);  // ***************  added
}

void loop()
{
   // put your main code here, to run repeatedly:
   if (digitalRead(sensor1) == HIGH) // ***** ==
      digitalWrite(M1a, HIGH);

   if (digitalRead(sensor2) == HIGH)  // ***** == and remove extra )
      digitalWrite(M2a, HIGH);

      else
      { // ***************  added
         digitalWrite(M1a, LOW);
         digitalWrite(M2a, LOW);
      }
}  // ****** added

Read the forum guidelines. Post your test code in code tags. Use the IDE autoformat tool (ctrl-t or Tools, Auto Format) to indent the code for readability before posting code.