Recent

Author Topic: Jedi Code Formatter (jcfidelazarus) issue with generics  (Read 6562 times)

dextermd

  • New Member
  • *
  • Posts: 13
Jedi Code Formatter (jcfidelazarus) issue with generics
« on: February 04, 2016, 01:42:03 pm »
Hi,

I'm trying to format an unit which contains the following declaration (using generics)

  TJobList = class(specialize TSyncObjectList<TJob>)
  end;

Code formatter raises the error:
uJobs.pas(30,20) Error: Exception TEParseError  Expected identifer Near SPECIALIZE

How can I debug (and eventually fix) a package used in Lazarus IDE?

Windsurfer

  • Sr. Member
  • ****
  • Posts: 368
    • Windsurfer
Re: Jedi Code Formatter (jcfidelazarus) issue with generics
« Reply #1 on: February 04, 2016, 04:08:52 pm »
I have never used specialized, but here is an example from the wiki that may help:
http://forum.lazarus.freepascal.org/index.php/topic,31078.msg198424.html#msg198424

dextermd

  • New Member
  • *
  • Posts: 13
Re: Jedi Code Formatter (jcfidelazarus) issue with generics
« Reply #2 on: February 04, 2016, 04:37:43 pm »
My code is working fine.

The issue is with jedi code formatter, it does not want to format such unit.

frakno

  • Jr. Member
  • **
  • Posts: 93
Re: Jedi Code Formatter (jcfidelazarus) issue with generics
« Reply #3 on: February 04, 2016, 05:17:06 pm »
Jedi Code Formatter is unfortunately outdated.

The Jedi Code Formatter is a very useful tool, and I use it very much.
Unfortunately, the tool is a bit dated and supports neither include files nor newer fpc code

Hopefully someone is able of the developing this tool
Lazarus 4.0 FPC 3.2.2 Windows 10 and 11

Thaddy

  • Hero Member
  • *****
  • Posts: 18666
  • Jungle wars. And failing health it seems.
Re: Jedi Code Formatter (jcfidelazarus) issue with generics
« Reply #4 on: February 04, 2016, 07:40:48 pm »
What's wrong with ptop?
Due to censorship, I changed this to "Nelly the Elephant". Keeps the message clear.

dextermd

  • New Member
  • *
  • Posts: 13
Re: Jedi Code Formatter (jcfidelazarus) issue with generics
« Reply #5 on: February 04, 2016, 08:58:46 pm »
Did not know about ptop, but it looks it's not a Lazarus IDE plugin, isn't it?

Leledumbo

  • Hero Member
  • *****
  • Posts: 8835
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Jedi Code Formatter (jcfidelazarus) issue with generics
« Reply #6 on: February 05, 2016, 08:02:59 am »
What's wrong with ptop?
It has no configuration dialog integrated in Lazarus IDE, looks like a good idea to integrate it. I'll take the initiative.
Did not know about ptop, but it looks it's not a Lazarus IDE plugin, isn't it?
It exists even before Lazarus was born ;) : http://freepascal.org/docs-html/current/user/userse44.html

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4660
  • I like bugs.
Re: Jedi Code Formatter (jcfidelazarus) issue with generics
« Reply #7 on: February 05, 2016, 10:14:07 am »
I'm trying to format an unit which contains the following declaration (using generics)

  TJobList = class(specialize TSyncObjectList<TJob>)
  end;
JCF actually works with simple generics. See:
  http://bugs.freepascal.org/view.php?id=16128
Your code has a useless "class" in front of specialize. Remove it.
But yes, JCF does not support the latest advanced generics syntax, maybe no class helpers either.
Patches are welcome, it has no active maintainer now.

Quote
How can I debug (and eventually fix) a package used in Lazarus IDE?
Just build everything with debug info and debug. :)


What's wrong with ptop?
It has no configuration dialog integrated in Lazarus IDE, looks like a good idea to integrate it. I'll take the initiative.

Does it support generics or other new syntax? I don't think so.
One option is to create a new formatter using CodeTools scanner / parser, but that requires some effort, too.
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

Leledumbo

  • Hero Member
  • *****
  • Posts: 8835
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Jedi Code Formatter (jcfidelazarus) issue with generics
« Reply #8 on: February 05, 2016, 11:33:19 am »
Does it support generics or other new syntax? I don't think so.
One option is to create a new formatter using CodeTools scanner / parser, but that requires some effort, too.
ptop is token based, not syntax based. It won't stop on parse error just like JCF. New keywords will be treated just like identifiers, adding new tokens is easy, just an addition to the token enum.

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4660
  • I like bugs.
Re: Jedi Code Formatter (jcfidelazarus) issue with generics
« Reply #9 on: February 06, 2016, 09:44:53 am »
ptop is token based, not syntax based. It won't stop on parse error just like JCF. New keywords will be treated just like identifiers, adding new tokens is easy, just an addition to the token enum.

Ok, that can be the best approach for a code formatter.
A Lazarus package with a configuration dialog would be nice.
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

Leledumbo

  • Hero Member
  • *****
  • Posts: 8835
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Jedi Code Formatter (jcfidelazarus) issue with generics
« Reply #10 on: February 06, 2016, 04:47:02 pm »
ptop is token based, not syntax based. It won't stop on parse error just like JCF. New keywords will be treated just like identifiers, adding new tokens is easy, just an addition to the token enum.

Ok, that can be the best approach for a code formatter.
A Lazarus package with a configuration dialog would be nice.
Working on the package. Just a single thought: what shortcut should I use? It looks like every good combination has been taken:
  • Ctrl+Shift+D -> Enclose in #IFDEF
  • Ctrl+Alt+D -> View Assembler
Ctrl+Shift+Alt+D is free, but I think it's too many keys. Minor issue, I can think of it later :p

 

TinyPortal © 2005-2018