summaryrefslogtreecommitdiffstats
path: root/checkman.txr
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2016-04-26 06:42:31 -0700
committerKaz Kylheku <kaz@kylheku.com>2016-04-26 06:42:31 -0700
commit60d39e586279076a4f0dbf58a3f9b75112ff8a59 (patch)
treef7b7425cbbef7f6f5f7e31f23378b77200af47dc /checkman.txr
parent969157bc8702fb307668386238c4a0edef43b4fd (diff)
downloadtxr-60d39e586279076a4f0dbf58a3f9b75112ff8a59.tar.gz
txr-60d39e586279076a4f0dbf58a3f9b75112ff8a59.tar.bz2
txr-60d39e586279076a4f0dbf58a3f9b75112ff8a59.zip
Adding manual page checker.
* Makefile (txr-manpage.pdf): Invoke checkman.txr on the man page source. * checkman.txr: New file.
Diffstat (limited to 'checkman.txr')
-rw-r--r--checkman.txr78
1 files changed, 78 insertions, 0 deletions
diff --git a/checkman.txr b/checkman.txr
new file mode 100644
index 00000000..98070c8a
--- /dev/null
+++ b/checkman.txr
@@ -0,0 +1,78 @@
+@(name file)
+@;;
+@;; Check syntax block after function
+@;;
+@(define check-synb ())
+.synb
+@ (assert bad ln `bad .synb block`)
+@ (repeat :gap 0 :min 1)
+.mets @(skip)
+@ (maybe)
+@ (repeat :gap 0 :mintimes 1)
+.mets \ \ @(skip)
+@ (last :mandatory)
+
+@ (trailer)
+.mets @(skip)
+@ (end)
+@ (end)
+@ (last :mandatory)
+.syne
+@ (end)
+@ (assert bad ln `missing .desc`)
+.desc
+@(end)
+@;;
+@;; Check variable description headings
+@;;
+@(define check-var ())
+@ (cases)
+@; exception
+.coNP Variables @@, s-ifmt @(skip)
+@ (or)
+@; exception
+.coNP Variables @@, *0 @(skip)
+@ (or)
+.coNP Variables@(assert bad ln `bad Variables heading`)@(rep :gap 0) @@, @{x /\S+/}@(last :mandatory) @@ @y and @@ @{z /\S+/}@(end)
+@ (assert bad ln `no .desc after variables heading`)
+.desc
+@ (or)
+.coNP Variable@(assert bad ln `bad Variable heading`) @{x /\S+/}
+@ (assert bad ln `no .desc after variable heading`)
+.desc
+@ (end)
+@(end)
+@;;
+@;; Check function/macro/operator headings
+@;;
+@(define check-func ())
+@ (cases)
+.coNP Operator/function @(skip)
+@ (or)
+.coNP @{type /Function|Operator|Macro/}s@(assert bad ln `bad @{type}s heading`)@(rep :gap 0) @@, @{x /\S+/}@(last :mandatory) @@ @y and @@ @{z /\S+/}@(end)
+@ (assert bad ln `no .synb after @{type}s heading`)
+@ (check-synb)
+@ (or)
+.coNP @{type /Function|Operator|Macro/}@(assert bad ln `bad @type heading`) @{x /\S+/}
+@ (assert bad ln `no .synb after @type heading`)
+@ (check-synb)
+@ (end)
+@(end)
+@;;
+@;; Main
+@;;
+@(bind errors 0)
+@(repeat)
+@ (line ln)
+@ (try)
+@ (cases)
+@ (check-var)
+@ (or)
+@ (check-func)
+@ (end)
+@ (catch bad (line msg))
+@ (do (inc errors)
+ (put-line `@file:@line:@msg`))
+@ (end)
+@(end)
+@(do (exit (zerop errors)))