diff options
author | Bad Diode <bd@badd10de.dev> | 2022-04-03 18:54:51 -0300 |
---|---|---|
committer | Bad Diode <bd@badd10de.dev> | 2022-04-03 18:54:51 -0300 |
commit | c8b53cb4590d8d6cbfc5cbf891809ddd99e33fe5 (patch) | |
tree | 716f3676abb4a777add1683390cfc37a605fe911 /src/errors.h | |
parent | 496ec36c8002a85dc0c3bb62de6d176e369b40af (diff) | |
download | bdl-c8b53cb4590d8d6cbfc5cbf891809ddd99e33fe5.tar.gz bdl-c8b53cb4590d8d6cbfc5cbf891809ddd99e33fe5.zip |
Add parsing for function definitions
This commits also changes the structure of some existing functions.
Namely, parse_* functions other than parse_next check that the type of
the token to parse is correct. This allow us to use them directly in the
rest of the code to consume tokens and properly produce an error if the
token type is not the expected one.
In the same fashion, two new functions consume_lparen and consume_rparen
are implemented. They only report true/false and report errors if
something went wrong.
Diffstat (limited to 'src/errors.h')
-rw-r--r-- | src/errors.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/errors.h b/src/errors.h index 25f9945..871711b 100644 --- a/src/errors.h +++ b/src/errors.h | |||
@@ -16,6 +16,13 @@ typedef enum ErrorValue { | |||
16 | ERR_MALFORMED_NUMBER, | 16 | ERR_MALFORMED_NUMBER, |
17 | ERR_MALFORMED_EXPR, | 17 | ERR_MALFORMED_EXPR, |
18 | ERR_UNIMPLEMENTED, | 18 | ERR_UNIMPLEMENTED, |
19 | ERR_NOT_A_NUMBER, | ||
20 | ERR_NOT_A_SYMBOL, | ||
21 | ERR_NOT_A_STRING, | ||
22 | ERR_NOT_A_TYPE, | ||
23 | ERR_NOT_A_BOOL, | ||
24 | ERR_NOT_A_LPAREN, | ||
25 | ERR_NOT_A_RPAREN, | ||
19 | ERR_OK, | 26 | ERR_OK, |
20 | } ErrorValue; | 27 | } ErrorValue; |
21 | 28 | ||