|
From: | Per Bothner |
Subject: | Re: [Kawa-commonlisp-dev] [PATCH] DECLARE processing. |
Date: | Wed, 15 Aug 2012 00:40:44 -0700 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:14.0) Gecko/20120717 Thunderbird/14.0 |
On 08/14/2012 01:26 PM, Charles Turner wrote:
On 14 August 2012 21:22, Jamison Hope <address@hidden> wrote:I wasn't sure what he meant, either, but I think you got it right. I don't see the FIXME you mentioned, though (at least not in so many words). Is it this comment? + // if declIterator.next() is not an instance of Pair, fail.Sorry Jamison, don't know what's wrong with me tonight. That's what I was referring to.
If there is a syntax error, just make sure SourceMessages#error is called - preferably by calling one of the Compilation#error methods is call. Then try to recover is a sane way - at least so we don't get an exception, and preferable to minimize the chance of follow-on useless error messages. For example: Object declNext = declIterator.next(); if (! (declNext instanceof Pair)) { Object save = tr.pushPositionOf(???); tr.error("malformed declare"); tr.popPositionOf(save(; break; } The pushPositionOf/popPositionOf pair is optional, to provide a more precise error message. You'll notice that I don't actually use SeqPosition/getIterator much, and certainly not in scan/rewrite of syntax forms. Not sure it buys you anything in this situation. -- --Per Bothner address@hidden http://per.bothner.com/
[Prev in Thread] | Current Thread | [Next in Thread] |