ietf-nntp Detailed syntax
Clive D.W. Feather
clive at demon.net
Thu Jan 3 09:58:13 PST 2002
Okay, here's my review of the formal syntax.
For readability, change WSP to:
WSP = 1*(SP / HT)
meaning that all "1*WSP" can just change to "WSP", and add a definition
LE = *WSP CRLF
(LE meaning "line end"), which allows you simplify all those commands
to end LE instead of 1*WSP CRLF. This has the benefit of making it clear
that all commands have the same line ending and none are special.
Alternatively, since this sequence is only used for command ends and all
commands end that way, make the root productions:
command-line = command *WSP CRLF
command = article-command /
[...] /
stat-command
and command productions things like:
article-command = "ARTICLE" [WSP (msg-id / article-number)]
For clarity in the rest of this message I'll assume these changes have been
made.
Now for some specific issues.
GROUP and LISTGROUP do not take a wildmat. Rather, they take a group name:
! group-command = "GROUP" WSP group-name
! listgroup-command = "LISTGROUP" [WSP group-name]
+ group-name = 1*wildmat-exact
The syntax for a message-ID could be improved to show the basics:
! msg-id = "<" 1*248msg-id-char ">"
+ ; subject to the requirements of section 9.1
+ msg-id-char = %x21-3B / %x3C / %x3E-7E ; exclude SP < >
Header names have to conform to RFC 2822, so why not do so ?
! header = 1*header-char
+ header-char = %x21-39 / %x3B-7E ; exclude SP and :
A date can't be 7 digits. Better to show the actual structure:
! date = [2DIGIT] 6DIGIT
You've got some typos in the commands that take "GMT":
newgroups-command = "NEWGROUPS" WSP date WSP time
! [WSP "GMT"]
newnews-command = "NEWNEWS" WSP wildmat WSP date
! WSP time [WSP "GMT"]
It would also be a little easier to bring date-time into a single concept:
! newgroups-command = "NEWGROUPS" WSP date-time
! newnews-command = "NEWNEWS" WSP wildmat WSP date-time
+ date-time = date WSP time [WSP "GMT"]
The entries "hdr-command" and "list-command" are out of order in the
expansion of "command".
The token "list-command" might better be called "list-active-command".
There's a typographic error in "wildmat-exact", and the range should be
limited to 0x7E (this is also an error in section 5.1 and should be fixed
there as well):
! wildmat-exact = %x21-29 / %x2B / %x2D-3E / %x40-5A /
! %x5E-7E / UTF-8-non-ascii ; exclude * , ? [ \ ]
You define "argument" without using it, and talk about "parameter" being
used for "command parameters whose syntax is specified elsewhere". A better
approach would be to add a definition for extension commands:
+ x-command = x-command-name *(WSP argument)
+ ; detailed syntax defined outside this memo
+ x-command-name = 3*12%x21-7E
There's now no need for "parameter", so move the definition to "argument".
Furthermore, you need to allow for UTF-8.
! argument = 1*(%x21-7E / UTF-8-non-ascii)
I'll leave the outstanding UTF-8 syntax issues for a separate email.
If you make all these changes, plus some minor tidying of the line wraps,
you get the following syntax, which I hope people find is more readable.
13 Augmented BNF Syntax for NNTP Commands
This syntax defines the non-terminal "command-line". It is
listed in alphabetical order. Note that ABNF strings are case
insensitive.
article-command = "ARTICLE" [WSP (msg-id /
article-number)]
article-number = 1*16DIGIT
argument = 1*(%x21-7E / UTF-8-non-ascii)
body-command = "BODY" [WSP (msg-id / article-number)]
command = article-command /
body-command /
date-command /
group-command /
hdr-command /
head-command /
help-command /
ihave-command /
last-command /
list-active-command /
list-active-times-command /
list-distrib-pats-command /
list-distributions-command /
list-extensions-command /
list-newsgroups-command /
list-overview-fmt-command /
listgroup-command /
mode-reader-command /
newgroups-command /
newnews-command /
next-command /
over-command /
post-command /
quit-command /
stat-command /
x-command
command-line = command *WSP CRLF
CR = %x0D
CRLF = CR LF
date-command = "DATE"
date-time = date WSP time [WSP "GMT"]
date = [2DIGIT] 6DIGIT
DIGIT = %x30-39
group-command = "GROUP" WSP group-name
group-name = 1*wildmat-exact
hdr-command = "HDR" WSP header WSP (range / msg-id)
head-command = "HEAD" [WSP (msg-id / article-number)]
header = 1*header-char
header-char = %x21-39 / %x3B-7E ; exclude SP and :
help-command = "HELP"
HT = %x09
ihave-command = "IHAVE" WSP msg-id
last-command = "LAST"
LF = %x0A
list-active-command = "LIST" [WSP "ACTIVE" [WSP wildmat]]
list-active-times-command = "LIST" WSP "ACTIVE.TIMES"
[WSP wildmat]
list-distrib-pats-command = "LIST" WSP "DISTRIB.PATS"
list-distributions-command = "LIST" WSP "DISTRIBUTIONS"
list-extensions-command = "LIST" WSP "EXTENSIONS"
list-newsgroups-command = "LIST" WSP "NEWSGROUPS"
[WSP wildmat]
list-overview-fmt-command = "LIST" WSP "OVERVIEW.FMT"
listgroup-command = "LISTGROUP" [WSP group-name]
mode-reader-command = "MODE" WSP "READER"
msg-id = "<" 1*248msg-id-char ">"
; subject to the requirements of section 9.1
msg-id-char = %x21-3B / %x3C / %x3E-7E ; exclude SP < >
newgroups-command = "NEWGROUPS" WSP date-time
newnews-command = "NEWNEWS" WSP wildmat WSP date-time
next-command = "NEXT"
over-command = "OVER" [WSP range]
post-command = "POST"
quit-command = "QUIT"
range = article-number ["-" [article-number]]
SP = %x20
stat-command = "STAT" [WSP (msg-id / article-number)]
time = 6DIGIT
UTF-8-non-ascii = UTF8-2 / UTF8-3 / UTF8-4 / UTF8-5 /
UTF8-6
UTF8-1 = %x80-BF
UTF8-2 = %xC0-DF UTF8-1
UTF8-3 = %xE0-EF 2UTF8-1
UTF8-4 = %xF0-F7 3UTF8-1
UTF8-5 = %xF8-FB 4UTF8-1
UTF8-6 = %xFC-FD 5UTF8-1
wildmat = wildmat-pattern *("," ["!"] wildmat-pattern)
wildmat-pattern = 1*wildmat-item
wildmat-item = wildmat-exact / wildmat-wild
wildmat-exact = %x21-29 / %x2B / %x2D-3E / %x40-5A /
%x5E-7E / UTF-8-non-ascii ; exclude * , ? [ \ ]
wildmat-wild = "*" / "?"
WSP = 1*(SP / HT)
x-command = x-command-name *(WSP argument)
; detailed syntax defined outside this memo
x-command-name = 3*12%x21-7E
Finally, though I haven't done it here, I think that alphabetical order
isn't the best choice. In particular, I would put command-line followed by
command at the top, then all the xxx-commands, then the other lowercase
names, and finally the uppercase ones. YMMV.
--
Clive D.W. Feather | Work: <clive at demon.net> | Tel: +44 20 8371 1138
Internet Expert | Home: <clive at davros.org> | Fax: +44 20 8371 4037
Demon Internet | WWW: http://www.davros.org | Mobile: +44 7973 377646
Thus plc | |
More information about the ietf-nntp
mailing list