interpret/src/lex.h
2022-02-13 20:45:38 -08:00

25 lines
575 B
C

#include <stddef.h>
int lex_looks_like_year(const char *, int *);
int lex_looks_like_month(const char *);
int lex_looks_like_day(const char *);
#define LEX_SYMBOL X(END), X(ERROR), X(TEXT), X(BANG), X(BRACKET), X(WHITE), \
X(MAP), \
/* Commands */ X(DEFAULT), X(SOURCE)
#define X(n) n
struct lex {
enum lex_symbol { LEX_SYMBOL } symbol;
int ws_before, new_paragraph;
const char *s0, *s1;
size_t line;
};
#undef X
#define X(n) #n
static const char *const lex_symbols[] = { LEX_SYMBOL };
#undef X
void lex_reset(const char *const buffer);
int lex_next(struct lex *);