(#22363) Make errors for illegal Class[x] references better.
This adds additional checks for Class[x] operations and adds more
tests. This also removes hyphen as a legal character in regexp patterns
used for checking (the lexer already did not include the hyphen and
they were flagged as errors. This change affects when strings are
checked for compliance with the name rule.