int type;
{
if (c->c_nblocks >= MAXBLOCKS) {
- err_setstr(TypeError, "too many statically nested blocks");
+ err_setstr(SystemError, "too many statically nested blocks");
c->c_errors++;
}
else {
REQ(n, trailer);
switch (TYPE(CHILD(n, 0))) {
case LPAR: /* '(' [exprlist] ')' */
- err_setstr(TypeError, "can't assign to function call");
+ err_setstr(SyntaxError, "can't assign to function call");
c->c_errors++;
break;
case DOT: /* '.' NAME */
com_assign_subscript(c, CHILD(n, 0), assigning);
break;
default:
- err_setstr(TypeError, "unknown trailer type");
+ err_setstr(SystemError, "unknown trailer type");
c->c_errors++;
}
}
case arith_expr:
case term:
if (NCH(n) > 1) {
- err_setstr(TypeError,
+ err_setstr(SyntaxError,
"can't assign to operator");
c->c_errors++;
return;
case factor: /* ('+'|'-'|'~') factor | atom trailer* */
if (TYPE(CHILD(n, 0)) != atom) { /* '+'|'-'|'~' */
- err_setstr(TypeError,
+ err_setstr(SyntaxError,
"can't assign to operator");
c->c_errors++;
return;
n = CHILD(n, 1);
if (TYPE(n) == RPAR) {
/* XXX Should allow () = () ??? */
- err_setstr(TypeError,
+ err_setstr(SyntaxError,
"can't assign to ()");
c->c_errors++;
return;
case LSQB:
n = CHILD(n, 1);
if (TYPE(n) == RSQB) {
- err_setstr(TypeError,
+ err_setstr(SyntaxError,
"can't assign to []");
c->c_errors++;
return;
com_assign_name(c, CHILD(n, 0), assigning);
return;
default:
- err_setstr(TypeError,
+ err_setstr(SyntaxError,
"can't assign to literal");
c->c_errors++;
return;
{
REQ(n, return_stmt); /* 'return' [testlist] */
if (!c->c_infunction) {
- err_setstr(TypeError, "'return' outside function");
+ err_setstr(SyntaxError, "'return' outside function");
c->c_errors++;
}
if (NCH(n) < 2)
i += 3) {
/* except_clause: 'except' [expr [',' expr]] */
if (except_anchor == 0) {
- err_setstr(TypeError,
+ err_setstr(SyntaxError,
"default 'except:' must be last");
c->c_errors++;
break;
com_addoparg(c, JUMP_ABSOLUTE, c->c_begin);
}
else {
- err_setstr(TypeError, "'continue' not properly in loop");
+ err_setstr(SyntaxError, "'continue' not properly in loop");
c->c_errors++;
}
/* XXX Could allow it inside a 'finally' clause
break;
case break_stmt:
if (c->c_loops == 0) {
- err_setstr(TypeError, "'break' outside loop");
+ err_setstr(SyntaxError, "'break' outside loop");
c->c_errors++;
}
com_addbyte(c, BREAK_LOOP);