It's been a while since I've updated the TAP grammar and the old one has some
weaknesses.  Here's the corrected one.  Feedback welcome.  I'm feeling under
the weather, so this was probably a bad thing for me to tackle right now.

Also, I can't find the email, but someone once rewrote part of this to
eliminate some performance issues.  If you could forward that along, I'd
appreciate it :)

Cheers,
Ovid

 (* 
     For the time being, I'm cheating on the EBNF by allowing 
     certain terms to be defined by POSIX character classes by
     using the following syntax:
 
       digit ::= [:digit:]
 
     As far as I am aware, that's not valid EBNF.  Sue me.  I
     didn't know how to write "char" otherwise (Unicode issues).  
     Suggestions welcome.
 *)
 
 (* POSIX character classes and other terminals *)
 
 digit              ::= [:digit:]
 character          ::= ([:print:] - "\n")
 positiveInteger    ::= ( digit - '0' ) {digit}
 nonNegativeInteger ::= digit {digit}
 
 tap            ::= { comment | unknown } leading_plan lines 
                    | 
                    lines trailing_plan {comment}
 
 leading_plan   ::= plan skip_directive? "\n"

 trailing_plan  ::= plan "\n"

 plan           ::= '1..' nonNegativeInteger
 
 lines          ::= line {line}

 line           ::= (comment | test | unknown | bailout ) "\n"
 
 tests          ::= test {test}
 
 test           ::= status positiveInteger? description? directive?
 
 status         ::= 'not '? 'ok '
 
 description    ::= (character - (digit | '#')) {character - '#'}
 
 directive      ::= todo_directive | skip_directive

 todo_directive ::= '#' 'TODO' ' ' {character}

 skip_directive ::= '#' 'SKIP' ' ' {character}

 comment        ::= '#' {character}

 bailout        ::= 'Bail out!' character {character}

 unknown        ::= character {character}


--

Buy the book -- http://www.oreilly.com/catalog/perlhks/
Perl and CGI -- http://users.easystreet.com/ovid/cgi_course/

Reply via email to