Skip to content

Commit

Permalink
Fix for uppercase 'f' and 'd' in float/decimal literals.
Browse files Browse the repository at this point in the history
  • Loading branch information
Troy Melhase committed Apr 24, 2012
1 parent 6578ed1 commit 940a4ff
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 1 deletion.
2 changes: 1 addition & 1 deletion java2python/mod/transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def syntaxSafeFloatLiteral(node, config):
value = node.token.text
if value.startswith('.'):
value = '0' + value
if value.endswith(('f', 'd')):
if value.lower().endswith(('f', 'd')):
value = value[:-1]
elif value.endswith(('l', 'L')):
value = value[:-1] + 'L'
Expand Down
33 changes: 33 additions & 0 deletions test/BasicTypes2.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
class BasicTypes2 {
public static void main(String[] args) {

Integer I = 32;
System.out.println(I);

Boolean B = true;
System.out.println( B ? "ok" : "nope" );

Byte Y = 0;
System.out.println(Y);

Character C = 'c';
System.out.println(C);

Short S = 128;
System.out.println(S);

Long L = 128L;
System.out.println(L);

Float F = 1.5F;
System.out.println(F);

Double D = 1.5;
System.out.println(D);

String T = "done";
System.out.println(T);


}
}

0 comments on commit 940a4ff

Please sign in to comment.