Support blank comments in IO readers
phase opened this issue · 2 comments
phase commented
I can't find many examples of comments, but it wouldn't hurt to ignore lines starting with #
in the CSRG/TSRG/SRG readers.
jamierocks commented
Lorenz does ignore comments in *SRG formats.
They all use the same implementation.
private static final Pattern HASH_COMMENT = Pattern.compile("#.+");
public static String removeComments(final String line) {
return HASH_COMMENT.matcher(line).replaceAll("");
}
phase commented
I got this error and assumed there as no support for it:
Exception in thread "main" java.lang.IllegalArgumentException: Faulty TSRG mapping encountered: `#`!
at org.cadixdev.lorenz.io.srg.tsrg.TSrgReader$Processor.accept(TSrgReader.java:86)
at org.cadixdev.lorenz.io.srg.tsrg.TSrgReader$Processor.accept(TSrgReader.java:56)
at java.util.Iterator.forEachRemaining(Iterator.java:116)
at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)
at java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:647)
at org.cadixdev.lorenz.io.TextMappingsReader.read(TextMappingsReader.java:73)
at org.cadixdev.lorenz.io.MappingFormat.read(MappingFormat.java:79)
at org.cadixdev.lorenz.io.MappingFormat.read(MappingFormat.java:92)
Usage:
MappingFormats.TSRG.read(Paths.get("beta/serverToClientObf.tsrg")),
After looking at this again, it appears to only error on lines that only contain a #
. This is probably due to the comment regex being .+
instead of .*
.