GExperts Code Formatter: Delphi 13 Language Support

The GExperts code formatter has been updated to support three new language constructs introduced in Delphi 13:

The noreturn Directive

Delphi 13 introduces the noreturn directive for procedures that never return (e.g., procedures that always raise an exception or call Halt). The formatter now correctly keeps this directive on the same line as the procedure declaration:

procedure FatalError(const Msg: string); noreturn;
procedure CriticalFailure(const Msg: string); stdcall; noreturn;

type
  TErrorHandler = class
    class procedure Fatal(const Msg: string); static; noreturn;
  end;

The is not Operator

The new is not operator provides a cleaner syntax for negated type checking:

if Animal is not TCat then
  WriteLn('Not a cat');

if (Animal is not TCat) and (Animal is TDog) then
  WriteLn('Definitely a dog');

The not in Operator

Similarly, the not in operator simplifies negated set membership tests:

if Color not in Colors then
  WriteLn('Color is not in set');

while Color not in [clBlue, clYellow] do
begin
  ProcessColor(Color);
  Color := GetNextColor;
end;

Availability

These improvements are available in the latest GExperts source code. The is not and not in operators were already handled correctly by the existing formatter logic. The noreturn directive required adding it to the list of recognized function directives.