autoformat bug with syntactical error in for loop

I am getting an error using the Auto Format command when there is a syntactical error in a for loop specifier. (MacOS 10.5.7, Arduino 0016)

When the for statement has commas for separators instead of semi-colons, the IDE thinks for a very long time when asked to Auto Format the sketch, and then yields the message:

Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError: Java heap space

The compiler will correctly diagnose the error, however.

Here is a very simple sketch that demonstrates the error:

int i;

void setup () {

void loop () {
  for (i = 0, i < 10, i++)


Commas as separator in a for loop structure, is a compile error.

Actually, the only time I can think of, that the comma is a separator, not an operator, is in arguments lists.

Why not use semicolons?

I know that it's not the right syntax; it was just a typo on my part when entering the code in the sketch. And the compiler did catch it.

But the auto-formatter did NOT catch it, or at least did not recover gracefully from parsing the erroneous syntax, and crashed.

So I'm just reporting this as an auto-formatter bug...

Yup, it is falling off the end of the world trying to make sense of that bad code. The parsing stuff looks ok, but it might be the display code wanting to display things over and over.

The autoformat function is still pretty buggy and is best avoided until after you have made sure that the program compiles.

It used to have a charming "auto-delete" bug where code was deleted if brackets weren't balanced (which balanced the code) but that one has been fixed for a while. There are still many bugs and quirks in it though so compile first - and you'll be happier.