Allow '!' to be used in expressions with same meaning as in C.
This commit is contained in:
parent
60ae75d3ab
commit
cb9bc21374
1 changed files with 13 additions and 0 deletions
13
eval.c
13
eval.c
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue