diff options
| author | Martial Simon <msimon_fr@hotmail.com> | 2025-09-15 01:07:58 +0200 |
|---|---|---|
| committer | Martial Simon <msimon_fr@hotmail.com> | 2025-09-15 01:07:58 +0200 |
| commit | 967be9e750221ab2ab783f95df79bb26d290a45e (patch) | |
| tree | 6802900a5e975f9f68b169f0f503f040056d6952 /21sh/ll-expr/src/lexer/token.h | |
Diffstat (limited to '21sh/ll-expr/src/lexer/token.h')
| -rw-r--r-- | 21sh/ll-expr/src/lexer/token.h | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/21sh/ll-expr/src/lexer/token.h b/21sh/ll-expr/src/lexer/token.h new file mode 100644 index 0000000..b0866fc --- /dev/null +++ b/21sh/ll-expr/src/lexer/token.h @@ -0,0 +1,25 @@ +#ifndef TOKEN_H +#define TOKEN_H + +#include <unistd.h> + +enum token_type +{ + TOKEN_PLUS, // '+' + TOKEN_MINUS, // '-' + TOKEN_MUL, // '*' + TOKEN_DIV, // '/' + TOKEN_NUMBER, // "[0-9]+" + TOKEN_LEFT_PAR, // '(' + TOKEN_RIGHT_PAR, // ')' + TOKEN_EOF, // end of input marker + TOKEN_ERROR // it is not a real token, it is returned in case of invalid + // input +}; + +struct token +{ + enum token_type type; // The kind of token + ssize_t value; // If the token is a number, its value +}; +#endif /* !TOKEN_H */ |
