version 1.9, 2011/03/15 16:23:51 |
version 1.12, 2011/09/18 14:14:15 |
|
|
/* $Id$ */ |
/* $Id$ */ |
/* |
/* |
* Copyright (c) 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv> |
* Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> |
* |
* |
* 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 |
|
|
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
*/ |
*/ |
|
#ifdef HAVE_CONFIG_H |
|
#include "config.h" |
|
#endif |
|
|
#include <ctype.h> |
#include <ctype.h> |
#include <stdio.h> |
#include <stdio.h> |
#include <stdlib.h> |
#include <stdlib.h> |
#include <string.h> |
#include <string.h> |
|
|
#include "mandoc.h" |
#include "mandoc.h" |
|
#include "libmandoc.h" |
#include "libroff.h" |
#include "libroff.h" |
|
|
enum tbl_ident { |
enum tbl_ident { |
Line 88 arg(struct tbl_node *tbl, int ln, const char *p, int * |
|
Line 93 arg(struct tbl_node *tbl, int ln, const char *p, int * |
|
/* Arguments always begin with a parenthesis. */ |
/* Arguments always begin with a parenthesis. */ |
|
|
if ('(' != p[*pos]) { |
if ('(' != p[*pos]) { |
TBL_MSG(tbl, MANDOCERR_TBL, ln, *pos); |
mandoc_msg(MANDOCERR_TBL, tbl->parse, |
|
ln, *pos, NULL); |
return(0); |
return(0); |
} |
} |
|
|
Line 103 arg(struct tbl_node *tbl, int ln, const char *p, int * |
|
Line 109 arg(struct tbl_node *tbl, int ln, const char *p, int * |
|
switch (key) { |
switch (key) { |
case (KEY_DELIM): |
case (KEY_DELIM): |
if ('\0' == p[(*pos)++]) { |
if ('\0' == p[(*pos)++]) { |
TBL_MSG(tbl, MANDOCERR_TBL, ln, *pos - 1); |
mandoc_msg(MANDOCERR_TBL, tbl->parse, |
|
ln, *pos - 1, NULL); |
return(0); |
return(0); |
} |
} |
|
|
if ('\0' == p[(*pos)++]) { |
if ('\0' == p[(*pos)++]) { |
TBL_MSG(tbl, MANDOCERR_TBL, ln, *pos - 1); |
mandoc_msg(MANDOCERR_TBL, tbl->parse, |
|
ln, *pos - 1, NULL); |
return(0); |
return(0); |
} |
} |
break; |
break; |
Line 116 arg(struct tbl_node *tbl, int ln, const char *p, int * |
|
Line 124 arg(struct tbl_node *tbl, int ln, const char *p, int * |
|
if ('\0' != (tbl->opts.tab = p[(*pos)++])) |
if ('\0' != (tbl->opts.tab = p[(*pos)++])) |
break; |
break; |
|
|
TBL_MSG(tbl, MANDOCERR_TBL, ln, *pos - 1); |
mandoc_msg(MANDOCERR_TBL, tbl->parse, |
|
ln, *pos - 1, NULL); |
return(0); |
return(0); |
case (KEY_LINESIZE): |
case (KEY_LINESIZE): |
for (i = 0; i < KEY_MAXNUMSZ && p[*pos]; i++, (*pos)++) { |
for (i = 0; i < KEY_MAXNUMSZ && p[*pos]; i++, (*pos)++) { |
Line 131 arg(struct tbl_node *tbl, int ln, const char *p, int * |
|
Line 140 arg(struct tbl_node *tbl, int ln, const char *p, int * |
|
break; |
break; |
} |
} |
|
|
(*tbl->msg)(MANDOCERR_TBL, tbl->data, ln, *pos, NULL); |
mandoc_msg(MANDOCERR_TBL, tbl->parse, ln, *pos, NULL); |
return(0); |
return(0); |
case (KEY_DPOINT): |
case (KEY_DPOINT): |
if ('\0' != (tbl->opts.decimal = p[(*pos)++])) |
if ('\0' != (tbl->opts.decimal = p[(*pos)++])) |
break; |
break; |
|
|
TBL_MSG(tbl, MANDOCERR_TBL, ln, *pos - 1); |
mandoc_msg(MANDOCERR_TBL, tbl->parse, |
|
ln, *pos - 1, NULL); |
return(0); |
return(0); |
default: |
default: |
abort(); |
abort(); |
Line 149 arg(struct tbl_node *tbl, int ln, const char *p, int * |
|
Line 159 arg(struct tbl_node *tbl, int ln, const char *p, int * |
|
if (')' == p[(*pos)++]) |
if (')' == p[(*pos)++]) |
return(1); |
return(1); |
|
|
TBL_MSG(tbl, MANDOCERR_TBL, ln, *pos - 1); |
mandoc_msg(MANDOCERR_TBL, tbl->parse, ln, *pos - 1, NULL); |
return(0); |
return(0); |
} |
} |
|
|
|
|
/* Exit if buffer is empty (or overrun). */ |
/* Exit if buffer is empty (or overrun). */ |
|
|
if (KEY_MAXNAME == i || 0 == i) { |
if (KEY_MAXNAME == i || 0 == i) { |
TBL_MSG(tbl, MANDOCERR_TBL, ln, *pos); |
mandoc_msg(MANDOCERR_TBL, tbl->parse, ln, *pos, NULL); |
return; |
return; |
} |
} |
|
|
|
|
*/ |
*/ |
|
|
if (KEY_MAXKEYS == i) |
if (KEY_MAXKEYS == i) |
TBL_MSG(tbl, MANDOCERR_TBLOPT, ln, sv); |
mandoc_msg(MANDOCERR_TBLOPT, tbl->parse, ln, sv, NULL); |
|
|
goto again; |
goto again; |
/* NOTREACHED */ |
/* NOTREACHED */ |