Re: SRFI 220: Line directives
Lassi Kortela 10 Feb 2021 10:19 UTC
One option is to unify this proposal with the RnRS directive syntax as
follows:
- If #! is followed immediately by a horizontal whitespace character,
read datums until end-of-line. If exactly one datum was read, and it's
either an empty list or a pair, return it. Otherwise wrap any and all
datums in an implicit list and return that list.
- If #! is followed immediately by a newline or end-of-file, return '().
This special case is a logical consequence of the above general case.
- If #! is followed by something else, read one datum. If it's either an
empty list or a pair, return it. Otherwise wrap it in an implicit list
and return that list.
Hence we would get:
#!r6rs => 'r6rs
#! r6rs => '(r6rs)
#!(r6rs) => '(r6rs)
#! (r6rs) => '(r6rs)
#!#(1 2 3) => '(#(1 2 3))
#! #(1 2 3) => '(#(1 2 3))
#!no-fold-case => '(no-fold-case)
#! foo bar baz => '(foo bar baz)
#!foo bar => '(foo) directive and `bar` ordinary code
#!(declare-things
(multi-line things)) => '(declare-things (multi-line things))
#! (declare-things
(multi-line things)) => '(declare-things (multi-line things))