2022-12-28 17:04:49 -05:00
|
|
|
#include "journal.h"
|
2022-02-13 01:35:02 -05:00
|
|
|
|
2022-02-13 23:45:38 -05:00
|
|
|
int lex_looks_like_year(const char *, int *);
|
|
|
|
int lex_looks_like_month(const char *);
|
|
|
|
int lex_looks_like_day(const char *);
|
|
|
|
|
2022-07-24 20:38:56 -04:00
|
|
|
#define FOR_SYMBOL(X) \
|
2022-02-15 22:48:50 -05:00
|
|
|
\
|
|
|
|
/* Results. */ \
|
2022-07-24 20:38:56 -04:00
|
|
|
X(END, 0), \
|
|
|
|
X(SYNTAX, 0), \
|
|
|
|
X(ILLEGAL, 0), \
|
|
|
|
X(NOT_FOUND, 0), \
|
2022-02-15 22:48:50 -05:00
|
|
|
\
|
2022-07-24 20:38:56 -04:00
|
|
|
X(ORDERED_LIST_ITEM, &no_vt), \
|
|
|
|
X(LIST_ITEM, 0), \
|
|
|
|
X(COMPLETE, 0), \
|
|
|
|
X(CANCELLED, 0), \
|
|
|
|
X(HEADING, 0), \
|
2022-02-15 22:48:50 -05:00
|
|
|
/* Text. */ \
|
2022-07-24 20:38:56 -04:00
|
|
|
X(PARAGRAPH, 0), \
|
|
|
|
X(TEXT, &word_vt), \
|
|
|
|
/*This is lazy.*/X(CAPTION, &word_vt), \
|
2022-02-15 22:48:50 -05:00
|
|
|
\
|
|
|
|
/* Edicts. */ \
|
2022-07-24 20:38:56 -04:00
|
|
|
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), \
|
2022-02-15 22:48:50 -05:00
|
|
|
\
|
|
|
|
/* Arguments. */ \
|
2022-07-24 20:38:56 -04:00
|
|
|
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), \
|
2022-07-05 22:21:56 -04:00
|
|
|
\
|
|
|
|
/* Bible */ \
|
2022-07-24 20:38:56 -04:00
|
|
|
X(KJV_BOOK, &kjv_book_vt), \
|
|
|
|
X(KJV_CHAPTER_VERSE, &word_vt), \
|
|
|
|
X(KJV_TEXT, &word_vt), \
|
|
|
|
X(KJV_NEXT, 0)
|
|
|
|
|
2022-12-28 17:04:49 -05:00
|
|
|
int scan(union date32 date, const char *const buffer);
|
2022-07-24 20:38:56 -04:00
|
|
|
|
2022-12-28 17:04:49 -05:00
|
|
|
#if 0
|
|
|
|
|
|
|
|
struct scan {
|
|
|
|
const char *marker, *from, *cursor, *limit, *label, *buffer;
|
|
|
|
int condition;
|
|
|
|
size_t line;
|
|
|
|
int is_ws_expected;
|
|
|
|
};
|
2022-02-13 23:45:38 -05:00
|
|
|
|
|
|
|
struct lex {
|
|
|
|
size_t line;
|
2022-07-24 20:38:56 -04:00
|
|
|
#define ARG1(n, m) n
|
|
|
|
enum lex_symbol { FOR_SYMBOL(ARG1) } symbol;
|
|
|
|
#undef ARG1
|
|
|
|
const char *s0, *s1;
|
2022-02-13 23:45:38 -05:00
|
|
|
};
|
2022-07-24 20:38:56 -04:00
|
|
|
#define STR1(n, m) #n
|
|
|
|
static const char *const lex_symbols[] = { FOR_SYMBOL(STR1) };
|
2022-02-13 23:45:38 -05:00
|
|
|
#undef X
|
|
|
|
|
2022-12-28 17:04:49 -05:00
|
|
|
struct scan scan(const char *);
|
|
|
|
int scan_next(struct scan *const s, struct lex *const x);
|
|
|
|
|
|
|
|
#endif
|