64 lines
1.3 KiB
C
64 lines
1.3 KiB
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 FOR_SYMBOL(X) \
|
|
\
|
|
/* Results. */ \
|
|
X(END, 0), \
|
|
X(SYNTAX, 0), \
|
|
X(ILLEGAL, 0), \
|
|
X(NOT_FOUND, 0), \
|
|
\
|
|
X(ORDERED_LIST_ITEM, &no_vt), \
|
|
X(LIST_ITEM, 0), \
|
|
X(COMPLETE, 0), \
|
|
X(CANCELLED, 0), \
|
|
X(HEADING, 0), \
|
|
/* Text. */ \
|
|
X(PARAGRAPH, 0), \
|
|
X(TEXT, &word_vt), \
|
|
/*This is lazy.*/X(CAPTION, &word_vt), \
|
|
\
|
|
/* Edicts. */ \
|
|
X(SOURCE, &word_vt), \
|
|
X(DEFAULT, 0), \
|
|
X(SOURCE_RECALL, &word_vt), \
|
|
X(LOCATION, 0), \
|
|
X(LOCATION_SAVE, 0), \
|
|
X(LOCATION_RECALL, 0), \
|
|
X(SIGNIFICANT, 0), \
|
|
X(SIGNIFICANT_RECALL, 0), \
|
|
X(EDITORIALIZING, 0), \
|
|
\
|
|
/* Arguments. */ \
|
|
X(ARG_KEYWORD, 0), \
|
|
X(ARG_DATE, &date_vt), \
|
|
X(ARG_NATURAL, &no_vt), \
|
|
X(ARG_RESTRICT_TEXT, &word_vt), \
|
|
X(ARG_END_TEXT, &word_vt), \
|
|
\
|
|
/* Bible */ \
|
|
X(KJV_BOOK, &kjv_book_vt), \
|
|
X(KJV_CHAPTER_VERSE, &word_vt), \
|
|
X(KJV_TEXT, &word_vt), \
|
|
X(KJV_NEXT, 0)
|
|
|
|
|
|
|
|
struct lex {
|
|
size_t line;
|
|
#define ARG1(n, m) n
|
|
enum lex_symbol { FOR_SYMBOL(ARG1) } symbol;
|
|
#undef ARG1
|
|
const char *s0, *s1;
|
|
};
|
|
#define STR1(n, m) #n
|
|
static const char *const lex_symbols[] = { FOR_SYMBOL(STR1) };
|
|
#undef X
|
|
|
|
void lex_reset(const char *const buffer);
|
|
int lex_next(struct lex *);
|