mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-11-02 03:29:34 +01:00
compiler: support ORD() intrinsic in preprocessor expressions
git-svn-id: trunk@25471 -
This commit is contained in:
parent
974aeb5573
commit
e42e9bb677
@ -1794,6 +1794,38 @@ type
|
||||
Message(scan_e_error_in_preproc_expr);
|
||||
end
|
||||
else
|
||||
if current_scanner.preproc_pattern='ORD' then
|
||||
begin
|
||||
preproc_consume(_ID);
|
||||
current_scanner.skipspace;
|
||||
if current_scanner.preproc_token =_LKLAMMER then
|
||||
begin
|
||||
preproc_consume(_LKLAMMER);
|
||||
current_scanner.skipspace;
|
||||
end
|
||||
else
|
||||
Message(scan_e_preproc_syntax_error);
|
||||
|
||||
exprvalue:=preproc_factor(eval);
|
||||
if eval then
|
||||
begin
|
||||
if is_ordinal(exprvalue.def) then
|
||||
result:=texprvalue.create_int(exprvalue.asInt)
|
||||
else
|
||||
begin
|
||||
exprvalue.error('Ordinal','ORD');
|
||||
result:=texprvalue.create_int(0);
|
||||
end;
|
||||
end
|
||||
else
|
||||
result:=texprvalue.create_int(0);
|
||||
exprvalue.free;
|
||||
if current_scanner.preproc_token =_RKLAMMER then
|
||||
preproc_consume(_RKLAMMER)
|
||||
else
|
||||
Message(scan_e_error_in_preproc_expr);
|
||||
end
|
||||
else
|
||||
if current_scanner.preproc_pattern='NOT' then
|
||||
begin
|
||||
preproc_consume(_ID);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user