interpret/src/lex.h

25 lines
591 B
C
Raw Normal View History

2022-02-14 04:45:38 +00:00
#include <stddef.h>
2022-02-13 06:35:02 +00:00
2022-02-14 04:45:38 +00:00
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), \
2022-02-14 05:38:03 +00:00
/* Commands */ X(SIGNIFICANT), X(DEFAULT), X(SOURCE)
2022-02-14 04:45:38 +00:00
#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 *);