Allow '!' to be used in expressions with same meaning as in C.

This commit is contained in:
Chuck Crayne 2007-05-02 04:21:26 +00:00
parent 60ae75d3ab
commit cb9bc21374

13
eval.c
View file

@ -631,6 +631,19 @@ static expr *expr6(int critical)
return NULL;
}
return scalarvect(~reloc_value(e));
} else if (i == '!') {
i = scan(scpriv, tokval);
e = expr6(critical);
if (!e)
return NULL;
if (is_just_unknown(e))
return unknown_expr();
else if (!is_simple(e)) {
error(ERR_NONFATAL, "`!' operator may only be applied to"
" scalar values");
return NULL;
}
return scalarvect(!reloc_value(e));
} else if (i == TOKEN_SEG) {
i = scan(scpriv, tokval);
e = expr6(critical);