37 lines
438 B
Plaintext
37 lines
438 B
Plaintext
#ifndef LEXER_H
|
|
#define LEXER_H
|
|
|
|
#include <stddef.h>
|
|
|
|
typedef enum {
|
|
Id,
|
|
Int,
|
|
Float,
|
|
String,
|
|
|
|
If,
|
|
Else,
|
|
While,
|
|
Break,
|
|
|
|
LParen,
|
|
RParen,
|
|
LBrace,
|
|
RBrace,
|
|
|
|
Plus,
|
|
Minus,
|
|
} TokenType;
|
|
|
|
typedef struct {
|
|
TokenType type;
|
|
size_t index, length;
|
|
int line, column;
|
|
} Token;
|
|
|
|
typedef struct Lexer Lexer;
|
|
|
|
void lexer_create(Lexer* lexer, const char* text, size_t text_length);
|
|
|
|
#endif
|