-
Notifications
You must be signed in to change notification settings - Fork 0
RADProgrammer Style Guide Indentation
Darian Miller edited this page Mar 14, 2021
·
1 revision
Note: RADProgrammer utilizes non-default settings for:
Do not indent after positionIndent compiler directives
-
Continuation Indent:
2- Defines additional indent that is added for continuation lines when an expression is continued on several lines.
- Default is
2
-
Do not indent after position:
120- Defines maximum width of indent, which can be inserted by the formatter.
- Default is
40
-
Indent assembly sections:
True
// True example (Default)
procedure proc1;
asm
nop
end;
// False example
procedure proc1;
asm
nop
end;-
Indent Begin and End keywords:
False
// True example
if i > 10 then
begin
j := 3;
end;
// False example (Default)
if i > 10 then
begin
j := 3;
end;-
Indent blocks between Begin and End:
True
// True example (Default)
if i > 10 then
begin
j := 3;
end;
// False example
if i > 10 then
begin
j := 3;
end;-
Indent class definition bodies:
False-
True- Insert additional indent for sections ('var', 'const', visibility) in class definition bodies Note: Members before the first section are always indented -
False- Indent the class definition body on the same level as a class name
-
// True example
type
a = class
i:integer;
public
j:Integer;
end;
// False example (Default)
type
a = class
i:integer;
public
j:Integer;
end;-
Indent comments:
Yes-
Yes- indent comments as usual statements (Default) -
With additional indent- indent comments with an extra indent -
No- do not change start positions of comments
-
// Yes example (Default)
if i > 10 then
begin
//this is a line comment
j := 3;
end;
// With additional indent example
if i > 10 then
begin
//this is a line comment
j := 3;
end;-
Indent compiler directives:
TrueNote - Inline compiler directives are left 'as is'-
True- indent compiler directives as usual statements -
False- place all compiler directives at the left margin (Default)
-
// True example
if i > 10 then
begin
{$IFDEF debug}
operator;
{$ENDIF}
end;
// False example
if i > 10 then
begin
{$IFDEF debug}
operator;
{$ENDIF}
end;-
Indent function bodies:
False
// True example
procedure MyProc;
var
a:string;
begin
a := 'Hello';
writeln(a);
end;
// False example (Default)
procedure MyProc;
var
a:string;
begin
a := 'Hello';
writeln(a);
end;-
Indent inner functions:
True
// True example (Default)
procedure MyProc1;
function PrintMyText(mytest:string):string;
begin
writeln('');
writeln(mytext + '!');
end;
begin
PrintMyText('Hello');
end;
// False example
procedure MyProc1;
function PrintMyText(mytest:string):string;
begin
writeln('');
writeln(mytext + '!');
end;
begin
PrintMyText('Hello');
end;-
Indent interface, implementation, and other sections:
False
// True example
unit Unit1;
interface
procedure PrintMessage(msg:string);
implementation
procedure PrintMessage(msg:string);
begin
Writeln(msg);
end;
end.
// False example (Default)
unit Unit1;
interface
procedure PrintMessage(msg:string);
implementation
procedure PrintMessage(msg:string);
begin
Writeln(msg);
end;
end.-
Indent nested brackets and parenthesis:
False-
True- insert additional indent for continuation lines for each additional nesting level of [ ] brackets and ( ) parenthesis
-
-
Indent case contents:
True-
True- indent contents of case-statement blocks (after case labels) relatively to case lables
-
// True example (Default)
case i of
value1:
statement1;
value2:
statement2;
end.
// False example
case i of
value1:
statement1;
value2:
statement2;
end.-
Indent case labels:
True-
True- indent case labels relatively to the 'case' keyword
-
// True example (Default)
case i of
value1:
statement1;
value2:
statement2;
end.
// False example
case i of
value1:
statement1;
value2:
statement2;
end.-
Indent 'Else' in case statements:
False-
True- extra indent 'else' in case statements (indent 'else' as case labels)
-
// True example
case i of
value1:
statement1;
value2:
statement2;
else:
statement3;
end.
// False example (Default)
case i of
value1:
statement1;
value2:
statement2;
else:
statement3;
end.-
Indent labels:
Decrease one indent-
To left margin- place lables at the leftmost column -
Decrease one indent- place labels on indent less than the current indent level (Default) -
None- keep current indent level for labels
-
// "To left margin" example
procedure test()
label label1;
begin
goto label1;
label1:
statement;
end;
// "Decrease one indent" example
procedure test()
label label1;
begin
goto label1;
label1:
statement;
end;
// "None" example
procedure test()
label label1;
begin
goto label1;
label1:
statement;
end;Note: Configuration text reproduced directly from RAD Studio, Copyright (C) 2021 Embarcadero Technologies, Inc. No claim made of ownership made, reproduced here under Fair Use purposes only.