Example #1
0
 public static FilePosition between(FilePosition a, FilePosition b) {
   return instance(
       a.source(),
       a.endLineNo(),
       a.endCharInFile(),
       a.endCharInLine(),
       b.startLineNo(),
       b.startCharInFile(),
       b.startCharInLine());
 }
Example #2
0
 public static FilePosition span(FilePosition start, FilePosition end) {
   if (start == end) {
     return start;
   }
   if (!start.source.equals(end.source)) {
     return FilePosition.UNKNOWN;
   }
   if (start.startCharInFile > end.endCharInFile) {
     throw new IllegalArgumentException(start + ", " + end);
   }
   return instance(
       start.source,
       start.startLineNo,
       start.startCharInFile,
       start.startCharInLine,
       end.endLineNo(),
       end.endCharInFile(),
       end.endCharInLine());
 }