1 // 2 // Copyright 2012 The ANGLE Project Authors. All rights reserved. 3 // Use of this source code is governed by a BSD-style license that can be 4 // found in the LICENSE file. 5 // 6 7 #ifndef COMPILER_PREPROCESSOR_DIRECTIVEHANDLERBASE_H_ 8 #define COMPILER_PREPROCESSOR_DIRECTIVEHANDLERBASE_H_ 9 10 #include <string> 11 #include "GLSLANG/ShaderLang.h" 12 13 namespace angle 14 { 15 16 namespace pp 17 { 18 19 struct SourceLocation; 20 21 // Base class for handling directives. 22 // Preprocessor uses this class to notify the clients about certain 23 // preprocessor directives. Derived classes are responsible for 24 // handling them in an appropriate manner. 25 class DirectiveHandler 26 { 27 public: 28 virtual ~DirectiveHandler(); 29 30 virtual void handleError(const SourceLocation &loc, const std::string &msg) = 0; 31 32 // Handle pragma of form: #pragma name[(value)] 33 virtual void handlePragma(const SourceLocation &loc, 34 const std::string &name, 35 const std::string &value, 36 bool stdgl) = 0; 37 38 virtual void handleExtension(const SourceLocation &loc, 39 const std::string &name, 40 const std::string &behavior) = 0; 41 42 virtual void handleVersion(const SourceLocation &loc, int version, ShShaderSpec spec) = 0; 43 }; 44 45 } // namespace pp 46 47 } // namespace angle 48 49 #endif // COMPILER_PREPROCESSOR_DIRECTIVEHANDLERBASE_H_ 50