Delphi Mode - Intro
Tusk offers an optional Delphi Mode, which disables nearly
all language features that differ from Delphi.
A complete list of such features can be found
here.
Use Delphi Mode for the highest degree of compatibility
between Tusk and Delphi.
For example, when using Tusk to quickly prototype or test
a modest amount of code that you plan to use later in Delphi,
Delphi Mode will keep the code Delphi-compliant from the start.
On the other hand, when using Tusk without a specific plan
to transfer the code back to Delphi, leaving Delphi Mode off
gives the full Tusk experience, including many useful language
features that elevate Tusk above Delphi.
For example, in a DB Script, in a .tkconfig file,
or in a Hermes SQL Event Read or Update script,
strict Delphi compatibility may not be a priority.
The host application can control whether Delphi Mode
is initially enabled or not.
For example, the Query Memo in VDB Explorer enables
Delphi Mode by default, anticipating the need to copy
Fluent SQL code back and forth between VDB Explorer
and the Delphi IDE.
Most other uses of Tusk leave Delphi Mode disabled.
To enable or disable Delphi Mode in Tusk source code,
use the {$Delphi On}
and {$Delphi Off} directives.
For example…
// Initially, Delphi Mode may be on or off
{$Delphi On}
// Delphi Mode is now On
{$Delphi Off}
// Delphi Mode is now Off
To enable Delphi Mode in a host Delphi application,
set the TTuskParser's Flags property to include
the TTuskParserFlag.DelphiMode flag…
var
Parser: TTuskParser;
Tree: ITuskTree;
begin
Parser.Flags := [TTuskParserFlag.DelphiMode];
Tree := Parser.Parse(FileName, FileContents);
// ...
end;
⏱ Last Modified: 2/15 9:51:46 am