diff options
| -rw-r--r-- | buttress.h | 1 | ||||
| -rw-r--r-- | error.c | 8 | ||||
| -rw-r--r-- | input.c | 3 |
3 files changed, 11 insertions, 1 deletions
@@ -134,6 +134,7 @@ enum { err_kwexpected, /* paragraph type expects a keyword */ err_kwtoomany, /* paragraph type expects only 1 */ err_bodyillegal, /* paragraph type expects only kws! */ + err_badparatype, /* invalid command at start of para */ err_badmidcmd, /* invalid command in mid-para */ err_unexbrace, /* unexpected brace */ err_explbr, /* expected `{' after command */ @@ -79,6 +79,14 @@ static void do_error(int code, va_list ap) { sprintf(error, "expected no text after paragraph keyword"); flags = FILEPOS; break; + case err_badparatype: + wsp = va_arg(ap, wchar_t *); + sp = ustrtoa(wsp, auxbuf, sizeof(auxbuf)); + fpos = *va_arg(ap, filepos *); + sprintf(error, "command `%.200s' unrecognised at start of" + " paragraph", sp); + flags = FILEPOS; + break; case err_badmidcmd: wsp = va_arg(ap, wchar_t *); sp = ustrtoa(wsp, auxbuf, sizeof(auxbuf)); @@ -505,7 +505,8 @@ static void read_file(paragraph ***ret, input *in, index *idx) { par.fpos = t.pos; switch (t.cmd) { default: - needkw = -1; + error(err_badparatype, t.text, &t.pos); + needkw = 4; break; case c__comment: if (isbrace(in)) |