Codegen multiple line strings
This commit is contained in:
@@ -99,20 +99,20 @@ Release :: (m: *Memory)
|
|||||||
- [ ] Dynamic arrays
|
- [ ] Dynamic arrays
|
||||||
- [ ] Hash tables
|
- [ ] Hash tables
|
||||||
- [ ] Tuples
|
- [ ] Tuples
|
||||||
|
- [x] Beginnings
|
||||||
- [x] Multiple return values from a function
|
- [x] Multiple return values from a function
|
||||||
|
- [ ] But do we actually want this?
|
||||||
- [ ] Some kind of tuple expressions
|
- [ ] Some kind of tuple expressions
|
||||||
- [ ] Using tuples as single values without unpacking
|
- [ ] Using tuples as single values without unpacking
|
||||||
|
|
||||||
|
|
||||||
- [ ] Generics / Parametric polymorphism
|
- [ ] Generics / Parametric polymorphism
|
||||||
|
|
||||||
- [ ] Function overloading
|
|
||||||
|
|
||||||
- [x] Operator overloading
|
- [x] Operator overloading
|
||||||
- [x] Binary operators
|
- [x] Binary operators
|
||||||
- [x] Unary operators
|
- [x] Unary operators
|
||||||
|
- [x] Bulletproof
|
||||||
- [ ] Assignment expressions?
|
- [ ] Assignment expressions?
|
||||||
- [ ] Bulletproof
|
|
||||||
|
|
||||||
- [ ] Platforms
|
- [ ] Platforms
|
||||||
- [x] Windows
|
- [x] Windows
|
||||||
|
|||||||
3
base.cpp
3
base.cpp
@@ -806,7 +806,7 @@ thread_ctx_init(){
|
|||||||
function void
|
function void
|
||||||
handle_log_message(Log_Kind kind, int line, const char *file, const char *str, ...){
|
handle_log_message(Log_Kind kind, int line, const char *file, const char *str, ...){
|
||||||
if(kind == Log_Kind_Trace) return;
|
if(kind == Log_Kind_Trace) return;
|
||||||
|
|
||||||
Scratch scratch;
|
Scratch scratch;
|
||||||
STRING_FMT(scratch, str, message);
|
STRING_FMT(scratch, str, message);
|
||||||
if(thread_ctx.log_proc) thread_ctx.log_proc(kind, message, (char *)file, line);
|
if(thread_ctx.log_proc) thread_ctx.log_proc(kind, message, (char *)file, line);
|
||||||
@@ -1479,4 +1479,3 @@ template<class T>
|
|||||||
bool should_we_continue(List_Iter<T> *iter){
|
bool should_we_continue(List_Iter<T> *iter){
|
||||||
return iter->item != 0;
|
return iter->item != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -471,7 +471,3 @@ string_from_cstring(char *string){
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -197,9 +197,18 @@ gen_value(Token *pos, Value a){
|
|||||||
gen("0x%llx", pointer_value);
|
gen("0x%llx", pointer_value);
|
||||||
}
|
}
|
||||||
}break;
|
}break;
|
||||||
case TYPE_STRING:
|
case TYPE_STRING:{
|
||||||
gen("(String){(U8 *)\"%Q\", %d}", a.intern_val, a.intern_val.len);
|
int length = 0;
|
||||||
break;
|
gen("(String){(U8 *)\"");
|
||||||
|
for(int i = 0; i < a.intern_val.len; i++){
|
||||||
|
if(a.intern_val.str[i] == '\n'){length += 2; gen("\\n");}
|
||||||
|
else if(a.intern_val.str[i] == '\r'){length += 2; gen("\\r");}
|
||||||
|
else{length += 1; gen("%c", a.intern_val.str[i]);}
|
||||||
|
|
||||||
|
}
|
||||||
|
gen("\", %d}", length);
|
||||||
|
|
||||||
|
}break;
|
||||||
CASE_BOOL: {
|
CASE_BOOL: {
|
||||||
a.bool_val ? gen("true"):gen("false");
|
a.bool_val ? gen("true"):gen("false");
|
||||||
}break;
|
}break;
|
||||||
|
|||||||
@@ -5,7 +5,6 @@
|
|||||||
- [ ] '.' Operator doesn't handle expressions inside the dot chain, no good, so casts don't work
|
- [ ] '.' Operator doesn't handle expressions inside the dot chain, no good, so casts don't work
|
||||||
|
|
||||||
- [ ] Basic
|
- [ ] Basic
|
||||||
- [ ] Introduce List to reduce heap allocations and make it more arena friendly, can we get rid of heap completly?
|
|
||||||
- [ ] Detecting if return was called
|
- [ ] Detecting if return was called
|
||||||
|
|
||||||
- [ ] Builtin data structures
|
- [ ] Builtin data structures
|
||||||
@@ -146,6 +145,7 @@ For modules it's a bit different cause they should be distributed as valid.
|
|||||||
|
|
||||||
## Done
|
## Done
|
||||||
|
|
||||||
|
- [x] Introduce List to reduce heap allocations and make it more arena friendly, can we get rid of heap completly?
|
||||||
- [x] Function renaming to prevent colissions, we can't really touch other stuff cause I want it to be easily debuggable
|
- [x] Function renaming to prevent colissions, we can't really touch other stuff cause I want it to be easily debuggable
|
||||||
- [x] Fix Length etc. they should be function calls not operators
|
- [x] Fix Length etc. they should be function calls not operators
|
||||||
- [x] Idea to fix overshoot when debugging and it goes to the close bracket and there is not enough line directives. Store the last outputed line and propagate it on the close brace etc.
|
- [x] Idea to fix overshoot when debugging and it goes to the close bracket and there is not enough line directives. Store the last outputed line and propagate it on the close brace etc.
|
||||||
|
|||||||
@@ -18,4 +18,12 @@ main :: (): int
|
|||||||
Assert(d.x == -3 && d.y == -4 && d.z == -5)
|
Assert(d.x == -3 && d.y == -4 && d.z == -5)
|
||||||
e := c - d
|
e := c - d
|
||||||
Assert(e.x == 6 && e.y == 8 && e.z == 10)
|
Assert(e.x == 6 && e.y == 8 && e.z == 10)
|
||||||
|
|
||||||
|
test_string := "
|
||||||
|
|
||||||
|
Memes
|
||||||
|
|
||||||
|
|
||||||
|
"
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
Reference in New Issue
Block a user