Add support for source mappings #10

Merged
TopchetoEU merged 22 commits from TopchetoEU/mapping into master 2023-12-18 20:42:38 +00:00
3 changed files with 14 additions and 2 deletions
Showing only changes of commit 27162ef8ac - Show all commits

View File

@ -24,6 +24,10 @@ public class Buffer {
return n;
}
public void append(byte b) {
write(length, new byte[] { b });
}
public byte[] data() {
var res = new byte[length];
System.arraycopy(this.data, 0, res, 0, length);
@ -38,4 +42,12 @@ public class Buffer {
this.length = data.length;
System.arraycopy(data, 0, this.data, 0, data.length);
}
public Buffer(int capacity) {
this.data = new byte[capacity];
this.length = 0;
}
public Buffer() {
this.data = new byte[128];
this.length = 0;
}
}

View File

@ -21,7 +21,7 @@ public interface File {
return new String(res);
}
default String readLine() {
var res = new Buffer(new byte[0]);
var res = new Buffer();
var buff = new byte[1];
while (true) {

View File

@ -24,7 +24,7 @@ public class MemoryFilesystem implements Filesystem {
if (!folders.contains(_path.getParent())) throw new FilesystemException(path, FSCode.DOESNT_EXIST);
if (folders.contains(_path) || files.containsKey(_path)) throw new FilesystemException(path, FSCode.ALREADY_EXISTS);
if (folders.contains(_path)) throw new FilesystemException(path, FSCode.ALREADY_EXISTS);
files.put(_path, new Buffer(new byte[0]));
files.put(_path, new Buffer());
break;
case FOLDER:
if (!folders.contains(_path.getParent())) throw new FilesystemException(path, FSCode.DOESNT_EXIST);