As it turns out, adding support to allow comments after a terminating plan was
trivial. However, the grammar was getting a bit old and needed some work. I
noticed, amongst other things, that comments had never been integrated.
If you're not familiar with reading this style of grammar, here are a few
comments:
I'm using POSIX character classes to represent digits and printable characters.
If you want to manually encode all of the Unicode characters for [:print:], be
my guest :)
The following means "all printable characters except the newline".
([:print:] - "\n")
The following means, a digit followed by zero or more digits.
digit {digit}
A question mark after an atom means it's optional.
I'm not particularly gifted with grammars, so corrections welcome.
The corrected TAP grammar:
digit ::= [:digit:]
character ::= ([:print:] - "\n")
positiveInteger ::= ( digit - '0' ) {digit}
nonNegativeInteger ::= digit {digit}
tap ::= plan tests | tests plan {comment}
plan ::= '1..' nonNegativeInteger "\n"
lines ::= line {lines}
line ::= (comment | test) "\n"
tests ::= test {test}
test ::= status positiveInteger? description? directive?
status ::= 'not '? 'ok '
description ::= (character - (digit '#')) {character - '#'}
directive ::= '#' ( 'TODO' | 'SKIP' ) ' ' {character}
comment ::= '#' {character}
Cheers,
Ovid
--
Buy the book -- http://www.oreilly.com/catalog/perlhks/
Perl and CGI -- http://users.easystreet.com/ovid/cgi_course/