Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2010-10

JEDI Code Format

12 messages · 5 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Bernd Kreuss
to Juha Manninen
Juha Manninen wrote 5 lines
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.

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

Reply by email

Juha Manninen
to Bernd Kreuss
Bernd Kreuss wrote 5 lines
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.

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

Reply by email

Bernd Kreuss
to Juha Manninen
Juha Manninen wrote
Did you implement the integration with Lazarus? Nice.

No, this is not my project :-)

I am only an ordinary user.

Show quoted text 30 lines
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.

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

Reply by email

Juha Manninen
to Paul Ishenin
Paul Ishenin wrote 6 lines
23.10.2010 19:43, Bernd Kreuss wrote: > Somebody 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.

Nice feature, thanks!
What about the improvements that happen in JEDI project, are you or somebody copying them to Lazarus source?

Juha

Reply by email

Graeme Geldenhuys
to Bernd Kreuss: It has its own parser (separate sourceforge project) and sometimes cannot parse new or…
Bernd Kreuss wrote
It 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.

Regards, ? - Graeme - _______________________________________________ fpGUI - a cross-platform Free Pascal GUI toolkit http://opensoft.homeip.net:8080/fpgui/

Reply by email

Michael Van Canneyt
to Graeme Geldenhuys
Graeme Geldenhuys wrote 9 lines
On 23 October 2010 01:10, Bernd Kreuss wrote: > > It 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.

Reply by email

Paul Ishenin
to Michael Van Canneyt: +1 Michael.
Michael Van Canneyt wrote 8 lines
> 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

Feel free to rewrite.

Best regards,
Paul Ishenin.

Reply by email

Michael Van Canneyt
to Paul Ishenin
Paul Ishenin wrote 10 lines
25.10.2010 3:08, Michael Van Canneyt wrote: >> 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 Feel free to rewrite.

I should have seen that one coming ;-)

Michael.

Reply by email