mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-14 19:59:14 +02:00
codetools: h2p: implemented converting | and & in macro values
git-svn-id: trunk@14664 -
This commit is contained in:
parent
635062877c
commit
54398675ff
@ -1458,8 +1458,14 @@ var
|
||||
AtomStart: integer;
|
||||
p: Integer;
|
||||
|
||||
procedure Replace(const NewAtom: string);
|
||||
procedure Replace(NewAtom: string);
|
||||
begin
|
||||
if IsIdentChar[NewAtom[1]]
|
||||
and (AtomStart>1) and (IsIdentChar[PasExpression[AtomStart-1]]) then
|
||||
NewAtom:=' '+NewAtom;
|
||||
if IsIdentChar[NewAtom[length(NewAtom)]]
|
||||
and (p<=length(PasExpression)) and (IsIdentChar[PasExpression[p]]) then
|
||||
NewAtom:=NewAtom+' ';
|
||||
PasExpression:=copy(PasExpression,1,AtomStart-1)+NewAtom
|
||||
+copy(PasExpression,p,length(PasExpression));
|
||||
p:=AtomStart+length(NewAtom);
|
||||
@ -1529,6 +1535,19 @@ begin
|
||||
if (CurAtom='(') or (CurAtom=')')
|
||||
or (CurAtom='+') or (CurAtom='-') then begin
|
||||
// same in pascal
|
||||
end else if (CurAtom='*') then begin
|
||||
// can be multiplication or dereference or pointer type
|
||||
if (AtomStart>1) and (IsNumberChar[PasExpression[AtomStart-1]]) then
|
||||
begin
|
||||
// is multiplication
|
||||
end else begin
|
||||
// don't know
|
||||
exit;
|
||||
end;
|
||||
end else if (CurAtom='|') then begin
|
||||
Replace('or');
|
||||
end else if (CurAtom='&') then begin
|
||||
Replace('and');
|
||||
end else begin
|
||||
DebugLn(['TH2PasTool.MacroValueIsConstant NO ',CurAtom]);
|
||||
// unknown
|
||||
|
@ -375,7 +375,7 @@ begin
|
||||
if (Position<1) or (Position>l) or (not IsNumberChar[Source[Position]])
|
||||
then exit;
|
||||
// check octal and hex number
|
||||
if (Source[Position]='0') and (Source[Position] in ['x','0'..'9'])
|
||||
if (Source[Position]='0') and (Source[Position+1] in ['x','0'..'9'])
|
||||
then exit;
|
||||
// check float
|
||||
inc(Position);
|
||||
|
Loading…
Reference in New Issue
Block a user