Parser's "CaseSensitive" implementation. To got the parser Case-Sensitive, provide the "-cS" argument at command line when using ws_helper.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@1931 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
inoussa
2011-09-10 03:44:54 +00:00
parent 068d0c4144
commit e9067503ae
3 changed files with 49 additions and 12 deletions

View File

@ -101,6 +101,7 @@ type
FCurrentModule: TPasModule;
FBindingList : TObjectList;
FProperties : TPropertyHolder;
FCaseSensitive : Boolean;
private
function GetBinding(AIndex : Integer): TwstBinding;
function GetBindingCount: Integer;
@ -163,6 +164,8 @@ type
function IsInitNeed(AType: TPasType): Boolean;
function IsOfType(AType: TPasType; AClass: TClass): Boolean;
property CaseSensitive : Boolean read FCaseSensitive write FCaseSensitive;
end;
TPasNativeModule = class(TPasModule)
@ -751,18 +754,37 @@ begin
decs := AModule.InterfaceSection.Declarations;
c := decs.Count;
if ( elkDeclaredName in ANameKinds ) then begin
for i := 0 to Pred(c) do begin
if AnsiSameText(AName, GetExternalName(TPasElement(decs[i]))) then begin
Result := TPasElement(decs[i]);
Exit;
if FCaseSensitive then begin
for i := 0 to Pred(c) do begin
if AnsiSameStr(AName, GetExternalName(TPasElement(decs[i]))) then begin
Result := TPasElement(decs[i]);
Exit;
end;
end;
end else begin
for i := 0 to Pred(c) do begin
if AnsiSameText(AName, GetExternalName(TPasElement(decs[i]))) then begin
Result := TPasElement(decs[i]);
Exit;
end;
end;
end;
end;
if ( Result = nil ) and ( elkName in ANameKinds ) then begin
for i := 0 to Pred(c) do begin
if AnsiSameText(AName, TPasElement(decs[i]).Name) then begin
Result := TPasElement(decs[i]);
Exit;
if FCaseSensitive then begin
for i := 0 to Pred(c) do begin
if AnsiSameStr(AName, TPasElement(decs[i]).Name) then begin
Result := TPasElement(decs[i]);
Exit;
end;
end;
end else begin
for i := 0 to Pred(c) do begin
if AnsiSameText(AName, TPasElement(decs[i]).Name) then begin
Result := TPasElement(decs[i]);
Exit;
end;
end;
end;
end;