From dd3e302830fe613800a62a7d2c05e2fad7afd7ce Mon Sep 17 00:00:00 2001 From: "Paul A. Patience" Date: Sun, 4 Jul 2021 10:40:27 -0400 Subject: doc: check for spurious spaces. * checkman.txr (check-spaces): New pattern function for checking for spurious spaces (i.e., two spaces or more in a row) in .meIP, .meti and .mets macros. * txr.1: Fix two instances of spurious spaces ("@\ newline" and "@\ space" examples). Conform the "@\x hex-digits" and "@\ octal-digits" examples to the fixed ones; this is more intuitive since there must be no space before the digits in the escape sequence. --- checkman.txr | 17 +++++++++++++++++ txr.1 | 8 ++++---- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/checkman.txr b/checkman.txr index 0f0c6a1e..c41407f6 100644 --- a/checkman.txr +++ b/checkman.txr @@ -143,6 +143,13 @@ @ (throw bad ln `.@ip followed by blank line`) @(end) @;; +@;; Check for .meIP, .meti or .mets containing spurious spaces. +@;; +@(define check-spaces ()) +.@{mac /meIP|meti|mets/}@/(( \\)+ )?/@(skip) @(skip) +@ (throw bad ln `.@mac contains spurious spaces`) +@(end) +@;; @;; Main @;; @(bind errors 0) @@ -173,4 +180,14 @@ (put-line `@file:@line:@msg`)) @ (end) @(end) +@(next file) +@(repeat) +@ (line ln) +@ (try) +@ (check-spaces) +@ (catch bad (line msg)) +@ (do (inc errors) + (put-line `@file:@line:@msg`)) +@ (end) +@(end) @(do (exit (zerop errors))) diff --git a/txr.1 b/txr.1 index f94972f4..72e38c48 100644 --- a/txr.1 +++ b/txr.1 @@ -1796,13 +1796,13 @@ Control characters may be embedded directly in a query (with the exception of newline characters). An alternative to embedding is to use escape syntax. The following escapes are supported: -.meIP >> @\e newline +.meIP >> @\e newline A backslash immediately followed by a newline introduces a physical line break without breaking up the logical line. Material following this sequence continues to be interpreted as a continuation of the previous line, so that indentation can be introduced to show the continuation without appearing in the data. -.meIP >> @\e space +.meIP >> @\e space A backslash followed by a space encodes a space. This is useful in line continuations when it is necessary for some or all of the leading spaces to be preserved. For instance the two line sequence @@ -1839,7 +1839,7 @@ kinds of terminals, or ejects a page of text from a line printer. Carriage return (ASCII 13, CR). .coIP @\ee Escape (ASCII 27, ESC) -.meIP @\ex < hex-digits +.meIP >> @\ex hex-digits A .code @\ex immediately followed by a sequence of hex digits is interpreted as a hexadecimal @@ -1848,7 +1848,7 @@ numeric character code. For instance is the ASCII character A. If a semicolon character immediately follows the hex digits, it is consumed, and characters which follow are not considered part of the hex escape even if they are hex digits. -.meIP @\e < octal-digits +.meIP >> @\e octal-digits A .code @\e immediately followed by a sequence of octal digits (0 through 7) is interpreted -- cgit v1.2.3