version 1.152, 2010/06/29 19:20:38 |
version 1.155, 2010/07/01 23:01:47 |
Line 239 mdoc_parseln(struct mdoc *m, int ln, char *buf, int of |
|
Line 239 mdoc_parseln(struct mdoc *m, int ln, char *buf, int of |
|
return(0); |
return(0); |
|
|
m->flags |= MDOC_NEWLINE; |
m->flags |= MDOC_NEWLINE; |
|
|
|
/* |
|
* Let the roff nS register switch SYNOPSIS mode early, |
|
* such that the parser knows at all times |
|
* whether this mode is on or off. |
|
* Note that this mode is also switched by the Sh macro. |
|
*/ |
|
if (m->regs->regs[(int)REG_nS].set) { |
|
if (m->regs->regs[(int)REG_nS].v.u) |
|
m->flags |= MDOC_SYNOPSIS; |
|
else |
|
m->flags &= ~MDOC_SYNOPSIS; |
|
} |
|
|
return(('.' == buf[offs] || '\'' == buf[offs]) ? |
return(('.' == buf[offs] || '\'' == buf[offs]) ? |
mdoc_pmacro(m, ln, buf, offs) : |
mdoc_pmacro(m, ln, buf, offs) : |
mdoc_ptext(m, ln, buf, offs)); |
mdoc_ptext(m, ln, buf, offs)); |
Line 373 node_alloc(struct mdoc *m, int line, int pos, |
|
Line 387 node_alloc(struct mdoc *m, int line, int pos, |
|
|
|
/* Flag analysis. */ |
/* Flag analysis. */ |
|
|
|
if (MDOC_SYNOPSIS & m->flags) |
|
p->flags |= MDOC_SYNPRETTY; |
|
else |
|
p->flags &= ~MDOC_SYNPRETTY; |
if (MDOC_NEWLINE & m->flags) |
if (MDOC_NEWLINE & m->flags) |
p->flags |= MDOC_LINE; |
p->flags |= MDOC_LINE; |
m->flags &= ~MDOC_NEWLINE; |
m->flags &= ~MDOC_NEWLINE; |
|
|
/* Section analysis. */ |
|
|
|
if (SEC_SYNOPSIS == p->sec) |
|
p->flags |= MDOC_SYNPRETTY; |
|
|
|
/* Register analysis. */ |
|
|
|
if (m->regs->regs[(int)REG_nS].set) { |
|
if (m->regs->regs[(int)REG_nS].v.u) |
|
p->flags |= MDOC_SYNPRETTY; |
|
else |
|
p->flags &= ~MDOC_SYNPRETTY; |
|
} |
|
|
|
return(p); |
return(p); |
} |
} |
|
|
Line 510 mdoc_word_alloc(struct mdoc *m, int line, int pos, con |
|
Line 514 mdoc_word_alloc(struct mdoc *m, int line, int pos, con |
|
} |
} |
|
|
|
|
void |
static void |
mdoc_node_free(struct mdoc_node *p) |
mdoc_node_free(struct mdoc_node *p) |
{ |
{ |
|
|
|
if (MDOC_Bd == p->tok && MDOC_BLOCK == p->type) |
|
if (p->data.Bd) |
|
free(p->data.Bd); |
|
if (MDOC_Bl == p->tok && MDOC_BLOCK == p->type) |
|
if (p->data.Bl) |
|
free(p->data.Bl); |
|
|
if (p->string) |
if (p->string) |
free(p->string); |
free(p->string); |
if (p->args) |
if (p->args) |
Line 606 mdoc_ptext(struct mdoc *m, int line, char *buf, int of |
|
Line 617 mdoc_ptext(struct mdoc *m, int line, char *buf, int of |
|
*/ |
*/ |
|
|
if (MDOC_Bl == n->tok && MDOC_BODY == n->type && |
if (MDOC_Bl == n->tok && MDOC_BODY == n->type && |
LIST_column == n->data.Bl.type) { |
LIST_column == n->data.Bl->type) { |
/* `Bl' is open without any children. */ |
/* `Bl' is open without any children. */ |
m->flags |= MDOC_FREECOL; |
m->flags |= MDOC_FREECOL; |
return(mdoc_macro(m, MDOC_It, line, offs, &offs, buf)); |
return(mdoc_macro(m, MDOC_It, line, offs, &offs, buf)); |
Line 615 mdoc_ptext(struct mdoc *m, int line, char *buf, int of |
|
Line 626 mdoc_ptext(struct mdoc *m, int line, char *buf, int of |
|
if (MDOC_It == n->tok && MDOC_BLOCK == n->type && |
if (MDOC_It == n->tok && MDOC_BLOCK == n->type && |
NULL != n->parent && |
NULL != n->parent && |
MDOC_Bl == n->parent->tok && |
MDOC_Bl == n->parent->tok && |
LIST_column == n->parent->data.Bl.type) { |
LIST_column == n->parent->data.Bl->type) { |
/* `Bl' has block-level `It' children. */ |
/* `Bl' has block-level `It' children. */ |
m->flags |= MDOC_FREECOL; |
m->flags |= MDOC_FREECOL; |
return(mdoc_macro(m, MDOC_It, line, offs, &offs, buf)); |
return(mdoc_macro(m, MDOC_It, line, offs, &offs, buf)); |
Line 727 macrowarn(struct mdoc *m, int ln, const char *buf, int |
|
Line 738 macrowarn(struct mdoc *m, int ln, const char *buf, int |
|
* Parse a macro line, that is, a line beginning with the control |
* Parse a macro line, that is, a line beginning with the control |
* character. |
* character. |
*/ |
*/ |
int |
static int |
mdoc_pmacro(struct mdoc *m, int ln, char *buf, int offs) |
mdoc_pmacro(struct mdoc *m, int ln, char *buf, int offs) |
{ |
{ |
enum mdoct tok; |
enum mdoct tok; |
Line 821 mdoc_pmacro(struct mdoc *m, int ln, char *buf, int off |
|
Line 832 mdoc_pmacro(struct mdoc *m, int ln, char *buf, int off |
|
*/ |
*/ |
|
|
if (MDOC_Bl == n->tok && MDOC_BODY == n->type && |
if (MDOC_Bl == n->tok && MDOC_BODY == n->type && |
LIST_column == n->data.Bl.type) { |
LIST_column == n->data.Bl->type) { |
m->flags |= MDOC_FREECOL; |
m->flags |= MDOC_FREECOL; |
if ( ! mdoc_macro(m, MDOC_It, ln, sv, &sv, buf)) |
if ( ! mdoc_macro(m, MDOC_It, ln, sv, &sv, buf)) |
goto err; |
goto err; |
Line 837 mdoc_pmacro(struct mdoc *m, int ln, char *buf, int off |
|
Line 848 mdoc_pmacro(struct mdoc *m, int ln, char *buf, int off |
|
if (MDOC_It == n->tok && MDOC_BLOCK == n->type && |
if (MDOC_It == n->tok && MDOC_BLOCK == n->type && |
NULL != n->parent && |
NULL != n->parent && |
MDOC_Bl == n->parent->tok && |
MDOC_Bl == n->parent->tok && |
LIST_column == n->parent->data.Bl.type) { |
LIST_column == n->parent->data.Bl->type) { |
m->flags |= MDOC_FREECOL; |
m->flags |= MDOC_FREECOL; |
if ( ! mdoc_macro(m, MDOC_It, ln, sv, &sv, buf)) |
if ( ! mdoc_macro(m, MDOC_It, ln, sv, &sv, buf)) |
goto err; |
goto err; |