summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul A. Patience <paul@apatience.com>2021-07-04 10:40:27 -0400
committerKaz Kylheku <kaz@kylheku.com>2021-07-04 11:34:07 -0700
commit1282c7c1aebaaca2005011397a576c22aa62db0b (patch)
treeb38f7c90b5ffdf89a150be6bdf4c6c217e1ec382
parentfce0e92c95dc34d379813aa6daf9a82b9ff45791 (diff)
downloadtxr-1282c7c1aebaaca2005011397a576c22aa62db0b.tar.gz
txr-1282c7c1aebaaca2005011397a576c22aa62db0b.tar.bz2
txr-1282c7c1aebaaca2005011397a576c22aa62db0b.zip
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.
-rw-r--r--checkman.txr17
-rw-r--r--txr.18
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