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