Leave everything inside #| ... |# as is#12
Open
iamFIREcracker wants to merge 2 commits intods26gte:masterfrom
Open
Leave everything inside #| ... |# as is#12iamFIREcracker wants to merge 2 commits intods26gte:masterfrom
iamFIREcracker wants to merge 2 commits intods26gte:masterfrom
Conversation
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)
reader-macro-p was introduced to understand while inside a #| ... |# block, and unless the character following the # is a |, we should just reset the flag
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Imagine you had a file that looked like this:
Feed it to lispindent and you would get back something like this (note
how the last line gets aligned to the indented _quote):
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:
#reader macro character, followed by|(i.e. the start marker for these commented out regions)
|-- from this moment on, everything read from the inputstream is kept as is
|character again, follwed by a#(i.e. the endof the region)