From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp1.rz.uni-karlsruhe.de (Debian-exim@smtp1.rz.uni-karlsruhe.de [129.13.185.217]) by krisdoz.my.domain (8.14.3/8.14.3) with ESMTP id o910NEYs023575 for ; Thu, 30 Sep 2010 20:23:16 -0400 (EDT) Received: from hekate.usta.de (asta-nat.asta.uni-karlsruhe.de [172.22.63.82]) by smtp1.rz.uni-karlsruhe.de with esmtp (Exim 4.63 #1) id 1P1TP6-0000ol-LD; Fri, 01 Oct 2010 02:23:12 +0200 Received: from donnerwolke.usta.de ([172.24.96.3]) by hekate.usta.de with esmtp (Exim 4.71) (envelope-from ) id 1P1TP6-0005u2-K4 for tech@mdocml.bsd.lv; Fri, 01 Oct 2010 02:23:12 +0200 Received: from iris.usta.de ([172.24.96.5] helo=usta.de) by donnerwolke.usta.de with esmtp (Exim 4.69) (envelope-from ) id 1P1TP6-0007Ld-Ig for tech@mdocml.bsd.lv; Fri, 01 Oct 2010 02:23:12 +0200 Received: from schwarze by usta.de with local (Exim 4.71) (envelope-from ) id 1P1TP6-0003GT-B3 for tech@mdocml.bsd.lv; Fri, 01 Oct 2010 02:23:12 +0200 Date: Fri, 1 Oct 2010 02:23:12 +0200 From: Ingo Schwarze To: tech@mdocml.bsd.lv Subject: Re: [PATCH] TODO entries for `Ns' and `No' spacing. Message-ID: <20101001002311.GB10250@iris.usta.de> References: <4CA45693.10809@bsd.lv> X-Mailinglist: mdocml-tech Reply-To: tech@mdocml.bsd.lv MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4CA45693.10809@bsd.lv> User-Agent: Mutt/1.5.20 (2009-06-14) Hi Kristaps, Kristaps Dzonsons wrote on Thu, Sep 30, 2010 at 11:21:23AM +0200: > Can anybody Ok that this patch correctly handles the cases of `No' > and `Ns' with respect to spacing and without fallout? Cf. TODO > items > > - .No text No ) is "text )", not "text)" > see the terrible example > case word in [[(] pattern [| pattern] ... ) list ;; ] ... esac > in OpenBSD ksh(1) > > - .It ${name Ns [ selector ] Ns } > should be "${name[selector]}" not "${name [selector]}" > This is parsed as > text("${name") text("[") Ns() text(selector)... > Opening punctuation should not fall out of .Ns. > see for example OpenBSD csh(1) The .Ns part - i.e. the mdoc_macro.c patch - looks good and, according to my tests, does the job. The .No part - i.e. the mdoc_term.c patch - also looks good as far as it goes, but does not seem to go far enough. It doesn't solve the problem for me, yet. To get it working, i need to add the following elements to the patch: - .No needs MDOC_IGNDELIM in mdoc_macro.c, too. - .No must be allowed to have one child (mdoc_macro.c and mdoc_validate.c). With the updated patch included below, i do not see the two problems any longer, and i see no regressions. I'm not sure that solution is ideal, though; the trick to get TERMP_IGNDELIM to the right places by limiting .No to one argument looks rather artificial. But i'm too tired now to rethink that. Yours, Ingo Index: mdoc_macro.c =================================================================== RCS file: /cvs/src/usr.bin/mandoc/mdoc_macro.c,v retrieving revision 1.56 diff -u -p -r1.56 mdoc_macro.c --- mdoc_macro.c 26 Sep 2010 20:19:58 -0000 1.56 +++ mdoc_macro.c 1 Oct 2010 00:04:01 -0000 @@ -134,8 +134,8 @@ const struct mdoc_macro __mdoc_macros[MD { 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 }, /* No */ - { in_line_argn, MDOC_CALLABLE | MDOC_PARSED }, /* Ns */ + { 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 */ @@ -1447,8 +1447,6 @@ in_line_argn(MACRO_PROT_ARGS) switch (tok) { case (MDOC_Ap): - /* FALLTHROUGH */ - case (MDOC_No): /* FALLTHROUGH */ case (MDOC_Ns): /* FALLTHROUGH */ Index: mdoc_term.c =================================================================== RCS file: /cvs/src/usr.bin/mandoc/mdoc_term.c,v retrieving revision 1.108 diff -u -p -r1.108 mdoc_term.c --- mdoc_term.c 27 Sep 2010 21:25:28 -0000 1.108 +++ mdoc_term.c 1 Oct 2010 00:04:02 -0000 @@ -71,11 +71,11 @@ static void termp_bl_post(DECL_ARGS); static void termp_bx_post(DECL_ARGS); static void termp_d1_post(DECL_ARGS); static void termp_fo_post(DECL_ARGS); +static void termp_igndelim_post(DECL_ARGS); static void termp_in_post(DECL_ARGS); static void termp_it_post(DECL_ARGS); static void termp_lb_post(DECL_ARGS); static void termp_nm_post(DECL_ARGS); -static void termp_pf_post(DECL_ARGS); static void termp_quote_post(DECL_ARGS); static void termp_sh_post(DECL_ARGS); static void termp_ss_post(DECL_ARGS); @@ -98,6 +98,7 @@ static int termp_fl_pre(DECL_ARGS); static int termp_fn_pre(DECL_ARGS); static int termp_fo_pre(DECL_ARGS); static int termp_ft_pre(DECL_ARGS); +static int termp_igndelim_pre(DECL_ARGS); static int termp_in_pre(DECL_ARGS); static int termp_it_pre(DECL_ARGS); static int termp_li_pre(DECL_ARGS); @@ -105,7 +106,6 @@ static int termp_lk_pre(DECL_ARGS); static int termp_nd_pre(DECL_ARGS); static int termp_nm_pre(DECL_ARGS); static int termp_ns_pre(DECL_ARGS); -static int termp_pf_pre(DECL_ARGS); static int termp_quote_pre(DECL_ARGS); static int termp_rs_pre(DECL_ARGS); static int termp_rv_pre(DECL_ARGS); @@ -192,12 +192,12 @@ static const struct termact termacts[MDO { NULL, NULL }, /* Eo */ { termp_xx_pre, NULL }, /* Fx */ { termp_bold_pre, NULL }, /* Ms */ - { NULL, NULL }, /* No */ + { termp_igndelim_pre, termp_igndelim_post }, /* No */ { termp_ns_pre, NULL }, /* Ns */ { termp_xx_pre, NULL }, /* Nx */ { termp_xx_pre, NULL }, /* Ox */ { NULL, NULL }, /* Pc */ - { termp_pf_pre, termp_pf_post }, /* Pf */ + { termp_igndelim_pre, termp_igndelim_post }, /* Pf */ { termp_quote_pre, termp_quote_post }, /* Po */ { termp_quote_pre, termp_quote_post }, /* Pq */ { NULL, NULL }, /* Qc */ @@ -1680,7 +1680,7 @@ termp_xx_pre(DECL_ARGS) /* ARGSUSED */ static int -termp_pf_pre(DECL_ARGS) +termp_igndelim_pre(DECL_ARGS) { p->flags |= TERMP_IGNDELIM; @@ -1690,11 +1690,12 @@ termp_pf_pre(DECL_ARGS) /* ARGSUSED */ static void -termp_pf_post(DECL_ARGS) +termp_igndelim_post(DECL_ARGS) { p->flags &= ~TERMP_IGNDELIM; - p->flags |= TERMP_NOSPACE; + if (MDOC_Pf == n->tok) + p->flags |= TERMP_NOSPACE; } Index: mdoc_validate.c =================================================================== RCS file: /cvs/src/usr.bin/mandoc/mdoc_validate.c,v retrieving revision 1.70 diff -u -p -r1.70 mdoc_validate.c --- mdoc_validate.c 27 Sep 2010 21:25:28 -0000 1.70 +++ mdoc_validate.c 1 Oct 2010 00:04:03 -0000 @@ -214,7 +214,7 @@ const struct valids mdoc_valids[MDOC_MAX { NULL, NULL }, /* Eo */ { NULL, NULL }, /* Fx */ { NULL, posts_text }, /* Ms */ - { NULL, posts_notext }, /* No */ + { NULL, NULL }, /* No */ { NULL, posts_notext }, /* Ns */ { NULL, NULL }, /* Nx */ { NULL, NULL }, /* Ox */ -- To unsubscribe send an email to tech+unsubscribe@mdocml.bsd.lv