lot of nonsense "unexpected token" errors with old code that used to work in older versions
in
Integration and Hardware
•
2 years ago
Hi,
I have an old sketch that used to work perfectly on an older version of Processing (it was around the end of 2009 - beginning of 2010 when I last run it). At that time I used Windows. I ran that sketch a lot of times on different machines and platforms and it was pretty robuts.
Now I've opened it with Processing 1.2.1 on Ubuntu, and I get a lot of error messages such as:
line 13:14: unexpected token: boolean
line 13:14: unexpected token: float
etc, (a few more of them). They all reference lines of code such as:
static final boolean CALIBRATE=false, READCALIBRATION=false;
static final float VIRTUAL_FRAMERATE=8.0;
static final int NSENSORS=4;
and the "unexpected" tokens as you can see are not that unexpected.
After a lot of errors like these, at the end I get a Null Pointer Exception which seems to be caused by the preprocessor itself, since my code doesn't even compile so it never gets to run:
Uncaught exception type:class java.lang.NullPointerException
java.lang.NullPointerException
at processing.app.antlr.PdeRecognizer.constructorCast(PdeRecognizer.java:1263)
at processing.app.antlr.PdeRecognizer.primaryExpression(PdeRecognizer.java:1568)
at processing.app.antlr.PdeRecognizer.postfixExpression(PdeRecognizer.java:7304)
at processing.app.antlr.PdeRecognizer.unaryExpressionNotPlusMinus(PdeRecognizer.java:7267)
at processing.app.antlr.PdeRecognizer.unaryExpression(PdeRecognizer.java:7125)
at processing.app.antlr.PdeRecognizer.multiplicativeExpression(PdeRecognizer.java:6988)
....... (much much longer than this)
I guess there has been some change in processing that is not backward compatible and my old code is not valid any more, but the problem cannot be in the lines where the "unexpected token" error points to, as they are perfectly valid, so the error must be somewhere else and must be driving the preprocessor crazy.
As I said my code used to work perfectly on older versions, though I don't know exactly which version of processing it was where it used to work (it was 1.something).
Does anybody know of some big non-backward-compatible changes that have happened in the last year that may cause this kind of issue? Wher should I start looking at?
The structure of my code is like this:
- variable declarations such as those listed above
- void setup() { ... }
- void draw() { ... }
- other event handlers such as void serialEvent(Serial p) {...}
- A COUPLE OF CLASS DEFINITIONS
May it be because of the class definitions? Should I put them in external files? It wasn't necessary before....
Thanks in advance
m.
I have an old sketch that used to work perfectly on an older version of Processing (it was around the end of 2009 - beginning of 2010 when I last run it). At that time I used Windows. I ran that sketch a lot of times on different machines and platforms and it was pretty robuts.
Now I've opened it with Processing 1.2.1 on Ubuntu, and I get a lot of error messages such as:
line 13:14: unexpected token: boolean
line 13:14: unexpected token: float
etc, (a few more of them). They all reference lines of code such as:
static final boolean CALIBRATE=false, READCALIBRATION=false;
static final float VIRTUAL_FRAMERATE=8.0;
static final int NSENSORS=4;
and the "unexpected" tokens as you can see are not that unexpected.
After a lot of errors like these, at the end I get a Null Pointer Exception which seems to be caused by the preprocessor itself, since my code doesn't even compile so it never gets to run:
Uncaught exception type:class java.lang.NullPointerException
java.lang.NullPointerException
at processing.app.antlr.PdeRecognizer.constructorCast(PdeRecognizer.java:1263)
at processing.app.antlr.PdeRecognizer.primaryExpression(PdeRecognizer.java:1568)
at processing.app.antlr.PdeRecognizer.postfixExpression(PdeRecognizer.java:7304)
at processing.app.antlr.PdeRecognizer.unaryExpressionNotPlusMinus(PdeRecognizer.java:7267)
at processing.app.antlr.PdeRecognizer.unaryExpression(PdeRecognizer.java:7125)
at processing.app.antlr.PdeRecognizer.multiplicativeExpression(PdeRecognizer.java:6988)
....... (much much longer than this)
I guess there has been some change in processing that is not backward compatible and my old code is not valid any more, but the problem cannot be in the lines where the "unexpected token" error points to, as they are perfectly valid, so the error must be somewhere else and must be driving the preprocessor crazy.
As I said my code used to work perfectly on older versions, though I don't know exactly which version of processing it was where it used to work (it was 1.something).
Does anybody know of some big non-backward-compatible changes that have happened in the last year that may cause this kind of issue? Wher should I start looking at?
The structure of my code is like this:
- variable declarations such as those listed above
- void setup() { ... }
- void draw() { ... }
- other event handlers such as void serialEvent(Serial p) {...}
- A COUPLE OF CLASS DEFINITIONS
May it be because of the class definitions? Should I put them in external files? It wasn't necessary before....
Thanks in advance
m.
1