Last active
February 14, 2016 07:15
-
-
Save fikr4n/2a4a688ecc94ba67f0f8 to your computer and use it in GitHub Desktop.
'Superkill' JVM type signatures to Java types converter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
p = re.compile(r'(\[*)([ZBCSIJFDV]|L([^;\s]+);)') | |
prims = {'Z': 'boolean', 'B': 'byte', 'C': 'char', 'S': 'short', 'I': 'int', 'J': 'long', 'F': 'float', 'D': 'double', 'V': 'void'} | |
def tr(s): | |
return [(i.group(3).replace('/', '.') if i.group(3) else prims[i.group(2)]) + ('[]' * len(i.group(1))) | |
for i in p.finditer(s)] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Example: