[PERCEPS] Error handling {if first} and {if last}

Tom Bryan tbryan@starship.python.net
Fri, 17 Sep 1999 07:57:44 -0400 (EDT)


On Fri, 17 Sep 1999, Noel Welsh wrote:

> {foreach typedef sort "$a cmp $b;"}

You should also be able to write this line as

{foreach typedef sort} 

since you're using the default lexical sort.  

> The first or last directive is skipped, apparently at random, leading
> to lists within lists that crawl towards the right of the screen. 

Yuck.

> It's probably my stupidity, but I've been staring at it too long to
> see what's wrong. Either that or it's gremlins. Or there is a bug in
> Perceps. Attached below is the full template.

It may be a bug in PERCEPS.  Note, though, that you must write "sort" if
you plan to use 'if first' and 'if last'.  For example, you have a
{foreach macro} followed by an {if first}.  You should say, {foreach macro
sort} before you use the {if first}.  Otherwise, I don't know how the if
first and if last will behave.  Fix that first.

If it's still not working, e-mail me off the list.  It might just be an
error in the code of GENTEXT around line 1000.  I can probably give you
some mods to the PERCEPS code to isolate the error.

> I plan to release these soon, in case anyone is interested.

Thanks.  I'd be happy to put them up on the PERCEPS web site.

> I'm also curious about the Perceps replacement under development. What's
> this projects hackability? 

Not quite hackable yet.  I promise to put something up once it's in a
hackable state.  I'm simultaneously looking at a 3.5.1 release to fix some
known bugs.  I just finished moving (just in time to get into hurricane
Floyd's path!) and hope to have a little more time on my hands now.

> As a side-note, it seems that a real parser would be a good thing.
> Regexp only go so far (which admittedly is quite far), but they
> inevitably reach limitation as seen with Emacs cc-mode.

Yes, it probably would.  I'm limited by the fact that I know nothing about
"real parsers" and don't have time now or in the near future to learn.  
Someone mentioned CCDOC on the PERCEPS comment page
http://starship.python.net/~tbryan/PERCEPS/perceps_comments.cgi

I haven't checked it out, but I'd be interested to know whether it's as
good as the poster says.  If so, a smarter (and less redundant) project
may be to support PERCEPS template syntax generated from the output of
CCDOC.  If anyone has used CCDOC, I'd be interested to hear from you off
the list about it.

---Tom

P.S. Noel, you first sent this message from Noel.Welsh@acis.uk.com.
Posting is only permitted from the address you used to sign onto the
PERCEPS list.  I would have let your message through the moderation
filter, but I hadn't checked the moderation queue in a few days.  Sorry
about that.