version 1.29, 2012/05/27 17:48:57 |
version 1.35, 2013/05/30 03:52:59 |
|
|
/* $Id$ */ |
/* $Id$ */ |
/* |
/* |
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> |
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> |
* Copyright (c) 2010, 2011 Ingo Schwarze <schwarze@openbsd.org> |
* Copyright (c) 2010, 2011, 2012, 2013 Ingo Schwarze <schwarze@openbsd.org> |
* |
* |
* Permission to use, copy, modify, and distribute this software for any |
* Permission to use, copy, modify, and distribute this software for any |
* purpose with or without fee is hereby granted, provided that the above |
* purpose with or without fee is hereby granted, provided that the above |
Line 95 static const char * const mandocerrs[MANDOCERR_MAX] = |
|
Line 95 static const char * const mandocerrs[MANDOCERR_MAX] = |
|
"no title in document", |
"no title in document", |
"document title should be all caps", |
"document title should be all caps", |
"unknown manual section", |
"unknown manual section", |
|
"unknown manual volume or arch", |
"date missing, using today's date", |
"date missing, using today's date", |
"cannot parse date, using it verbatim", |
"cannot parse date, using it verbatim", |
"prologue macros out of order", |
"prologue macros out of order", |
Line 106 static const char * const mandocerrs[MANDOCERR_MAX] = |
|
Line 107 static const char * const mandocerrs[MANDOCERR_MAX] = |
|
".so is fragile, better use ln(1)", |
".so is fragile, better use ln(1)", |
"NAME section must come first", |
"NAME section must come first", |
"bad NAME section contents", |
"bad NAME section contents", |
"manual name not yet set", |
|
"sections out of conventional order", |
"sections out of conventional order", |
"duplicate section name", |
"duplicate section name", |
"section not in conventional manual section", |
"section not in conventional manual section", |
Line 114 static const char * const mandocerrs[MANDOCERR_MAX] = |
|
Line 114 static const char * const mandocerrs[MANDOCERR_MAX] = |
|
/* related to macros and nesting */ |
/* related to macros and nesting */ |
"skipping obsolete macro", |
"skipping obsolete macro", |
"skipping paragraph macro", |
"skipping paragraph macro", |
|
"moving paragraph macro out of list", |
"skipping no-space macro", |
"skipping no-space macro", |
"blocks badly nested", |
"blocks badly nested", |
"child violates parent syntax", |
"child violates parent syntax", |
Line 174 static const char * const mandocerrs[MANDOCERR_MAX] = |
|
Line 175 static const char * const mandocerrs[MANDOCERR_MAX] = |
|
"input stack limit exceeded, infinite loop?", |
"input stack limit exceeded, infinite loop?", |
"skipping bad character", |
"skipping bad character", |
"escaped character not allowed in a name", |
"escaped character not allowed in a name", |
|
"manual name not yet set", |
"skipping text before the first section header", |
"skipping text before the first section header", |
"skipping unknown macro", |
"skipping unknown macro", |
"NOT IMPLEMENTED, please use groff: skipping request", |
"NOT IMPLEMENTED, please use groff: skipping request", |
"argument count wrong", |
"argument count wrong", |
|
"skipping column outside column list", |
"skipping end of block that is not open", |
"skipping end of block that is not open", |
"missing end of block", |
"missing end of block", |
"scope open on exit", |
"scope open on exit", |
Line 325 mparse_buf_r(struct mparse *curp, struct buf blk, int |
|
Line 328 mparse_buf_r(struct mparse *curp, struct buf blk, int |
|
break; |
break; |
} |
} |
|
|
|
/* |
|
* Make sure we have space for at least |
|
* one backslash and one other character |
|
* and the trailing NUL byte. |
|
*/ |
|
|
|
if (pos + 2 >= (int)ln.sz) |
|
resize_buf(&ln, 256); |
|
|
/* |
/* |
* Warn about bogus characters. If you're using |
* Warn about bogus characters. If you're using |
* non-ASCII encoding, you're screwing your |
* non-ASCII encoding, you're screwing your |
Line 341 mparse_buf_r(struct mparse *curp, struct buf blk, int |
|
Line 353 mparse_buf_r(struct mparse *curp, struct buf blk, int |
|
mandoc_msg(MANDOCERR_BADCHAR, curp, |
mandoc_msg(MANDOCERR_BADCHAR, curp, |
curp->line, pos, NULL); |
curp->line, pos, NULL); |
i++; |
i++; |
if (pos >= (int)ln.sz) |
|
resize_buf(&ln, 256); |
|
ln.buf[pos++] = '?'; |
ln.buf[pos++] = '?'; |
continue; |
continue; |
} |
} |
Line 350 mparse_buf_r(struct mparse *curp, struct buf blk, int |
|
Line 360 mparse_buf_r(struct mparse *curp, struct buf blk, int |
|
/* Trailing backslash = a plain char. */ |
/* Trailing backslash = a plain char. */ |
|
|
if ('\\' != blk.buf[i] || i + 1 == (int)blk.sz) { |
if ('\\' != blk.buf[i] || i + 1 == (int)blk.sz) { |
if (pos >= (int)ln.sz) |
|
resize_buf(&ln, 256); |
|
ln.buf[pos++] = blk.buf[i++]; |
ln.buf[pos++] = blk.buf[i++]; |
continue; |
continue; |
} |
} |
Line 393 mparse_buf_r(struct mparse *curp, struct buf blk, int |
|
Line 401 mparse_buf_r(struct mparse *curp, struct buf blk, int |
|
break; |
break; |
} |
} |
|
|
/* Some other escape sequence, copy & cont. */ |
/* Catch escaped bogus characters. */ |
|
|
if (pos + 1 >= (int)ln.sz) |
c = (unsigned char) blk.buf[i+1]; |
resize_buf(&ln, 256); |
|
|
|
|
if ( ! (isascii(c) && |
|
(isgraph(c) || isblank(c)))) { |
|
mandoc_msg(MANDOCERR_BADCHAR, curp, |
|
curp->line, pos, NULL); |
|
i += 2; |
|
ln.buf[pos++] = '?'; |
|
continue; |
|
} |
|
|
|
/* Some other escape sequence, copy & cont. */ |
|
|
ln.buf[pos++] = blk.buf[i++]; |
ln.buf[pos++] = blk.buf[i++]; |
ln.buf[pos++] = blk.buf[i++]; |
ln.buf[pos++] = blk.buf[i++]; |
} |
} |
Line 738 mparse_alloc(enum mparset inttype, enum mandoclevel wl |
|
Line 756 mparse_alloc(enum mparset inttype, enum mandoclevel wl |
|
curp->inttype = inttype; |
curp->inttype = inttype; |
curp->defos = defos; |
curp->defos = defos; |
|
|
curp->roff = roff_alloc(curp); |
curp->roff = roff_alloc(inttype, curp); |
return(curp); |
return(curp); |
} |
} |
|
|