Re: Syntax locations are ambiguous: can we track source 'offset' and 'length'?

2021-08-03 Thread Linus Björnstam
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.



Re: Syntax locations are ambiguous: can we track source 'offset' and 'length'?

2021-08-03 Thread Keith Wright
>> Vivien Kraus via General Guile related discussions 

> what do you think of the attached patch?

Well, I think it is too special interest and
way too damn big for a general user discussion list.

  -- Keith