version 1.183, 2015/02/12 12:24:33 |
version 1.184, 2015/04/02 21:36:50 |
|
|
* purpose with or without fee is hereby granted, provided that the above |
* purpose with or without fee is hereby granted, provided that the above |
* copyright notice and this permission notice appear in all copies. |
* copyright notice and this permission notice appear in all copies. |
* |
* |
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHORS DISCLAIM ALL WARRANTIES |
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR |
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR |
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
|
|
#include <string.h> |
#include <string.h> |
#include <time.h> |
#include <time.h> |
|
|
#include "mdoc.h" |
|
#include "mandoc.h" |
#include "mandoc.h" |
#include "libmdoc.h" |
#include "roff.h" |
|
#include "mdoc.h" |
#include "libmandoc.h" |
#include "libmandoc.h" |
|
#include "libmdoc.h" |
|
|
static void blk_full(MACRO_PROT_ARGS); |
static void blk_full(MACRO_PROT_ARGS); |
static void blk_exp_close(MACRO_PROT_ARGS); |
static void blk_exp_close(MACRO_PROT_ARGS); |
Line 217 mdoc_macroend(struct mdoc *mdoc) |
|
Line 218 mdoc_macroend(struct mdoc *mdoc) |
|
mdoc->last->parent : mdoc->last; |
mdoc->last->parent : mdoc->last; |
|
|
for ( ; n; n = n->parent) |
for ( ; n; n = n->parent) |
if (n->type == MDOC_BLOCK && |
if (n->type == ROFFT_BLOCK && |
mdoc_macros[n->tok].flags & MDOC_EXPLICIT) |
mdoc_macros[n->tok].flags & MDOC_EXPLICIT) |
mandoc_msg(MANDOCERR_BLK_NOEND, mdoc->parse, |
mandoc_msg(MANDOCERR_BLK_NOEND, mdoc->parse, |
n->line, n->pos, mdoc_macronames[n->tok]); |
n->line, n->pos, mdoc_macronames[n->tok]); |
Line 287 rew_pending(struct mdoc *mdoc, const struct mdoc_node |
|
Line 288 rew_pending(struct mdoc *mdoc, const struct mdoc_node |
|
rew_last(mdoc, n); |
rew_last(mdoc, n); |
|
|
switch (n->type) { |
switch (n->type) { |
case MDOC_HEAD: |
case ROFFT_HEAD: |
mdoc_body_alloc(mdoc, n->line, n->pos, n->tok); |
mdoc_body_alloc(mdoc, n->line, n->pos, n->tok); |
return; |
return; |
case MDOC_BLOCK: |
case ROFFT_BLOCK: |
break; |
break; |
default: |
default: |
return; |
return; |
Line 303 rew_pending(struct mdoc *mdoc, const struct mdoc_node |
|
Line 304 rew_pending(struct mdoc *mdoc, const struct mdoc_node |
|
if ((n = n->parent) == NULL) |
if ((n = n->parent) == NULL) |
return; |
return; |
|
|
if (n->type == MDOC_BLOCK || |
if (n->type == ROFFT_BLOCK || |
n->type == MDOC_HEAD) { |
n->type == ROFFT_HEAD) { |
if (n->flags & MDOC_ENDED) |
if (n->flags & MDOC_ENDED) |
break; |
break; |
else |
else |
Line 366 rew_elem(struct mdoc *mdoc, enum mdoct tok) |
|
Line 367 rew_elem(struct mdoc *mdoc, enum mdoct tok) |
|
struct mdoc_node *n; |
struct mdoc_node *n; |
|
|
n = mdoc->last; |
n = mdoc->last; |
if (MDOC_ELEM != n->type) |
if (n->type != ROFFT_ELEM) |
n = n->parent; |
n = n->parent; |
assert(MDOC_ELEM == n->type); |
assert(n->type == ROFFT_ELEM); |
assert(tok == n->tok); |
assert(tok == n->tok); |
rew_last(mdoc, n); |
rew_last(mdoc, n); |
} |
} |
Line 387 dword(struct mdoc *mdoc, int line, int col, const char |
|
Line 388 dword(struct mdoc *mdoc, int line, int col, const char |
|
|
|
if (may_append && |
if (may_append && |
! (mdoc->flags & (MDOC_SYNOPSIS | MDOC_KEEP | MDOC_SMOFF)) && |
! (mdoc->flags & (MDOC_SYNOPSIS | MDOC_KEEP | MDOC_SMOFF)) && |
d == DELIM_NONE && mdoc->last->type == MDOC_TEXT && |
d == DELIM_NONE && mdoc->last->type == ROFFT_TEXT && |
mdoc_isdelim(mdoc->last->string) == DELIM_NONE) { |
mdoc_isdelim(mdoc->last->string) == DELIM_NONE) { |
mdoc_word_append(mdoc, p); |
mdoc_word_append(mdoc, p); |
return; |
return; |
Line 522 blk_exp_close(MACRO_PROT_ARGS) |
|
Line 523 blk_exp_close(MACRO_PROT_ARGS) |
|
|
|
/* Remember the start of our own body. */ |
/* Remember the start of our own body. */ |
|
|
if (n->type == MDOC_BODY && atok == n->tok) { |
if (n->type == ROFFT_BODY && atok == n->tok) { |
if (n->end == ENDBODY_NOT) |
if (n->end == ENDBODY_NOT) |
body = n; |
body = n; |
continue; |
continue; |
} |
} |
|
|
if (n->type != MDOC_BLOCK || n->tok == MDOC_Nm) |
if (n->type != ROFFT_BLOCK || n->tok == MDOC_Nm) |
continue; |
continue; |
|
|
if (n->tok == MDOC_It) { |
if (n->tok == MDOC_It) { |
Line 873 blk_full(MACRO_PROT_ARGS) |
|
Line 874 blk_full(MACRO_PROT_ARGS) |
|
n->flags |= MDOC_BROKEN; |
n->flags |= MDOC_BROKEN; |
continue; |
continue; |
} |
} |
if (n->type != MDOC_BLOCK) |
if (n->type != ROFFT_BLOCK) |
continue; |
continue; |
|
|
if (tok == MDOC_It && n->tok == MDOC_Bl) { |
if (tok == MDOC_It && n->tok == MDOC_Bl) { |
Line 1016 blk_full(MACRO_PROT_ARGS) |
|
Line 1017 blk_full(MACRO_PROT_ARGS) |
|
|
|
/* |
/* |
* Emit leading punctuation (i.e., punctuation before |
* Emit leading punctuation (i.e., punctuation before |
* the MDOC_HEAD) for non-phrase types. |
* the ROFFT_HEAD) for non-phrase types. |
*/ |
*/ |
|
|
if (head == NULL && |
if (head == NULL && |
Line 1086 blk_full(MACRO_PROT_ARGS) |
|
Line 1087 blk_full(MACRO_PROT_ARGS) |
|
n->flags |= MDOC_BROKEN; |
n->flags |= MDOC_BROKEN; |
continue; |
continue; |
} |
} |
if (n->type == MDOC_BLOCK && |
if (n->type == ROFFT_BLOCK && |
mdoc_macros[n->tok].flags & MDOC_EXPLICIT) { |
mdoc_macros[n->tok].flags & MDOC_EXPLICIT) { |
n->flags = MDOC_BROKEN; |
n->flags = MDOC_BROKEN; |
head->flags = MDOC_ENDED; |
head->flags = MDOC_ENDED; |
Line 1171 blk_part_imp(MACRO_PROT_ARGS) |
|
Line 1172 blk_part_imp(MACRO_PROT_ARGS) |
|
n->flags |= MDOC_BROKEN; |
n->flags |= MDOC_BROKEN; |
continue; |
continue; |
} |
} |
if (n->type == MDOC_BLOCK && |
if (n->type == ROFFT_BLOCK && |
mdoc_macros[n->tok].flags & MDOC_EXPLICIT) { |
mdoc_macros[n->tok].flags & MDOC_EXPLICIT) { |
n->flags |= MDOC_BROKEN; |
n->flags |= MDOC_BROKEN; |
if ( ! (body->flags & MDOC_ENDED)) { |
if ( ! (body->flags & MDOC_ENDED)) { |
Line 1452 phrase_ta(MACRO_PROT_ARGS) |
|
Line 1453 phrase_ta(MACRO_PROT_ARGS) |
|
for (n = mdoc->last; n != NULL; n = n->parent) { |
for (n = mdoc->last; n != NULL; n = n->parent) { |
if (n->flags & MDOC_ENDED) |
if (n->flags & MDOC_ENDED) |
continue; |
continue; |
if (n->tok == MDOC_It && n->type == MDOC_BODY) |
if (n->tok == MDOC_It && n->type == ROFFT_BODY) |
body = n; |
body = n; |
if (n->tok == MDOC_Bl) |
if (n->tok == MDOC_Bl) |
break; |
break; |