Fixed small bug in the indent function

This commit is contained in:
Christian Hammacher 2005-11-12 15:11:14 +00:00
parent 4165548661
commit 32fd0f9e93
5 changed files with 15 additions and 22 deletions

View File

@ -115,7 +115,7 @@ AutoIncBuild=1
MajorVer=1 MajorVer=1
MinorVer=3 MinorVer=3
Release=0 Release=0
Build=28 Build=29
Debug=0 Debug=0
PreRelease=0 PreRelease=0
Special=0 Special=0
@ -126,7 +126,7 @@ CodePage=1252
[Version Info Keys] [Version Info Keys]
CompanyName=AMX Mod X Dev Team CompanyName=AMX Mod X Dev Team
FileDescription= FileDescription=
FileVersion=1.3.0.28 FileVersion=1.3.0.29
InternalName= InternalName=
LegalCopyright= LegalCopyright=
LegalTrademarks= LegalTrademarks=

Binary file not shown.

Binary file not shown.

View File

@ -143,6 +143,7 @@ begin
frmMain.pbLoading.Position := i; frmMain.pbLoading.Position := i;
SetProgressStatus('Indenting Code...'); SetProgressStatus('Indenting Code...');
eStr[i] := RemoveStringsAndComments(eStr[i], True, True); eStr[i] := RemoveStringsAndComments(eStr[i], True, True);
eStr[i] := LowerCase(Trim(eStr[i]));
end; end;
for i := 0 to eStr.Count -1 do begin for i := 0 to eStr.Count -1 do begin
@ -173,15 +174,8 @@ begin
eTempIndent := eTempIndent +1; eTempIndent := eTempIndent +1;
end; end;
end end
else if (IsAtStart('else', eStr[i], False)) and (Pos('{', eStr[i]) = 0) then begin else if (eStr[i] = 'else') or (Pos('else if', eStr[i]) = 1) and (Pos('{', eStr[i]) = 0) then
eString := eStr[i]; eTempIndent := eTempIndent +1
Delete(eString, 1, 4);
if eString[1] <> Trim(eString)[1] then begin
eString := Trim(eString);
if GetMatchingBrace(eString) = Length(eString) then
eTempIndent := eTempIndent +1;
end;
end
else if (Pos('{', eStr[i]) = 0) and (Length(eStr[i]) > 6) then begin else if (Pos('{', eStr[i]) = 0) and (Length(eStr[i]) > 6) then begin
if (IsAtStart('stock', eStr[i], False)) or (IsAtStart('while', eStr[i], True)) then begin if (IsAtStart('stock', eStr[i], False)) or (IsAtStart('while', eStr[i], True)) then begin
eString := eStr[i]; eString := eStr[i];

View File

@ -44,7 +44,7 @@ begin
Result := ExtractFilePath(frmSettings.txtPawnCompilerPath.Text) + eInput + '.inc' Result := ExtractFilePath(frmSettings.txtPawnCompilerPath.Text) + eInput + '.inc'
else if FileExists(ExtractFilePath(frmSettings.txtPawnCompilerPath.Text) + 'include\' + eInput + '.inc') then else if FileExists(ExtractFilePath(frmSettings.txtPawnCompilerPath.Text) + 'include\' + eInput + '.inc') then
Result := ExtractFilePath(frmSettings.txtPawnCompilerPath.Text) + 'include\' + eInput + '.inc' Result := ExtractFilePath(frmSettings.txtPawnCompilerPath.Text) + 'include\' + eInput + '.inc'
else if (FileExists(ExtractFilePath(ActiveDoc.FileName) + eInput + '.inc')) and (not ActiveDoc.Modified) then else if (FileExists(ExtractFilePath(ActiveDoc.FileName) + eInput + '.inc')) then
Result := ExtractFilePath(ActiveDoc.FileName) + eInput + '.inc' Result := ExtractFilePath(ActiveDoc.FileName) + eInput + '.inc'
else else
Result := ''; Result := '';
@ -75,21 +75,20 @@ begin
for i := 0 to eCode.Count - 1 do begin for i := 0 to eCode.Count - 1 do begin
if (Application.Terminated) or (not Started) or (frmMain.pnlLoading.Visible) or (not frmMain.trvExplorer.Visible) then exit; if (Application.Terminated) or (not Started) or (frmMain.pnlLoading.Visible) or (not frmMain.trvExplorer.Visible) then exit;
if Pos('get_user_button', eCode[i]) <> 0 then
eCActive := eCActive;
eString := RemoveStringsAndComments(Trim(eCode[i]), True, True);
if (Pos('/*', eString) = 1) or (Pos('*/', eString) <> 0) then begin
eCActive := (Pos('/*', eString) = 1);
if Pos('*/', eString) < Pos('/*', eString) then
continue
else
eCActive := False;
end;
if eCActive then
continue;
eBackup := Trim(eCode[i]); eBackup := Trim(eCode[i]);
eString := RemoveStringsAndComments(Trim(eCode[i]), True, True);
if (Pos('/*', eBackup) = 1) or (Pos('*/', eBackup) <> 0) then begin
eCActive := (Pos('/*', eBackup) = 1);
if (eCActive) and (Pos('*/', eBackup) <> 0) then begin
eCActive := False;
continue
end;
end;
if (eBackup = '') or (Pos('//', eBackup) = 1) or (eCActive) then
continue;
eProcedureAdded := False; eProcedureAdded := False;
Inc(eTimeToSleep, 1); Inc(eTimeToSleep, 1);