package yokohama.unit.position;

import java.nio.file.Path;
import java.util.Optional;
import lombok.Value;

@Value
public class Span {
    private final Optional<Path> sourcePath;
    private final Position start;
    private final Position end;

    public String getFileName() {
        if (!sourcePath.isPresent()) return "?";

        Path path = sourcePath.get();
        int nameCount = path.getNameCount();

        if (nameCount == 0) return "?";

        String fileName = path.getName(nameCount -1).toString();

        return fileName.equals("") ? "?" : fileName;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(sourcePath.isPresent() ? sourcePath.get().toString() : "?");
        sb.append(":");
        sb.append(start.toString());
        if (!end.isDummy()) {
            sb.append("-");
            sb.append(end.toString());
        }
        return sb.toString();
    }

    private static Span dummySpan =
            new Span(
                    Optional.empty(),
                    Position.dummyPos(),
                    Position.dummyPos());
    public static Span dummySpan() {
        return dummySpan;
    }
}

@@ -987,24 +987,413 @@
 ;%0D%0A    %7D%0D%0A%0D%0A
+    public Span of(Path path) %7B%0D%0A        return new Span(Optional.of(path), Position.dummyPos(), Position.dummyPos());%0D%0A    %7D%0D%0A%0D%0A    public Span of(Path path, Position start) %7B%0D%0A        return new Span(Optional.of(path), start, Position.dummyPos());%0D%0A    %7D%0D%0A%0D%0A    public Span of(Path path, Position start, Position end) %7B%0D%0A        return new Span(Optional.of(path), start, end);%0D%0A    %7D%0D%0A%0D%0A
     private 

Add Span.of methods