From 3ea5db22e2af7b4446528de78b4c51bc3cd0559b Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Thu, 21 Oct 1999 13:34:34 +0000 Subject: We were failing to diagnose bad command at paragraph start [originally from svn r242] --- buttress.h | 1 + error.c | 8 ++++++++ input.c | 3 ++- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/buttress.h b/buttress.h index 062bc37..b059322 100644 --- a/buttress.h +++ b/buttress.h @@ -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 */ diff --git a/error.c b/error.c index b7eb0d5..01451dd 100644 --- a/error.c +++ b/error.c @@ -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)); diff --git a/input.c b/input.c index 1f40912..32eca3b 100644 --- a/input.c +++ b/input.c @@ -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)) -- cgit v1.1