glsl: Refactor code to check that identifier names are valid.

GLSL reserves identifiers beginning with "gl_" or containing "__", but
we haven't been consistent about enforcing this rule.  This patch
makes a new function to check whether identifier names are valid.  In
the process it closes a loophole where we would previously allow
function argument names to contain "__".
!UPSTREAM: glsl: Don't allow unnamed interface blocks to redeclare variables.

Fixes piglit test
spec/glsl-1.50/compiler/unnamed-interface-block-elem-conflicts-with-prev-global.vert.

TODO:
- Some limited amount of redeclaration is allowed
!UPSTREAM: glsl: Don't allow invalid identifier names in struct/interface fields.

Fixes piglit test
spec/glsl-1.50/compiler/unnamed-interface-block-elem-uses-gl-prefix.vert.

TODO:
- Needs to be allowed when redeclaring gl_PerVertex.
!UPSTREAM: glsl: Don't allow invalid identifiers as interface block names.

Fixes piglit test
spec/glsl-1.50/compiler/interface-block-name-uses-gl-prefix.vert.

TODO:
- Needs to be allowed when redeclaring gl_PerVertex.