diff options
Diffstat (limited to 'src/lexer.h')
-rw-r--r-- | src/lexer.h | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/src/lexer.h b/src/lexer.h index 7271498..37b6af6 100644 --- a/src/lexer.h +++ b/src/lexer.h @@ -6,6 +6,30 @@ enum { LEXIDENT, + + LEXCOLON = ':', + LEXLBRACE = '{', + LEXLPAR = '(', + LEXRBRACE = '}', + LEXRPAR = ')', + LEXSEMI = ';', + + LEXAMP = '&', + LEXEQ = '=', + LEXLANGL = '<', + LEXMINUS = '-', + LEXPIPE = '|', + LEXPLUS = '+', + LEXRANGL = '>', + LEXSLASH = '/', + LEXSTAR = '*', + LEXTILDE = '~', + + /* We keep these exactly 2 away from each other, because ‘<’ and ‘>’ are 2 + away from each other in ASCII. This gives us a simple mapping from some + token T to the doubled equivalent by doing T += 193. */ + LEXLANGL_DBL = UINT8_MAX - 2, /* << */ + LEXRANGL_DBL = UINT8_MAX - 0, /* >> */ }; typedef uint8_t lexeme_kind; @@ -16,6 +40,6 @@ struct lexeme { size_t len; }; -struct lexeme *lexstring(const char *, size_t, size_t *); +struct lexeme *lexstring(const unsigned char *, size_t, size_t *); #endif /* !ORYX_LEXER_H */ |