diff options
| author | Mel <mel@rnrd.eu> | 2025-07-09 22:19:53 +0200 |
|---|---|---|
| committer | Mel <mel@rnrd.eu> | 2025-07-09 22:19:53 +0200 |
| commit | c55f2311d3c618187ad17804417cb7aec127cc6f (patch) | |
| tree | c0a197af7832ee3e4659401cfb9547a14704228a | |
| parent | 815869606771b0117dd7be657232ec6dfab136c4 (diff) | |
| download | catskill-c55f2311d3c618187ad17804417cb7aec127cc6f.tar.zst catskill-c55f2311d3c618187ad17804417cb7aec127cc6f.zip | |
Parse unary reference and dereference operators
Signed-off-by: Mel <mel@rnrd.eu>
| -rw-r--r-- | boot/tree.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/boot/tree.c b/boot/tree.c index 9ea9e6f..aab05eb 100644 --- a/boot/tree.c +++ b/boot/tree.c @@ -16,8 +16,10 @@ enum Unary_Operation UNARY_MINUS, UNARY_NOT, - UNARY_BITWISE_NOT, + + UNARY_REFERENCE, + UNARY_DEREFERENCE, }; enum Unary_Operation @@ -30,6 +32,10 @@ unary_operation_from_token(const struct Token* token) return UNARY_NOT; case TOKEN_TILDE: return UNARY_BITWISE_NOT; + case TOKEN_AMPERSAND: + return UNARY_REFERENCE; + case TOKEN_STAR: + return UNARY_DEREFERENCE; default: return UNARY_NONE; @@ -46,6 +52,10 @@ unary_operation_to_string(enum Unary_Operation operation) return "!"; case UNARY_BITWISE_NOT: return "~"; + case UNARY_REFERENCE: + return "&"; + case UNARY_DEREFERENCE: + return "*"; default: failure("unexpected unary operation passed to `unary_operation_to_string`"); |
