Last active
August 29, 2015 14:16
-
-
Save deathbeam/a9205246592fb8babb13 to your computer and use it in GitHub Desktop.
Mirah import -> require
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 java.util.regex.*; | |
class ItoR { | |
public static void main (String[] args) { | |
String source = "require \"non/Graphics\"\n" + | |
"require \"non/graphics\"\n" + | |
"require \"non/GFX\"\n" + | |
"require \"non/Audio\"\n"; | |
System.out.println(source + "\n"); | |
Pattern pattern = Pattern.compile("(\\s*)(require)(\\s?)(\")(.+)(\")"); | |
Matcher matcher = pattern.matcher(source); | |
source = matcher.replaceAll("import $5\n"); | |
System.out.println(source); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment