Use the correct local variable for syntax errors.

In my defense, it is Monday morning and I've not had my mandatory 10 liters of
tea. This fixes #3076.
Renamed variables used for checking syntax.

This should hopefully prevent future cases of the Mondays.