Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

Ovid (2709)

Ovid
  (email not shown publicly)
http://publius-ovidius.livejournal.com/
AOL IM: ovidperl (Add Buddy, Send Message)

Stuff with the Perl Foundation. A couple of patches in the Perl core. A few CPAN modules. That about sums it up.

Journal of Ovid (2709)

Monday July 24, 2006
04:32 AM

TAPx::Parser 0.10 (now with stream support)

[ #30397 ]

TAPx::Parser 0.10 is now available for download (deliberately not on the CPAN yet).

Not having a 'net connection in my flat yet meant that I was mostly flying blind and had to try and recall what was said on the list from memory. As a result, I'm sure that what I've put together doesn't quite match what may be expected. However, I've gotten enough stuff done that I think this could possibly serve as a preliminary TAP::Harness parser. Any thoughts on this?

From the change log:

  0.10    23 July, 2006
        - Oh my Larry, we gots docs!
        - _parse and _tap are now private methods.
        - Stream support has been added.
        - Moved the grammar into its own class.
        - Pulled remaining parser functionality out of lexer.
        - Added type() method to Results().
        - Parse errors no longer croak().  Instead, they are available through
          the parse_errors() method.
        - Added good_plan() method.
        - tests_planned != tests_run is no longer a parse error.
        - Renamed test_count() to tests_run().
        - Renamed num_tests() to tests_planned().

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.

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.

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 $result object is the token I spoke of earlier. Each type (qw) 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).

This is still alpha, so feedback appreciated. Also, I'm at about 95% test coverage, but it still astonishes me how much more really needs to be tested.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.