diff options
author | Leo Tenenbaum <pommicket@gmail.com> | 2020-01-24 09:09:30 -0500 |
---|---|---|
committer | Leo Tenenbaum <pommicket@gmail.com> | 2020-01-24 09:09:30 -0500 |
commit | 7645cdc5e3635623f89042d80d4dfd5dd4a95dda (patch) | |
tree | 4e8b2acf48294c8b35aca0881fa90e3392f8c546 | |
parent | 49d4492692d0b1fa382ecadfd4ef76107f584df7 (diff) |
fixed operator precedence for as
-rw-r--r-- | parse.c | 2 | ||||
-rw-r--r-- | test.toc | 25 |
2 files changed, 2 insertions, 25 deletions
@@ -912,7 +912,7 @@ static void fprint_expr(FILE *out, Expression *e); #define NOT_AN_OP -1 /* cast/new aren't really operators since they operate on types, not exprs. */ -#define CAST_PRECEDENCE 45 +#define CAST_PRECEDENCE -10 #define NEW_PRECEDENCE 22 static int op_precedence(Keyword op) { switch (op) { @@ -1,34 +1,11 @@ -// io ::= pkg "std/io"; -// main ::= fn() { - // io.puts("Hello, world!"); -// }; -<<<<<<< HEAD -foo ::= fn(bar :: int = #foreign "X") { - -}; - -stdout :: &u8 = #foreign "stdout"; -fwrite :: fn(&u8, u64, u64, &u8) = #foreign "fwrite"; - -puts ::= fn(x : []char) { -// NOTE: removing brackets here causes error! this shouldn't happen! - fwrite((&x[0]) as (&u8), 1, x.len as u64, stdout); -}; - -main ::= fn() { - puts("Hello, world!\n"); -}; -======= stdout :: &u8 = #foreign "stdout"; fwrite :: fn(&u8, u64, u64, &u8) = #foreign "fwrite"; puts ::= fn(x : []char) { -// NOTE: removing brackets here causes error! this shouldn't happen! - fwrite((&x[0]) as (&u8), 1, x.len as u64, stdout); + fwrite(&x[0] as &u8 as &u16 as &u8, 1, x.len as u64, stdout); }; main ::= fn() { puts("Hello, world!\n"); }; ->>>>>>> 3fa3c17a12cb52edbcc9890cad59d610e0360f90 |