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.
Page Index Toggle Pages: 1
Char literal bug in PDE parser (Read 1758 times)
Char literal bug in PDE parser
Feb 1st, 2006, 4:19am
 
I just submitted a minor bug with the PDE parser.  I thought I'd post it here figuring that more people will see it on the forums :)

If you try this:

if ( someString.charAt( n ) == '(' )
{
    some code ...
}

You'll get Processing complaining that the first curly bracket is an unexpected token.  Seems the '(' is being seen as ( so processing sees:

if ( someString.charAt( n ) == ( )
{
    some code ...
}

A workaround is to use the ASCII numeric instead of a char literal:

if ( someString.charAt( n ) == 0x28 )
{
    some code ...
}

Both the ( and ) characters do this.  ) is 0x29 BTW :)  I guess others like { and } might be a problem too...

Anyway, hope this isn't something that people already know about.  Sorry to have wasted anyone's time if it is!
Re: Char literal bug in PDE parser
Reply #1 - Feb 1st, 2006, 10:15pm
 
nah, that's a new one.. playing with the spaces before/after your parens in that line may change things to make them work, however.
Re: Char literal bug in PDE parser
Reply #2 - Feb 2nd, 2006, 12:15am
 
Thanks Fry, I'll give it a go.
Page Index Toggle Pages: 1