From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Neil Jerram Newsgroups: gmane.lisp.guile.devel Subject: [PATCH] Date: Wed, 27 Oct 2010 19:27:47 +0100 Message-ID: <87d3qvo5i4.fsf@ossau.uklinux.net> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: dough.gmane.org 1288204125 18040 80.91.229.12 (27 Oct 2010 18:28:45 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 27 Oct 2010 18:28:45 +0000 (UTC) To: guile-devel@gnu.org Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Wed Oct 27 20:28:42 2010 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 1PBAjm-0000oY-7u for guile-devel@m.gmane.org; Wed, 27 Oct 2010 20:28:38 +0200 Original-Received: from localhost ([127.0.0.1]:59691 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PBAjl-0002C0-7v for guile-devel@m.gmane.org; Wed, 27 Oct 2010 14:28:37 -0400 Original-Received: from [140.186.70.92] (port=46353 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PBAja-000292-Tl for guile-devel@gnu.org; Wed, 27 Oct 2010 14:28:29 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PBAjZ-0004fI-Nr for guile-devel@gnu.org; Wed, 27 Oct 2010 14:28:26 -0400 Original-Received: from mail3.uklinux.net ([80.84.72.33]:45498) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PBAjZ-0004bf-J1 for guile-devel@gnu.org; Wed, 27 Oct 2010 14:28:25 -0400 Original-Received: from arudy (unknown [78.149.124.242]) by mail3.uklinux.net (Postfix) with ESMTP id 37F071F683D for ; Wed, 27 Oct 2010 19:27:48 +0100 (BST) Original-Received: from neil-laptop (unknown [192.168.1.5]) by arudy (Postfix) with ESMTP id 905FE3800B for ; Wed, 27 Oct 2010 19:28:12 +0100 (BST) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4-2.6 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:11073 Archived-At: --=-=-= I have a program that calls (read-elisp) in a loop, to read in a BBDB file. When it gets to the end of the file, the next (read-elisp) throws an error (wrong type arg, pair expected), and the attached patch makes it return '*eoi* instead. Is that correct? Is *eoi* better than # here? Or should I just catch the exception instead? Neil --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-Make-read-elisp-handle-EOF.patch >From b6017106abe754c596efe208554e98efc0248662 Mon Sep 17 00:00:00 2001 From: Neil Jerram Date: Wed, 27 Oct 2010 19:23:35 +0100 Subject: [PATCH] Make (read-elisp) handle EOF * module/language/elisp/parser.scm (get-expression): Handle the case where a top level lex returns *eoi*. --- module/language/elisp/parser.scm | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/module/language/elisp/parser.scm b/module/language/elisp/parser.scm index 4d9b0c3..bb495ea 100644 --- a/module/language/elisp/parser.scm +++ b/module/language/elisp/parser.scm @@ -171,7 +171,7 @@ (define (get-expression lex) (let* ((token (lex 'get)) - (type (car token)) + (type (if (pair? token) (car token) token)) (return (lambda (result) (if (pair? result) (set-source-properties! result (source-properties token))) @@ -194,6 +194,8 @@ (setter expr) (force-promises! expr) expr)) + ((*eoi*) + (return token)) (else (parse-error token "expected expression, got" token))))) -- 1.7.1 --=-=-=--