Permalink
Browse files

fixed param regex

  • Loading branch information...
1 parent f0c3c03 commit 2f0ca9921b961133689d29b807333241010a802d @AbrarSyed AbrarSyed committed Mar 11, 2014
Showing with 4 additions and 3 deletions.
  1. +4 −3 src/main/java/net/minecraftforge/gradle/tasks/RemapSourcesTask.java
@@ -43,7 +43,7 @@
private final Map<String, Map<String, String>> fields = new HashMap<String, Map<String, String>>();
private final Map<String, String> params = new HashMap<String, String>();
- private static final Pattern SRG_FINDER = Pattern.compile("func_[0-9]+_[a-zA-Z_]+|field_[0-9]+_[a-zA-Z_]+|p_[\\w]+_\\d+_");
+ private static final Pattern SRG_FINDER = Pattern.compile("(func_[0-9]+_[a-zA-Z_]+|field_[0-9]+_[a-zA-Z_]+|p_[\\w]+_\\d+_)([^\\w\\$])");
private static final Pattern METHOD = Pattern.compile("^((?: {4})+|\\t+)(?:[\\w$.\\[\\]]+ )+(func_[0-9]+_[a-zA-Z_]+)\\(");
private static final Pattern FIELD = Pattern.compile("^((?: {4})+|\\t+)(?:[\\w$.\\[\\]]+ )+(field_[0-9]+_[a-zA-Z_]+) *(?:=|;)");
@@ -158,7 +158,7 @@ private String replaceInLine(String line)
Matcher matcher = SRG_FINDER.matcher(line);
while (matcher.find())
{
- String find = matcher.group();
+ String find = matcher.group(1);
if (find.startsWith("p_"))
find = params.get(find);
@@ -168,9 +168,10 @@ else if (find.startsWith("field_"))
find = stupidMacro(fields, find);
if (find == null)
- find = matcher.group();
+ find = matcher.group(1);
matcher.appendReplacement(buf, find);
+ buf.append(matcher.group(2));
}
matcher.appendTail(buf);
return buf.toString();

0 comments on commit 2f0ca99

Please sign in to comment.