mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-12 17:09:35 +02:00
* Fix case sensitivity of macro value
This commit is contained in:
parent
153baf41ce
commit
412de8a17d
@ -3968,14 +3968,14 @@ Var
|
||||
MName,MValue : String;
|
||||
|
||||
begin
|
||||
Param := UpperCase(Param);
|
||||
// Param is already trimmed on entry.
|
||||
Index:=Pos(':=',Param);
|
||||
If (Index=0) then
|
||||
AddDefine(GetMacroName(Param))
|
||||
else
|
||||
begin
|
||||
MValue:=Trim(Param);
|
||||
MName:=Trim(Copy(MValue,1,Index-1));
|
||||
MValue:=Param;
|
||||
MName:=UpperCase(Trim(Copy(MValue,1,Index-1)));
|
||||
Delete(MValue,1,Index+1);
|
||||
AddMacro(MName,Trim(MValue));
|
||||
end;
|
||||
@ -5729,6 +5729,7 @@ begin
|
||||
while (p<=length(Result)) and (Result[p] in ['a'..'z','A'..'Z','0'..'9','_']) do
|
||||
inc(p);
|
||||
SetLength(Result,p-1);
|
||||
Result:=UpperCase(Result);
|
||||
end;
|
||||
|
||||
procedure TPascalScanner.SetCurMsg(MsgType: TMessageType; MsgNumber: integer;
|
||||
|
@ -274,6 +274,7 @@ type
|
||||
Procedure TestMacro1;
|
||||
procedure TestMacro2;
|
||||
procedure TestMacro3;
|
||||
procedure TestMacro4;
|
||||
procedure TestMacroHandling;
|
||||
procedure TestIFDefined;
|
||||
procedure TestIFUnDefined;
|
||||
@ -1906,6 +1907,14 @@ begin
|
||||
TestTokens([tkof],'{$MACRO on}{$DEFINE MM:=begin end}'#13#10'{$IFDEF MM} of {$ELSE} in {$ENDIF}');
|
||||
end;
|
||||
|
||||
procedure TTestScanner.TestMacro4;
|
||||
begin
|
||||
FScanner.SkipComments:=True;
|
||||
FScanner.SkipWhiteSpace:=True;
|
||||
TestTokens([tkIdentifier],'{$MACRO on}{$DEFINE MM:=Solo}'#13#10'MM',False);
|
||||
AssertEquals('Token case preserved','Solo',FScanner.CurTokenString);
|
||||
end;
|
||||
|
||||
procedure TTestScanner.TestMacroHandling;
|
||||
begin
|
||||
TTestingPascalScanner(FScanner).DoSpecial:=True;
|
||||
|
Loading…
Reference in New Issue
Block a user