plugin: Refactored Parser.matches

* Refactored Parser.matches to make sure it is readable and looks a bit
  more Pythonic