alokp@chromium.org | 36124de8 | 2012-05-24 02:17:43 +0000 | [diff] [blame] | 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 | |
Geoff Lang | 0a73dd8 | 2014-11-19 16:18:08 -0500 | [diff] [blame] | 7 | #ifndef COMPILER_PREPROCESSOR_DIRECTIVEHANDLERBASE_H_ |
| 8 | #define COMPILER_PREPROCESSOR_DIRECTIVEHANDLERBASE_H_ |
alokp@chromium.org | 36124de8 | 2012-05-24 02:17:43 +0000 | [diff] [blame] | 9 | |
| 10 | #include <string> |
| 11 | |
| 12 | namespace pp |
| 13 | { |
| 14 | |
| 15 | struct SourceLocation; |
| 16 | |
| 17 | // Base class for handling directives. |
| 18 | // Preprocessor uses this class to notify the clients about certain |
| 19 | // preprocessor directives. Derived classes are responsible for |
| 20 | // handling them in an appropriate manner. |
| 21 | class DirectiveHandler |
| 22 | { |
| 23 | public: |
| 24 | virtual ~DirectiveHandler(); |
| 25 | |
Zhenyao Mo | d526f98 | 2014-05-13 14:51:19 -0700 | [diff] [blame] | 26 | virtual void handleError(const SourceLocation &loc, |
| 27 | const std::string &msg) = 0; |
alokp@chromium.org | 36124de8 | 2012-05-24 02:17:43 +0000 | [diff] [blame] | 28 | |
| 29 | // Handle pragma of form: #pragma name[(value)] |
Zhenyao Mo | d526f98 | 2014-05-13 14:51:19 -0700 | [diff] [blame] | 30 | virtual void handlePragma(const SourceLocation &loc, |
| 31 | const std::string &name, |
Zhenyao Mo | 94ac7b7 | 2014-10-15 18:22:08 -0700 | [diff] [blame] | 32 | const std::string &value, |
| 33 | bool stdgl) = 0; |
alokp@chromium.org | 7c88454 | 2012-05-24 19:13:03 +0000 | [diff] [blame] | 34 | |
Zhenyao Mo | d526f98 | 2014-05-13 14:51:19 -0700 | [diff] [blame] | 35 | virtual void handleExtension(const SourceLocation &loc, |
| 36 | const std::string &name, |
| 37 | const std::string &behavior) = 0; |
alokp@chromium.org | 7c88454 | 2012-05-24 19:13:03 +0000 | [diff] [blame] | 38 | |
Zhenyao Mo | d526f98 | 2014-05-13 14:51:19 -0700 | [diff] [blame] | 39 | virtual void handleVersion(const SourceLocation &loc, |
alokp@chromium.org | 7c88454 | 2012-05-24 19:13:03 +0000 | [diff] [blame] | 40 | int version) = 0; |
alokp@chromium.org | 36124de8 | 2012-05-24 02:17:43 +0000 | [diff] [blame] | 41 | }; |
| 42 | |
| 43 | } // namespace pp |
Geoff Lang | 0a73dd8 | 2014-11-19 16:18:08 -0500 | [diff] [blame] | 44 | |
| 45 | #endif // COMPILER_PREPROCESSOR_DIRECTIVEHANDLERBASE_H_ |