version 1.109, 2010/07/04 21:59:30 |
version 1.112, 2010/07/20 14:56:42 |
|
|
/* $Id$ */ |
/* $Id$ */ |
/* |
/* |
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@bsd.lv> |
* Copyright (c) 2008, 2009, 2010 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 |
|
|
#include "libmandoc.h" |
#include "libmandoc.h" |
|
|
/* FIXME: .Bl -diag can't have non-text children in HEAD. */ |
/* FIXME: .Bl -diag can't have non-text children in HEAD. */ |
/* TODO: ignoring Pp (it's superfluous in some invocations). */ |
|
|
|
#define PRE_ARGS struct mdoc *mdoc, struct mdoc_node *n |
#define PRE_ARGS struct mdoc *mdoc, struct mdoc_node *n |
#define POST_ARGS struct mdoc *mdoc |
#define POST_ARGS struct mdoc *mdoc |
Line 454 check_argv(struct mdoc *m, struct mdoc_node *n, struct |
|
Line 453 check_argv(struct mdoc *m, struct mdoc_node *n, struct |
|
|
|
|
|
static int |
static int |
check_text(struct mdoc *mdoc, int line, int pos, char *p) |
check_text(struct mdoc *m, int ln, int pos, char *p) |
{ |
{ |
int c; |
int c; |
|
size_t sz; |
|
|
/* |
|
* FIXME: we absolutely cannot let \b get through or it will |
|
* destroy some assumptions in terms of format. |
|
*/ |
|
|
|
for ( ; *p; p++, pos++) { |
for ( ; *p; p++, pos++) { |
|
sz = strcspn(p, "\t\\"); |
|
p += (int)sz; |
|
|
|
if ('\0' == *p) |
|
break; |
|
|
|
pos += (int)sz; |
|
|
if ('\t' == *p) { |
if ('\t' == *p) { |
if ( ! (MDOC_LITERAL & mdoc->flags)) |
if (MDOC_LITERAL & m->flags) |
if ( ! mdoc_pmsg(mdoc, line, pos, MANDOCERR_BADCHAR)) |
continue; |
return(0); |
if (mdoc_pmsg(m, ln, pos, MANDOCERR_BADTAB)) |
} else if ( ! isprint((u_char)*p) && ASCII_HYPH != *p) |
continue; |
if ( ! mdoc_pmsg(mdoc, line, pos, MANDOCERR_BADCHAR)) |
return(0); |
return(0); |
} |
|
|
if ('\\' != *p) |
/* Check the special character. */ |
continue; |
|
|
|
c = mandoc_special(p); |
c = mandoc_special(p); |
if (c) { |
if (c) { |
Line 482 check_text(struct mdoc *mdoc, int line, int pos, char |
|
Line 484 check_text(struct mdoc *mdoc, int line, int pos, char |
|
continue; |
continue; |
} |
} |
|
|
c = mdoc_pmsg(mdoc, line, pos, MANDOCERR_BADESCAPE); |
c = mdoc_pmsg(m, ln, pos, MANDOCERR_BADESCAPE); |
if ( ! (MDOC_IGN_ESCAPE & mdoc->pflags) && ! c) |
if ( ! (MDOC_IGN_ESCAPE & m->pflags) && ! c) |
return(c); |
return(c); |
} |
} |
|
|
Line 491 check_text(struct mdoc *mdoc, int line, int pos, char |
|
Line 493 check_text(struct mdoc *mdoc, int line, int pos, char |
|
} |
} |
|
|
|
|
|
|
|
|
static int |
static int |
check_parent(PRE_ARGS, enum mdoct tok, enum mdoc_type t) |
check_parent(PRE_ARGS, enum mdoct tok, enum mdoc_type t) |
{ |
{ |
Line 508 check_parent(PRE_ARGS, enum mdoct tok, enum mdoc_type |
|
Line 508 check_parent(PRE_ARGS, enum mdoct tok, enum mdoc_type |
|
mdoc_macronames[tok]); |
mdoc_macronames[tok]); |
return(0); |
return(0); |
} |
} |
|
|
|
|
|
|
static int |
static int |