field_name = {
('!'..'9' | ';'..'~')+
}
field_value = {
// this is technically wrong, but it's the only way I can deal with the
// de-facto standard. We need to remove the non-printables and stuff,
// but we see adoption of unicode (rightly!) in fields like Maintainer,
// or Uploaders. Using a glob like above is going to cause us a headache.
( !("\n") ~ ANY )*
}
comment = {
"#" ~ field_value ~ "\n"
}
field = {
field_name ~
":" ~
field_value? ~
(
"\n" ~
((" " ~ field_value) | comment)
)* ~
"\n"?
}
paragraph = {
(comment | field)+
}
single_paragraph = {
SOI ~ paragraph ~ "\n"* ~ EOI
}
multiple_paragraphs = {
SOI ~ ((paragraph | comment)* ~ "\n"* ~ EOI)
}