(PUP-2568) Downcase class name before validating

Previously the check for a valid name was done against the raw input,
however it later downcased the name and used that form. This order
caused Class['A'] to be an error, which isn't desired (at least not
until PUP-1810 is taken care of). By just changing the order of
operations capital letters are once again allowed.
(PUP-2581) Make illegal names interchangeable to legal variable work

In interpolation when using expression mode ${} and having an illegal
name (e.g. _x) that resulted in a syntax error as the _x got translated
to a STRING token (a bare word not being a name). The interpolation
logic could then not transform it into a (valid) variable expression
(i.e. $_x).

The change is to let the lexer emit a WORD token for the illegal NAME.
The interpolation then changes that to a VARIBLE if it is the only
expression. If the WORD token escapes into the grammar, it is equivalent
to having used a quoted string in the source text.

Note that WORD only accepts unqualified input, anything with a : that is
not a valid NAME is still flagged as an error. Thus _x::y, x::_y are
both illegal NAME.
(maint) Reorder code to increase clarity

There were a lot of unless cases that made it hard for me to track down
the path of what was actually accepted. This inverts the branches so
that the if statements lay out what is required for the good case and
the else clauses express the various failures.

In addition there were a few error scenarios where reordering was
possible and reduced the amount of work that needed to be done before
the error was detected.
(PUP-2568) Remove unnecessary calls

There are several calls that can be removed from various paths. Downcase
isn't needed for the PResourceType's type_name, since that is already
downcased (removes a string copy). The other change is that the NAME
pattern can handle leading :: and so that only needs to be stripped off
if it is a valid name (removes a string copy).
Merge branch 'pr/2656' into stable

* pr/2656:
  (PUP-2568) Remove unnecessary calls
  (maint) Reorder code to increase clarity
  (PUP-2568) Downcase class name before validating

Closes GH-2656
Merge pull request #2661 from hlindberg/pup-2581_interpolating-expression-of-bad-name

(PUP-2581) Make illegal names interchangeable to legal variable in interpolation
Merge remote-tracking branch 'upstream/stable'

* upstream/stable:
  (PUP-2568) Remove unnecessary calls
  (maint) Reorder code to increase clarity
  (PUP-2581) Make illegal names interchangeable to legal variable work
  (PUP-2568) Downcase class name before validating

Conflicts:
	lib/puppet/pops/parser/eparser.rb

Rebuilt eparser.