Some bugfixes, allow overloading of [] and add that to vector and string, work on regex. Need closures before that finishes....

This commit is contained in:
Nathan Braswell
2015-06-08 21:47:02 -04:00
parent 69048ebc31
commit 47bc52f00c
19 changed files with 188 additions and 48 deletions

View File

@@ -1,6 +1,11 @@
import vector;
import mem;
fun string(in:char*):string {
var out:string = in
return out
}
obj string (Object) {
var data: vector::vector<char>;
fun construct(): string* {
@@ -33,6 +38,9 @@ obj string (Object) {
data.destruct()
}
fun operator[](index: int): char { return data[index]; }
fun length():int { return data.size; }
fun operator=(str: char*): void {
destruct();
construct(str)