Closed GoogleCodeExporter closed 8 years ago
this kind of expression shouldn't be parsed to CastExpr
Original comment by jges...@gmail.com
on 1 Apr 2009 at 2:20
I see currently no way to do that easily in the parser without a complete
semantic
analysis. Tell me if I'm wrong. If you point me into the right direction I'm
willing
to do the needed coding to implement it correctly in javaparser.
Original comment by michaelkoch6@googlemail.com
on 6 Apr 2009 at 5:55
I haven't found a way to determine this kind of expression in the parser.
There is no syntax difference between
int a = (foo)+bar;
and
byte a = (byte)+bar;
where the second expression is indeed a CastExpr. Semantics should be used to
determine if it is a Cast or not. But, if the expression looks like this:
int a = (+foo)+bar;
the parser will recognize it as a simple BinaryExpr with parenthesis in the
left operand.
What I think you could do is add a specific semantic for this case in your
visitor.
It will isn't be a simple task, I will research a little more to check if there
is
any other solution, if I find anything I will reopen this issue.
Original comment by jges...@gmail.com
on 13 Apr 2009 at 12:39
I have found a way to solve this issue in the Java Language Specification. But
to
solve this I will need to make a lot of changes in the parser, I have starter
the
changes now.
Original comment by jges...@gmail.com
on 13 Apr 2009 at 12:56
Issue solved, released in 1.0.7.
thanks!
Original comment by jges...@gmail.com
on 13 Apr 2009 at 1:48
Original issue reported on code.google.com by
michaelkoch6@googlemail.com
on 9 Mar 2009 at 9:57