From: "Linus Björnstam" <linus.internet@fastmail.se>
To: "Vivien Kraus" <vivien@planete-kraus.eu>, guile-user@gnu.org
Subject: Re: Syntax locations are ambiguous: can we track source 'offset' and 'length'?
Date: Tue, 03 Aug 2021 21:29:52 +0200 [thread overview]
Message-ID: <bac3e71f-a52a-4005-933e-2450cb721577@www.fastmail.com> (raw)
In-Reply-To: <771a6e88782e288143be269b14751b761523e4c1.camel@planete-kraus.eu>
On Tue, 3 Aug 2021, at 00:50, Vivien Kraus via General Guile related discussions wrote:
> Dear guilers,
>
> I’m playing with syntaxes as first-class objects, and I notice that the
> syntax source location is ambiguous:
>
> (syntax-case
> (call-with-input-string "(a\r b)" read-syntax) ()
> ((a b)
> (values (syntax-source #'a) (syntax-source #'b))))
>
> =>
>
> $1 = ((line . 0) (column . 1))
> $2 = ((line . 0) (column . 1))
>
> This is obviously because of #\return.
Well, if anything this has confused the guile reader. It is probably a bug: I suspect it resets the column because it anticipates a windows-style newline.
But are you often dealing with lonely "\r" in sources? Using either \n (unix-style) or \r\n (window-style) will give you the correct results.
next prev parent reply other threads:[~2021-08-03 19:29 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-02 22:50 Syntax locations are ambiguous: can we track source 'offset' and 'length'? Vivien Kraus via General Guile related discussions
2021-08-03 19:29 ` Linus Björnstam [this message]
2021-08-03 23:51 ` Vivien Kraus via General Guile related discussions
2021-08-04 1:20 ` Keith Wright
2021-08-04 10:01 ` Vivien Kraus via General Guile related discussions
2021-08-04 12:05 ` Ludovic Courtès
2021-08-04 12:25 ` Vivien Kraus via General Guile related discussions
2021-08-04 13:41 ` Ludovic Courtès
2021-08-04 14:09 ` Vivien Kraus via General Guile related discussions
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=bac3e71f-a52a-4005-933e-2450cb721577@www.fastmail.com \
--to=linus.internet@fastmail.se \
--cc=guile-user@gnu.org \
--cc=vivien@planete-kraus.eu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).