|
@@ -227,6 +227,7 @@ interface
|
|
|
procedure skipoldtpcomment(read_first_char:boolean);
|
|
|
procedure readtoken(allowrecordtoken:boolean);
|
|
|
function readpreproc:ttoken;
|
|
|
+ function readpreprocint(var value:int64;const place:string):boolean;
|
|
|
function asmgetchar:char;
|
|
|
end;
|
|
|
|
|
@@ -276,7 +277,6 @@ interface
|
|
|
Function SetCompileModeSwitch(s:string; changeInit: boolean):boolean;
|
|
|
procedure SetAppType(NewAppType:tapptype);
|
|
|
|
|
|
-
|
|
|
implementation
|
|
|
|
|
|
uses
|
|
@@ -963,6 +963,7 @@ type
|
|
|
function evaluate(v:texprvalue;op:ttoken):texprvalue;
|
|
|
procedure error(expecteddef, place: string);
|
|
|
function isBoolean: Boolean;
|
|
|
+ function isInt: Boolean;
|
|
|
function asBool: Boolean;
|
|
|
function asInt: Integer;
|
|
|
function asInt64: Int64;
|
|
@@ -1403,6 +1404,11 @@ type
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
+ function texprvalue.isInt: Boolean;
|
|
|
+ begin
|
|
|
+ result:=is_integer(def);
|
|
|
+ end;
|
|
|
+
|
|
|
function texprvalue.asBool: Boolean;
|
|
|
begin
|
|
|
result:=value.valueord<>0;
|
|
@@ -5753,6 +5759,25 @@ exit_label:
|
|
|
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;
|
|
|
begin
|
|
|
readchar;
|