From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Vivien Kraus via General Guile related discussions Newsgroups: gmane.lisp.guile.user Subject: Syntax locations are ambiguous: can we track source 'offset' and 'length'? Date: Tue, 03 Aug 2021 00:50:24 +0200 Message-ID: <771a6e88782e288143be269b14751b761523e4c1.camel@planete-kraus.eu> Reply-To: Vivien Kraus Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="30000"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Evolution 3.34.2 To: guile-user@gnu.org Original-X-From: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Tue Aug 03 00:50:57 2021 Return-path: Envelope-to: guile-user@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mAglt-0007au-AM for guile-user@m.gmane-mx.org; Tue, 03 Aug 2021 00:50:57 +0200 Original-Received: from localhost ([::1]:37848 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mAglr-00065y-8O for guile-user@m.gmane-mx.org; Mon, 02 Aug 2021 18:50:55 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:56110) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mAglX-00065q-7r for guile-user@gnu.org; Mon, 02 Aug 2021 18:50:35 -0400 Original-Received: from planete-kraus.eu ([2a00:5881:4008:2810::309]:49246) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_CHACHA20_POLY1305:256) (Exim 4.90_1) (envelope-from ) id 1mAglV-0005Xm-CW for guile-user@gnu.org; Mon, 02 Aug 2021 18:50:34 -0400 Original-Received: from planete-kraus.eu (localhost.lan [127.0.0.1]) by planete-kraus.eu (OpenSMTPD) with ESMTP id 91b13609 for ; Mon, 2 Aug 2021 22:50:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=planete-kraus.eu; h= message-id:subject:from:to:date:content-type:mime-version :content-transfer-encoding; s=*; bh=2/nsca4hFCyMsEZZ6bO3dvHdb6o=; b= rSL0ZJlmghNHfDrr0eE16eAnDz/ch0ye7PJgkhFLOivBqMX3u/EE23MkhsBP7Yoh tSrRGf0jI3mbRDx3ju9KAg19cXCSriJbztgIsz7WdgO0rOsyabApn3DsHN8opmbP CeqUTBnqq9t7JGUYJ9qGtGsvrT0ghsk5d2acfQtBpw4= Original-Received: by planete-kraus.eu (OpenSMTPD) with ESMTPSA id 390cc22a (TLSv1.3:AEAD-CHACHA20-POLY1305-SHA256:256:NO) for ; Mon, 2 Aug 2021 22:50:26 +0000 (UTC) Received-SPF: pass client-ip=2a00:5881:4008:2810::309; envelope-from=vivien@planete-kraus.eu; helo=planete-kraus.eu X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, DKIM_INVALID=0.1, DKIM_SIGNED=0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Original-Sender: "guile-user" Xref: news.gmane.io gmane.lisp.guile.user:17662 Archived-At: 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