len := 0;
state := 0;
-
for ch: format do switch (state) {
case 0 {
if ch == #char "%" do state = 1;
}
}
- case 1 {
+ case #default {
switch (ch) {
case #char "%" { buffer[len] = ch; len += 1; }
[ ] explicit memory controls at top level
- [ ] 'use' enums and packages at an arbitrary scope
+ [X] 'use' enums and packages at an arbitrary scope
[ ] look into creating a source map
- first-look looks really gross
- Compile time conditions
- Only evalutate code blocks that evaluate to be true
- [ ] Top level variable initialization
+ [X] Top level variable initialization
- Works for numeric literals
[ ] multiple lvals and compound assignment
use package core;
-old_va_test :: proc (prefix: string, va: ..i32) {
- println(prefix);
+old_va_test :: proc (fix: Fixes, va: ..i32) {
+ println(fix.prefix);
for v: va do println(v);
+ println(fix.suffix);
}
-new_va_test :: proc (prefix: string, va: ...) {
- println(prefix);
+Fixes :: struct { prefix: string; suffix: string; }
+
+new_va_test :: proc (fix: Fixes, va: ...) {
+ println(fix.prefix);
for i: 0 .. va.count {
x : i32;
vararg_get(va, ^x);
println(x);
}
+
+ println(fix.suffix);
}
main :: proc (args: [] cstring) {
- new_va_test("foo", 1, 2, 3.0f, 5.0f);
- old_va_test("bar", 1);
+ new_va_test(Fixes.{ "foo", "foozle" }, 1, 2, 3.0f, 5.0f);
+ old_va_test(Fixes.{ "bar", "barzle" }, 1);
- printf("Hello, %i, %s!\n", 1234, "World");
+ printf("Hello, %%%i, %s!\n", 1234, "World");
}
bh_table_each_start(AstTyped *, block->scope->symbols);
fill_in_type(value);
- if (value->type == NULL) {
- onyx_report_error(value->token->pos,
- "Unable to resolve type for local '%b'.",
- value->token->text, value->token->length);
- return 1;
- }
+ // if (value->type == NULL) {
+ // onyx_report_error(value->token->pos,
+ // "Unable to resolve type for local '%b'.",
+ // value->token->text, value->token->length);
+ // return 1;
+ // }
bh_table_each_end;
return 0;