Spec bug in formal definition of Document in dir-spec.txt
I was attempting to write a parser that reads vote/consensus documents using the the formal definition [here](https://gitweb.torproject.org/torspec.git/tree/dir-spec.txt#n210). However, I noticed an ambiguity. Using only the formal definition, the following: ``` directory-signature 13241234321 12343234 -----BEGIN SIGNATURE----- 00thisisvalidbase64data12345 -----END SIGNATURE----- ``` Could be potentially parsed as ``` Document(   Item(     KeywordLine(       Keyword(KeywordChar+("directory-signature")),       WS,       ArgumentChar+("13241234321 12343234"),       NL     )   ),   Item(     KeywordLine(       Keyword(KeywordChar+("-----BEGIN")),       WS,       ArgumentChar+("SIGNATURE-----"),       NL     )   ),   Item(     KeywordLine(       Keyword(KeywordChar+("00thisisvalidbase64data12345"))       WS,       ArgumentChar+("SIGNATURE-----"),       NL     )   ),   Item(     KeywordLine(       Keyword(KeywordChar+("-----END")),       WS,       ArgumentChar+("SIGNATURE-----"),       NL     )   ), ) ``` When the correct parsing would be ``` Document(   Item(     KeywordLine(       Keyword(KeywordChar+("directory-signature")),       WS,       ArgumentChar+("13241234321 12343234"),       NL     ),     Object(       BeginLine(         "-----BEGIN ",         Keyword(KeywordChar+("SIGNATURE")),         "-----",         NL       ),       Base64-encoded-data("00thisisvalidbase64data12345"),       EndLine(         "-----END ",         Keyword(KeywordChar+("SIGNATURE")),         "-----",         NL       ),     ),   ), ) ``` A potential change to the spec (assuming that keywords will never start with "-") that would prevent would be to replace ``` Keyword = KeywordChar+ KeywordChar ::= 'A' ... 'Z' | 'a' ... 'z' | '0' ... '9' | '-' ``` with ``` Keyword = KeywordStartChar KeywordChar* KeywordStartChar ::= 'A' ... 'Z' | 'a' ... 'z' | '0' ... '9' KeywordChar ::= 'A' ... 'Z' | 'a' ... 'z' | '0' ... '9' | '-' ``` **Trac**: **Username**: witchof0x20
issue