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 *);
|
|
|
|
|
2022-02-15 21:05:15 +00:00
|
|
|
#define LEX_SYMBOL \
|
|
|
|
/* Results. */ X(END), X(SYNTAX), X(ILLEGAL), X(NOT_FOUND), \
|
2022-02-15 21:56:36 +00:00
|
|
|
/* Text. */ X(PARAGRAPH), X(TEXT), \
|
|
|
|
/* Edicts. */ X(SOURCE), X(DEFAULT), X(SIGNIFICANT), X(SCORE), X(MAP), \
|
|
|
|
/* Arguments. */ X(ARG_KEYWORD), X(ARG_DATE), X(ARG_NATURAL), \
|
|
|
|
X(ARG_FREEFORM)
|
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 *);
|