Delphi 11 10 XE8 XE7 XE Seattle Berlin Tokyo Rio Firemonkey, Delphi Android, Delphi IOS

Syntax Highlighting And Syntax Checking Source Code Demo For Delphi XE8 Firemonkey On Android And IOS

| Delphi 11 10 XE8 XE7 XE Seattle Berlin Tokyo Rio Firemonkey Delphi Android Delphi IOS

Delphi XE8 Firemonkey Syntax Checking Syntax Highlighting Android IOS | Delphi 11 10 XE8 XE7 XE Seattle Berlin Tokyo Rio Firemonkey Delphi Android Delphi IOSI worked with a developer on UpWork (formally called oDesk) to create a demo project for Delphi XE8 Firemonkey recently which features syntax highlighting and syntax checking. The syntax highlighting is provided by TTMSFMXMemo from the TMS Pack for Firemonkey. The syntax checking is provided by paxCompiler Interpreter engine. When you combine these two together you get IDE like functionality for highlighting the line within TTMSFMXMemo at runtime which did not pass the syntax check. Functionality like this allows you to build a runtime plugin editor for your Delphi apps on Android, IOS, Windows, and OSX. You can offer Object Pascal, Basic, and Javascript as scripting possibilities to your end users. You should be able to use this demo in Appmethod as well. Full source code for the demo is available. Here is the relevant code snippets from the demo:
procedure TForm1.btnSYntaxCheckClick(Sender: TObject);
var
i : integer;
lNumber : integer;
aMsg : string;
begin
mmoMsg.Lines.Clear;
FErrorList.Clear;
if CheckSyntax(TMSFMXMemo1.Lines.Text) then
exit;
lNumber := PaxCompiler1.ErrorLineNumber[0];
SelectLine(lNumber);
for I:=0 to PaxCompiler1.ErrorCount - 1 do
begin
lNumber := PaxCompiler1.ErrorLineNumber[i];
FErrorList.Add(lNumber);
aMsg := 'msg: '+PaxCompiler1.ErrorMessage[i] +
' ln: '+inttostr(lNumber);
mmoMsg.Lines.Add(aMsg);
end;
end;

function TForm1.CheckSyntax(ACode: string): Boolean;
begin
Result := false;
PaxCompiler1.Reset;
PaxCompiler1.RegisterLanguage(PaxPascalLanguage1);
PaxCompiler1.AddModule('1', 'Pascal');
PaxCompiler1.AddCode('1', ACode);
if PaxCompiler1.Compile(PaxInterpreter1) then
exit(True);
end;

procedure TForm1.SelectLine(lNumber: Integer);
var
lineText, temp : string;
posStart, i : integer;
begin
TMSFMXMemo1.ClearSelection;
TMSFMXMemo1.SetCursor(0,lNumber);
TMSFMXMemo1.ActiveLine := lNumber;
end;
Download the source code for the syntax highlighting syntax checker demo for Delphi XE8 Firemonkey.

Exit mobile version