Add tokeninfo
This commit is contained in:
+17
@@ -6,6 +6,9 @@
|
|||||||
|
|
||||||
#include "buffer.h"
|
#include "buffer.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A list of all possible tokens.
|
||||||
|
*/
|
||||||
typedef enum {
|
typedef enum {
|
||||||
// Keywords
|
// Keywords
|
||||||
TOKEN_MODULE,
|
TOKEN_MODULE,
|
||||||
@@ -26,6 +29,20 @@ typedef enum {
|
|||||||
TOKEN_IDENTIFIER,
|
TOKEN_IDENTIFIER,
|
||||||
} Token;
|
} Token;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Holds additional information about a token.
|
||||||
|
*/
|
||||||
|
typedef struct {
|
||||||
|
/// @brief The textual representation of a token.
|
||||||
|
char* text;
|
||||||
|
|
||||||
|
/// @brief The length of the `text` string.
|
||||||
|
size_t text_length;
|
||||||
|
|
||||||
|
/// @brief The actual token.
|
||||||
|
Token token;
|
||||||
|
} TokenInfo;
|
||||||
|
|
||||||
typedef struct TokenStream TokenStream;
|
typedef struct TokenStream TokenStream;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user