[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Syntax locations are ambiguous: can we track source 'offset' and 'le
From: |
Ludovic Courtès |
Subject: |
Re: Syntax locations are ambiguous: can we track source 'offset' and 'length'? |
Date: |
Wed, 04 Aug 2021 14:05:59 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) |
Hi Vivien,
Vivien Kraus via General Guile related discussions <guile-user@gnu.org>
skribis:
> I am trying to use the guile reader to read scheme comments, in
> addition to the syntax elements. I know with syntax-source where a
> syntax object starts, and I can know where it ends by using a spying
> soft port and re-reading it. However, the #\return ambiguity makes all
> my efforts pointless.
As you know, ‘read-syntax’ appeared in 3.0.7, so it’s brand new and we
could certainly extend (ice-9 read) with more features, including
reading comments.
In the meantime, I needed the ability to read comments in Guix,
including with Guile < 3.0.7, so I hacked up this thing:
https://git.savannah.gnu.org/cgit/guix.git/tree/guix/scripts/style.scm?h=core-updates&id=8419221620191d2988c22f6e7811d9ce1e0837bf#n50
It can read and write while preserving comments.
Again, we could/should probably integrate that functionality in (ice-9
read) eventually, it shouldn’t be too hard.
Thanks,
Ludo’.