#include 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 \ \ /* Results. */ \ X(END), X(SYNTAX), X(ILLEGAL), X(NOT_FOUND), \ \ X(ORDERED_LIST_ITEM), X(LIST_ITEM), X(COMPLETE), X(CANCELLED), X(HEADING), \ /* Text. */ \ X(PARAGRAPH), X(TEXT), X(CAPTION), \ \ /* Edicts. */ \ X(SOURCE), X(DEFAULT), X(SOURCE_RECALL), \ X(LOCATION), X(LOCATION_SAVE), X(LOCATION_RECALL), \ X(SIGNIFICANT), X(SIGNIFICANT_RECALL), X(EDITORIALIZING), \ \ /* Arguments. */ \ X(ARG_KEYWORD), X(ARG_DATE), X(ARG_NATURAL), X(ARG_RESTRICT_TEXT), \ X(ARG_END_TEXT), \ \ /* Bible */ \ X(BIBLE_BOOK), X(BIBLE_CHAPTER_VERSE), X(BIBLE_TEXT), X(BIBLE_NEXT) struct lex { #define X(n) n enum lex_symbol { LEX_SYMBOL } symbol; #undef X /*int ws_before, new_paragraph; ???*/ const char *s0, *s1; size_t line; }; #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 *);