blob: 2aaeec281803985eddb016c14958a0a2dd9e4a70 [file] [log] [blame]
alokp@chromium.org36124de82012-05-24 02:17:43 +00001//
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_DIRECTIVE_HANDLER_H_
8#define COMPILER_PREPROCESSOR_DIRECTIVE_HANDLER_H_
9
10#include <string>
11
12namespace pp
13{
14
15struct 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.
21class DirectiveHandler
22{
23 public:
24 virtual ~DirectiveHandler();
25
26 virtual void handleError(const SourceLocation& loc,
27 const std::string& msg) = 0;
28
29 // Handle pragma of form: #pragma name[(value)]
30 virtual void handlePragma(const SourceLocation& loc,
31 const std::string& name,
32 const std::string& value) = 0;
alokp@chromium.org7c884542012-05-24 19:13:03 +000033
34 virtual void handleExtension(const SourceLocation& loc,
35 const std::string& name,
36 const std::string& behavior) = 0;
37
38 virtual void handleVersion(const SourceLocation& loc,
39 int version) = 0;
alokp@chromium.org36124de82012-05-24 02:17:43 +000040};
41
42} // namespace pp
43#endif // COMPILER_PREPROCESSOR_DIRECTIVE_HANDLER_H_