logo       

Re: TAPx::Parser 0.10 (now with stream support): msg#00584

Subject: Re: TAPx::Parser 0.10 (now with stream support)
Ovid wrote:
Hi all,

[...]
A few comments before I start work:

A stream is merely a coderef which returns "chunks" of TAP.  When it returns 
undef, the stream is considered finished.  It will be trivial for me to change this, if 
needed.

What is a "chunk"? Is it a "line"? A partial or multiple lines? Can it contain a partial or more than one complete "expression"?

Still not sure about the coderef. An object could possibly be more flexible, but I can't think of an actual use-case atm, and coderefs are possibly easier on the user.

Second, "Bail out!" doesn't stop the parser.  A careful reading of the TAP docs 
made it clear that this the the TAP generator's responsibility, not the parsers.  I can 
change this behavior, if necessary.

That sounds right. I'm assuming that a stream is one planned test "file" and no more, so that everything in the stream relates to that one plan.

Third, the docs are fairly complete, but not well organized.  Specifically, I 
need to have token methods moved to the main TAPx::Parser page so folks don't 
have to jump from POD to POD to understand how to use this thing.

Fourth, the interface has changed:

    use TAPx::Parser;
my $parser = TAPx::Parser->new( { tap => $string_o_tap } );
    # or
    my $parser = TAPx::Parser->new( { stream => $stream_o_tap } );
while ( my $result = $parser->results ) {
        print $result->as_string;
}

The method name results() doesn't convey any meaning, nor does it make it obvious that it is an iterator. I liked next() better.

The $result object is the token I spoke of earlier.  Each type (qw<comment plan 
test bailout unknown>) is documented as an appropriate subclass of 
TAPx::Parser::Results.

Fifth, I deliberately broke the grammar out into its own class to make it 
easier, in the future, to load different version grammars.  This exposed a 
problem which Schwern pointed out at one point:  I pushed too much work into 
the lexer (Ovid shakes his tiny, tiny fist at Schwern).

I notice that TAPx::Parser::Grammar contains information about each of the Results types. Could it be moved into the Results types? Maybe let the Results types be sort of like plugins that register a rule. When the rule matches you invoke the constructor for the matching Results class and return it.

You would possibly have to include a way of ordering the rules so that rules are checked in the correct order.

Then again, that may be adding more complexity than it removes.

All the is_${type} methods feel wrong (from a purely abstract design-type perspective), but I guess I don't know enough about how the Parser is going to be used and extended to suggest alternatives.

This is still alpha, so feedback appreciated.

Okay!

Randy.




<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
linux.arklinux....    user-groups.lin...    kde.usability/2...    ietf.ipp/2002-0...    mail.spam.spamc...    os.netbsd.devel...    audio.cd-record...    text.unicode.de...    php.documentati...    games.fps.halfl...    window-managers...    suse.oracle.gen...    bug-tracking.gn...    video.dvdrip.us...    xfree86.cvs/200...    java.netbeans.m...    network.argus/2...    culture.sf.kill...    debian.ports.al...    freebsd.questio...    qplus.devel/200...    handhelds.palm....   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe