Codegen multiple line strings
This commit is contained in:
@@ -99,20 +99,20 @@ Release :: (m: *Memory)
|
||||
- [ ] Dynamic arrays
|
||||
- [ ] Hash tables
|
||||
- [ ] Tuples
|
||||
- [x] Beginnings
|
||||
- [x] Multiple return values from a function
|
||||
- [ ] But do we actually want this?
|
||||
- [ ] Some kind of tuple expressions
|
||||
- [ ] Using tuples as single values without unpacking
|
||||
|
||||
|
||||
- [ ] Generics / Parametric polymorphism
|
||||
|
||||
- [ ] Function overloading
|
||||
|
||||
- [x] Operator overloading
|
||||
- [x] Binary operators
|
||||
- [x] Unary operators
|
||||
- [x] Bulletproof
|
||||
- [ ] Assignment expressions?
|
||||
- [ ] Bulletproof
|
||||
|
||||
- [ ] Platforms
|
||||
- [x] Windows
|
||||
|
||||
3
base.cpp
3
base.cpp
@@ -806,7 +806,7 @@ thread_ctx_init(){
|
||||
function void
|
||||
handle_log_message(Log_Kind kind, int line, const char *file, const char *str, ...){
|
||||
if(kind == Log_Kind_Trace) return;
|
||||
|
||||
|
||||
Scratch scratch;
|
||||
STRING_FMT(scratch, str, message);
|
||||
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){
|
||||
return iter->item != 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -471,7 +471,3 @@ string_from_cstring(char *string){
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -197,9 +197,18 @@ gen_value(Token *pos, Value a){
|
||||
gen("0x%llx", pointer_value);
|
||||
}
|
||||
}break;
|
||||
case TYPE_STRING:
|
||||
gen("(String){(U8 *)\"%Q\", %d}", a.intern_val, a.intern_val.len);
|
||||
break;
|
||||
case TYPE_STRING:{
|
||||
int length = 0;
|
||||
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: {
|
||||
a.bool_val ? gen("true"):gen("false");
|
||||
}break;
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
- [ ] '.' Operator doesn't handle expressions inside the dot chain, no good, so casts don't work
|
||||
|
||||
- [ ] 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
|
||||
|
||||
- [ ] Builtin data structures
|
||||
@@ -146,6 +145,7 @@ For modules it's a bit different cause they should be distributed as valid.
|
||||
|
||||
## 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] 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.
|
||||
|
||||
@@ -18,4 +18,12 @@ main :: (): int
|
||||
Assert(d.x == -3 && d.y == -4 && d.z == -5)
|
||||
e := c - d
|
||||
Assert(e.x == 6 && e.y == 8 && e.z == 10)
|
||||
|
||||
test_string := "
|
||||
|
||||
Memes
|
||||
|
||||
|
||||
"
|
||||
|
||||
return 0
|
||||
Reference in New Issue
Block a user