mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-16 18:19:16 +02:00
+ add method to retrieve an integer expression from the scanner
git-svn-id: trunk@47601 -
This commit is contained in:
parent
48271b880c
commit
a8d316d187
@ -227,6 +227,7 @@ interface
|
|||||||
procedure skipoldtpcomment(read_first_char:boolean);
|
procedure skipoldtpcomment(read_first_char:boolean);
|
||||||
procedure readtoken(allowrecordtoken:boolean);
|
procedure readtoken(allowrecordtoken:boolean);
|
||||||
function readpreproc:ttoken;
|
function readpreproc:ttoken;
|
||||||
|
function readpreprocint(var value:int64;const place:string):boolean;
|
||||||
function asmgetchar:char;
|
function asmgetchar:char;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -276,7 +277,6 @@ interface
|
|||||||
Function SetCompileModeSwitch(s:string; changeInit: boolean):boolean;
|
Function SetCompileModeSwitch(s:string; changeInit: boolean):boolean;
|
||||||
procedure SetAppType(NewAppType:tapptype);
|
procedure SetAppType(NewAppType:tapptype);
|
||||||
|
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
uses
|
uses
|
||||||
@ -963,6 +963,7 @@ type
|
|||||||
function evaluate(v:texprvalue;op:ttoken):texprvalue;
|
function evaluate(v:texprvalue;op:ttoken):texprvalue;
|
||||||
procedure error(expecteddef, place: string);
|
procedure error(expecteddef, place: string);
|
||||||
function isBoolean: Boolean;
|
function isBoolean: Boolean;
|
||||||
|
function isInt: Boolean;
|
||||||
function asBool: Boolean;
|
function asBool: Boolean;
|
||||||
function asInt: Integer;
|
function asInt: Integer;
|
||||||
function asInt64: Int64;
|
function asInt64: Int64;
|
||||||
@ -1403,6 +1404,11 @@ type
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function texprvalue.isInt: Boolean;
|
||||||
|
begin
|
||||||
|
result:=is_integer(def);
|
||||||
|
end;
|
||||||
|
|
||||||
function texprvalue.asBool: Boolean;
|
function texprvalue.asBool: Boolean;
|
||||||
begin
|
begin
|
||||||
result:=value.valueord<>0;
|
result:=value.valueord<>0;
|
||||||
@ -5753,6 +5759,25 @@ exit_label:
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
function tscannerfile.readpreprocint(var value:int64;const place:string):boolean;
|
||||||
|
var
|
||||||
|
hs : texprvalue;
|
||||||
|
begin
|
||||||
|
hs:=preproc_comp_expr;
|
||||||
|
if hs.isInt then
|
||||||
|
begin
|
||||||
|
value:=hs.asInt64;
|
||||||
|
result:=true;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
hs.error('Integer',place);
|
||||||
|
result:=false;
|
||||||
|
end;
|
||||||
|
hs.free;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
function tscannerfile.asmgetchar : char;
|
function tscannerfile.asmgetchar : char;
|
||||||
begin
|
begin
|
||||||
readchar;
|
readchar;
|
||||||
|
Loading…
Reference in New Issue
Block a user