diff options
author | Leo Tenenbaum <pommicket@gmail.com> | 2020-01-06 14:38:10 -0500 |
---|---|---|
committer | Leo Tenenbaum <pommicket@gmail.com> | 2020-01-06 14:38:10 -0500 |
commit | 28f622a04c5af314c80bbe112dc22e8ae16f01ef (patch) | |
tree | c3407655ecc51b456bea69633e67e54d1ab1e5bd | |
parent | dea1ae517bd01e3f21db9e338264417cd6cbea51 (diff) |
so: tuples need a different syntax because (int, int) could
refer to a tuple type, or to the tuple of int and int. fixed stuff related to that
-rw-r--r-- | parse.c | 8 | ||||
-rw-r--r-- | test.toc | 3 |
2 files changed, 9 insertions, 2 deletions
@@ -692,7 +692,10 @@ static bool parser_is_definitely_type(Parser *p, Token **end) { } } break; - case KW_LPAREN: { + case KW_LT: { + /* no expression can start with < */ + return true; +#if 0 Token *child_end; ++t->token; ret = false; @@ -702,7 +705,7 @@ static bool parser_is_definitely_type(Parser *p, Token **end) { if (t->token->kw == KW_COMMA) { ++t->token; continue; - } else if (t->token->kw == KW_RPAREN) { + } else if (t->token->kw == KW_GT) { /* it *is* a tuple! */ ret = true; ++t->token; @@ -710,6 +713,7 @@ static bool parser_is_definitely_type(Parser *p, Token **end) { } } else break; } +#endif } break; case KW_FN: { ret = false; @@ -13,5 +13,8 @@ foo ::= fn() <int, int> { main ::= fn() { a, b := foo(); + x , y::= (int, int); puti(a); puti(b); + c:x = 7; + d:x = 18; };
\ No newline at end of file |