Subject: [tap] Question about directives and comments

From: Andrew Rodland <[email-masked]>
Date: Sun, 19 Sep 2010 20:02:40 -0500

Following some recent improvements in Regexp::Grammars and in perl 5.13, I've 
been able to unstick progress on TAP::Spec::Parser, my attempt to turn the 
draft spec into live code suitable for running a test suite.

It's gotten to the point where I can throw real, complex TAP output at it and 
have it work, which means it's time for me to start asking questions. The one 
I've got so far -- the spec shows this BNF for a test result:

> Test-Result     = Status [SP Test-Number] [SP Description]
>                   [SP "#" SP Directive [SP Reason]] EOL

and Directive is

> Directive       = "SKIP" / "TODO"

It's already been brought up in a conversation between EBo and Ovid on tap-l 
that the SP between "#" and directive and between the directive and reason are 
optional, so I'll pass over that for now.

My question regards section 8.6 "Ignored Elements", which says "Any directive 
or plan-directive which is not recognized must also be ignored", and later 
"The directive 'BANG' on test #2 should be treated as an ordinary comment, it 
is not a tap directive."

So we have three different opinions here.

1. The grammar, as written, says that if there's a "#" on a test-result line, 
the word following it must match Directive (i.e. be either "SKIP" or "TODO"). 
If it's not, the entire line will be junked. This is almost certainly wrong.

2. The first statement in the "Ignored Elements" section implies that 
Directive should match any sequence of not-SP, and that the directive should 
simply have no effect if it's not one of "SKIP" or "TODO". This seems 
reasonable.

3. The second statement in the "Ignored Elements" section implies that an 
unrecognized directive should instead be parsed as a Comment until the end of 
line -- but we don't match Comments within Test-Result (or any TAP-Line), only 
Comments that take up the full line. Is this an omission in the grammar (do we 
*need* to handle line-ending Comments) or is it simply a thinko on the part of 
the person who wrote that statement?

Any comments are welcome.

Thanks,

Andrew