35 lines
728 B
Plaintext
35 lines
728 B
Plaintext
main = {
|
|
SOI ~ NEWLINE*
|
|
~ header ~ NEWLINE*
|
|
~ withdrawn ~ NEWLINE*
|
|
~ ballot_list
|
|
~ "0" ~ NEWLINE*
|
|
~ (string ~ NEWLINE*)+
|
|
~ EOI
|
|
}
|
|
|
|
header = {
|
|
integer ~ integer
|
|
}
|
|
|
|
withdrawn = {
|
|
(withdrawn_cand ~ NEWLINE*)*
|
|
}
|
|
withdrawn_cand = @{ "-" ~ integer }
|
|
|
|
ballot_list = { (ballot ~ NEWLINE*)* }
|
|
ballot = {
|
|
number ~ integer* ~ ("0" ~ NEWLINE? | NEWLINE)
|
|
}
|
|
|
|
integer = @{ ASCII_NONZERO_DIGIT ~ ASCII_DIGIT* }
|
|
decimal = @{ "0." ~ ASCII_DIGIT+ | integer ~ "." ~ ASCII_DIGIT+ }
|
|
number = { decimal | integer }
|
|
|
|
quoted_string = @{ "\"" ~ (!"\"" ~ !NEWLINE ~ ANY)* ~ "\"" }
|
|
raw_string = @{ (!" " ~ !NEWLINE ~ ANY)+ }
|
|
string = { quoted_string | raw_string }
|
|
|
|
WHITESPACE = _{ " " }
|
|
COMMENT = _{ "#" ~ (!NEWLINE ~ ANY)* ~ (&NEWLINE | &EOI) }
|