mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-13 21:39:21 +02:00
codetools: expreval: readoperand
git-svn-id: trunk@22778 -
This commit is contained in:
parent
f0afca08f5
commit
5f2cf12f1f
@ -972,6 +972,13 @@ var
|
|||||||
ExprEnd: Pointer;
|
ExprEnd: Pointer;
|
||||||
p, AtomStart: PChar;
|
p, AtomStart: PChar;
|
||||||
|
|
||||||
|
function GetAtom: string;
|
||||||
|
begin
|
||||||
|
Setlength(Result,p-AtomStart);
|
||||||
|
if Result<>'' then
|
||||||
|
System.Move(AtomStart^,Result[1],length(Result));
|
||||||
|
end;
|
||||||
|
|
||||||
procedure ReadNextAtom;
|
procedure ReadNextAtom;
|
||||||
begin
|
begin
|
||||||
// skip space
|
// skip space
|
||||||
@ -1005,6 +1012,7 @@ var
|
|||||||
else
|
else
|
||||||
inc(p);
|
inc(p);
|
||||||
end;
|
end;
|
||||||
|
DebugLn(['ReadNextAtom ',GetAtom]);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure Error(NewErrorPos: PChar; const NewErrorMsg: string);
|
procedure Error(NewErrorPos: PChar; const NewErrorMsg: string);
|
||||||
@ -1014,6 +1022,7 @@ var
|
|||||||
else
|
else
|
||||||
FErrorPos:=0;
|
FErrorPos:=0;
|
||||||
ErrorMsg:=NewErrorMsg;
|
ErrorMsg:=NewErrorMsg;
|
||||||
|
DebugLn(['Error ',ErrorMsg,' at ',ErrorPosition]);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure ExpressionMissing(NewErrorPos: PChar);
|
procedure ExpressionMissing(NewErrorPos: PChar);
|
||||||
@ -1048,16 +1057,19 @@ var
|
|||||||
NeedBracketClose: Boolean;
|
NeedBracketClose: Boolean;
|
||||||
begin
|
begin
|
||||||
Result:=false;
|
Result:=false;
|
||||||
|
DebugLn(['ParseDefinedParams AAA1 ',GetAtom]);
|
||||||
ReadNextAtom;
|
ReadNextAtom;
|
||||||
if AtomStart>=ExprEnd then begin
|
if AtomStart>=ExprEnd then begin
|
||||||
IdentifierMissing(AtomStart);
|
IdentifierMissing(AtomStart);
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
NeedBracketClose:=false;
|
NeedBracketClose:=false;
|
||||||
if p^='(' then begin
|
DebugLn(['ParseDefinedParams AAA2 ',GetAtom]);
|
||||||
|
if AtomStart^='(' then begin
|
||||||
// defined(
|
// defined(
|
||||||
NeedBracketClose:=true;
|
NeedBracketClose:=true;
|
||||||
ReadNextAtom;
|
ReadNextAtom;
|
||||||
|
DebugLn(['ParseDefinedParams AAA3 ',GetAtom]);
|
||||||
// skip space
|
// skip space
|
||||||
if AtomStart>=ExprEnd then begin
|
if AtomStart>=ExprEnd then begin
|
||||||
IdentifierMissing(AtomStart);
|
IdentifierMissing(AtomStart);
|
||||||
@ -1099,8 +1111,7 @@ var
|
|||||||
i: LongInt;
|
i: LongInt;
|
||||||
begin
|
begin
|
||||||
Result:=false;
|
Result:=false;
|
||||||
ReadNextAtom;
|
DebugLn(['ReadOperand ',GetAtom]);
|
||||||
if AtomStart>=ExprEnd then exit;
|
|
||||||
case UpChars[AtomStart^] of
|
case UpChars[AtomStart^] of
|
||||||
'N':
|
'N':
|
||||||
if CompareIdentifiers(AtomStart,'NOT')=0 then begin
|
if CompareIdentifiers(AtomStart,'NOT')=0 then begin
|
||||||
@ -1165,7 +1176,10 @@ begin
|
|||||||
Operand:=CleanOperandValue;
|
Operand:=CleanOperandValue;
|
||||||
ReadOperand(Operand);
|
ReadOperand(Operand);
|
||||||
ReadNextAtom;
|
ReadNextAtom;
|
||||||
|
// set result
|
||||||
|
SetLength(Result,Operand.Len);
|
||||||
|
if Result<>'' then
|
||||||
|
System.Move(Operand.Value^,Result[1],length(Result));
|
||||||
FreeOperandValue(Operand);
|
FreeOperandValue(Operand);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user