Skip to content

Commit 26dc874

Browse files
committed
Fix SAS parser
1 parent 67d07de commit 26dc874

2 files changed

Lines changed: 15 additions & 11 deletions

File tree

src/main/java/net/minecraftforge/binarypatcher/ConsoleTool.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public static void main(String[] args) throws IOException {
7272
log("Generating: ");
7373
log(" Output: " + output);
7474
log(" Pack200: " + pack200);
75-
log(" Legacy: " + legacy);
75+
log(" Legacy: " + legacy);
7676

7777
Generator gen = new Generator(output).pack200(pack200).legacy(legacy);
7878

@@ -82,9 +82,9 @@ public static void main(String[] args) throws IOException {
8282
int max = Math.max(clean.size(), Math.max(dirty.size(), prefixes.size()));
8383
for (int x = 0; x < max; x++) {
8484
log("Set #" + x + ':');
85-
log(" Prefix: " + (x < prefixes.size() ? prefixes.get(x) : null));
86-
log(" Clean: " + (x < clean.size() ? clean.get(x) : null));
87-
log(" Dirty: " + (x < dirty.size() ? dirty.get(x) : null));
85+
log(" Prefix: " + (x < prefixes.size() ? prefixes.get(x) : null));
86+
log(" Clean: " + (x < clean.size() ? clean.get(x) : null));
87+
log(" Dirty: " + (x < dirty.size() ? dirty.get(x) : null));
8888
}
8989
err("Unbalanced patchset arguments, see log for details");
9090
}
@@ -102,8 +102,8 @@ public static void main(String[] args) throws IOException {
102102
log(" Dirty: " + dirty.get(0));
103103
gen.addSet(clean.get(0), dirty.get(0), prefixes.get(0));
104104
} else {
105-
log(" Clean: " + clean.get(0));
106-
log(" Dirty: " + dirty.get(0));
105+
log(" Clean: " + clean.get(0));
106+
log(" Dirty: " + dirty.get(0));
107107
gen.addSet(clean.get(0), dirty.get(0), null);
108108
}
109109
}

src/main/java/net/minecraftforge/binarypatcher/Generator.java

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -114,17 +114,21 @@ public void loadPatches(File root) throws IOException {
114114
public void loadSideAnnotationStripper(File file) throws IOException {
115115
List<String> lines = Files.readAllLines(file.toPath());
116116
for (String line : lines) {
117+
// Strip comments
117118
int idx = line.indexOf('#');
118-
if (idx == 0) return;
119-
119+
if (idx == 0) continue;
120120
if (idx != -1) line = line.substring(0, idx - 1);
121+
122+
// Account for groups
121123
if (line.charAt(0) == '\t') line = line.substring(1);
122124
line = line.trim();
125+
126+
// Methods, we only care about the class name
123127
idx = line.indexOf(' ');
124-
if (idx == -1)
125-
continue;
128+
if (idx != -1)
129+
line = line.substring(0, idx);
126130

127-
patches.add(line.substring(0, idx));
131+
patches.add(line);
128132
}
129133
}
130134

0 commit comments

Comments
 (0)