Hi
Is the JEDI Code Formatter in Lazarus Tools menu already supposed to format code, or is it still under construction? I only get a parse tree and no option to modify the code.
http://koti.phnet.fi/juhamann/Lazarus/JCF_Parse_Tree.jpg
Juha

Mailing lists / lazarus / 2010-10
12 messages · 5 people · –
Reply by email Subscribe to this list Your subscription
Read-only archive. Use j and k to move between messages.
Hi
Is the JEDI Code Formatter in Lazarus Tools menu already supposed to format code, or is it still under construction? I only get a parse tree and no option to modify the code.
http://koti.phnet.fi/juhamann/Lazarus/JCF_Parse_Tree.jpg
Juha
It has its own parser (separate sourceforge project) and sometimes cannot parse new or seldom used language features or dialect variations that it does not (yet) know or that trigger a bug in its parser. I have seen this happen already. Try to identify the offending language construct that it cannot parse and file a bug report.
Bernd
Did you implement the integration with Lazarus? Nice.
I happened to always test it with "too difficult" code. The small example I tried contained generics tests. So, it seems to fail with generics.
Then one code has this odd use of IFNDEF and ELSE:
procedure TForm1.PrintPreview1Click(Sender: TObject);
{$IFNDEF LCL}
var
pf: TPreviewForm;
Viewer: ThtmlViewer;
Abort: boolean;
begin
Viewer := FrameViewer.ActiveViewer;
if Assigned(Viewer) then
begin
pf := TPreviewForm.CreateIt(Self, Viewer, Abort);
try
if not Abort then
pf.ShowModal;
finally
pf.Free;
end;
end;
{$ELSE}
begin
{$ENDIF}
end;I removed ELSE and the extra "begin", and used 2 IFNDEF blocks and then Jedi formatter accepted it.
There is no proper error message to locate the problem. I had to guess it from the parse tree. The error should mention the line number at least, and preferably jump to it when clicked.
I must figure out myself for Delphi converter how to jump to the error location by clicking. It is on a ToDo list.
Juha
Juha Manninen wroteDid you implement the integration with Lazarus? Nice.
No, this is not my project :-)
I am only an ordinary user.
Maybe (wild guessing) it ignores all IFDEFS and expects that the code is still grammatically correct or well-formed if you leave them away. Many people (at least those who have some sense for symmetry) would never place the $IFDEFs the way it is shown above, maybe this is why it is not expected by JEDI.
Somebody on this mailinglist here is responsible for maintaining the Lazarus-JEDI port, I only can't remember his name. He will quickly port/merge all JEDI changes to Lazarus. IIRC I also filed a bug directly at the JEDI project.
Bernd
JEDI bug tracker:
No, this is not my project :-) I am only an ordinary user. Maybe (wild guessing) it…
Bernd Kreuss wroteSomebody on this mailinglist here is responsible for maintaining the Lazarus-JEDI port, I only can't remember his name.
That's me. But I very seldom do the bug fixing there. I only ported it to the lazarus/fpc and commited the changes back to the Jedi repository.
Best regards,
Paul Ishenin.
Nice feature, thanks!
What about the improvements that happen in JEDI project, are you or somebody copying them to Lazarus source?
Juha
It has its own parser (separate sourceforge project) and sometimes cannot parse new or…
Bernd Kreuss wroteIt has its own parser (separate sourceforge project) and sometimes
To minimize maintenance, and seeing that it is now part of Lazarus source tree, maybe that jcf parser must be swapped out for the fcl-passrc parser instead. This might be work now, but in the long run it is better. Because the fcl-passrc parse will stand a better change of being updated as language features are added to FPC.
+1
Michael.
Nice feature, thanks! What about the improvements that happen in JEDI project, are you or…
Juha Manninen wroteNice feature, thanks! What about the improvements that happen in JEDI project, are you or somebody copying them to Lazarus source?
Only in jedi code format project. I update the lazarus copy from time to time.
Best regards,
Paul Ishenin.
+1 Michael.
Feel free to rewrite.
Best regards,
Paul Ishenin.
I should have seen that one coming ;-)
Michael.