• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #include "Macro.h"
13 
14 namespace angle
15 {
16 
17 namespace pp
18 {
19 
20 struct SourceLocation;
21 
22 // Base class for handling directives.
23 // Preprocessor uses this class to notify the clients about certain
24 // preprocessor directives. Derived classes are responsible for
25 // handling them in an appropriate manner.
26 class DirectiveHandler
27 {
28   public:
29     virtual ~DirectiveHandler();
30 
31     virtual void handleError(const SourceLocation &loc, const std::string &msg) = 0;
32 
33     // Handle pragma of form: #pragma name[(value)]
34     virtual void handlePragma(const SourceLocation &loc,
35                               const std::string &name,
36                               const std::string &value,
37                               bool stdgl) = 0;
38 
39     virtual void handleExtension(const SourceLocation &loc,
40                                  const std::string &name,
41                                  const std::string &behavior) = 0;
42 
43     virtual void handleVersion(const SourceLocation &loc,
44                                int version,
45                                ShShaderSpec spec,
46                                MacroSet *macro_set) = 0;
47 };
48 
49 }  // namespace pp
50 
51 }  // namespace angle
52 
53 #endif  // COMPILER_PREPROCESSOR_DIRECTIVEHANDLERBASE_H_
54