#ifndef LEX_H #define LEX_H #include typedef struct { size_t idx; int line; int col; } Loc; typedef enum { Tok_Eof, Tok_Ident, Tok_Int, Tok_Str, Tok_Char, Tok_If, Tok_Nl = '\n', Tok_LParen = '(', Tok_RParen = ')', Tok_LBrace = '{', Tok_RBrace = '}', } TokTy; typedef struct { TokTy ty; Loc loc; size_t len; } Tok; typedef struct { const char* text; size_t idx; int line; int col; char ch; } Lexer; Tok lexer_next(Lexer* l); #endif