Catch bad operand to some unary operators.

This commit is contained in:
steve 2000-04-21 03:22:18 +00:00
parent 9a36dcd33d
commit 23725cf42c
1 changed files with 11 additions and 1 deletions

12
parse.y
View File

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
#ident "$Id: parse.y,v 1.90 2000/04/15 19:51:30 steve Exp $"
#ident "$Id: parse.y,v 1.91 2000/04/21 03:22:18 steve Exp $"
#endif
# include "parse_misc.h"
@ -524,6 +524,16 @@ expression
tmp->set_lineno(@2.first_line);
$$ = tmp;
}
| '!' error %prec UNARY_PREC
{ yyerror(@1, "error: Operand of unary ! "
"is not a primary expression.");
$$ = 0;
}
| '^' error %prec UNARY_PREC
{ yyerror(@1, "error: Operand of reduction ^ "
"is not a primary expression.");
$$ = 0;
}
| expression '^' expression
{ PEBinary*tmp = new PEBinary('^', $1, $3);
tmp->set_file(@2.text);