michael@0: // michael@0: // Copyright (c) 2011 The ANGLE Project Authors. All rights reserved. michael@0: // Use of this source code is governed by a BSD-style license that can be michael@0: // found in the LICENSE file. michael@0: // michael@0: michael@0: #ifndef COMPILER_PREPROCESSOR_PREPROCESSOR_H_ michael@0: #define COMPILER_PREPROCESSOR_PREPROCESSOR_H_ michael@0: michael@0: #include michael@0: michael@0: #include "pp_utils.h" michael@0: michael@0: namespace pp michael@0: { michael@0: michael@0: class Diagnostics; michael@0: class DirectiveHandler; michael@0: struct PreprocessorImpl; michael@0: struct Token; michael@0: michael@0: class Preprocessor michael@0: { michael@0: public: michael@0: Preprocessor(Diagnostics* diagnostics, DirectiveHandler* directiveHandler); michael@0: ~Preprocessor(); michael@0: michael@0: // count: specifies the number of elements in the string and length arrays. michael@0: // string: specifies an array of pointers to strings. michael@0: // length: specifies an array of string lengths. michael@0: // If length is NULL, each string is assumed to be null terminated. michael@0: // If length is a value other than NULL, it points to an array containing michael@0: // a string length for each of the corresponding elements of string. michael@0: // Each element in the length array may contain the length of the michael@0: // corresponding string or a value less than 0 to indicate that the string michael@0: // is null terminated. michael@0: bool init(size_t count, const char* const string[], const int length[]); michael@0: // Adds a pre-defined macro. michael@0: void predefineMacro(const char* name, int value); michael@0: michael@0: void lex(Token* token); michael@0: michael@0: private: michael@0: PP_DISALLOW_COPY_AND_ASSIGN(Preprocessor); michael@0: michael@0: PreprocessorImpl* mImpl; michael@0: }; michael@0: michael@0: } // namespace pp michael@0: #endif // COMPILER_PREPROCESSOR_PREPROCESSOR_H_ michael@0: