Add pragma errors for malformed pragmas.

Instead of always warning on invalid pragmas, only warn when the pragma
type is not recognized and error when the syntax is invalid.

Fixes:
dEQP-GLES2.functional.shaders.preprocessor.pragmas.invalid_pragma_invalid_debug_vertex
dEQP-GLES2.functional.shaders.preprocessor.pragmas.invalid_pragma_invalid_debug_fragment
dEQP-GLES2.functional.shaders.preprocessor.pragmas.invalid_pragma_invalid_token_vertex
dEQP-GLES2.functional.shaders.preprocessor.pragmas.invalid_pragma_invalid_token_fragment

BUG=angleproject:989

Change-Id: Ibd584dc08a2436e163dfc52eeffdf2dac8a22cb8
Reviewed-on: https://chromium-review.googlesource.com/267639
Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Tested-by: Geoff Lang <geofflang@chromium.org>
diff --git a/src/compiler/preprocessor/DirectiveParser.cpp b/src/compiler/preprocessor/DirectiveParser.cpp
index 55ff3f6..62fe6ab 100644
--- a/src/compiler/preprocessor/DirectiveParser.cpp
+++ b/src/compiler/preprocessor/DirectiveParser.cpp
@@ -616,7 +616,8 @@
             break;
           case PRAGMA_VALUE:
             value = token->text;
-            valid = valid && (token->type == Token::IDENTIFIER);
+            // Pragma value validation is handled in DirectiveHandler::handlePragma
+            // because the proper pragma value is dependent on the pragma name.
             break;
           case RIGHT_PAREN:
             valid = valid && (token->type == ')');
@@ -633,7 +634,7 @@
                       (state == RIGHT_PAREN + 1));  // With value.
     if (!valid)
     {
-        mDiagnostics->report(Diagnostics::PP_UNRECOGNIZED_PRAGMA,
+        mDiagnostics->report(Diagnostics::PP_INVALID_PRAGMA,
                              token->location, name);
     }
     else if (state > PRAGMA_NAME)  // Do not notify for empty pragma.