Hi all,

http://users.easystreet.com/ovid/downloads/TAPx-Parser-0.10.tar.gz

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 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.

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<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).

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.

Cheers,
Ovid

-- If this message is a response to a question on a mailing list, please send 
follow up questions to the list.
 
Web Programming with Perl -- http://users.easystreet.com/ovid/cgi_course/



Reply via email to