Revise Pagure comment parsers, make more liberal (#153) (#155)
This is an alternative to #160 that rewrites the line parsers.
Broadly we use a small set of simple regexes as constants (rather
than constructing more complex regexes on the fly from keyword
constants). We factor out the similarity in how the former
agreed_parser and revote_parser worked. We also fix #155 by
accepting both "FE" and "FreezeException".
We fix #153 even harder than required, by accepting any number of
pairs of TRACKER and VOTE in any order with arbitrary whitespace
(so you can vote multiple times on a line if you like, as on IRC).
You still can't have any non-vote text in the line. For agreeds
and revotes, the behaviour should be the same as before but with
a different implementation. The on-the-fly regexes that were being
used here behaved a bit oddly in general, if you extract them out
and play around with them. The old code avoided most consequences
of the weirdness by only using them for initial matching and then
not using capture groups but just iterating over the KEYWORDS
constants, but it still made things a bit hard to follow. I think
it's clearer this way. This way also deals elegantly with
whitespace issues.
I stole the inverted tests from Lukas' #160, thanks.
Signed-off-by: Adam Williamson <awilliam@redhat.com>