There doesn't seem to be a syntax for comments in rules files. Blank lines are
disallowed, too. Rules can be tricky, and it would be useful to allow grouping
them with blank lines and documenting them with comments.
Suggested patch:
Index: src/main/com/tonicsystems/jarjar/RulesFileParser.java
===================================================================
--- src/main/com/tonicsystems/jarjar/RulesFileParser.java (revision 138)
+++ src/main/com/tonicsystems/jarjar/RulesFileParser.java (working copy)
@@ -32,6 +32,11 @@
return parse(new java.io.StringReader(value));
}
+ private static String stripComment(String in) {
+ int p = in.indexOf("#");
+ return p < 0 ? in : in.substring(0, p);
+ }
+
private static List<PatternElement> parse(Reader r) throws IOException {
try {
List<PatternElement> patterns = new ArrayList<PatternElement>();
@@ -39,6 +44,9 @@
int c = 1;
String line;
while ((line = br.readLine()) != null) {
+ line = stripComment(line);
+ if (line.isEmpty())
+ continue;
String[] parts = line.split("\\s+");
if (parts.length < 2)
error(c, parts);
Original issue reported on code.google.com by oh...@google.com on 2 Jul 2012 at 8:02
Original issue reported on code.google.com by
oh...@google.com
on 2 Jul 2012 at 8:02