aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMustafa Quraish <[email protected]>2022-02-02 03:09:38 -0500
committerMustafa Quraish <[email protected]>2022-02-02 03:09:38 -0500
commit733cf587ffc21b2fbee7df7a8a42a1bc3c9a01e8 (patch)
tree68c89184499cf04b9970624108c1212745672666
parentAdd support for pointers! (tests missing) (diff)
downloadcup-733cf587ffc21b2fbee7df7a8a42a1bc3c9a01e8.tar.xz
cup-733cf587ffc21b2fbee7df7a8a42a1bc3c9a01e8.zip
Use `type*` instead of `type&` to denote a pointer type (for now)
While I prefer the latter, the lexer/parser cannot correctly parse `type&&` since it thinks `&&` is `TOKEN_AND`. Perhaps how these cases are handled can be changed in the future.
-rw-r--r--src/parser.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/parser.c b/src/parser.c
index 5123189..85c4d6a 100644
--- a/src/parser.c
+++ b/src/parser.c
@@ -190,7 +190,7 @@ Type *parse_type(Lexer *lexer)
type = type_new(TYPE_NONE);
}
- while (Lexer_peek(lexer).type == TOKEN_AMPERSAND) {
+ while (Lexer_peek(lexer).type == TOKEN_STAR) {
Lexer_next(lexer);
Type *ptr = type_new(TYPE_PTR);
ptr->ptr = type;