version 1.75, 2010/05/31 10:28:04 |
version 1.81, 2010/06/26 16:07:08 |
|
|
/* $Id$ */ |
/* $Id$ */ |
/* |
/* |
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se> |
* Copyright (c) 2008, 2009 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 |
Line 50 static int append_delims(struct mdoc *, |
|
Line 50 static int append_delims(struct mdoc *, |
|
int, int *, char *); |
int, int *, char *); |
static enum mdoct lookup(enum mdoct, const char *); |
static enum mdoct lookup(enum mdoct, const char *); |
static enum mdoct lookup_raw(const char *); |
static enum mdoct lookup_raw(const char *); |
static int phrase(struct mdoc *, int, int, char *); |
static int phrase(struct mdoc *, |
|
const struct regset *, |
|
int, int, char *); |
static enum mdoct rew_alt(enum mdoct); |
static enum mdoct rew_alt(enum mdoct); |
static int rew_dobreak(enum mdoct, |
static int rew_dobreak(enum mdoct, |
const struct mdoc_node *); |
const struct mdoc_node *); |
Line 739 blk_exp_close(MACRO_PROT_ARGS) |
|
Line 741 blk_exp_close(MACRO_PROT_ARGS) |
|
return(0); |
return(0); |
flushed = 1; |
flushed = 1; |
} |
} |
if ( ! mdoc_macro(m, ntok, line, lastarg, pos, buf)) |
if ( ! mdoc_macro(m, regs, ntok, line, lastarg, pos, buf)) |
return(0); |
return(0); |
break; |
break; |
} |
} |
Line 840 in_line(MACRO_PROT_ARGS) |
|
Line 842 in_line(MACRO_PROT_ARGS) |
|
if ( ! mdoc_pmsg(m, line, ppos, MANDOCERR_MACROEMPTY)) |
if ( ! mdoc_pmsg(m, line, ppos, MANDOCERR_MACROEMPTY)) |
return(0); |
return(0); |
} |
} |
if ( ! mdoc_macro(m, ntok, line, la, pos, buf)) |
if ( ! mdoc_macro(m, regs, ntok, line, la, pos, buf)) |
return(0); |
return(0); |
if ( ! nl) |
if ( ! nl) |
return(1); |
return(1); |
Line 1086 blk_full(MACRO_PROT_ARGS) |
|
Line 1088 blk_full(MACRO_PROT_ARGS) |
|
if (ARGS_PEND == ac && ARGS_PPHRASE == lac) |
if (ARGS_PEND == ac && ARGS_PPHRASE == lac) |
m->flags |= MDOC_PPHRASE; |
m->flags |= MDOC_PPHRASE; |
|
|
if ( ! phrase(m, line, la, buf)) |
if ( ! phrase(m, regs, line, la, buf)) |
return(0); |
return(0); |
|
|
m->flags &= ~MDOC_PPHRASE; |
m->flags &= ~MDOC_PPHRASE; |
Line 1101 blk_full(MACRO_PROT_ARGS) |
|
Line 1103 blk_full(MACRO_PROT_ARGS) |
|
continue; |
continue; |
} |
} |
|
|
if ( ! mdoc_macro(m, ntok, line, la, pos, buf)) |
if ( ! mdoc_macro(m, regs, ntok, line, la, pos, buf)) |
return(0); |
return(0); |
break; |
break; |
} |
} |
Line 1118 blk_full(MACRO_PROT_ARGS) |
|
Line 1120 blk_full(MACRO_PROT_ARGS) |
|
/* If we've already opened our body, exit now. */ |
/* If we've already opened our body, exit now. */ |
|
|
if (NULL != body) |
if (NULL != body) |
return(1); |
goto out; |
|
|
#ifdef UGLY |
#ifdef UGLY |
/* |
/* |
Line 1145 blk_full(MACRO_PROT_ARGS) |
|
Line 1147 blk_full(MACRO_PROT_ARGS) |
|
if ( ! mdoc_body_alloc(m, line, ppos, tok)) |
if ( ! mdoc_body_alloc(m, line, ppos, tok)) |
return(0); |
return(0); |
|
|
|
out: |
|
if ( ! (MDOC_FREECOL & m->flags)) |
|
return(1); |
|
|
|
if ( ! rew_sub(MDOC_BODY, m, tok, line, ppos)) |
|
return(0); |
|
if ( ! rew_sub(MDOC_BLOCK, m, tok, line, ppos)) |
|
return(0); |
|
|
|
m->flags &= ~MDOC_FREECOL; |
return(1); |
return(1); |
} |
} |
|
|
Line 1219 blk_part_imp(MACRO_PROT_ARGS) |
|
Line 1231 blk_part_imp(MACRO_PROT_ARGS) |
|
continue; |
continue; |
} |
} |
|
|
if ( ! mdoc_macro(m, ntok, line, la, pos, buf)) |
if ( ! mdoc_macro(m, regs, ntok, line, la, pos, buf)) |
return(0); |
return(0); |
break; |
break; |
} |
} |
Line 1364 blk_part_exp(MACRO_PROT_ARGS) |
|
Line 1376 blk_part_exp(MACRO_PROT_ARGS) |
|
continue; |
continue; |
} |
} |
|
|
if ( ! mdoc_macro(m, ntok, line, la, pos, buf)) |
if ( ! mdoc_macro(m, regs, ntok, line, la, pos, buf)) |
return(0); |
return(0); |
break; |
break; |
} |
} |
Line 1483 in_line_argn(MACRO_PROT_ARGS) |
|
Line 1495 in_line_argn(MACRO_PROT_ARGS) |
|
if ( ! flushed && ! rew_elem(m, tok)) |
if ( ! flushed && ! rew_elem(m, tok)) |
return(0); |
return(0); |
flushed = 1; |
flushed = 1; |
if ( ! mdoc_macro(m, ntok, line, la, pos, buf)) |
if ( ! mdoc_macro(m, regs, ntok, line, la, pos, buf)) |
return(0); |
return(0); |
j++; |
j++; |
break; |
break; |
Line 1589 in_line_eoln(MACRO_PROT_ARGS) |
|
Line 1601 in_line_eoln(MACRO_PROT_ARGS) |
|
|
|
if ( ! rew_elem(m, tok)) |
if ( ! rew_elem(m, tok)) |
return(0); |
return(0); |
return(mdoc_macro(m, ntok, line, la, pos, buf)); |
return(mdoc_macro(m, regs, ntok, line, la, pos, buf)); |
} |
} |
|
|
/* Close out (no delimiters). */ |
/* Close out (no delimiters). */ |
Line 1608 ctx_synopsis(MACRO_PROT_ARGS) |
|
Line 1620 ctx_synopsis(MACRO_PROT_ARGS) |
|
|
|
/* If we're not in the SYNOPSIS, go straight to in-line. */ |
/* If we're not in the SYNOPSIS, go straight to in-line. */ |
if (SEC_SYNOPSIS != m->lastsec) |
if (SEC_SYNOPSIS != m->lastsec) |
return(in_line(m, tok, line, ppos, pos, buf)); |
return(in_line(m, regs, tok, line, ppos, pos, buf)); |
|
|
/* If we're a nested call, same place. */ |
/* If we're a nested call, same place. */ |
if ( ! nl) |
if ( ! nl) |
return(in_line(m, tok, line, ppos, pos, buf)); |
return(in_line(m, regs, tok, line, ppos, pos, buf)); |
|
|
/* |
/* |
* XXX: this will open a block scope; however, if later we end |
* XXX: this will open a block scope; however, if later we end |
Line 1620 ctx_synopsis(MACRO_PROT_ARGS) |
|
Line 1632 ctx_synopsis(MACRO_PROT_ARGS) |
|
* the formatting. Be careful. |
* the formatting. Be careful. |
*/ |
*/ |
|
|
return(blk_part_imp(m, tok, line, ppos, pos, buf)); |
return(blk_part_imp(m, regs, tok, line, ppos, pos, buf)); |
} |
} |
|
|
|
|
Line 1639 obsolete(MACRO_PROT_ARGS) |
|
Line 1651 obsolete(MACRO_PROT_ARGS) |
|
* macro is encountered. |
* macro is encountered. |
*/ |
*/ |
static int |
static int |
phrase(struct mdoc *m, int line, int ppos, char *buf) |
phrase(struct mdoc *m, const struct regset *regs, |
|
int line, int ppos, char *buf) |
{ |
{ |
int la, pos; |
int la, pos; |
enum margserr ac; |
enum margserr ac; |
Line 1664 phrase(struct mdoc *m, int line, int ppos, char *buf) |
|
Line 1677 phrase(struct mdoc *m, int line, int ppos, char *buf) |
|
continue; |
continue; |
} |
} |
|
|
if ( ! mdoc_macro(m, ntok, line, la, &pos, buf)) |
if ( ! mdoc_macro(m, regs, ntok, line, la, &pos, buf)) |
return(0); |
return(0); |
return(append_delims(m, line, &pos, buf)); |
return(append_delims(m, line, &pos, buf)); |
} |
} |
Line 1673 phrase(struct mdoc *m, int line, int ppos, char *buf) |
|
Line 1686 phrase(struct mdoc *m, int line, int ppos, char *buf) |
|
} |
} |
|
|
|
|
|
/* ARGSUSED */ |
static int |
static int |
phrase_ta(MACRO_PROT_ARGS) |
phrase_ta(MACRO_PROT_ARGS) |
{ |
{ |
int la; |
int la; |
enum mdoct ntok; |
enum mdoct ntok; |
enum margserr ac; |
enum margserr ac; |
struct mdoc_node *n; |
|
char *p; |
char *p; |
|
|
/* |
/* |
Line 1687 phrase_ta(MACRO_PROT_ARGS) |
|
Line 1700 phrase_ta(MACRO_PROT_ARGS) |
|
* it should simply error out with ARGSLOST. |
* it should simply error out with ARGSLOST. |
*/ |
*/ |
|
|
n = m->last; |
|
if ( ! rew_sub(MDOC_BODY, m, MDOC_It, line, ppos)) |
if ( ! rew_sub(MDOC_BODY, m, MDOC_It, line, ppos)) |
return(0); |
return(0); |
|
|
/* |
|
* FIXME: this is necessary in bogus constructions like |
|
* .Bl -column foo bar |
|
* .Sy foo Ta bar |
|
* It is, however, an ugly way to do it. |
|
* |
|
* XXX; remove this when the above construct builds an implied |
|
* `It' marker. |
|
*/ |
|
if (NULL == m->last || |
|
MDOC_BODY != m->last->type || |
|
MDOC_It != m->last->tok) { |
|
swarn(m, tok, line, ppos, n); |
|
return(0); |
|
} |
|
|
|
if ( ! mdoc_body_alloc(m, line, ppos, MDOC_It)) |
if ( ! mdoc_body_alloc(m, line, ppos, MDOC_It)) |
return(0); |
return(0); |
|
|
Line 1727 phrase_ta(MACRO_PROT_ARGS) |
|
Line 1722 phrase_ta(MACRO_PROT_ARGS) |
|
continue; |
continue; |
} |
} |
|
|
if ( ! mdoc_macro(m, ntok, line, la, pos, buf)) |
if ( ! mdoc_macro(m, regs, ntok, line, la, pos, buf)) |
return(0); |
return(0); |
return(append_delims(m, line, pos, buf)); |
return(append_delims(m, line, pos, buf)); |
} |
} |