Arbed updated to 1.8.1

• Arbed finally runs properly on Linux, too, with the Drop Pad (the bug preventing this way fixed early 2014, but I only noticed now).
• Fixes an issue on Windows where it would report errors at start or when generating HTML output from code.
• Can now handle FileTypeSets of VCP projects written by Xojo 2015r4.
• The search function can now search specifically for “Kind”, e.g. to find all Properties or all Container Controls.

See: http://www.tempel.org/Arbed/

A feature that would be useful: automatically detect all non-used methods, and be able to remove them at a glance.

After a few years, our projects grow much, and some methods are no longer used. But they add to the project. Sometimes, we lose time to update these methods so that they are no longer used!

I am ready to buy a plugin that does this.

Good luck :stuck_out_tongue:

Norman once said, that if you start to do stuff like this you are on your way to write your own Compiler for Xojo. :wink:

Which means, Xojo could offer such a tool.

Normal also said, this feature is “not yet” available :wink:

If what you want is “is this method called anywhere” then thats a matter of search & replace
If what you want is a correct “this method is not used” that is entirely different

And you probably would need a lot of the same infrastructure that a compiler would need

  1. a full & complete & correct grammar for the language (most of the ones I have seen people try to create by hand are incorrect in many respects)
  2. a parser that can handle that grammar

then you have to parse the entire project, build up correct symbol tables and mimic the compilers actual name look up symbol resolution mechanisms etc
then you have to do code flow analysis to see IF code reaches calls to that method to know IF it is “used”

so yeah its a LOT of work to know

hence “good luck”

NORMAN :slight_smile:

[quote=253798:@Norman Palardy]@Sascha S Normal also said, this feature is “not yet” available :wink:
NORMAN :)[/quote]
Since when can Norman ever be considered Normal? Odd maybe…

Norman is normal for Canadian.

Maybe one could do something by saving a project as an xml file, searching for “”, getting its name, and searching the rest of the xml file for instances of the name.

even a search/replace improved would already be well.

Initially, the tool can deal with simple cases without any ambiguity.

Maybe I’ll say nonsense, but for example:

-Delete private methods never called in the object.

-Delete private properties never called in the object.

-Delete local variables never called.

-Delete methods (without homonym/overloading, and not in an external module) that are never called in the project.

I know that some are already available in the analysis of the project. But I believe that then we must delete them one by one. If these are cases without ambiguity, it would be useful to be able to remove them at a glance. With a backup before of course.

I had years ago already written a full parser for Xojo code, based on work by Jonathan Johnson. I had planned something like that, but never got around finishing this because it’s a lot of work.

While removing all actually unused functions is rather difficult, I had wanted to remove all code that was never referenced by any other code in the project. That would help a lot with things such as the huge MacOSLib, for instance, or whenever one has a set of general-use modules and classes that one simply includes into a project without needing them all.

But, as I said, it’s never been finished. Though, with the parser in place, the most difficult part is done. All that’s missing is building the dictionary of referenced identifiers. The most complex part of that is to figure out where “top” in a line of code points to - to a function-local variable, or to a property or method somewhere. It could be part of the enclosing class container, or its module container. But it may also be a function declared with the “extends” keyword. That’s a lot of cases that need to be handled, and well tested. That’s the part I haven’t done. If someone is eager to try that, I’m happy to share my code. It’s actually stand-alone-ish so you can implement the code without needing the entire Arbed source. Once you’ve solved this puzzle, I can integrate it into Arbed and place useful operations around it.

Thomas

I’d be curious to see the parser

[quote=240979:@Thomas Tempelmann]
See: http://www.tempel.org/Arbed/[/quote]
The link to the video at the bottom of that page is down.
Maybe an idea to put up a simple demonstration video on YT?

Marco, no time for that atm :frowning:

Norman and everyone - here’s the last version of my Parser project: http://files.tempel.org/RB/TTsRBParser.zip

Run the ASTBuilder.rbp. It’ll load a default .rbs file and parse it.

The GenerateASTParser project is for reading the “morphe” grammar (ast.morphe is the one for the Xojo syntax, though I haven’t updated it in a while) and generate 3 RB xml classes from it, which then would need to be put into the TTsRBParser parser.

No idea what TextBuilder.rbp did.

Everyone, feel free to play around with it, or even improve it. But I retain the copyright of all code, including any changes made to Jon Johnson’s original work which I’m using by his permission. If you want to do something great with it, get my permission first.

BTW, the AST builder code in the project is something I built without having a clue of what I was doing. I was just going along, trying out things. So, this may well be a very bad design for what I had planned with it. I’d never done this before, perhaps that’s also a reason why I didn’t finished it - I wasn’t confident I did it right.

Ah this was based on the old morphe project jon had ?
Thats basically a bison clone in RB / Xojo code isn’t it

Correct, Norman. It had a few issues when he abandoned it, and I did fix them. I also wrote the complete RB syntax for it.

I’d guess you’re close but not quite
I can imagine its based on what you can discern since we dont publish a grammar
And I know that in our actual parser based on the C bison we have some stuff that literally cannot be done in the grammar itself and is handled elsewhere in code

to know if a method, function, whatever is used or not, I add a prefix to its name and compile. Usually, if used, Wojo complain about a missing Method, Function, whatever.

BUT: as Thomas said: with time the project grows… so an automatic scan is far better than doing this manually !