commit b1884f1995bd13eb58789e5ac892cd74d0c3cbf2
parent 4faa862c24425e286cfd65ecada76d9e8f701551
Author: Wolfgang Corcoran-Mathe <wcm@sigwinch.xyz>
Date: Tue, 6 Feb 2024 13:06:09 -0500
Add macro for grammatical pseudo-productions & use it.
Diffstat:
2 files changed, 20 insertions(+), 8 deletions(-)
diff --git a/doc/r7rs-small/formal-syntax.texinfo b/doc/r7rs-small/formal-syntax.texinfo
@@ -64,7 +64,7 @@ with the given Unicode scalar value is supported by the implementation,
identifiers containing such a sequence are equivalent to identifiers
containing the corresponding character.
-@c TODO: Alignment and brackets for non-variable text.
+@c TODO: Better alignment in output.
@format
@svar{token} @expansion{} @svar{identifier} | @svar{boolean}
| @svar{number} | @svar{character} | @svar{string}
@@ -78,14 +78,14 @@ containing the corresponding character.
@svar{vertical line} @expansion{} @code{|}
@svar{line ending} @expansion{} @svar{newline}
| @svar{return} @svar{newline} | @svar{return}
-@svar{comment} @expansion{} @code{;} all subsequent characters
- up to a line ending
+@svar{comment} @expansion{} @code{;} @pseudoprod{all subsequent
+ characters up to a line ending}
| @svar{nested comment}
| @code{#;} @svar{intertoken space} @svar{datum}
@svar{nested comment} @expansion{} @code{#|} @svar{comment text}
@arbno{@svar{comment cont}} @code{|#}
-@svar{comment text} @expansion{} character sequence not containing
- @code{#|} or @code{|#}
+@svar{comment text} @expansion{} @pseudoprod{character sequence
+ not containing @code{#|} or @code{|#}}
@svar{comment cont} @expansion{} @svar{nested comment}
@svar{comment text}
@svar{directive} @expansion{} @code{#!fold-case} | @code{#!no-fold-case}
@@ -136,7 +136,7 @@ identifiers.
@svar{sign subsequent} @expansion{} @svar{initial} | @svar{explicit sign}
| @code{@@}
@svar{symbol element} @expansion{}
- any character other than @svar{vertical line} or @code{\}
+ @pseudoprod{any character other than @svar{vertical line} or @code{\}}
| @svar{inline hex escape} | @svar{mnemonic escape} | @code{|}
@svar{boolean} @expansion{} @code{#t} | @code{#f} | @code{#true}
@@ -153,7 +153,7 @@ identifiers.
@svar{string} @expansion{} @code{"} @arbno{@svar{string element}} @code{"}
@svar{string element} @expansion{}
- any character other than @code{"} or @code{\}
+ @pseudoprod{any character other than @code{"} or @code{\}}
| @svar{mnemonic escape} | @code{\"} | @code{\\}
| \@arbno{@svar{intraline whitespace}}@svar{line ending}
@arbno{@svar{intraline whitespace}}
@@ -161,7 +161,7 @@ identifiers.
@svar{bytevector} @expansion{} \#u8(@arbno{@svar{byte}})
-@svar{byte} @expansion{} any exact integer between 0 and 255
+@svar{byte} @expansion{} @pseudoprod{any exact integer between 0 and 255}
@end format
The following rules for @svar{num R}, @svar{complex R}, @svar{real R}, @svar{ureal R}, @svar{uinteger R}, and
diff --git a/doc/r7rs-small/r7rs-texinfo-macros.texinfo b/doc/r7rs-small/r7rs-texinfo-macros.texinfo
@@ -157,3 +157,15 @@ R@sup{6}RS
@macro atleastone {obj}
\obj\@sup{+}
@end macro
+
+@c Brackets for things that aren't really grammar elements.
+@macro pseudoprod {text}
+@U{27e8}\text\@U{27e9}
+@end macro
+
+@iftex
+@unmacro pseudoprod
+@macro pseudoprod {text}
+@inlineraw{tex, $\\langle$\text\$\\rangle$}
+@end macro
+@end iftex