Skip to content

RADProgrammer Style Guide Spacing

Darian Miller edited this page Mar 14, 2021 · 1 revision

Settings for: Spacing

Note: RADProgrammer utilizes non-default settings for:

  • Set spacing around colons
  • Set spacing around unary prefix operators

General

  • Set spacing around colons: None

    • None - do not insert spaces
    • Before only - insert one space before each colon
    • After only - insert one space after each colon (Default)
    • Before and after - insert one space before and after each colon
    • Preserve spacing - one space is inserted before or/and after a colon if any number of space characters are at this position in the source code. Otherwise no spaces are inserted.
  • Set spacing around colons in format: None Defines spaces around colons in format parameters (in write, writeln)

    • None - do not insert spaces (Default)
    • Before only - insert one space before each colon
    • After only - insert one space after each colon
    • Before and after - insert one space before and after each colon
    • Preserve spacing - one space is inserted before or/and after a colon if any number of space characters are at this position in the source code. Otherwise no spaces are inserted.
  • Set spacing around commas: After only

    • None - do not insert spaces
    • Before only - insert one space before each comma
    • After only - insert one space after each comma (Default)
    • Before and after - insert one space before and after each comma
    • Preserve spacing - one space is inserted before or/and after a comma if any number of space characters are at this position in the source code. Otherwise no spaces are inserted.
  • Set spacing around semicolons: After only

    • None - do not insert spaces
    • Before only - insert one space before each semicolon
    • After only - insert one space after each semicolon (Default)
    • Before and after - insert one space before and after each semicolon
    • Preserve spacing - one space is inserted before or/and after a semicolon if any number of space characters are at this position in the source code. Otherwise no spaces are inserted.
  • Spaces before parenthesis in functions: No

    • Defines spaces before left parenthesis '(' in functions and procedures
    • Yes insert space before parenthesis
    • No do not leave a space before parenthesis (Default)
    • Preseve spacing One space is inserted if any number of spaces are at this position in the source code
    // This code:
    procedure f   (i:Integer); begin myFunc(42); end;

    // Becomes...

    // If "Yes":

    procedure f (i:integer)
    begin
      myFunc (42);
    end;

    // If "No":

    procedure f(i:integer)
    begin
      myFunc(42);
    end;

    // If "Preserve spacing":

    procedure f (i:integer)
    begin
      myFunc(42);
    end;

Set spacing for comments

  • Set spacing for // comments: Before and after (Note: All spaces used inside comments are kept)

    • None - do not insert spaces
    • Before only - insert one space before each // token
    • After only - insert one space after each // token
    • Before and after - insert one space beforeand after each // token (Default)
    • Preserve spacing
      • One space is inserted before the text and the // token if any spaces preceed //
      • One space is inserted after the // token if any spaces are here in the source code
      • No spaces are inserted before or after the // token if no spaces are in these positions in the source code
      • If no code precedes a line comment, then the indentation of the comment is defined by the Indent comments option
  • Set spacing for { and (* comments: Inner and outer (Note: All spaces used inside comments are kept)

    • None - do not insert spaces
    • Inner only - insert only inner spaces. One space is inserted after each opening brace { or (* and before each closing brace } or *)
    • Outer only - insert only outer spaces. One space is inserted after each opening brace { or (* and before each closing brace } or *)
    • Inner and outer - insert both inner and outer spaces. Insert one space both before and after each opening brace { or (* and each closing brace } or *) (Default)
    • Preserve spacing
      • One space is inserted before an opening brace { or (* if some code precedes { or (* in the source line and any spaces are exactly before { or (*
      • One space is inserted after {, (* or *) and before } or *) in any spaces are here in the source code
      • No spaces are inserted if no spaces are at this position in the source code before or after {, (*, } or *)
      • If no code precedes a { or (* comment, then the indentation of the comment is defined by the Indent comments option. Continuation lines (when a comment is continued on several lines) are indented according to the Indent comments option

Set spacing for operators

  • Set spacing around assignment operators: Before and after Defines spaces around assign := operators
    • None - do not insert spaces
    • Before only - insert one space before each assign operator
    • After only - insert one space after each assign operator
    • Before and after - insert one space before and after each assign operator (Default)
    • Preserve spacing
      • One space is inserted before or/and after an assign operator if any number of space characters are at this position in the source code. Otherwise no spaces are inserted.
    // This code:
    a :=b

    // Becomes...

    // If "None":
    a:=b

    // If "Before only":
    a :=b

    // If "After only":
    a:= b

    // If "Before and After":
    a := b

    // If "Preserve spacing":
    a :=b
  • Set spacing around binary operators: Before and after Defines spaces around assign binary mathematical operators like <, >, =, <>, <=, >=, +, -, /, *, .., or, and, xor, div operators
    • None - do not insert spaces
    • Before only - insert one space before each operator
    • After only - insert one space after each operator
    • Before and after - insert one space before and after each operator (Default)
    • Preserve spacing
      • One space is inserted before or/and after an operator if any number of space characters are at this position in the source code. Otherwise no spaces are inserted.
    // This code:
    a :=b +c* d;

    // Becomes...

    // If "None":
    a:=b+c*d;

    // If "Before only":
    a :=b +c *d;

    // If "After only":
    a:= b+ c* d;

    // If "Before and After":
    a := b + c * d;

    // If "Preserve spacing":
    a :=b +c* d;
  • Set spacing around unary prefix operators: Before only Defines spaces around unary prefix operators +, -, not
    • None - do not insert spaces
    • Before only - insert one space before each operator
    • After only - insert one space after each operator
    • Before and after - insert one space before and after each operator (Default)
    • Preserve spacing
      • One space is inserted before or/and after an operator if any number of space characters are at this position in the source code. Otherwise no spaces are inserted.
    // This code:
    a :=b+ -c;

    // Becomes...

    // If "None":
    a :=b+-c;

    // If "Before only":
    a :=b+ -c;

    // If "After only":
    a :=b+- c;

    // If "Before and After":
    a :=b+ - c;

    // If "Preserve spacing":
    a :=b+ -c;

Set spacing for parenthesis and brackets

  • Set spacing for parenthesis: False
    • True - insert one space after each opening ( and before each closing ) parenthesis
    • False - do not insert space (Default)
    // This code:
    procedure TestMe(x:integer );

    // Becomes...

    // If "True":
    procedure TestMe( x:integer );

    // If "False":
    procedure TestMe(x:integer);
  • Set spacing for square brackets: False
    • True - insert one space after each opening [ and before each closing ] square bracket
    • False - do not insert space (Default)
    // This code:
    NewChoices : array [0..5 ] of string;

    // Becomes...

    //If "True":
    NewChoices : array [ 0..5 ] of string;

    // If "False":
    NewChoices : array [0..5] of string;
  • Set spacing inside angle brackets in generics: False Defines inner spacing inside angle brackets < and > used in generics to specify lists of type arguments
    • True - insert one space after each left < bracket and before each right > bracket
    • False - do not insert space (Default)
    // This code:
    type TFoo<T > = class

    // Becomes...

    // If "True":
    type TFoo< T > = class

    // If "False":
    type TFoo<T> = class

Spacing conflicts

  • Resolve space conflicts as: Space Defines how to manage spaces in positions that are controlled by several conflicting options. For example, one option can require inserting a space in some position while the other option can define that no spaces should be inserted in the same position. This option controls such conflicting positions.
    • No space - do not insert any spaces
    • Space - insert one space (Default)
    • Preserve spacing - insert one space if any number of spaces are at this position in the source code. Otherwise, do not insert any spaces.

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.