Code-Formatting
This commit is contained in:
@@ -87,7 +87,6 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
{ TUnitInfo implementation }
|
||||
constructor TUnitInfo.Create(const AFilePath: string);
|
||||
begin
|
||||
@@ -141,7 +140,7 @@ begin
|
||||
if (currentChar = #13) or (currentChar = #10) then
|
||||
begin
|
||||
inLineComment := False;
|
||||
if (Builder.Length > 0) and (Builder[Builder.Length-1] <> ' ') and (Builder[Builder.Length-1] <> ',') then
|
||||
if (Builder.Length > 0) and (Builder[Builder.Length - 1] <> ' ') and (Builder[Builder.Length - 1] <> ',') then
|
||||
Builder.Append(' ');
|
||||
end;
|
||||
Inc(i);
|
||||
@@ -189,7 +188,7 @@ begin
|
||||
end;
|
||||
if (currentChar = #13) or (currentChar = #10) or (currentChar = #9) then
|
||||
begin
|
||||
if (Builder.Length = 0) or ((Builder.Length > 0) and (Builder[Builder.Length-1] <> ' ')) then
|
||||
if (Builder.Length = 0) or ((Builder.Length > 0) and (Builder[Builder.Length - 1] <> ' ')) then
|
||||
Builder.Append(' ');
|
||||
Inc(i);
|
||||
end
|
||||
@@ -588,7 +587,13 @@ begin
|
||||
outputFileName := ParamStr(currentParamIndex + 1);
|
||||
Inc(currentParamIndex, 2);
|
||||
end
|
||||
else begin WriteLn('Error: Missing filename after -o option.'); WriteLn(usageStr); exitcode := 1; exit; end;
|
||||
else
|
||||
begin
|
||||
WriteLn('Error: Missing filename after -o option.');
|
||||
WriteLn(usageStr);
|
||||
exitcode := 1;
|
||||
exit;
|
||||
end;
|
||||
end
|
||||
else if SameText(currentParam, '-dirs') then
|
||||
begin
|
||||
@@ -610,12 +615,23 @@ begin
|
||||
WriteLn('Warning: File specified with -dirs not found: ' + dirsFileName);
|
||||
Inc(currentParamIndex, 2);
|
||||
end
|
||||
else begin WriteLn('Error: Missing filename after -dirs option.'); WriteLn(usageStr); exitcode := 1; exit; end;
|
||||
else
|
||||
begin
|
||||
WriteLn('Error: Missing filename after -dirs option.');
|
||||
WriteLn(usageStr);
|
||||
exitcode := 1;
|
||||
exit;
|
||||
end;
|
||||
end
|
||||
else if SameText(currentParam, '-f') or SameText(currentParam, '-fx') then
|
||||
begin
|
||||
if focusMode then
|
||||
begin WriteLn('Error: -f and -fx options cannot be used together.'); WriteLn(usageStr); exitcode := 1; exit; end;
|
||||
begin
|
||||
WriteLn('Error: -f and -fx options cannot be used together.');
|
||||
WriteLn(usageStr);
|
||||
exitcode := 1;
|
||||
exit;
|
||||
end;
|
||||
|
||||
if currentParamIndex + 1 <= ParamCount then
|
||||
begin
|
||||
@@ -626,12 +642,18 @@ begin
|
||||
filesToExcludeFromOutput.Text := initialFocusFiles.Text;
|
||||
Inc(currentParamIndex, 2);
|
||||
end
|
||||
else begin WriteLn('Error: Missing file list after ' + currentParam + ' option.'); WriteLn(usageStr); exitcode := 1; exit; end;
|
||||
else
|
||||
begin
|
||||
WriteLn('Error: Missing file list after ' + currentParam + ' option.');
|
||||
WriteLn(usageStr);
|
||||
exitcode := 1;
|
||||
exit;
|
||||
end;
|
||||
end
|
||||
else
|
||||
begin
|
||||
sourceDirectories.Add(currentParam);
|
||||
inc( currentParamIndex );
|
||||
inc(currentParamIndex);
|
||||
end;
|
||||
end;
|
||||
|
||||
@@ -650,12 +672,11 @@ begin
|
||||
Dec(i);
|
||||
end;
|
||||
|
||||
|
||||
if writeToClipboard and (outputFileName <> '') then
|
||||
begin
|
||||
WriteLn('Error: -o (output to file) and -c (output to clipboard) cannot be used together.');
|
||||
exitcode := 1;
|
||||
exit;
|
||||
WriteLn('Error: -o (output to file) and -c (output to clipboard) cannot be used together.');
|
||||
exitcode := 1;
|
||||
exit;
|
||||
end;
|
||||
|
||||
if sourceDirectories.Count = 0 then
|
||||
@@ -687,14 +708,20 @@ begin
|
||||
for var focusFile in initialFocusFiles do
|
||||
begin
|
||||
if not TFile.Exists(focusFile) then
|
||||
begin WriteLn('Warning: Focus file not found, skipping: ' + focusFile); Continue; end;
|
||||
begin
|
||||
WriteLn('Warning: Focus file not found, skipping: ' + focusFile);
|
||||
Continue;
|
||||
end;
|
||||
if allFoundPasFilesList.IndexOf(focusFile) = -1 then
|
||||
allFoundPasFilesList.Add(focusFile);
|
||||
end;
|
||||
end;
|
||||
|
||||
if allFoundPasFilesList.Count = 0 then
|
||||
begin WriteLn('No .pas files found in any specified directory (respecting exclusions).'); exit; end;
|
||||
begin
|
||||
WriteLn('No .pas files found in any specified directory (respecting exclusions).');
|
||||
exit;
|
||||
end;
|
||||
|
||||
allUnits := TDictionary<string, TUnitInfo>.Create(TStringComparer.Ordinal);
|
||||
sortedUnits := TList<TUnitInfo>.Create;
|
||||
@@ -719,14 +746,23 @@ begin
|
||||
end;
|
||||
end
|
||||
else
|
||||
begin WriteLn('Warning: Could not determine unit name for file: ' + filePathKey + '. Skipping.'); unitInfo.Free; end;
|
||||
begin
|
||||
WriteLn('Warning: Could not determine unit name for file: ' + filePathKey + '. Skipping.');
|
||||
unitInfo.Free;
|
||||
end;
|
||||
end
|
||||
else
|
||||
begin WriteLn('Warning: Failed to parse unit: ' + filePathKey + '. Skipping.'); unitInfo.Free; end;
|
||||
begin
|
||||
WriteLn('Warning: Failed to parse unit: ' + filePathKey + '. Skipping.');
|
||||
unitInfo.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
if allUnits.Count = 0 then
|
||||
begin WriteLn('No units successfully parsed.'); exit; end;
|
||||
begin
|
||||
WriteLn('No units successfully parsed.');
|
||||
exit;
|
||||
end;
|
||||
|
||||
if focusMode then
|
||||
begin
|
||||
@@ -929,12 +965,15 @@ begin
|
||||
|
||||
if item.InterfaceSection.Count > 0 then
|
||||
begin
|
||||
outputContent.Add('//==================================================================================================');
|
||||
outputContent
|
||||
.Add('//==================================================================================================');
|
||||
outputContent.Add('//== UNIT START: ' + item.Name + ' (from ' + ExtractFileName(item.FilePath) + ')');
|
||||
outputContent.Add('//==================================================================================================');
|
||||
outputContent
|
||||
.Add('//==================================================================================================');
|
||||
outputContent.AddStrings(item.InterfaceSection);
|
||||
outputContent.Add('//== UNIT END: ' + item.Name);
|
||||
outputContent.Add('//==================================================================================================');
|
||||
outputContent
|
||||
.Add('//==================================================================================================');
|
||||
outputContent.Add('');
|
||||
end;
|
||||
end;
|
||||
|
||||
Reference in New Issue
Block a user