1 This is a pseudo-formal grammar for TAP from: http://cpansearch.perl.org/src/ANDYA/Test-Harness-3.17/lib/TAP/Parser/Grammar.pm
4 For the time being, I'm cheating on the EBNF by allowing
5 certain terms to be defined by POSIX character classes by
6 using the following syntax:
10 As far as I am aware, that's not valid EBNF. Sue me. I
11 didn't know how to write "char" otherwise (Unicode issues).
15 tap ::= version? { comment | unknown } leading_plan lines
17 lines trailing_plan {comment}
19 version ::= 'TAP version ' positiveInteger {positiveInteger} "\n"
21 leading_plan ::= plan skip_directive? "\n"
23 trailing_plan ::= plan "\n"
25 plan ::= '1..' nonNegativeInteger
29 line ::= (comment | test | unknown | bailout ) "\n"
31 test ::= status positiveInteger? description? directive?
33 status ::= 'not '? 'ok '
35 description ::= (character - (digit | '#')) {character - '#'}
37 directive ::= todo_directive | skip_directive
39 todo_directive ::= hash_mark 'TODO' ' ' {character}
41 skip_directive ::= hash_mark 'SKIP' ' ' {character}
43 comment ::= hash_mark {character}
45 hash_mark ::= '#' {' '}
47 bailout ::= 'Bail out!' {character}
49 unknown ::= { (character - "\n") }
51 (* POSIX character classes and other terminals *)
54 character ::= ([:print:] - "\n")
55 positiveInteger ::= ( digit - '0' ) {digit}
56 nonNegativeInteger ::= digit {digit}