unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* Syntax locations are ambiguous: can we track source 'offset' and 'length'?
@ 2021-08-02 22:50 Vivien Kraus via General Guile related discussions
  2021-08-03 19:29 ` Linus Björnstam
  2021-08-04 12:05 ` Ludovic Courtès
  0 siblings, 2 replies; 9+ messages in thread
From: Vivien Kraus via General Guile related discussions @ 2021-08-02 22:50 UTC (permalink / raw)
  To: guile-user

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.

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.

In (system base lalr), the source location contains a filename, line
and column, but also an offset and length. However, these last 2 get
dropped in source-location->source-properties. I could not find out
whether this is relevant to read-syntax.

So, is there a way to track source offset and length for syntax
objects?

Best regards,

Vivien




^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2021-08-04 14:09 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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

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).