Huge dump of refactored code. Still in the middle of the changes that
are to be squashed later in a one huge monster commit, because there is
no value in anything atomic here.
Added method for parsing simple literals for use in top-level class
declarations.
Along with this change we've also moved out methods specific for parsing
low-level literals into the same file as new method, since that
structure made more sense.