diff --git a/sablecc-runtime/src/main/java/de/hhu/stups/sablecc/patch/SourcePosition.java b/sablecc-runtime/src/main/java/de/hhu/stups/sablecc/patch/SourcePosition.java index 2b3451b2d6d91a1c6475f6f96fc9c6cddbdcf40e..1f43ec581388782d7c689ae4349ec7bac7b66076 100644 --- a/sablecc-runtime/src/main/java/de/hhu/stups/sablecc/patch/SourcePosition.java +++ b/sablecc-runtime/src/main/java/de/hhu/stups/sablecc/patch/SourcePosition.java @@ -25,10 +25,15 @@ public class SourcePosition implements Comparable<SourcePosition> { return pos; } + @Override public int compareTo(SourcePosition that) { - if (that.line < line) return 1; - if (that.line > line) return -1; - return pos-that.pos; + if (this.line < that.line) { + return -1; + } else if (this.line > that.line) { + return 1; + } else { + return Integer.compare(this.pos, that.pos); + } } @Override