txr-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Txr-users] matching blank lines


From: Kaz Kylheku
Subject: Re: [Txr-users] matching blank lines
Date: Wed, 24 Feb 2010 11:52:58 -0800

On Tue, Feb 23, 2010 at 6:51 PM, Daniel Lyons <address@hidden> wrote:
> Hi,

Hi Daniel.

> Thanks for txr! This is an immensely helpful program and I'm looking forward
> to using it in all sorts of situations where awk/sed/etc. are
> unpleasant.

This program sucks now, but I have some ideas about improving it. :)

>Unfortunately, I am running into a problem.

I see that you are trying to collect the code/price pairs like
A and 47.50 using a freeform collect.

Unfortunately, in investigating this problem, I've found
that freeform is buggy. :(

It looks like you might be expecting @(freeform "\n\n") to stop
when it sees two newlines, but in fact "\n\n" simply means
that the character sequence "\n\n" will separate the lines
when they are considered to be a big virtual string.

The @(coll) will keep going over the entire virtual line,
gathering all matching inputs, skipping over nonmatching
stuff.

To terminate on two newlines, you can add an @(until)
like this:

@(freeform)
@(coll) ... <your collect logic>..... @(until)@address@hidden@(end)

Problem is, that due to bugs in the implementation
of @(freeform) this won't work; there are multiple issues
with the logic that reverts the unmatched tail of
the virtual string back to a list of lines, so that continued
outer collect over multiple records doesn't work.

One small fix (commit 68e5c54c9fc4f1ac27a1f4e8ad787feb4868c19c)
 is already in GIT---that's not it, though!




reply via email to

[Prev in Thread] Current Thread [Next in Thread]