misc. tweaks

* relax the document class regex, so that we don't need to change the
  source every time we see a new class
* support the "comment" package
* clean up repeated regex use by naming the repeated bits
factor out the code for compiling many regexen into one