musiKk / plyj

A Java parser written in Python using PLY.
Other
150 stars 69 forks source link

TypeError: unsupported operand type(s) for +: 'Name' and 'str' #5

Closed vgel closed 11 years ago

vgel commented 11 years ago

Got this traceback:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/plyj-0.0.1-py2.7.egg/plyj/parser.py", line 2036, in parse_file
    return self.parse_string(content, debug=debug)
  File "/usr/local/lib/python2.7/dist-packages/plyj-0.0.1-py2.7.egg/plyj/parser.py", line 2028, in parse_string
    return self.parser.parse(prefix + code, lexer=self.lexer, debug=debug)
  File "/usr/local/lib/python2.7/dist-packages/ply-3.4-py2.7.egg/ply/yacc.py", line 265, in parse
    return self.parseopt_notrack(input,lexer,debug,tracking,tokenfunc)
  File "/usr/local/lib/python2.7/dist-packages/ply-3.4-py2.7.egg/ply/yacc.py", line 971, in parseopt_notrack
    p.callable(pslice)
  File "/usr/local/lib/python2.7/dist-packages/plyj-0.0.1-py2.7.egg/plyj/parser.py", line 415, in p_primary_no_new_array4
    p[0] = p[1] + '.' + p[3]
TypeError: unsupported operand type(s) for +: 'Name' and 'str'

Trying to parse this code (don't judge me; it's decompiled!):

import com.bulletphysics.collision.dispatch.CollisionObject;

public class zZ {

  public long a;
  public long b;
  public CollisionObject a;
  public CollisionObject b;
  // $FF: synthetic field
  private static boolean a = !zZ.class.desiredAssertionStatus();

   public zZ(CollisionObject var1, CollisionObject var2, long var3, long var5) {
      this.a = var1;
      this.b = var2;
      if(!a && var1 == var2) {
         throw new AssertionError();
      } else {
         this.a = var3;
         this.b = var5;
      }
   }

  public boolean equals(Object var1) {
     zZ var2;
     return (var2 = (zZ)var1).a.equals(this.a) && var2.b.equals(this.b) || var2.b.equals(this.a) && var2.a.equals(this.b);
  }

}
musiKk commented 11 years ago

Just wanted to let you know that I'm going to look at it once I find some time. Could take a couple of days though.

vgel commented 11 years ago

Thanks for fixing this!

musiKk commented 11 years ago

Thanks for finding this. :beer: