guile-user
[Top][All Lists]
Advanced

[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: Linus Björnstam
Subject: Re: Syntax locations are ambiguous: can we track source 'offset' and 'length'?
Date: Tue, 03 Aug 2021 21:29:52 +0200
User-agent: Cyrus-JMAP/3.5.0-alpha0-548-g3a0b1fef7b-fm-20210802.001-g3a0b1fef

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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]