source@mandoc.bsd.lv
 help / color / mirror / Atom feed
From: schwarze@mandoc.bsd.lv
To: source@mandoc.bsd.lv
Subject: mandoc: Since \.
Date: Thu, 2 Jun 2022 09:52:12 -0500 (EST)	[thread overview]
Message-ID: <33659989c9ad882d@mandoc.bsd.lv> (raw)

Log Message:
-----------
Since \. is not a character escape sequence, re-classify it from the
wrong parsing class ESCAPE_SPECIAL to the better-suited parsing class
ESCAPE_UNDEF, exactly like it is already done for the similar \\,
which isn't a character escape sequence either.  

No formatting change is intended just yet, but this will matter for
upcoming improvements in the parser for roff(7) macro, string, and
register names.

See the node "5.23.2 Copy Mode" in "info groff" regarding
what \\ and \. really mean.

Modified Files:
--------------
    mandoc:
        roff_escape.c
        chars.c
        mandoc_char.7

Revision Data
-------------
Index: mandoc_char.7
===================================================================
RCS file: /home/cvs/mandoc/mandoc/mandoc_char.7,v
retrieving revision 1.78
retrieving revision 1.79
diff -Lmandoc_char.7 -Lmandoc_char.7 -u -p -r1.78 -r1.79
--- mandoc_char.7
+++ mandoc_char.7
@@ -1,8 +1,9 @@
-.\"	$Id$
+.\" $Id$
 .\"
 .\" Copyright (c) 2003 Jason McIntyre <jmc@openbsd.org>
 .\" Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
-.\" Copyright (c) 2011,2013,2015,2017-2020 Ingo Schwarze <schwarze@openbsd.org>
+.\" Copyright (c) 2011, 2013, 2015, 2017-2020, 2022
+.\"               Ingo Schwarze <schwarze@openbsd.org>
 .\"
 .\" Permission to use, copy, modify, and distribute this software for any
 .\" purpose with or without fee is hereby granted, provided that the above
@@ -220,13 +221,18 @@ where it introduces a
 request or a macro, and when appearing alone as a macro argument in
 .Xr mdoc 7 .
 In such situations, prepend a zero-width space
-.Pq Sq \e&.
+.Pq Sq \e&.\&
 to make it behave like normal text.
 .Pp
-Do not use the
+Do not use the character pair
 .Sq \e.
-escape sequence.
-It does not prevent special handling of the period.
+to escape a period because
+.Sq \e.
+is not a character escape sequence, does not prevent special handling
+of the period under normal circumstances, and is only intended to
+be used in the very special situation of defining a user-defined
+macro that, when called, defines another user-defined macro, which
+no manual page is ever supposed to do.
 .Ss Backslashes
 To include a literal backslash
 .Pq Sq \e
@@ -326,7 +332,6 @@ Punctuation:
 .It \e(en    Ta \(en        Ta en-dash
 .It \e(hy    Ta \(hy        Ta hyphen
 .It \ee      Ta \e          Ta back-slash
-.It \e.      Ta \.          Ta period
 .It \e(r!    Ta \(r!        Ta upside-down exclamation
 .It \e(r?    Ta \(r?        Ta upside-down question
 .El
Index: chars.c
===================================================================
RCS file: /home/cvs/mandoc/mandoc/chars.c,v
retrieving revision 1.79
retrieving revision 1.80
diff -Lchars.c -Lchars.c -u -p -r1.79 -r1.80
--- chars.c
+++ chars.c
@@ -1,4 +1,4 @@
-/*	$Id$ */
+/* $Id$ */
 /*
  * Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
  * Copyright (c) 2011, 2014, 2015, 2017, 2018, 2020
@@ -92,7 +92,6 @@ static struct ln lines[] = {
 	{ "en",			"-",		0x2013	},
 	{ "hy",			"-",		0x2010	},
 	{ "e",			"\\",		0x005c	},
-	{ ".",			".",		0x002e	},
 	{ "r!",			"!",		0x00a1	},
 	{ "r?",			"?",		0x00bf	},
 
Index: roff_escape.c
===================================================================
RCS file: /home/cvs/mandoc/mandoc/roff_escape.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -Lroff_escape.c -Lroff_escape.c -u -p -r1.7 -r1.8
--- roff_escape.c
+++ roff_escape.c
@@ -127,6 +127,7 @@ roff_escape(const char *buf, const int l
 	case '\0':
 		iendarg = --iend;
 		/* FALLTHROUGH */
+	case '.':
 	case '\\':
 	default:
 		iarg--;
@@ -136,7 +137,6 @@ roff_escape(const char *buf, const int l
 	case ' ':
 	case '\'':
 	case '-':
-	case '.':
 	case '0':
 	case ':':
 	case '_':
@@ -481,7 +481,7 @@ out:
 		err = MANDOCERR_ESC_UNSUPP;
 		break;
 	case ESCAPE_UNDEF:
-		if (buf[inam] == '\\')
+		if (buf[inam] == '\\' || buf[inam] == '.')
 			return rval;
 		err = MANDOCERR_ESC_UNDEF;
 		break;
--
 To unsubscribe send an email to source+unsubscribe@mandoc.bsd.lv


                 reply	other threads:[~2022-06-02 14:52 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=33659989c9ad882d@mandoc.bsd.lv \
    --to=schwarze@mandoc.bsd.lv \
    --cc=source@mandoc.bsd.lv \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).