scmindent
scmindent copied to clipboard
Leave everything inside #| ... |# as is
Imagine you had a file that looked like this:
#|
I like quotes:
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam hendrerit
nisi sed sollicitudin pellentesque.
|#
(define hello-world ()
(format t "Hello, world!~%"))
Feed it to lispindent and you would get back something like this (note how the last line gets aligned to the indented _quote):
#|
I like quotes:
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam hendrerit
nisi sed sollicitudin pellentesque.
|#
(define hello-world ()
(format t "Hello, world!~%"))
In addition, lispindent would now assume everything needed an extra 4 space of indentation -- this does not show up in the example, because the code is already properly indented.
Anyways, this commit tries to fix that by building a small state machine to handle with commented out regions:
- First it waits for the
#
reader macro character, followed by|
(i.e. the start marker for these commented out regions) - Then for
|
-- from this moment on, everything read from the input stream is kept as is - Then waits for a
|
character again, follwed by a#
(i.e. the end of the region)