mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-16 13:09:28 +02:00
fixed code beautifying for compiler directives
git-svn-id: trunk@7621 -
This commit is contained in:
parent
692146e306
commit
1b5dea0408
@ -109,6 +109,8 @@ type
|
||||
DoNotSplitLineAfter: TAtomTypes;
|
||||
DoInsertSpaceInFront: TAtomTypes;
|
||||
DoInsertSpaceAfter: TAtomTypes;
|
||||
DoNotInsertSpaceInFront: TAtomTypes;
|
||||
DoNotInsertSpaceAfter: TAtomTypes;
|
||||
PropertyReadIdentPrefix: string;
|
||||
PropertyWriteIdentPrefix: string;
|
||||
PropertyStoredIdentPostfix: string;
|
||||
@ -256,6 +258,8 @@ const
|
||||
DefaultDoNotSplitLineAfter: TAtomTypes = [atColon,atAt,atPoint,atKeyWord];
|
||||
DefaultDoInsertSpaceInFront: TAtomTypes = [];
|
||||
DefaultDoInsertSpaceAfter: TAtomTypes = [atColon,atComma,atSemicolon];
|
||||
DefaultDoNotInsertSpaceInFront: TAtomTypes = [];
|
||||
DefaultDoNotInsertSpaceAfter: TAtomTypes = [atDirectiveStart];
|
||||
|
||||
function AtomTypeNameToType(const s: string): TAtomType;
|
||||
function WordPolicyNameToPolicy(const s: string): TWordPolicy;
|
||||
@ -939,6 +943,8 @@ begin
|
||||
DoNotSplitLineAfter:=DefaultDoNotSplitLineAfter;
|
||||
DoInsertSpaceInFront:=DefaultDoInsertSpaceInFront;
|
||||
DoInsertSpaceAfter:=DefaultDoInsertSpaceAfter;
|
||||
DoNotInsertSpaceInFront:=DefaultDoInsertSpaceInFront;
|
||||
DoNotInsertSpaceAfter:=DefaultDoInsertSpaceAfter;
|
||||
PropertyReadIdentPrefix:='Get';
|
||||
PropertyWriteIdentPrefix:='Set';
|
||||
PropertyStoredIdentPostfix:='IsStored';
|
||||
@ -1127,6 +1133,10 @@ begin
|
||||
if (CurPos<=SrcLen) and (Src[CurPos]='$') then begin
|
||||
inc(CurPos);
|
||||
CurAtomType:=atDirectiveStart;
|
||||
while (CurPos<=SrcLen) and (IsIdentChar[Src[CurPos]]) do
|
||||
inc(CurPos);
|
||||
if (CurPos<=SrcLen) and (Src[CurPos] in ['+','-']) then
|
||||
inc(CurPos);
|
||||
end else begin
|
||||
CurAtomType:=atCommentStart;
|
||||
end;
|
||||
@ -1144,6 +1154,10 @@ begin
|
||||
if (CurPos<=SrcLen) and (Src[CurPos]='$') then begin
|
||||
inc(CurPos);
|
||||
CurAtomType:=atDirectiveStart;
|
||||
while (CurPos<=SrcLen) and (IsIdentChar[Src[CurPos]]) do
|
||||
inc(CurPos);
|
||||
if (CurPos<=SrcLen) and (Src[CurPos] in ['+','-']) then
|
||||
inc(CurPos);
|
||||
end else begin
|
||||
CurAtomType:=atCommentStart;
|
||||
end;
|
||||
@ -1169,6 +1183,10 @@ begin
|
||||
if (CurPos<=SrcLen) and (Src[CurPos]='$') then begin
|
||||
inc(CurPos);
|
||||
CurAtomType:=atDirectiveStart;
|
||||
while (CurPos<=SrcLen) and (IsIdentChar[Src[CurPos]]) do
|
||||
inc(CurPos);
|
||||
if (CurPos<=SrcLen) and (Src[CurPos] in ['+','-']) then
|
||||
inc(CurPos);
|
||||
end else begin
|
||||
CurAtomType:=atCommentStart;
|
||||
end;
|
||||
@ -1221,6 +1239,18 @@ begin
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
function TBeautifyCodeOptions.BeautifyStatement(const AStatement: string;
|
||||
IndentSize: integer): string;
|
||||
begin
|
||||
Result:=BeautifyStatement(AStatement,IndentSize,[]);
|
||||
end;
|
||||
|
||||
function TBeautifyCodeOptions.BeautifyStatementLeftAligned(
|
||||
const AStatement: string; IndentSize: integer): string;
|
||||
begin
|
||||
Result:=BeautifyStatement(AStatement,IndentSize,[bcfNoIndentOnBreakLine]);
|
||||
end;
|
||||
|
||||
function TBeautifyCodeOptions.BeautifyStatement(const AStatement: string;
|
||||
IndentSize: integer; BeautifyFlags: TBeautifyCodeFlags): string;
|
||||
var CurAtom: string;
|
||||
@ -1262,9 +1292,11 @@ begin
|
||||
break;
|
||||
until false;
|
||||
if ((Result='') or (Result[length(Result)]<>' '))
|
||||
and (not (CurAtomType in DoNotInsertSpaceInFront))
|
||||
and (not (LastAtomType in DoNotInsertSpaceAfter))
|
||||
and ((CurAtomType in DoInsertSpaceInFront)
|
||||
or (LastAtomType in DoInsertSpaceAfter))
|
||||
and (CurAtom<>'$') then
|
||||
or (LastAtomType in DoInsertSpaceAfter))
|
||||
then
|
||||
AddAtom(Result,' ');
|
||||
if (not (CurAtomType in DoNotSplitLineInFront))
|
||||
and (not (LastAtomType in DoNotSplitLineAfter)) then
|
||||
@ -1284,18 +1316,6 @@ begin
|
||||
//DebugLn('**********************************************************');
|
||||
end;
|
||||
|
||||
function TBeautifyCodeOptions.BeautifyStatement(const AStatement: string;
|
||||
IndentSize: integer): string;
|
||||
begin
|
||||
Result:=BeautifyStatement(AStatement,IndentSize,[]);
|
||||
end;
|
||||
|
||||
function TBeautifyCodeOptions.BeautifyStatementLeftAligned(
|
||||
const AStatement: string; IndentSize: integer): string;
|
||||
begin
|
||||
Result:=BeautifyStatement(AStatement,IndentSize,[bcfNoIndentOnBreakLine]);
|
||||
end;
|
||||
|
||||
function TBeautifyCodeOptions.AddClassAndNameToProc(const AProcCode, AClassName,
|
||||
AMethodName: string): string;
|
||||
var StartPos, NamePos, ProcLen: integer;
|
||||
|
@ -2,19 +2,19 @@
|
||||
This source is only used to compile and install the package.
|
||||
}
|
||||
|
||||
unit JPEGForLazarus;
|
||||
unit JPEGForLazarus;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
LazJPEG, LazarusPackageIntf;
|
||||
LazJPEG, LazarusPackageIntf;
|
||||
|
||||
implementation
|
||||
|
||||
procedure Register;
|
||||
procedure Register;
|
||||
begin
|
||||
end;
|
||||
end;
|
||||
|
||||
initialization
|
||||
RegisterPackage('JPEGForLazarus', @Register);
|
||||
RegisterPackage('JPEGForLazarus',@Register);
|
||||
end.
|
||||
|
@ -2,20 +2,20 @@
|
||||
This source is only used to compile and install the package.
|
||||
}
|
||||
|
||||
unit Printer4Lazarus;
|
||||
unit Printer4Lazarus;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
PrintersDlgs, OSPrinters, LazarusPackageIntf;
|
||||
PrintersDlgs, OSPrinters, LazarusPackageIntf;
|
||||
|
||||
implementation
|
||||
|
||||
procedure Register;
|
||||
procedure Register;
|
||||
begin
|
||||
RegisterUnit('PrintersDlgs', @PrintersDlgs.Register);
|
||||
end;
|
||||
RegisterUnit('PrintersDlgs',@PrintersDlgs.Register);
|
||||
end;
|
||||
|
||||
initialization
|
||||
RegisterPackage('Printer4Lazarus', @Register);
|
||||
RegisterPackage('Printer4Lazarus',@Register);
|
||||
end.
|
||||
|
@ -2,21 +2,21 @@
|
||||
This source is only used to compile and install the package.
|
||||
}
|
||||
|
||||
unit RunTimeTypeInfoControls;
|
||||
unit RunTimeTypeInfoControls;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
RTTICtrls, RTTIGrids, LazarusPackageIntf;
|
||||
RTTICtrls, RTTIGrids, LazarusPackageIntf;
|
||||
|
||||
implementation
|
||||
|
||||
procedure Register;
|
||||
procedure Register;
|
||||
begin
|
||||
RegisterUnit('RTTICtrls', @RTTICtrls.Register);
|
||||
RegisterUnit('RTTIGrids', @RTTIGrids.Register);
|
||||
end;
|
||||
RegisterUnit('RTTICtrls',@RTTICtrls.Register);
|
||||
RegisterUnit('RTTIGrids',@RTTIGrids.Register);
|
||||
end;
|
||||
|
||||
initialization
|
||||
RegisterPackage('RunTimeTypeInfoControls', @Register);
|
||||
RegisterPackage('RunTimeTypeInfoControls',@Register);
|
||||
end.
|
||||
|
@ -275,6 +275,7 @@ const
|
||||
+'begin'#13
|
||||
+' A:=@B.C;D:=3;'#13
|
||||
+' {$I unit1.lrs}'#13
|
||||
+' {$R-}{$R+}'#13
|
||||
+'end;';
|
||||
|
||||
function AtomTypeDescriptionToType(const s: string): TAtomType;
|
||||
|
@ -158,6 +158,7 @@ begin
|
||||
inherited Create(nil);
|
||||
|
||||
OnKeyDown :=@PromptDialogKeyDown;
|
||||
//debugln('TPromptDialog.CreateMessageDialog A ButtonCount=',dbgs(ButtonCount));
|
||||
|
||||
ControlStyle:= ControlStyle-[csSetCaption];
|
||||
BorderStyle := bsDialog;
|
||||
|
Loading…
Reference in New Issue
Block a user