=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/mandoc/mdoc_macro.c,v retrieving revision 1.79 retrieving revision 1.80 diff -c -r1.79 -r1.80 *** src/usr.bin/mandoc/mdoc_macro.c 2013/09/15 18:26:39 1.79 --- src/usr.bin/mandoc/mdoc_macro.c 2013/10/21 23:32:32 1.80 *************** *** 1,7 **** ! /* $Id: mdoc_macro.c,v 1.79 2013/09/15 18:26:39 schwarze Exp $ */ /* * Copyright (c) 2008-2012 Kristaps Dzonsons ! * Copyright (c) 2010, 2012 Ingo Schwarze * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above --- 1,7 ---- ! /* $Id: mdoc_macro.c,v 1.80 2013/10/21 23:32:32 schwarze Exp $ */ /* * Copyright (c) 2008-2012 Kristaps Dzonsons ! * Copyright (c) 2010, 2012, 2013 Ingo Schwarze * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above *************** *** 47,54 **** static int obsolete(MACRO_PROT_ARGS); static int phrase_ta(MACRO_PROT_ARGS); ! static int dword(struct mdoc *, int, int, ! const char *, enum mdelim); static int append_delims(struct mdoc *, int, int *, char *); static enum mdoct lookup(enum mdoct, const char *); --- 47,54 ---- static int obsolete(MACRO_PROT_ARGS); static int phrase_ta(MACRO_PROT_ARGS); ! static int dword(struct mdoc *, int, int, const char *, ! enum mdelim, int); static int append_delims(struct mdoc *, int, int *, char *); static enum mdoct lookup(enum mdoct, const char *); *************** *** 66,193 **** enum mdoct, int, int); const struct mdoc_macro __mdoc_macros[MDOC_MAX] = { ! { in_line_argn, MDOC_CALLABLE | MDOC_PARSED }, /* Ap */ { in_line_eoln, MDOC_PROLOGUE }, /* Dd */ { in_line_eoln, MDOC_PROLOGUE }, /* Dt */ { in_line_eoln, MDOC_PROLOGUE }, /* Os */ ! { blk_full, MDOC_PARSED }, /* Sh */ ! { blk_full, MDOC_PARSED }, /* Ss */ ! { in_line_eoln, 0 }, /* Pp */ ! { blk_part_imp, MDOC_PARSED }, /* D1 */ ! { blk_part_imp, MDOC_PARSED }, /* Dl */ { blk_full, MDOC_EXPLICIT }, /* Bd */ ! { blk_exp_close, MDOC_EXPLICIT }, /* Ed */ { blk_full, MDOC_EXPLICIT }, /* Bl */ ! { blk_exp_close, MDOC_EXPLICIT }, /* El */ ! { blk_full, MDOC_PARSED }, /* It */ ! { in_line, MDOC_CALLABLE | MDOC_PARSED }, /* Ad */ ! { in_line, MDOC_CALLABLE | MDOC_PARSED }, /* An */ { in_line, MDOC_CALLABLE | MDOC_PARSED }, /* Ar */ { in_line, MDOC_CALLABLE | MDOC_PARSED }, /* Cd */ { in_line, MDOC_CALLABLE | MDOC_PARSED }, /* Cm */ ! { in_line, MDOC_CALLABLE | MDOC_PARSED }, /* Dv */ ! { in_line, MDOC_CALLABLE | MDOC_PARSED }, /* Er */ ! { in_line, MDOC_CALLABLE | MDOC_PARSED }, /* Ev */ { in_line_eoln, 0 }, /* Ex */ ! { in_line, MDOC_CALLABLE | MDOC_PARSED }, /* Fa */ ! { in_line_eoln, 0 }, /* Fd */ { in_line, MDOC_CALLABLE | MDOC_PARSED }, /* Fl */ ! { in_line, MDOC_CALLABLE | MDOC_PARSED }, /* Fn */ ! { in_line, MDOC_CALLABLE | MDOC_PARSED }, /* Ft */ ! { in_line, MDOC_CALLABLE | MDOC_PARSED }, /* Ic */ { in_line_argn, MDOC_CALLABLE | MDOC_PARSED }, /* In */ ! { in_line, MDOC_CALLABLE | MDOC_PARSED }, /* Li */ ! { blk_full, 0 }, /* Nd */ ! { ctx_synopsis, MDOC_CALLABLE | MDOC_PARSED }, /* Nm */ { blk_part_imp, MDOC_CALLABLE | MDOC_PARSED }, /* Op */ { obsolete, 0 }, /* Ot */ { in_line, MDOC_CALLABLE | MDOC_PARSED }, /* Pa */ { in_line_eoln, 0 }, /* Rv */ ! { in_line_argn, MDOC_CALLABLE | MDOC_PARSED }, /* St */ { in_line, MDOC_CALLABLE | MDOC_PARSED }, /* Va */ ! { ctx_synopsis, MDOC_CALLABLE | MDOC_PARSED }, /* Vt */ { in_line_argn, MDOC_CALLABLE | MDOC_PARSED }, /* Xr */ ! { in_line_eoln, 0 }, /* %A */ ! { in_line_eoln, 0 }, /* %B */ ! { in_line_eoln, 0 }, /* %D */ ! { in_line_eoln, 0 }, /* %I */ ! { in_line_eoln, 0 }, /* %J */ { in_line_eoln, 0 }, /* %N */ ! { in_line_eoln, 0 }, /* %O */ { in_line_eoln, 0 }, /* %P */ ! { in_line_eoln, 0 }, /* %R */ ! { in_line_eoln, 0 }, /* %T */ { in_line_eoln, 0 }, /* %V */ ! { blk_exp_close, MDOC_EXPLICIT | MDOC_CALLABLE | MDOC_PARSED }, /* Ac */ ! { blk_part_exp, MDOC_CALLABLE | MDOC_PARSED | MDOC_EXPLICIT }, /* Ao */ ! { blk_part_imp, MDOC_CALLABLE | MDOC_PARSED }, /* Aq */ { in_line_argn, MDOC_CALLABLE | MDOC_PARSED }, /* At */ ! { blk_exp_close, MDOC_EXPLICIT | MDOC_CALLABLE | MDOC_PARSED }, /* Bc */ ! { blk_full, MDOC_EXPLICIT }, /* Bf */ ! { blk_part_exp, MDOC_CALLABLE | MDOC_PARSED | MDOC_EXPLICIT }, /* Bo */ ! { blk_part_imp, MDOC_CALLABLE | MDOC_PARSED }, /* Bq */ { in_line_argn, MDOC_CALLABLE | MDOC_PARSED }, /* Bsx */ { in_line_argn, MDOC_CALLABLE | MDOC_PARSED }, /* Bx */ { in_line_eoln, 0 }, /* Db */ ! { blk_exp_close, MDOC_EXPLICIT | MDOC_CALLABLE | MDOC_PARSED }, /* Dc */ ! { blk_part_exp, MDOC_CALLABLE | MDOC_PARSED | MDOC_EXPLICIT }, /* Do */ ! { blk_part_imp, MDOC_CALLABLE | MDOC_PARSED }, /* Dq */ ! { blk_exp_close, MDOC_EXPLICIT | MDOC_CALLABLE | MDOC_PARSED }, /* Ec */ ! { blk_exp_close, MDOC_EXPLICIT }, /* Ef */ ! { in_line, MDOC_CALLABLE | MDOC_PARSED }, /* Em */ { blk_part_exp, MDOC_CALLABLE | MDOC_PARSED | MDOC_EXPLICIT }, /* Eo */ { in_line_argn, MDOC_CALLABLE | MDOC_PARSED }, /* Fx */ { in_line, MDOC_CALLABLE | MDOC_PARSED }, /* Ms */ ! { in_line_argn, MDOC_CALLABLE | MDOC_PARSED | MDOC_IGNDELIM }, /* No */ ! { in_line_argn, MDOC_CALLABLE | MDOC_PARSED | MDOC_IGNDELIM }, /* Ns */ { in_line_argn, MDOC_CALLABLE | MDOC_PARSED }, /* Nx */ { in_line_argn, MDOC_CALLABLE | MDOC_PARSED }, /* Ox */ ! { blk_exp_close, MDOC_EXPLICIT | MDOC_CALLABLE | MDOC_PARSED }, /* Pc */ { in_line_argn, MDOC_CALLABLE | MDOC_PARSED | MDOC_IGNDELIM }, /* Pf */ ! { blk_part_exp, MDOC_CALLABLE | MDOC_PARSED | MDOC_EXPLICIT }, /* Po */ ! { blk_part_imp, MDOC_CALLABLE | MDOC_PARSED }, /* Pq */ ! { blk_exp_close, MDOC_EXPLICIT | MDOC_CALLABLE | MDOC_PARSED }, /* Qc */ ! { blk_part_imp, MDOC_CALLABLE | MDOC_PARSED }, /* Ql */ ! { blk_part_exp, MDOC_CALLABLE | MDOC_PARSED | MDOC_EXPLICIT }, /* Qo */ ! { blk_part_imp, MDOC_CALLABLE | MDOC_PARSED }, /* Qq */ ! { blk_exp_close, MDOC_EXPLICIT }, /* Re */ { blk_full, MDOC_EXPLICIT }, /* Rs */ ! { blk_exp_close, MDOC_EXPLICIT | MDOC_CALLABLE | MDOC_PARSED }, /* Sc */ ! { blk_part_exp, MDOC_CALLABLE | MDOC_PARSED | MDOC_EXPLICIT }, /* So */ ! { blk_part_imp, MDOC_CALLABLE | MDOC_PARSED }, /* Sq */ { in_line_eoln, 0 }, /* Sm */ ! { in_line, MDOC_CALLABLE | MDOC_PARSED }, /* Sx */ ! { in_line, MDOC_CALLABLE | MDOC_PARSED }, /* Sy */ { in_line, MDOC_CALLABLE | MDOC_PARSED }, /* Tn */ ! { in_line_argn, MDOC_CALLABLE | MDOC_PARSED }, /* Ux */ { blk_exp_close, MDOC_EXPLICIT | MDOC_CALLABLE | MDOC_PARSED }, /* Xc */ { blk_part_exp, MDOC_CALLABLE | MDOC_PARSED | MDOC_EXPLICIT }, /* Xo */ ! { blk_full, MDOC_EXPLICIT | MDOC_CALLABLE }, /* Fo */ ! { blk_exp_close, MDOC_EXPLICIT | MDOC_CALLABLE | MDOC_PARSED }, /* Fc */ ! { blk_part_exp, MDOC_CALLABLE | MDOC_PARSED | MDOC_EXPLICIT }, /* Oo */ ! { blk_exp_close, MDOC_EXPLICIT | MDOC_CALLABLE | MDOC_PARSED }, /* Oc */ { blk_full, MDOC_EXPLICIT }, /* Bk */ ! { blk_exp_close, MDOC_EXPLICIT }, /* Ek */ { in_line_eoln, 0 }, /* Bt */ { in_line_eoln, 0 }, /* Hf */ { obsolete, 0 }, /* Fr */ { in_line_eoln, 0 }, /* Ud */ { in_line, 0 }, /* Lb */ ! { in_line_eoln, 0 }, /* Lp */ ! { in_line, MDOC_CALLABLE | MDOC_PARSED }, /* Lk */ ! { in_line, MDOC_CALLABLE | MDOC_PARSED }, /* Mt */ ! { blk_part_imp, MDOC_CALLABLE | MDOC_PARSED }, /* Brq */ ! { blk_part_exp, MDOC_CALLABLE | MDOC_PARSED | MDOC_EXPLICIT }, /* Bro */ ! { blk_exp_close, MDOC_EXPLICIT | MDOC_CALLABLE | MDOC_PARSED }, /* Brc */ ! { in_line_eoln, 0 }, /* %C */ { obsolete, 0 }, /* Es */ { obsolete, 0 }, /* En */ { in_line_argn, MDOC_CALLABLE | MDOC_PARSED }, /* Dx */ ! { in_line_eoln, 0 }, /* %Q */ { in_line_eoln, 0 }, /* br */ { in_line_eoln, 0 }, /* sp */ { in_line_eoln, 0 }, /* %U */ ! { phrase_ta, MDOC_CALLABLE | MDOC_PARSED }, /* Ta */ }; const struct mdoc_macro * const mdoc_macros = __mdoc_macros; --- 66,212 ---- enum mdoct, int, int); const struct mdoc_macro __mdoc_macros[MDOC_MAX] = { ! { in_line_argn, MDOC_CALLABLE | MDOC_PARSED | MDOC_JOIN }, /* Ap */ { in_line_eoln, MDOC_PROLOGUE }, /* Dd */ { in_line_eoln, MDOC_PROLOGUE }, /* Dt */ { in_line_eoln, MDOC_PROLOGUE }, /* Os */ ! { blk_full, MDOC_PARSED | MDOC_JOIN }, /* Sh */ ! { blk_full, MDOC_PARSED | MDOC_JOIN }, /* Ss */ ! { in_line_eoln, 0 }, /* Pp */ ! { blk_part_imp, MDOC_PARSED | MDOC_JOIN }, /* D1 */ ! { blk_part_imp, MDOC_PARSED | MDOC_JOIN }, /* Dl */ { blk_full, MDOC_EXPLICIT }, /* Bd */ ! { blk_exp_close, MDOC_EXPLICIT | MDOC_JOIN }, /* Ed */ { blk_full, MDOC_EXPLICIT }, /* Bl */ ! { blk_exp_close, MDOC_EXPLICIT | MDOC_JOIN }, /* El */ ! { blk_full, MDOC_PARSED | MDOC_JOIN }, /* It */ ! { in_line, MDOC_CALLABLE | MDOC_PARSED }, /* Ad */ ! { in_line, MDOC_CALLABLE | MDOC_PARSED | MDOC_JOIN }, /* An */ { in_line, MDOC_CALLABLE | MDOC_PARSED }, /* Ar */ { in_line, MDOC_CALLABLE | MDOC_PARSED }, /* Cd */ { in_line, MDOC_CALLABLE | MDOC_PARSED }, /* Cm */ ! { in_line, MDOC_CALLABLE | MDOC_PARSED }, /* Dv */ ! { in_line, MDOC_CALLABLE | MDOC_PARSED }, /* Er */ ! { in_line, MDOC_CALLABLE | MDOC_PARSED }, /* Ev */ { in_line_eoln, 0 }, /* Ex */ ! { in_line, MDOC_CALLABLE | MDOC_PARSED }, /* Fa */ ! { in_line_eoln, 0 }, /* Fd */ { in_line, MDOC_CALLABLE | MDOC_PARSED }, /* Fl */ ! { in_line, MDOC_CALLABLE | MDOC_PARSED }, /* Fn */ ! { in_line, MDOC_CALLABLE | MDOC_PARSED }, /* Ft */ ! { in_line, MDOC_CALLABLE | MDOC_PARSED }, /* Ic */ { in_line_argn, MDOC_CALLABLE | MDOC_PARSED }, /* In */ ! { in_line, MDOC_CALLABLE | MDOC_PARSED | MDOC_JOIN }, /* Li */ ! { blk_full, MDOC_JOIN }, /* Nd */ ! { ctx_synopsis, MDOC_CALLABLE | MDOC_PARSED }, /* Nm */ { blk_part_imp, MDOC_CALLABLE | MDOC_PARSED }, /* Op */ { obsolete, 0 }, /* Ot */ { in_line, MDOC_CALLABLE | MDOC_PARSED }, /* Pa */ { in_line_eoln, 0 }, /* Rv */ ! { in_line_argn, MDOC_CALLABLE | MDOC_PARSED }, /* St */ { in_line, MDOC_CALLABLE | MDOC_PARSED }, /* Va */ ! { ctx_synopsis, MDOC_CALLABLE | MDOC_PARSED }, /* Vt */ { in_line_argn, MDOC_CALLABLE | MDOC_PARSED }, /* Xr */ ! { in_line_eoln, MDOC_JOIN }, /* %A */ ! { in_line_eoln, MDOC_JOIN }, /* %B */ ! { in_line_eoln, MDOC_JOIN }, /* %D */ ! { in_line_eoln, MDOC_JOIN }, /* %I */ ! { in_line_eoln, MDOC_JOIN }, /* %J */ { in_line_eoln, 0 }, /* %N */ ! { in_line_eoln, MDOC_JOIN }, /* %O */ { in_line_eoln, 0 }, /* %P */ ! { in_line_eoln, MDOC_JOIN }, /* %R */ ! { in_line_eoln, MDOC_JOIN }, /* %T */ { in_line_eoln, 0 }, /* %V */ ! { blk_exp_close, MDOC_CALLABLE | MDOC_PARSED | ! MDOC_EXPLICIT | MDOC_JOIN }, /* Ac */ ! { blk_part_exp, MDOC_CALLABLE | MDOC_PARSED | ! MDOC_EXPLICIT | MDOC_JOIN }, /* Ao */ ! { blk_part_imp, MDOC_CALLABLE | MDOC_PARSED | MDOC_JOIN }, /* Aq */ { in_line_argn, MDOC_CALLABLE | MDOC_PARSED }, /* At */ ! { blk_exp_close, MDOC_CALLABLE | MDOC_PARSED | ! MDOC_EXPLICIT | MDOC_JOIN }, /* Bc */ ! { blk_full, MDOC_EXPLICIT }, /* Bf */ ! { blk_part_exp, MDOC_CALLABLE | MDOC_PARSED | ! MDOC_EXPLICIT | MDOC_JOIN }, /* Bo */ ! { blk_part_imp, MDOC_CALLABLE | MDOC_PARSED | MDOC_JOIN }, /* Bq */ { in_line_argn, MDOC_CALLABLE | MDOC_PARSED }, /* Bsx */ { in_line_argn, MDOC_CALLABLE | MDOC_PARSED }, /* Bx */ { in_line_eoln, 0 }, /* Db */ ! { blk_exp_close, MDOC_CALLABLE | MDOC_PARSED | ! MDOC_EXPLICIT | MDOC_JOIN }, /* Dc */ ! { blk_part_exp, MDOC_CALLABLE | MDOC_PARSED | ! MDOC_EXPLICIT | MDOC_JOIN }, /* Do */ ! { blk_part_imp, MDOC_CALLABLE | MDOC_PARSED | MDOC_JOIN }, /* Dq */ ! { blk_exp_close, MDOC_CALLABLE | MDOC_PARSED | MDOC_EXPLICIT }, /* Ec */ ! { blk_exp_close, MDOC_EXPLICIT | MDOC_JOIN }, /* Ef */ ! { in_line, MDOC_CALLABLE | MDOC_PARSED | MDOC_JOIN }, /* Em */ { blk_part_exp, MDOC_CALLABLE | MDOC_PARSED | MDOC_EXPLICIT }, /* Eo */ { in_line_argn, MDOC_CALLABLE | MDOC_PARSED }, /* Fx */ { in_line, MDOC_CALLABLE | MDOC_PARSED }, /* Ms */ ! { in_line_argn, MDOC_CALLABLE | MDOC_PARSED | ! MDOC_IGNDELIM | MDOC_JOIN }, /* No */ ! { in_line_argn, MDOC_CALLABLE | MDOC_PARSED | ! MDOC_IGNDELIM | MDOC_JOIN }, /* Ns */ { in_line_argn, MDOC_CALLABLE | MDOC_PARSED }, /* Nx */ { in_line_argn, MDOC_CALLABLE | MDOC_PARSED }, /* Ox */ ! { blk_exp_close, MDOC_CALLABLE | MDOC_PARSED | ! MDOC_EXPLICIT | MDOC_JOIN }, /* Pc */ { in_line_argn, MDOC_CALLABLE | MDOC_PARSED | MDOC_IGNDELIM }, /* Pf */ ! { blk_part_exp, MDOC_CALLABLE | MDOC_PARSED | ! MDOC_EXPLICIT | MDOC_JOIN }, /* Po */ ! { blk_part_imp, MDOC_CALLABLE | MDOC_PARSED | MDOC_JOIN }, /* Pq */ ! { blk_exp_close, MDOC_CALLABLE | MDOC_PARSED | ! MDOC_EXPLICIT | MDOC_JOIN }, /* Qc */ ! { blk_part_imp, MDOC_CALLABLE | MDOC_PARSED | MDOC_JOIN }, /* Ql */ ! { blk_part_exp, MDOC_CALLABLE | MDOC_PARSED | ! MDOC_EXPLICIT | MDOC_JOIN }, /* Qo */ ! { blk_part_imp, MDOC_CALLABLE | MDOC_PARSED | MDOC_JOIN }, /* Qq */ ! { blk_exp_close, MDOC_EXPLICIT | MDOC_JOIN }, /* Re */ { blk_full, MDOC_EXPLICIT }, /* Rs */ ! { blk_exp_close, MDOC_CALLABLE | MDOC_PARSED | ! MDOC_EXPLICIT | MDOC_JOIN }, /* Sc */ ! { blk_part_exp, MDOC_CALLABLE | MDOC_PARSED | ! MDOC_EXPLICIT | MDOC_JOIN }, /* So */ ! { blk_part_imp, MDOC_CALLABLE | MDOC_PARSED | MDOC_JOIN }, /* Sq */ { in_line_eoln, 0 }, /* Sm */ ! { in_line, MDOC_CALLABLE | MDOC_PARSED | MDOC_JOIN }, /* Sx */ ! { in_line, MDOC_CALLABLE | MDOC_PARSED | MDOC_JOIN }, /* Sy */ { in_line, MDOC_CALLABLE | MDOC_PARSED }, /* Tn */ ! { in_line_argn, MDOC_CALLABLE | MDOC_PARSED | MDOC_JOIN }, /* Ux */ { blk_exp_close, MDOC_EXPLICIT | MDOC_CALLABLE | MDOC_PARSED }, /* Xc */ { blk_part_exp, MDOC_CALLABLE | MDOC_PARSED | MDOC_EXPLICIT }, /* Xo */ ! { blk_full, MDOC_EXPLICIT | MDOC_CALLABLE }, /* Fo */ ! { blk_exp_close, MDOC_CALLABLE | MDOC_PARSED | ! MDOC_EXPLICIT | MDOC_JOIN }, /* Fc */ ! { blk_part_exp, MDOC_CALLABLE | MDOC_PARSED | ! MDOC_EXPLICIT | MDOC_JOIN }, /* Oo */ ! { blk_exp_close, MDOC_CALLABLE | MDOC_PARSED | ! MDOC_EXPLICIT | MDOC_JOIN }, /* Oc */ { blk_full, MDOC_EXPLICIT }, /* Bk */ ! { blk_exp_close, MDOC_EXPLICIT | MDOC_JOIN }, /* Ek */ { in_line_eoln, 0 }, /* Bt */ { in_line_eoln, 0 }, /* Hf */ { obsolete, 0 }, /* Fr */ { in_line_eoln, 0 }, /* Ud */ { in_line, 0 }, /* Lb */ ! { in_line_eoln, 0 }, /* Lp */ ! { in_line, MDOC_CALLABLE | MDOC_PARSED }, /* Lk */ ! { in_line, MDOC_CALLABLE | MDOC_PARSED }, /* Mt */ ! { blk_part_imp, MDOC_CALLABLE | MDOC_PARSED | MDOC_JOIN }, /* Brq */ ! { blk_part_exp, MDOC_CALLABLE | MDOC_PARSED | ! MDOC_EXPLICIT | MDOC_JOIN }, /* Bro */ ! { blk_exp_close, MDOC_CALLABLE | MDOC_PARSED | ! MDOC_EXPLICIT | MDOC_JOIN }, /* Brc */ ! { in_line_eoln, MDOC_JOIN }, /* %C */ { obsolete, 0 }, /* Es */ { obsolete, 0 }, /* En */ { in_line_argn, MDOC_CALLABLE | MDOC_PARSED }, /* Dx */ ! { in_line_eoln, MDOC_JOIN }, /* %Q */ { in_line_eoln, 0 }, /* br */ { in_line_eoln, 0 }, /* sp */ { in_line_eoln, 0 }, /* %U */ ! { phrase_ta, MDOC_CALLABLE | MDOC_PARSED | MDOC_JOIN }, /* Ta */ }; const struct mdoc_macro * const mdoc_macros = __mdoc_macros; *************** *** 584,596 **** * Punctuation consists of those tokens found in mdoc_isdelim(). */ static int ! dword(struct mdoc *mdoc, int line, ! int col, const char *p, enum mdelim d) { if (DELIM_MAX == d) d = mdoc_isdelim(p); if ( ! mdoc_word_alloc(mdoc, line, col, p)) return(0); --- 603,623 ---- * Punctuation consists of those tokens found in mdoc_isdelim(). */ static int ! dword(struct mdoc *mdoc, int line, int col, const char *p, ! enum mdelim d, int may_append) { if (DELIM_MAX == d) d = mdoc_isdelim(p); + if (may_append && + ! ((MDOC_SYNOPSIS | MDOC_KEEP | MDOC_SMOFF) & mdoc->flags) && + DELIM_NONE == d && MDOC_TEXT == mdoc->last->type && + DELIM_NONE == mdoc_isdelim(mdoc->last->string)) { + mdoc_word_append(mdoc, p); + return(1); + } + if ( ! mdoc_word_alloc(mdoc, line, col, p)) return(0); *************** *** 634,640 **** else if (ARGS_EOLN == ac) break; ! dword(mdoc, line, la, p, DELIM_MAX); /* * If we encounter end-of-sentence symbols, then trigger --- 661,667 ---- else if (ARGS_EOLN == ac) break; ! dword(mdoc, line, la, p, DELIM_MAX, 1); /* * If we encounter end-of-sentence symbols, then trigger *************** *** 676,681 **** --- 703,711 ---- case (MDOC_Ec): maxargs = 1; break; + case (MDOC_Ek): + if ( ! (MDOC_SYNOPSIS & mdoc->flags)) + mdoc->flags &= ~MDOC_KEEP; default: maxargs = 0; break; *************** *** 778,784 **** ntok = ARGS_QWORD == ac ? MDOC_MAX : lookup(tok, p); if (MDOC_MAX == ntok) { ! if ( ! dword(mdoc, line, lastarg, p, DELIM_MAX)) return(0); continue; } --- 808,815 ---- ntok = ARGS_QWORD == ac ? MDOC_MAX : lookup(tok, p); if (MDOC_MAX == ntok) { ! if ( ! dword(mdoc, line, lastarg, p, DELIM_MAX, ! MDOC_JOIN & mdoc_macros[tok].flags)) return(0); continue; } *************** *** 944,950 **** if (DELIM_NONE == d) cnt++; ! if ( ! dword(mdoc, line, la, p, d)) return(0); /* --- 975,982 ---- if (DELIM_NONE == d) cnt++; ! if ( ! dword(mdoc, line, la, p, d, ! MDOC_JOIN & mdoc_macros[tok].flags)) return(0); /* *************** *** 1063,1070 **** if ( ! mdoc_body_alloc(mdoc, line, ppos, tok)) return(0); body = mdoc->last; ! } ac = ARGS_ERROR; for ( ; ; ) { --- 1095,1105 ---- if ( ! mdoc_body_alloc(mdoc, line, ppos, tok)) return(0); body = mdoc->last; ! } + if (MDOC_Bk == tok) + mdoc->flags |= MDOC_KEEP; + ac = ARGS_ERROR; for ( ; ; ) { *************** *** 1108,1114 **** ARGS_PPHRASE != ac && ARGS_QWORD != ac && DELIM_OPEN == mdoc_isdelim(p)) { ! if ( ! dword(mdoc, line, la, p, DELIM_OPEN)) return(0); continue; } --- 1143,1149 ---- ARGS_PPHRASE != ac && ARGS_QWORD != ac && DELIM_OPEN == mdoc_isdelim(p)) { ! if ( ! dword(mdoc, line, la, p, DELIM_OPEN, 0)) return(0); continue; } *************** *** 1161,1167 **** MDOC_MAX : lookup(tok, p); if (MDOC_MAX == ntok) { ! if ( ! dword(mdoc, line, la, p, DELIM_MAX)) return(0); continue; } --- 1196,1203 ---- MDOC_MAX : lookup(tok, p); if (MDOC_MAX == ntok) { ! if ( ! dword(mdoc, line, la, p, DELIM_MAX, ! MDOC_JOIN & mdoc_macros[tok].flags)) return(0); continue; } *************** *** 1272,1281 **** if (NULL == body && ARGS_QWORD != ac && DELIM_OPEN == mdoc_isdelim(p)) { ! if ( ! dword(mdoc, line, la, p, DELIM_OPEN)) return(0); continue; ! } if (NULL == body) { if ( ! mdoc_body_alloc(mdoc, line, ppos, tok)) --- 1308,1317 ---- if (NULL == body && ARGS_QWORD != ac && DELIM_OPEN == mdoc_isdelim(p)) { ! if ( ! dword(mdoc, line, la, p, DELIM_OPEN, 0)) return(0); continue; ! } if (NULL == body) { if ( ! mdoc_body_alloc(mdoc, line, ppos, tok)) *************** *** 1286,1292 **** ntok = ARGS_QWORD == ac ? MDOC_MAX : lookup(tok, p); if (MDOC_MAX == ntok) { ! if ( ! dword(mdoc, line, la, p, DELIM_MAX)) return(0); continue; } --- 1322,1329 ---- ntok = ARGS_QWORD == ac ? MDOC_MAX : lookup(tok, p); if (MDOC_MAX == ntok) { ! if ( ! dword(mdoc, line, la, p, DELIM_MAX, ! MDOC_JOIN & mdoc_macros[tok].flags)) return(0); continue; } *************** *** 1412,1421 **** if (NULL == head && ARGS_QWORD != ac && DELIM_OPEN == mdoc_isdelim(p)) { assert(NULL == body); ! if ( ! dword(mdoc, line, la, p, DELIM_OPEN)) return(0); continue; ! } if (NULL == head) { assert(NULL == body); --- 1449,1458 ---- if (NULL == head && ARGS_QWORD != ac && DELIM_OPEN == mdoc_isdelim(p)) { assert(NULL == body); ! if ( ! dword(mdoc, line, la, p, DELIM_OPEN, 0)) return(0); continue; ! } if (NULL == head) { assert(NULL == body); *************** *** 1433,1439 **** assert(head); /* No check whether it's a macro! */ if (MDOC_Eo == tok) ! if ( ! dword(mdoc, line, la, p, DELIM_MAX)) return(0); if ( ! rew_sub(MDOC_HEAD, mdoc, tok, line, ppos)) --- 1470,1476 ---- assert(head); /* No check whether it's a macro! */ if (MDOC_Eo == tok) ! if ( ! dword(mdoc, line, la, p, DELIM_MAX, 0)) return(0); if ( ! rew_sub(MDOC_HEAD, mdoc, tok, line, ppos)) *************** *** 1451,1457 **** ntok = ARGS_QWORD == ac ? MDOC_MAX : lookup(tok, p); if (MDOC_MAX == ntok) { ! if ( ! dword(mdoc, line, la, p, DELIM_MAX)) return(0); continue; } --- 1488,1495 ---- ntok = ARGS_QWORD == ac ? MDOC_MAX : lookup(tok, p); if (MDOC_MAX == ntok) { ! if ( ! dword(mdoc, line, la, p, DELIM_MAX, ! MDOC_JOIN & mdoc_macros[tok].flags)) return(0); continue; } *************** *** 1555,1561 **** if ( ! (MDOC_IGNDELIM & mdoc_macros[tok].flags) && ARGS_QWORD != ac && 0 == j && DELIM_OPEN == mdoc_isdelim(p)) { ! if ( ! dword(mdoc, line, la, p, DELIM_OPEN)) return(0); continue; } else if (0 == j) --- 1593,1599 ---- if ( ! (MDOC_IGNDELIM & mdoc_macros[tok].flags) && ARGS_QWORD != ac && 0 == j && DELIM_OPEN == mdoc_isdelim(p)) { ! if ( ! dword(mdoc, line, la, p, DELIM_OPEN, 0)) return(0); continue; } else if (0 == j) *************** *** 1589,1595 **** flushed = 1; } ! if ( ! dword(mdoc, line, la, p, DELIM_MAX)) return(0); j++; } --- 1627,1634 ---- flushed = 1; } ! if ( ! dword(mdoc, line, la, p, DELIM_MAX, ! MDOC_JOIN & mdoc_macros[tok].flags)) return(0); j++; } *************** *** 1660,1666 **** ntok = ARGS_QWORD == ac ? MDOC_MAX : lookup(tok, p); if (MDOC_MAX == ntok) { ! if ( ! dword(mdoc, line, la, p, DELIM_MAX)) return(0); continue; } --- 1699,1706 ---- ntok = ARGS_QWORD == ac ? MDOC_MAX : lookup(tok, p); if (MDOC_MAX == ntok) { ! if ( ! dword(mdoc, line, la, p, DELIM_MAX, ! MDOC_JOIN & mdoc_macros[tok].flags)) return(0); continue; } *************** *** 1740,1746 **** ntok = ARGS_QWORD == ac ? MDOC_MAX : lookup_raw(p); if (MDOC_MAX == ntok) { ! if ( ! dword(mdoc, line, la, p, DELIM_MAX)) return(0); continue; } --- 1780,1786 ---- ntok = ARGS_QWORD == ac ? MDOC_MAX : lookup_raw(p); if (MDOC_MAX == ntok) { ! if ( ! dword(mdoc, line, la, p, DELIM_MAX, 1)) return(0); continue; } *************** *** 1791,1797 **** ntok = ARGS_QWORD == ac ? MDOC_MAX : lookup_raw(p); if (MDOC_MAX == ntok) { ! if ( ! dword(mdoc, line, la, p, DELIM_MAX)) return(0); continue; } --- 1831,1838 ---- ntok = ARGS_QWORD == ac ? MDOC_MAX : lookup_raw(p); if (MDOC_MAX == ntok) { ! if ( ! dword(mdoc, line, la, p, DELIM_MAX, ! MDOC_JOIN & mdoc_macros[tok].flags)) return(0); continue; }