Trimming behavior of the Pollen Preprocessor
#180
Closed
opened 6 years ago by joergen7
·
10 comments
Loading…
Reference in New Issue
There is no content yet.
Delete Branch '%!s(<nil>)'
Deleting a branch is permanent. It CANNOT be undone. Continue?
Hello,
I'm trying to use the Pollen preprocessor to augment a programming language I created. I have realized that the Pollen preprocessor trims leading whitespace of its input file. Is there a way to make the preprocessor skip the trimming?
The problem is that the trimming mixes up the line-positions in the source file which makes interpreting error messages a bit of a hassle.
Possibly, but are you sure you want
#lang pollen/pre
and not#lang scribble/text
?Thanks for the hint, I tried out
#lang scribble/text
. It also trims the leading new lines XD. While I get results, I had to get rid of all occurrences of th@
symbol in my source file to makescribble/text
swallow the input.So if in doubt, I would stay with Pollen because the lozenge syntax is pretty much exactly what I need since it does not interfere with anything else.
Anyway, I just wanted to know whether there is already something in Pollen to retain the line numbers in the output. I guess if you do trim the leading new-lines, you do it for a reason. I don't intend to break anyone's workflow.
OK. Would it suffice to add a
setup
value that controls whitespace trimming? Meaning, you’d need to supply a"pollen.rkt"
with asetup
submodule that overrides the value.I'm not sure if I truly understand the feature. Would the
pollen.rkt
file need to be located in a fixed position in my file system or would I supply it to raco along with the source file name?In the setup submodule, I guess I would have to redefine a parameter. Something like
(trim-leading-ws #f)
?Right. When
pollen
runs, it looks in thesetup
submodule of"pollen.rkt"
for configuration values. You would put the"pollen.rkt"
in the same folder as the Pollen source files, with something like this:See also
Ah, I see. Well, since there are already a number of things you can configure this way, I guess one more is not too drastic of a change wrt the user interface.
btw, I don't intend to make your life miserable with my petty problems. If you don't find the time for it or it takes a long time, that's completely fine with me. It's not that anything is broken.
I should probably just go out of my own way and make a proper hashlang already (instead of hijacking other people's preprocessors).
I was very miserable for the three minutes it took to fix this for you ;)
Try this update and see if it does what you want. The sample code above should work.
crazy stuff!
Works beautifully. 249 lines go in and 249 lines come out.