We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSyntax Questions › use ENUM inside processing
Page Index Toggle Pages: 1
use ENUM inside processing (Read 1962 times)
use ENUM inside processing
Nov 24th, 2008, 7:59pm
 
Hi,

I didn't find a way to declare without an error a ENUM insite processing. Like example:

enum Apple {  
 A, B, C, D, E
}

The error say: "Unexpected token Apple"

Anyone have some idea how to do it.
Re: use ENUM inside processing
Reply #1 - Nov 24th, 2008, 11:46pm
 
Whilst Processing uses now Java 1.5 (or 1.6 now?), it still uses a Java 1.4 grammar inherited from Antlr for its pre-processing needs... If anybody known such grammar for 1.5/1.6 syntax, I am sure Processing authors will appreciate!

The consequence is, alas, we cannot use yet new syntax constructs, like ArrayList<String> (generics), @Override (annotation), for (String str : stringList) (foreach syntax), and some others like, here, enums...
Re: use ENUM inside processing
Reply #2 - Nov 27th, 2008, 3:05pm
 
Um, I see a Java 1.5 .g file at Antlr site: http://www.antlr.org/grammar/list
So maybe my info is outdated... Smiley

And anyway, you can use 1.5 syntax in separate .java files, I think. Might be worth to try out.
Re: use ENUM inside processing
Reply #3 - Nov 27th, 2008, 11:19pm
 
PhiLho  wrote on Nov 27th, 2008, 3:05pm:
Um, I see a Java 1.5 .g file at Antlr site: http://www.antlr.org/grammar/list
So maybe my info is outdated... Smiley

And anyway, you can use 1.5 syntax in separate .java files, I think. Might be worth to try out.

No, that's only a small fraction of the work that needs to be done (I'm aware of the 1.5 grammar). See the bug mentioned from the FAQ on this topic:
http://dev.processing.org/bugs/show_bug.cgi?id=598
Re: use ENUM inside processing
Reply #4 - Nov 28th, 2008, 12:35am
 
Ah, I knew I saw that somewhere, I just mixed up ideas! Smiley
Alas, I never studied Antlr and I am not overly familiar with grammars, but maybe this thread will bring this bug in light and attract a knowledgeable person with some free time!
Page Index Toggle Pages: 1