From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Noah Lavine Newsgroups: gmane.lisp.guile.devel Subject: Re: problem with trailing comment in repl Date: Sun, 13 Feb 2011 16:27:16 -0500 Message-ID: References: <87r5beb7dg.fsf@gnu.org> <8739ntbd8a.fsf@gnu.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary=000e0cd6a97e726840049c30987d X-Trace: dough.gmane.org 1297632453 26808 80.91.229.12 (13 Feb 2011 21:27:33 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 13 Feb 2011 21:27:33 +0000 (UTC) Cc: "Jose A. Ortega Ruiz" , guile-devel@gnu.org To: Andy Wingo Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Sun Feb 13 22:27:28 2011 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PojTa-0007IS-6G for guile-devel@m.gmane.org; Sun, 13 Feb 2011 22:27:26 +0100 Original-Received: from localhost ([127.0.0.1]:58803 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PojTZ-0002lA-E1 for guile-devel@m.gmane.org; Sun, 13 Feb 2011 16:27:25 -0500 Original-Received: from [140.186.70.92] (port=55944 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PojTU-0002hE-H1 for guile-devel@gnu.org; Sun, 13 Feb 2011 16:27:21 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PojTT-0000k2-1f for guile-devel@gnu.org; Sun, 13 Feb 2011 16:27:20 -0500 Original-Received: from mail-yw0-f41.google.com ([209.85.213.41]:54921) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PojTS-0000js-RM; Sun, 13 Feb 2011 16:27:18 -0500 Original-Received: by ywj3 with SMTP id 3so2020471ywj.0 for ; Sun, 13 Feb 2011 13:27:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=8xNBddTRsR5JwEjynFW17MYy1SJu7bWZUN+E/n+aGp4=; b=rDTVWiIn8IWZr63P2905Tv0b5lrhnX7z8O7h0Oq88do/WlQUxl+wWPgTE8wTdO43b2 bhj4rY2BDP29GvuDDirQ4/sqMInUNNyT2a5cFPHf9baUiJNPEW7V8FqIp+Q2AQrnxEtv xQlcp+qdPWvBji0+3HIxr/5JdARQD2YoGGuxY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; b=e3i/AkzWL56pJddjY4jwk7n9nB77wdMQVZCtpx9MyT/83DBQ/ArYvhB2CbeXVySRTO z9vC5jWl/jGDqwGv382ZblrqQmD2B+2hixLuGJoqNfwb2x5s7QVs+ewq0eLuzsRGFBCy m0NEGFlxIhG1vdIXJWucZkunS+KurcO9IXo7w= Original-Received: by 10.150.11.16 with SMTP id 16mr3440988ybk.444.1297632436839; Sun, 13 Feb 2011 13:27:16 -0800 (PST) Original-Received: by 10.147.40.5 with HTTP; Sun, 13 Feb 2011 13:27:16 -0800 (PST) In-Reply-To: X-Google-Sender-Auth: LQ08NXqpsxyFCLwo-rXRZKvfG4Q X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 209.85.213.41 X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:11611 Archived-At: --000e0cd6a97e726840049c30987d Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable The attached patch does it. I almost hate to commit it because it's such a hack, but this is from my last Guile session: scheme@(guile-user)> 'foo $2 =3D foo scheme@(guile-user)> 'foo ; hi there! $3 =3D foo scheme@(guile-user)> ; why, hello! scheme@(guile-user)> ,q Noah On Sun, Feb 13, 2011 at 2:19 PM, Andy Wingo wrote: > Hi Noah, > > I think it makes sense to have a reader that actually returns comments. > That, to me, is the general solution: the REPL reader just treats a > comment as whitespace. > > On Sun 13 Feb 2011 16:22, Noah Lavine writes: > >> - The quicker way: if the language in use is scheme, change the >> next-char function (repl.scm line 205) to know about comments, so that >> if it saw a semicolon, it would snarf everything until the end of the >> line. > > Nasty, but a good idea I think! =A0Care to submit a patch? :) > > Andy > -- > http://wingolog.org/ > --000e0cd6a97e726840049c30987d Content-Type: application/octet-stream; name="0001-Show-prompts-after-a-comment-in-the-REPL.patch" Content-Disposition: attachment; filename="0001-Show-prompts-after-a-comment-in-the-REPL.patch" Content-Transfer-Encoding: base64 X-Attachment-Id: f_gk4glmcc0 RnJvbSA4MDVhMTgxMzQyMGM0ODA1NTljODQ5YmMxOTg0ZjY1ZGIzODgwOTM3IE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQpGcm9tOiBOb2FoIExhdmluZSA8bmxhdmluZUBoYXZlcmZvcmQuZWR1PgpE YXRlOiBTdW4sIDEzIEZlYiAyMDExIDE2OjE3OjExIC0wNTAwClN1YmplY3Q6IFtQQVRDSF0gU2hv dyBwcm9tcHRzIGFmdGVyIGEgY29tbWVudCBpbiB0aGUgUkVQTAoKICogbW9kdWxlL3N5c3RlbS9y ZXBsL3JlcGwuc2NtIChuZXh0LWNoYXIsIHJ1bi1yZXBsLCBtZXRhLXJlYWRlcik6IGlmIHRoZQog ICAgY3VycmVudCBsYW5ndWFnZSBpcyBTY2hlbWUsIGlnbm9yZSBhbnkgY2hhcmFj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CiAg ICAgICAobGFtYmRhICgpCi0gICAgICAgIChsZXQgKChjaCAobmV4dC1jaGFyICN0KSkpCisgICAg ICAgIChsZXQgKChjaCAobmV4dC1jaGFyICN0IHNlbWljb2xvbi1jb21tZW50cykpKQogICAgICAg ICAgIChjb25kICgoZW9mLW9iamVjdD8gY2gpCiAgICAgICAgICAgICAgICAgIDs7IEVPRiBvYmpl Y3RzIGFyZSBub3QgYnVmZmVyZWQuIEl0J3MgcXVpdGUgcG9zc2libGUKICAgICAgICAgICAgICAg ICAgOzsgdG8gcGVlayBhbiBFT0YgdGhlbiByZWFkIHNvbWV0aGluZyBlbHNlLiBJdCdzCkBAIC03 NSw2ICs3Niw3IEBACiAgICAgICAgICAgICAgICAgKChlcXY/IGNoICNcLCkKICAgICAgICAgICAg ICAgICAgKHJlYWQtY2hhciBwb3J0KQogICAgICAgICAgICAgICAgICBtZXRhLWNvbW1hbmQtdG9r ZW4pCisgICAgICAgICAgICAgICAgKChub3QgY2gpICp1bnNwZWNpZmllZCopCiAgICAgICAgICAg ICAgICAgKGVsc2UgKHJlYWQgcG9ydCBlbnYpKSkpKSkpKQogICAgICAgICAKIDs7IHJlcGwtcmVh ZGVyIGlzIGEgZnVuY3Rpb24gZGVmaW5lZCBpbiBib290LTkuc2NtLCBhbmQgaXMgcmVwbGFjZWQg YnkKQEAgLTgyLDEyICs4NCwxMyBAQAogOzsgdG8gYmUgYWJsZSB0byByZS11c2UgdGhlIGV4aXN0 aW5nIHJlYWRsaW5lIG1hY2hpbmVyeS4KIDs7CiA7OyBDYXRjaGVzIHJlYWQgZXJyb3JzLCByZXR1 cm5pbmcgKnVuc3BlY2lmaWVkKiBpbiB0aGF0IGNhc2UuCi0oZGVmaW5lIChwcm9tcHRpbmctbWV0 YS1yZWFkIHJlcGwpCisoZGVmaW5lIChwcm9tcHRpbmctbWV0YS1yZWFkIHJlcGwgc2VtaWNvbG9u LWNvbW1lbnRzKQogICAoY2F0Y2ggI3QKICAgICAobGFtYmRhICgpCiAgICAgICAocmVwbC1yZWFk ZXIgKGxhbWJkYSAoKSAocmVwbC1wcm9tcHQgcmVwbCkpCiAgICAgICAgICAgICAgICAgICAgKG1l dGEtcmVhZGVyIChsYW5ndWFnZS1yZWFkZXIgKHJlcGwtbGFuZ3VhZ2UgcmVwbCkpCi0gICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgIChjdXJyZW50LW1vZHVsZSkpKSkKKyAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgKGN1cnJlbnQtbW9kdWxlKQorICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICBzZW1pY29sb24tY29tbWVudHMpKSkKICAgICAobGFtYmRhIChrZXkgLiBh cmdzKQogICAgICAgKGNhc2Uga2V5CiAgICAgICAgICgocXVpdCkKQEAgLTE0Niw3ICsxNDksMTAg QEAKICAgICAgICAoaWYgKG51bGw/IChjZHIgKGZsdWlkLXJlZiAqcmVwbC1zdGFjayopKSkKICAg ICAgICAgICAgKHJlcGwtd2VsY29tZSByZXBsKSkKICAgICAgICAobGV0IHByb21wdC1sb29wICgp Ci0gICAgICAgICAobGV0ICgoZXhwIChwcm9tcHRpbmctbWV0YS1yZWFkIHJlcGwpKSkKKyAgICAg ICAgIChsZXQgKChleHAgKHByb21wdGluZy1tZXRhLXJlYWQKKyAgICAgICAgICAgICAgICAgICAg IHJlcGwKKyAgICAgICAgICAgICAgICAgICAgIChlcT8gKHJlcGwtbGFuZ3VhZ2UgKGNhciAoZmx1 aWQtcmVmICpyZXBsLXN0YWNrKikpKQorICAgICAgICAgICAgICAgICAgICAgICAgICBzY2hlbWUt bGFuZykpKSkKICAgICAgICAgICAgKGNvbmQKICAgICAgICAgICAgICgoZXF2PyBleHAgKnVuc3Bl Y2lmaWVkKikpICA7IHJlYWQgZXJyb3IsIHBhc3MKICAgICAgICAgICAgICgoZXE/IGV4cCBtZXRh LWNvbW1hbmQtdG9rZW4pCkBAIC0xOTcsMTYgKzIwMywyMyBAQAogICAgICAgICAgICAgICAgICAg KGxhbWJkYSAoayAuIGFyZ3MpCiAgICAgICAgICAgICAgICAgICAgIChhYm9ydCBhcmdzKSkpKQog ICAgICAgICAgICAgICAjOnRyYXAtaGFuZGxlciAnZGlzYWJsZWQpKSkKLSAgICAgICAgICAgKG5l eHQtY2hhciAjZikgOzsgY29uc3VtZSB0cmFpbGluZyB3aGl0ZXNwYWNlCisgICAgICAgICAgIChu ZXh0LWNoYXIgI2YgKGVxPyAocmVwbC1sYW5ndWFnZSAoY2FyIChmbHVpZC1yZWYgKnJlcGwtc3Rh Y2sqKSkpCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzY2hlbWUtbGFuZykpIDs7IGNv bnN1bWUgdHJhaWxpbmcgd2hpdGVzcGFjZQogICAgICAgICAgICAocHJvbXB0LWxvb3ApKSkpCiAg ICAgIChsYW1iZGEgKGsgc3RhdHVzKQogICAgICAgIHN0YXR1cykpKQogCi0oZGVmaW5lIChuZXh0 LWNoYXIgd2FpdCkKKyhkZWZpbmUgc2NoZW1lLWxhbmcgKGxvb2t1cC1sYW5ndWFnZSAnc2NoZW1l KSkKKworKGRlZmluZSAobmV4dC1jaGFyIHdhaXQgc2VtaWNvbG9uLWNvbW1lbnRzKQogICAoaWYg KG9yIHdhaXQgKGNoYXItcmVhZHk/KSkKICAgICAgIChsZXQgKChjaCAocGVlay1jaGFyKSkpCiAJ KGNvbmQgKChlb2Ytb2JqZWN0PyBjaCkgY2gpCi0JICAgICAgKChjaGFyLXdoaXRlc3BhY2U/IGNo KSAocmVhZC1jaGFyKSAobmV4dC1jaGFyIHdhaXQpKQorICAgICAgICAgICAgICAoKGFuZCAoY2hh cj0/IGNoICNcOykgc2VtaWNvbG9uLWNvbW1lbnRzKQorICAgICAgICAgICAgICAgKHJlYWQtbGlu ZSkgI2YpIDsgaWdub3JlIHdhaXQgYWZ0ZXIgYSBuZXdsaW5lCisJICAgICAgKChjaGFyLXdoaXRl c3BhY2U/IGNoKQorICAgICAgICAgICAgICAgKHJlYWQtY2hhcikKKyAgICAgICAgICAgICAgIChu ZXh0LWNoYXIgd2FpdCBzZW1pY29sb24tY29tbWVudHMpKQogCSAgICAgIChlbHNlIGNoKSkpCiAg ICAgICAjZikpCiAKLS0gCjEuNy40Cgo= --000e0cd6a97e726840049c30987d--